メインコンテンツまでスキップ

Ring

ライブエディター

function Canvas() {
      const geo = ring({ innerRadius: 0.5, outerRadius: 1, thetaSegments: 32, phiSegments: 4 })
      const mat = rotate3dX(iMouse.y.negate()).mul(rotate3dY(iMouse.x))
      const gl = useGL({
              isWebGL: true,
              isDepth: true,
              count: geo.count,
              vertex: vec4(mat.mul(geo.vertex), 1),
              fragment: vec4(varying(geo.normal), 1),
      })
      return <canvas ref={gl.ref} />
}
結果
Loading...

Ring Props

innerRadiusThe inner radius of the ring.
Default is 0.5.
outerRadiusThe outer radius of the ring.
Default is 1.
thetaSegmentsNumber of angular segments.
Higher values create smoother curves.
Minimum is 3.
Default is 32.
phiSegmentsNumber of radial segments.
Controls radial subdivision density.
Minimum is 1.
Default is 1.
thetaStartStarting angle in radians.
Default is 0.
thetaLengthAngular sweep in radians.
Default is Math.PI*2.

Mathematical Foundation

Ring geometry generates vertices in polar coordinate space following the parametric equations:

x=rcos(θ)x = r \cos(\theta) y=rsin(θ)y = r \sin(\theta)

where rr varies linearly from inner radius rinnerr_{inner} to outer radius routerr_{outer} across ϕ\phi segments:

r(ϕ)=rinner+ϕnϕ(routerrinner)r(\phi) = r_{inner} + \frac{\phi}{n_{\phi}} \cdot (r_{outer} - r_{inner})

The angular parameter θ\theta spans from θstart\theta_{start} to θstart+θlength\theta_{start} + \theta_{length} across nθn_{\theta} segments:

θ(i)=θstart+inθθlength\theta(i) = \theta_{start} + \frac{i}{n_{\theta}} \cdot \theta_{length}

Radial Distribution Analysis

Ring geometry establishes uniform radial distribution through linear interpolation. Each vertex position is determined by the intersection of radial lines and concentric circles. The vertex count formula:

V=(nθ+1)×(nϕ+1)V = (n_{\theta} + 1) \times (n_{\phi} + 1)

where nθn_{\theta} and nϕn_{\phi} represent angular and radial segment counts respectively.

Geometric Properties

Ring structures exhibit rotational symmetry about the z-axis. All vertices lie in the xy-plane with z-coordinate fixed at zero. Normal vectors remain constant as n=(0,0,1)\vec{n} = (0, 0, 1) for all vertices, indicating planar geometry.

The area enclosed between concentric boundaries follows:

A=π(router2rinner2)A = \pi(r_{outer}^2 - r_{inner}^2)

This area distribution enables mathematical pattern visualization through vertex density manipulation.

Practical Implementation

Ring geometry serves mathematical visualization where polar coordinate relationships require explicit representation. The parametric control over radial and angular subdivision enables precise pattern generation for mathematical demonstrations.

Segment parameters directly control mesh resolution. Angular segments determine circumferential smoothness, while radial segments control the density of concentric patterns.