Class: TorusKnotGeometry

zen3d.TorusKnotGeometry(radiusopt, tubeopt, tubularSegmentsopt, radialSegmentsopt, popt, qopt)

new TorusKnotGeometry(radiusopt, tubeopt, tubularSegmentsopt, radialSegmentsopt, popt, qopt)

Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q. If p and q are not coprime, the result will be a torus link.
Parameters:
Name Type Attributes Default Description
radius number <optional>
1 — Radius of the torus. Default is 1.
tube number <optional>
0.4 — Radius of the tube. Default is 0.4.
tubularSegments Integer <optional>
64 — Default is 64.
radialSegments Integer <optional>
8 — Default is 8.
p Integer <optional>
2 — This value determines, how many times the geometry winds around its axis of rotational symmetry. Default is 2.
q Integer <optional>
3 — This value determines, how many times the geometry winds around a circle in the interior of the torus. Default is 3.
Source:

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 zen3d.Geometry#addAttribute and zen3d.Geometry#getAttribute to access attributes of this geometry.
Type:
  • Object
Inherited From:
Source:

boundingBox :zen3d.Box3

Bounding box for the bufferGeometry, which can be calculated with zen3d.Geometry#computeBoundingBox.
Type:
Inherited From:
Default Value:
  • zen3d.Box3()
Source:

boundingSphere :zen3d.Sphere

Bounding sphere for the bufferGeometry, which can be calculated with zen3d.Geometry#computeBoundingSphere.
Type:
Inherited From:
Default Value:
  • zen3d.Sphere()
Source:

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 }
Type:
  • Array
Inherited From:
Default Value:
  • []
Source:

index :zen3d.BufferAttribute|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:
Inherited From:
Source:

morphAttributes :Object

Hashmap of Attributes Array for morph targets.
Type:
  • Object
Inherited From:
Source:

uuid :string

UUID of this geometry instance. This gets automatically assigned, so this shouldn't be edited.
Type:
  • string
Inherited From:
Source:

version :Integer

A version number, incremented every time the attribute object or index object changes to mark VAO drity.
Type:
  • Integer
Inherited From:
Default Value:
  • 0
Source:

Methods

addAttribute(name, attribute)

Adds an attribute to this geometry. Use this rather than the attributes property.
Parameters:
Name Type Description
name string
attribute zen3d.BufferAttribute | zen3d.InterleavedBufferAttribute
Inherited From:
Source:

addEventListener(type, listener, thisObjectopt)

Adds a listener to an event type.
Parameters:
Name Type Attributes Default Description
type string The type of event to listen to.
listener function The function that gets called when the event is fired.
thisObject Object <optional>
this The Object of calling listener method.
Inherited From:
Source:

addGroup(start, count, materialIndex)

Adds a group to this geometry; see the zen3d.Geometry#groups for details.
Parameters:
Name Type Description
start Integer
count Integer
materialIndex Integer
Inherited From:
Source:

clearGroups()

Clears all groups.
Inherited From:
Source:

clone() → {zen3d.Geometry}

Creates a clone of this Geometry.
Inherited From:
Source:
Returns:
Type
zen3d.Geometry

computeBoundingBox()

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

computeBoundingSphere()

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

copy(source) → {zen3d.Geometry}

Copies another Geometry to this Geometry.
Parameters:
Name Type Description
source zen3d.Geometry The geometry to be copied.
Inherited From:
Source:
Returns:
Type
zen3d.Geometry

dispatchEvent(event)

Fire an event type.
Parameters:
Name Type Description
event Object The event that gets fired.
Inherited From:
Source:

dispose()

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

getAttribute() → {zen3d.BufferAttribute|zen3d.InterleavedBufferAttribute}

Returns the attribute with the specified name.
Inherited From:
Source:
Returns:
Type
zen3d.BufferAttribute | zen3d.InterleavedBufferAttribute

removeAttribute()

Removes the attribute with the specified name.
Inherited From:
Source:

removeEventListener(type, listener, thisObjectopt)

Removes a listener from an event type.
Parameters:
Name Type Attributes Default Description
type string The type of the listener that gets removed.
listener function The listener function that gets removed.
thisObject Object <optional>
this thisObject - The Object of calling listener method.
Inherited From:
Source:

setIndex(index)

Set the zen3d.Geometry#index buffer.
Parameters:
Name Type Description
index Array | zen3d.BufferAttribute
Inherited From:
Source: