[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 ),
new THREE.Vector3( -10, -10, 0 ),
new THREE.Vector3( 10, -10, 0 )
);
geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
geometry.computeBoundingSphere();
Constructor
[name]()
The constructor takes no arguments.
Properties
[property:Integer id]
Unique number for this geometry instance.
[property:String name]
Name for this geometry. Default is an empty string.
[property:Array vertices]
Array of [page:Vector3 vertices].
The array of vertices holds every position of points in the model.
To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true.
[property:Array colors]
Array of vertex [page:Color colors], matching number and order of vertices.
Used in [page:PointCloud] and [page:Line].
[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.
[property:Array faces]
Array of [page:Face3 triangles].
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.
[property:Array faceVertexUvs]
Array of face [page:UV] layers.
Each UV layer is an array of [page:UV]s matching the order and number of vertices in faces.
To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
[property: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.
[property: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 the number and order of faces (face colors) or the number of vertices (vertex colors).
[property:Array morphNormals]
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(), ... ] }
[property:Array skinWeights]
Array of skinning weights, matching number and order of vertices.
[property:Array skinIndices]
Array of skinning indices, matching number and order of vertices.
[property:Object boundingBox]
Bounding box.
{ min: new THREE.Vector3(), max: new THREE.Vector3() }
[property:Object boundingSphere]
Bounding sphere.
{ radius: float }
[property:Boolean hasTangents]
True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
[property: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.
[property:Boolean verticesNeedUpdate]
Set to *true* if the vertices array has been updated.
[property:Boolean elementsNeedUpdate]
Set to *true* if the faces array has been updated.
[property:Boolean uvsNeedUpdate]
Set to *true* if the uvs array has been updated.
[property:Boolean normalsNeedUpdate]
Set to *true* if the normals array has been updated.
[property:Boolean tangentsNeedUpdate]
Set to *true* if the tangents in the faces has been updated.
[property:Boolean colorsNeedUpdate]
Set to *true* if the colors array has been updated.
[property:Boolean lineDistancesNeedUpdate]
Set to *true* if the linedistances array has been updated.
[property:array lineDistances]
An array containing distances between vertices for Line geometries.
This is required for LinePieces/LineDashedMaterial to render correctly.
Line distances can also be generated with computeLineDistances.
Methods
[page:EventDispatcher EventDispatcher] methods are available on this class.
[method:null applyMatrix]( [page:Matrix4 matrix] )
Bakes matrix transform directly into vertex coordinates.
[method:null computeFaceNormals]()
Computes face normals.
[method:null computeVertexNormals]()
Computes vertex normals by averaging face normals.
Face normals must be existing / computed beforehand.
[method:null computeMorphNormals]()
Computes morph normals.
[method:null 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).
[method:null computeBoundingBox]()
Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
[method:null 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*.
[method:null merge]( [page:Geometry geometry], [page:Matrix4 matrix], [page:Integer materialIndexOffset] )
Merge two geometries or geometry and geometry from object (using object's transform)
[method:null mergeVertices]()
Checks for duplicate vertices using hashmap.
Duplicated vertices are removed and faces' vertices are updated.
[method:Geometry clone]()
Creates a new clone of the Geometry.
[method:null dispose]()
Removes The object from memory.
Don't forget to call this method when you remove a geometry because it can cause memory leaks.
[method:null computeLineDistances]()
Compute distances between vertices for Line geometries.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]