|
@@ -138,6 +138,12 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+THREE.Curve.prototype.updateArcLengths = function() {
|
|
|
+ this.needsUpdate = true;
|
|
|
+ this.getLengths();
|
|
|
+};
|
|
|
+
|
|
|
// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance
|
|
|
|
|
|
THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
|
|
@@ -249,7 +255,7 @@ THREE.Curve.prototype.getTangent = function( t ) {
|
|
|
var pt1 = this.getPoint( t1 );
|
|
|
var pt2 = this.getPoint( t2 );
|
|
|
|
|
|
- var vec = pt1.clone().subSelf(pt2);
|
|
|
+ var vec = pt2.clone().subSelf(pt1);
|
|
|
return vec.normalize();
|
|
|
|
|
|
};
|
|
@@ -711,12 +717,17 @@ THREE.SplineCurve3 = THREE.Curve.create(
|
|
|
|
|
|
c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
|
|
|
c[ 1 ] = intPoint;
|
|
|
- c[ 2 ] = intPoint > points.length - 2 ? points.length -1 : intPoint + 1;
|
|
|
- c[ 3 ] = intPoint > points.length - 3 ? points.length -1 : intPoint + 2;
|
|
|
+ c[ 2 ] = intPoint > points.length - 2 ? points.length - 1 : intPoint + 1;
|
|
|
+ c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : 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 );
|
|
|
+ var pt0 = points[ c[0] ],
|
|
|
+ pt1 = points[ c[1] ],
|
|
|
+ pt2 = points[ c[2] ],
|
|
|
+ pt3 = points[ c[3] ];
|
|
|
+
|
|
|
+ v.x = THREE.Curve.Utils.interpolate(pt0.x, pt1.x, pt2.x, pt3.x, weight);
|
|
|
+ v.y = THREE.Curve.Utils.interpolate(pt0.y, pt1.y, pt2.y, pt3.y, weight);
|
|
|
+ v.z = THREE.Curve.Utils.interpolate(pt0.z, pt1.z, pt2.z, pt3.z, weight);
|
|
|
|
|
|
return v;
|
|
|
|
|
@@ -724,6 +735,35 @@ THREE.SplineCurve3 = THREE.Curve.create(
|
|
|
|
|
|
);
|
|
|
|
|
|
+
|
|
|
+// THREE.SplineCurve3.prototype.getTangent = 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 ? points.length - 1 : intPoint + 1;
|
|
|
+// c[ 3 ] = intPoint > points.length - 3 ? points.length - 1 : intPoint + 2;
|
|
|
+
|
|
|
+// var pt0 = points[ c[0] ],
|
|
|
+// pt1 = points[ c[1] ],
|
|
|
+// pt2 = points[ c[2] ],
|
|
|
+// pt3 = points[ c[3] ];
|
|
|
+
|
|
|
+// // t = weight;
|
|
|
+// v.x = THREE.Curve.Utils.tangentSpline( t, pt0.x, pt1.x, pt2.x, pt3.x );
|
|
|
+// v.y = THREE.Curve.Utils.tangentSpline( t, pt0.y, pt1.y, pt2.y, pt3.y );
|
|
|
+// v.z = THREE.Curve.Utils.tangentSpline( t, pt0.z, pt1.z, pt2.z, pt3.z );
|
|
|
+
|
|
|
+// return v;
|
|
|
+
|
|
|
+// }
|
|
|
+
|
|
|
/**************************************************************
|
|
|
* Closed Spline 3D curve
|
|
|
**************************************************************/
|