RingGeometry
RingGeometry
is a simple component for a two-dimensional ring geometry.
Any modifications to the properties will update the underlying THREE.BufferGeometry
.
Example
Click me to view the example code
vue
<template>
<div style="width: 100vh; height: 100vh;">
<Renderer :antialias="true">
<PerspectiveCamera :position="[3, 3, 3]" :up="[0, 0, 1]">
<OrbitControls />
</PerspectiveCamera>
<Scene background="#f9f9f9">
<Mesh>
<MeshNormalMaterial :side="DoubleSide" />
<RingGeometry />
</Mesh>
</Scene>
</Renderer>
</div>
</template>
<script setup lang="ts">
import { DoubleSide } from "three";
import { Renderer, Scene } from "@janvorisek/drie";
import { PerspectiveCamera, OrbitControls } from "@janvorisek/drie";
import { Mesh, RingGeometry, MeshNormalMaterial } from "@janvorisek/drie";
</script>
Props
Prop name | Description | Type | Default |
---|---|---|---|
name | Name of the geometry. | string | "" |
innerRadius | Inner radius of the ring. Must be smaller than outerRadius . | number | 0.5 |
outerRadius | Outer radius of the ring. Must be greater than innerRadius . | number | 1 |
thetaSegments | Number of radial segments. A higher number means the ring will be more round Minimum value is 3 . | number | 32 |
phiSegments | Number of segments over the ring thickness. | number | 1 |
thetaStart | Start angle for first segment. | number | 0 |
thetaLength | The central angle, often called theta, of the circular sector. The default is 2π , which makes for a complete circle. | number | 2 * Math.PI |
Expose
three
You can access the managed
THREE.BufferGeometry
instance using the exposedthree
property.
Example code
template
<RingGeometry ref="geometry" />
ts
const geometry = ref(null);
onMounted(() => {
// Do something with the THREE.BufferGeometry instance
const threeGeometry = geometry.value.three;
});