CylinderGeometry

A class for generating cylinder geometries.

Constructor

new CylinderGeometry(radiusTopopt, radiusBottomopt, heightopt, radialSegmentsopt, heightSegmentsopt, openEndedopt, thetaStartopt, thetaLengthopt)

Parameters:
NameTypeAttributesDefaultDescription
radiusTopnumber<optional>
1

— Radius of the cylinder at the top.

radiusBottomnumber<optional>
1

— Radius of the cylinder at the bottom.

heightnumber<optional>
1

— Height of the cylinder.

radialSegmentsnumber<optional>
8

— Number of segmented faces around the circumference of the cylinder.

heightSegmentsnumber<optional>
1

— Number of rows of faces along the height of the cylinder.

openEndednumber<optional>
false

— A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.

thetaStartnumber<optional>
0

— Start angle for first segment, default = 0 (three o'clock position).

thetaLengthnumber<optional>
2*Pi

— The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder.

Extends

Members

attributes :object

This hashmap has as id the name of the attribute to be set and as value the buffer to set it to. Rather than accessing this property directly, use Geometry#addAttribute and Geometry#getAttribute to access attributes of this geometry.

Type:
  • object

boundingBox :Box3

Bounding box for the bufferGeometry, which can be calculated with Geometry#computeBoundingBox.

Type:
Default Value
  • Box3()

boundingSphere :Sphere

Bounding sphere for the bufferGeometry, which can be calculated with Geometry#computeBoundingSphere.

Type:
Default Value
  • Sphere()

groups :Array

Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry. Each group is an object of the form: { start: Integer, count: Integer, materialIndex: Integer }, or { multiDrawStarts: Integer[], multiDrawCounts: Integer[], multiDrawCount: Integer, materialIndex: Integer } if multiDraw is available.

Type:
  • Array
Default Value
  • []

(readonly) id :number

Unique number for this geometry instance.

Type:
  • number
Overrides

index :Attribute|null

Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles" and each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face. If this attribute is not set, the renderer assumes that each three contiguous positions represent a single triangle.

Type:

instanceCount :number

The number of instances to be rendered. If set to -1 (default), instanced rendering is disabled. This property is used for instanced rendering, where multiple copies of the geometry are drawn with a single draw call.

Type:
  • number
Default Value
  • -1

morphAttributes :object

Hashmap of Attributes Array for morph targets.

Type:
  • object

(readonly) uuid :string

UUID of this geometry instance. This gets automatically assigned, so this shouldn't be edited.

Type:
  • string
Overrides

version :number

A version number, incremented every time the attribute object or index object changes to mark VAO drity.

Type:
  • number
Default Value
  • 0

Methods

addAttribute(name, attribute)

Adds an attribute to this geometry. Use this rather than the attributes property.

Parameters:
NameTypeDescription
namestring
attributeAttribute

addEventListener(type, listener)

Adds a listener to an event type.

Parameters:
NameTypeDescription
typestring

The type of event to listen to.

listenerfunction

The function that gets called when the event is fired.

addGroup(start, count, materialIndexopt)

Adds a group to this geometry; see the Geometry#groups for details.

Parameters:
NameTypeAttributesDefaultDescription
startnumber
countnumber
materialIndexnumber<optional>
0

clearGroups()

Clears all groups.

clone() → {Geometry}

Creates a clone of this Geometry.

Returns:
Type: 
Geometry

computeBoundingBox()

Computes bounding box of the geometry, updating Geometry#boundingBox. Bounding boxes aren't computed by default. They need to be explicitly computed.

computeBoundingSphere()

Computes bounding sphere of the geometry, updating Geometry#boundingSphere. Bounding spheres aren't computed by default. They need to be explicitly computed.

copy(source) → {Geometry}

Copies another Geometry to this Geometry.

Parameters:
NameTypeDescription
sourceGeometry

The geometry to be copied.

Overrides
Returns:
Type: 
Geometry

dispatchEvent(event)

Fire an event.

Parameters:
NameTypeDescription
eventobject

The event that gets fired.

dispose()

Disposes the object from memory. You need to call this when you want the BufferGeometry removed while the application is running.

getAttribute(name) → {Attribute}

Returns the attribute with the specified name.

Parameters:
NameTypeDescription
namestring
Returns:
Type: 
Attribute

removeAttribute(name)

Removes the attribute with the specified name.

Parameters:
NameTypeDescription
namestring

removeEventListener(type, listener)

Removes a listener from an event type.

Parameters:
NameTypeDescription
typestring

The type of the listener that gets removed.

listenerfunction

The listener function that gets removed.

setIndex(index)

Set the Geometry#index buffer.

Parameters:
NameTypeDescription
indexArray | Attribute | null