提交 84615fe3 编写于 作者: W WestLangley

Corrected face normal calculation in PolyhedronGeometry

上级 c338d045
......@@ -63,11 +63,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
}
// Merge vertices
this.mergeVertices();
// Apply radius
for ( var i = 0, l = this.vertices.length; i < l; i ++ ) {
......@@ -77,6 +72,17 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
}
// Merge vertices
this.mergeVertices();
this.computeCentroids();
this.computeFaceNormals();
this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
// Project vector onto sphere's surface
function prepare( vector ) {
......@@ -101,7 +107,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
face.normal.copy( face.centroid ).normalize();
that.faces.push( face );
var azi = azimuth( face.centroid );
......@@ -213,9 +218,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
}
this.computeCentroids();
this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册