[name]

Base class for geometries.
A geometry holds all data necessary to describe a 3D model.

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]()

todo

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].
The array of vertices hold every position of points of the model.
To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true.

.[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.
To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true.

.[page:Array normals]

Array of vertex [page:Vector3 normals], matching number and order of vertices.
[link:http://en.wikipedia.org/wiki/Normal_(geometry) Normal vectors] are nessecary for lighting
To signal an update in this array, [page:Geometry Geometry.normalsNeedUpdate] needs to be set to true.

.[page:Array faces]

Array of [page:Face3 triangles] or/and [page:Face4 quads].
The array of faces describe how each vertex in the model is connected with each other.
To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true.

.[page:Array faceUvs]

Array of face [page:UV] layers.
Each UV layer is an array of [page:UV] matching order and number of faces.
To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.

.[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.
To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.

.[page:Array morphTargets]

Array of morph targets. Each morph target is a Javascript object: { name: "targetName", vertices: [ new THREE.Vector3(), ... ] } 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 morphColors]

Array of morph normals. Morph Normals have similar structure as morph targets, each normal set is a Javascript object: morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }

.[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.
Defaults to true.

.[page:Boolean verticesNeedUpdate]

Set to *true* if the vertices array has been updated.

.[page:Boolean elementsNeedUpdate]

Set to *true* if the faces array has been updated.

.[page:Boolean uvsNeedUpdate]

Set to *true* if the uvs array has been updated.

.[page:Boolean normalsNeedUpdate]

Set to *true* if the normals array has been updated.

.[page:Boolean tangentsNeedUpdate]

Set to *true* if the tangents in the faces has been updated.

.[page:Boolean colorsNeedUpdate]

Set to *true* if the colors array has been updated.

.[page:Boolean lineDistancesNeedUpdate]

Set to *true* if the linedistances array has been updated.

.[page:Boolean buffersNeedUpdate]

Set to *true* if an array has changed in length.

.[page:array morphNormals]

todo

.[page:array lineDistances]

todo

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.

.computeMorphNormals()

Computes morph normals.

.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.

.clone()

Creates a new clone of the Geometry.

.dispose()

Removes The object from memory.
Don't forget to call this method when you remove an geometry because it can cuase meomory leaks.

.dispatchEvent([page:todo event]) [page:todo]

event -- todo
todo

.hasEventListener([page:todo type], [page:todo listener]) [page:todo]

type -- todo
listener -- todo
todo

.removeEventListener([page:todo type], [page:todo listener]) [page:todo]

type -- todo
listener -- todo
todo

.computeLineDistances() [page:todo]

todo

.addEventListener([page:todo type], [page:todo listener]) [page:todo]

type -- todo
listener -- todo
todo

Source

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