[name]

Base class for geometries

Example

var geometry = new THREE.Geometry() geometry.vertices.push( new THREE.Vector3( -10, 10, 0 ) ); geometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) ); geometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) ); geometry.faces.push( new THREE.Face3( 0, 1, 2 ) ); geometry.computeBoundingSphere();

Constructor

[name]()

Properties

.[page:Integer id]

Unique number of this geometry instance

.[page:String name]

Name for this geometry. Default is an empty string.

.[page:Array vertices]

Array of [page:Vector3 vertices].

.[page:Array colors]

Array of vertex [page:Color colors], matching number and order of vertices.
Used in [page:ParticleSystem], [page:Line] and [page:Ribbon].
[page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.

.[page:Array materials]

Array of [page:Material materials].

.[page:Array faces]

Array of [page:Face3 triangles] or/and [page:Face4 quads].

.[page:Array faceUvs]

Array of face [page:UV] layers.
Each UV layer is an array of [page:UV] matching order and number of faces.

.[page:Array faceVertexUvs]

Array of face [page:UV] layers.
Each UV layer is an array of [page:UV] matching order and number of vertices in faces.

.[page:Array morphTargets]

Array of morph targets. Each morph target is a Javascript object: { name: "targetName", vertices: [ new THREE.Vertex(), ... ] } Morph vertices match number and order of primary vertices.

.[page:Array morphColors]

Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object: morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] } Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors).

.[page:Array skinWeights]

Array of skinning weights, matching number and order of vertices.

.[page:Array skinIndices]

Array of skinning indices, matching number and order of vertices.

.[page:Object boundingBox]

Bounding box. { min: new THREE.Vector3(), max: new THREE.Vector3() }

.[page:Object boundingSphere]

Bounding sphere. { radius: float }

.[page:Boolean hasTangents]

True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].

.[page:Boolean dynamic]

Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).
Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.

Methods

.applyMatrix( [page:Matrix4 matrix] )

Bakes matrix transform directly into vertex coordinates.

.computeCentroids()

Computes centroids for all faces.

.computeFaceNormals()

Computes face normals.

.computeVertexNormals()

Computes vertex normals by averaging face normals.
Face normals must be existing / computed beforehand.

.computeTangents()

Computes vertex tangents.
Based on [link:http://www.terathon.com/code/tangent.html]
Geometry must have vertex [page:UV UVs] (layer 0 will be used).

.computeBoundingBox()

Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.

.computeBoundingSphere()

Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.

.mergeVertices()

Checks for duplicate vertices using hashmap.
Duplicated vertices are removed and faces' vertices are updated.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]