[name]
Base class for geometries
Example
// geometry with random points
var geometry = new THREE.Geometry()
for ( var i = 0; i < 10000; i ++ ) {
var vertex = new THREE.Vertex();
vertex.position.x = Math.random() * 1000 - 500;
vertex.position.y = Math.random() * 1000 - 500;
vertex.position.z = Math.random() * 1000 - 500;
geometry.vertices.push( vertex );
}
geometry.computeBoundingSphere();
Constructor
[name]()
Properties
.[page:Integer id]
Unique number of this geometry instance
.[page:Array vertices]
Array of [page:Vertex 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 JS 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 JS 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.
.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]