Browse Source

Deprecated SplineCurve3

Mugen87 8 years ago
parent
commit
b28ec61410

+ 2 - 0
docs/api/deprecated/DeprecatedList.html

@@ -140,6 +140,8 @@
 		<h3>[page:ClosedSplineCurve3]</h3>
 		<h3>[page:ClosedSplineCurve3]</h3>
 		<div>ClosedSplineCurve3 has been deprecated. Use [page:CatmullRomCurve3] instead.</div>
 		<div>ClosedSplineCurve3 has been deprecated. Use [page:CatmullRomCurve3] instead.</div>
 
 
+		<h3>[page:SplineCurve3]</h3>
+		<div>SplineCurve3 has been deprecated. Use [page:CatmullRomCurve3] instead.</div>
 
 
 
 
 
 

+ 1 - 1
docs/api/extras/CurveUtils.html

@@ -25,7 +25,7 @@
 		t -- interpolation weight. <br />
 		t -- interpolation weight. <br />
 		p0, p1, p2, p4 -- the points defining the spline curve.<br /><br />
 		p0, p1, p2, p4 -- the points defining the spline curve.<br /><br />
 
 
-		Used internally by [page:SplineCurve SplineCurve] and [page:SplineCurve3 SplineCurve3].
+		Used internally by [page:SplineCurve SplineCurve].
 		</div>
 		</div>
 
 
 		<h3>[method:Number tangentQuadraticBezier]( t, p0, p1, p2 )</h3>
 		<h3>[method:Number tangentQuadraticBezier]( t, p0, p1, p2 )</h3>

+ 0 - 66
docs/api/extras/curves/SplineCurve3.html

@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="list.js"></script>
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-		[page:Curve] &rarr;
-
-		<h1>[name]</h1>
-
-		<div class="desc">
-			Create a smooth 3d spline curve from a series of points. Internally this uses
-		[page:CurveUtils.interpolate] to create the curve.<br /><br />
-
-		Note that this will be deprecated. Please use a [page:CatmullRomCurve3] instead.
-
-	</div>
-
-		<h2>Example</h2>
-
-		<div>[example:webgl_geometry_extrude_splines geometry / extrude / splines ] (choose PipeSpline)</div>
-
-		<code>
-//Create a closed bent a sine-like wave
-var curve = new THREE.SplineCurve3( [
-	new THREE.Vector3( -10, 0, 10 ),
-	new THREE.Vector3( -5, 5, 5 ),
-	new THREE.Vector3( 0, 0, 0 ),
-	new THREE.Vector3( 5, -5, 5 ),
-	new THREE.Vector3( 10, 0, 10 )
-] );
-
-var geometry = new THREE.Geometry();
-geometry.vertices = curve.getPoints( 50 );
-
-var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
-
-//Create the final object to add to the scene
-var splineObject = new THREE.Line( geometry, material );
-	</code>
-
-
-
-
-		<h2>Constructor</h2>
-
-
-		<h3>[name]( [page:Array points] )</h3>
-		<div>points – An array of [page:Vector3] points that define the curve.</div>
-
-
-		<h2>Properties</h2>
-
-		<h3>[property:Array points]</h3>
-
-		<h2>Methods</h2>
-
-		<h3>See [page:Curve] for inherited methods</h3>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-	</body>
-</html>

+ 1 - 2
docs/list.js

@@ -107,8 +107,7 @@ var list = {
 			[ "LineCurve3", "api/extras/curves/LineCurve3" ],
 			[ "LineCurve3", "api/extras/curves/LineCurve3" ],
 			[ "QuadraticBezierCurve", "api/extras/curves/QuadraticBezierCurve" ],
 			[ "QuadraticBezierCurve", "api/extras/curves/QuadraticBezierCurve" ],
 			[ "QuadraticBezierCurve3", "api/extras/curves/QuadraticBezierCurve3" ],
 			[ "QuadraticBezierCurve3", "api/extras/curves/QuadraticBezierCurve3" ],
-			[ "SplineCurve", "api/extras/curves/SplineCurve" ],
-			[ "SplineCurve3", "api/extras/curves/SplineCurve3" ]
+			[ "SplineCurve", "api/extras/curves/SplineCurve" ]
 		],
 		],
 
 
 		"Extras / Helpers": [
 		"Extras / Helpers": [

+ 0 - 18
editor/js/libs/tern-threejs/threejs.js

@@ -1431,15 +1431,6 @@
       },
       },
       "!doc": "Alias for [page:EllipseCurve]"
       "!doc": "Alias for [page:EllipseCurve]"
     },
     },
