Skip to content
On this page

ConeGeometry

ConeGeometry is a simple component for creating a cone with given radius and height.

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 ref="renderer" :antialias="true">
      <PerspectiveCamera :position="[6, 6, 3]" :up="[0, 0, 1]">
        <OrbitControls />
      </PerspectiveCamera>
      <Scene background="#f9f9f9">
        <Mesh :rotation="[Math.PI / 2, 0, 0]">
          <MeshNormalMaterial :side="DoubleSide" />
          <ConeGeometry name="geo" :radius="4" :height="5" />
        </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, ConeGeometry, MeshNormalMaterial } from "@janvorisek/drie";
</script>

Props

Prop nameDescriptionTypeDefault
name Name of the geometry.string""
radius Radius of the circle.number1
height Height of the cone.number1
radialSegmentsNumber of segmented faces around the circumference of the cone.
Minimum value is 3.
number32
heightSegmentsNumber of rows of faces along the height of the cone.
Minimum value is 3.
number1
openEnded A Boolean indicating whether the base of the cone is open or capped.
Default is false, meaning capped.
booleanfalse
thetaStart Start angle for first segment.number0
thetaLength The central angle, often called theta, of the circular sector.
The default is , which makes for a complete cone.
number2 * Math.PI

Expose

three

You can access the managed THREE.BufferGeometry instance using the exposed three property.

Example code

template
<ConeGeometry ref="geometry" />
ts
const geometry = ref(null);

onMounted(() => {
  // Do something with the THREE.BufferGeometry instance
  const threeGeometry = geometry.value.three;
});

Released under the MIT License.