提交 61a407f3 编写于 作者: Z zz85

Updated Curve.js, Updated builds

上级 c2e0d05e
此差异已折叠。
......@@ -106,9 +106,9 @@
//PlaneGeometry not supported
// quick fix for duplicated vertices
// /geometry.checkDupVertices( true );
geometry.checkDupVertices( true );
console.log(geometry);
//console.log(geometry);
smooth = createSubdivision(geometry, 2);
......@@ -131,8 +131,6 @@
context.fillText(i, 0,0);
};
......
......@@ -14,7 +14,7 @@ THREE.Geometry = function () {
this.faces = [];
this.edges = [];
//this.edges = [];
this.faceUvs = [[]];
this.faceVertexUvs = [[]];
......@@ -487,9 +487,7 @@ THREE.Geometry.prototype = {
// to triangles: a,b,d / b,c,d
// shared edge is: b,d
// should shared edge be included?
// comment out if not
// add edge B-D only if you wish to slice a face4
// hash = edge_hash( face.b, face.d );
// addToMap( vfMap, hash, i );
......@@ -513,6 +511,7 @@ THREE.Geometry.prototype = {
this.vfMap = vfMap;
this.edges = [];
var numOfEdges = 0;
for (i in vfMap) {
......@@ -525,25 +524,7 @@ THREE.Geometry.prototype = {
//console.log('vfMap', vfMap, 'this.edges',this.edges, 'numOfEdges', numOfEdges);
// Not sure what the below does.
// for( i = 0, il = this.edges.length; i < il; i ++ ) {
//
// edge = this.edges[ i ];
//
// v1 = edge.vertexIndices[ 0 ];
// v2 = edge.vertexIndices[ 1 ];
//
// edge.faceIndices = vfMap[ edge_hash( v1, v2 ) ].array;
//
// for( j = 0; j < edge.faceIndices.length; j ++ ) {
//
// faceIndex = edge.faceIndices[ j ];
// edge.faces.push( this.faces[ faceIndex ] );
//
// }
//
// }
return vfMap;
},
......
......@@ -4,12 +4,19 @@
*
* This file contains following classes:
*
* -- 2d classes --
* THREE.Curve
* THREE.LineCurve
* THREE.QuadraticBezierCurve
* THREE.CubicBezierCurve
* THREE.SplineCurve
* THREE.ArcCurve
*
* -- 3d classes --
* THREE.LineCurve3
* THREE.QuadraticBezierCurve3
* THREE.CubicBezierCurve3
* THREE.SplineCurve3
*
**/
......@@ -660,3 +667,74 @@ THREE.QuadraticBezierCurve3 = THREE.Curve.create(
}
);
/**************************************************************
* Cubic Bezier 3D curve
**************************************************************/
THREE.CubicBezierCurve3 = THREE.Curve.create(
function ( v0, v1, v2, v3 ) {
this.v0 = v0;
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
},
function ( t ) {
var tx, ty, tz;
tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );
ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );
tz = THREE.Shape.Utils.b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z );
return new THREE.Vector3( tx, ty, tz );
}
);
/**************************************************************
* Spline 3D curve
**************************************************************/
THREE.SplineCurve3 = THREE.Curve.create(
function ( points /* array of Vector3 */) {
this.points = points;
},
function ( t ) {
var v = new THREE.Vector3();
var c = [];
var points = this.points, point, intPoint, weight;
point = ( points.length - 1 ) * t;
intPoint = Math.floor( point );
weight = point - intPoint;
c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
c[ 1 ] = intPoint;
c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight );
v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight );
v.z = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].z, points[ c[ 1 ] ].z, points[ c[ 2 ] ].z, points[ c[ 3 ] ].z, weight );
return v;
}
);
......@@ -54,9 +54,6 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
}
// UVs to be added
// How can we create UVs on this?
this.computeCentroids();
this.computeFaceNormals();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册