-    "ClosedSplineCurve3": {
-      "!url": "http://threejs.org/docs/#Reference/extras/curves/ClosedSplineCurve3",
-      "prototype": {
-        "!proto": "THREE.Curve.prototype",
-        "points": "[]"
-      },
-      "!doc": "Create a smooth 3d spline curve from a series of points that loops back onto itself",
-      "!type": "fn(points: [])"
-    },
     "CubicBezierCurve": {
     "CubicBezierCurve": {
       "!url": "http://threejs.org/docs/#Reference/extras/curves/CubicBezierCurve",
       "!url": "http://threejs.org/docs/#Reference/extras/curves/CubicBezierCurve",
       "prototype": {
       "prototype": {
@@ -1529,15 +1520,6 @@
       "!doc": "Create a smooth 2d spline curve from a series of points",
       "!doc": "Create a smooth 2d spline curve from a series of points",
       "!type": "fn(points: [])"
       "!type": "fn(points: [])"
     },
     },
-    "SplineCurve3": {
-      "!url": "http://threejs.org/docs/#Reference/extras/curves/SplineCurve3",
-      "prototype": {
-        "!proto": "THREE.Curve.prototype",
-        "points": "[]"
-      },
-      "!doc": "Create a smooth 3d spline curve from a series of points",
-      "!type": "fn(points: [])"
-    },
     "BoxGeometry": {
     "BoxGeometry": {
       "!url": "http://threejs.org/docs/#Reference/geometries/BoxGeometry",
       "!url": "http://threejs.org/docs/#Reference/geometries/BoxGeometry",
       "prototype": {
       "prototype": {

+ 12 - 0
src/Three.Legacy.js

@@ -217,6 +217,18 @@ export function ClosedSplineCurve3( points ) {
 
 
 ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
 ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
 
 
+//
+
+export function SplineCurve3( points ) {
+
+	console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
+
+	CatmullRomCurve3.call( this, points );
+	this.type = 'catmullrom';
+
+}
+
+SplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
 
 
 //
 //
 export function BoundingBoxHelper( object, color ) {
 export function BoundingBoxHelper( object, color ) {

+ 0 - 1
src/Three.js

@@ -136,7 +136,6 @@ export { BoxHelper } from './extras/helpers/BoxHelper.js';
 export { ArrowHelper } from './extras/helpers/ArrowHelper.js';
 export { ArrowHelper } from './extras/helpers/ArrowHelper.js';
 export { AxisHelper } from './extras/helpers/AxisHelper.js';
 export { AxisHelper } from './extras/helpers/AxisHelper.js';
 export { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
 export { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
-export { SplineCurve3 } from './extras/curves/SplineCurve3.js';
 export { CubicBezierCurve3 } from './extras/curves/CubicBezierCurve3.js';
 export { CubicBezierCurve3 } from './extras/curves/CubicBezierCurve3.js';
 export { QuadraticBezierCurve3 } from './extras/curves/QuadraticBezierCurve3.js';
 export { QuadraticBezierCurve3 } from './extras/curves/QuadraticBezierCurve3.js';
 export { LineCurve3 } from './extras/curves/LineCurve3.js';
 export { LineCurve3 } from './extras/curves/LineCurve3.js';

+ 1 - 1
src/extras/core/Curve.js

@@ -27,7 +27,7 @@ import { Matrix4 } from '../../math/Matrix4';
  * THREE.LineCurve3
  * THREE.LineCurve3
  * THREE.QuadraticBezierCurve3
  * THREE.QuadraticBezierCurve3
  * THREE.CubicBezierCurve3
  * THREE.CubicBezierCurve3
- * THREE.SplineCurve3
+ * THREE.CatmullRomCurve3
  *
  *
  * A series of curves can be represented as a THREE.CurvePath
  * A series of curves can be represented as a THREE.CurvePath
  *
  *

+ 0 - 45
src/extras/curves/SplineCurve3.js

@@ -1,45 +0,0 @@
-import { Vector3 } from '../../math/Vector3';
-import { CurveUtils } from '../CurveUtils';
-import { Curve } from '../core/Curve';
-
-/**************************************************************
- *	Spline 3D curve
- **************************************************************/
-
-
-var SplineCurve3 = Curve.create(
-
-	function ( points /* array of Vector3 */ ) {
-
-		console.warn( 'THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3' );
-		this.points = ( points === undefined ) ? [] : points;
-
-	},
-
-	function ( t ) {
-
-		var points = this.points;
-		var point = ( points.length - 1 ) * t;
-
-		var intPoint = Math.floor( point );
-		var weight = point - intPoint;
-
-		var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ];
-		var point1 = points[ intPoint ];
-		var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];
-		var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];
-
-		var interpolate = CurveUtils.interpolate;
-
-		return new Vector3(
-			interpolate( point0.x, point1.x, point2.x, point3.x, weight ),
-			interpolate( point0.y, point1.y, point2.y, point3.y, weight ),
-			interpolate( point0.z, point1.z, point2.z, point3.z, weight )
-		);
-
-	}
-
-);
-
-
-export { SplineCurve3 };

+ 0 - 56
test/unit/extras/curves/ClosedSplineCurve3.js

@@ -1,56 +0,0 @@
-/**
- * @author zz85 / http://joshuakoo.com
- */
-
-module( "ClosedSplineCurve3" );
-
-var threshold = 0.000001;
-
-function vectorsAreEqual( check, that ) {
-
-	if ( check.length !== that.length ) return 'Length not equal';
-
-	for ( var i = 0; i < check.length; i ++ ) {
-
-		var a = check[ i ], b = that[ i ];
-		if ( a.distanceToSquared( b ) > threshold ) {
-
-			return 'Vector differs at index ' + i +
-				'. Should be ' + [ a.x, a.y, a.z ] +
-				' instead of ' + [ b.x, b.y, b.z ];
-		}
-	}
-
-}
-
-test( "basic check", function() {
-
-	var closedSpline = new THREE.ClosedSplineCurve3( [
-		new THREE.Vector3( -60, -100,  60 ),
-		new THREE.Vector3( -60,   20,  60 ),
-		new THREE.Vector3( -60,  120,  60 ),
-		new THREE.Vector3(  60,   20, -60 ),
-		new THREE.Vector3(  60, -100, -60 )
-	] );
-
-	var closedSplinePoints = [
-		new THREE.Vector3(-60,-100,60),
-		new THREE.Vector3(-67.5,-46.25,67.5),
-		new THREE.Vector3(-60,20,60),
-		new THREE.Vector3(-67.5,83.75,67.5),
-		new THREE.Vector3(-60,120,60),
-		new THREE.Vector3(0,83.75,0),
-		new THREE.Vector3(60,20,-60),
-		new THREE.Vector3(75,-46.25,-75),
-		new THREE.Vector3(60,-100,-60),
-		new THREE.Vector3(0,-115,0),
-		new THREE.Vector3(-60,-100,60),
-	];
-
-	var getPoints = closedSpline.getPoints(10);
-	var error = vectorsAreEqual( getPoints , closedSplinePoints );
-	ok( getPoints.length == 11, 'getPoints should be equal.');
-	var desc = error ? ' ' + error : '';
-	ok( !error, 'Lists of Vectors3 should be equal.' + desc );
-
-});

+ 0 - 2
test/unit/unittests_sources.html

@@ -36,7 +36,6 @@
   <script src="../../src/extras/core/Curve.js"></script>
   <script src="../../src/extras/core/Curve.js"></script>
   <script src="../../src/extras/CurveUtils.js"></script>
   <script src="../../src/extras/CurveUtils.js"></script>
   <script src="../../src/extras/curves/CatmullRomCurve3.js"></script>
   <script src="../../src/extras/curves/CatmullRomCurve3.js"></script>
-  <script src="../../src/extras/curves/ClosedSplineCurve3.js"></script>
 
 
   <!-- add class-based unit tests below -->
   <!-- add class-based unit tests below -->
 
 
@@ -60,7 +59,6 @@
   <script src="math/Color.js"></script>
   <script src="math/Color.js"></script>
   <script src="math/Interpolant.js"></script>
   <script src="math/Interpolant.js"></script>
 
 
-  <script src="extras/curves/ClosedSplineCurve3.js"></script>
   <script src="extras/curves/CatmullRomCurve3.js"></script>
   <script src="extras/curves/CatmullRomCurve3.js"></script>
 
 
 </body>
 </body>