Bladeren bron

CatmullRomCurve3: Enhance constructor and copy()

Mugen87 7 jaren geleden
bovenliggende
commit
03119e5d76
2 gewijzigde bestanden met toevoegingen van 9 en 7 verwijderingen
  1. 6 5
      docs/api/extras/curves/CatmullRomCurve3.html
  2. 3 2
      src/extras/curves/CatmullRomCurve3.js

+ 6 - 5
docs/api/extras/curves/CatmullRomCurve3.html

@@ -41,11 +41,12 @@ var curveObject = new THREE.Line( geometry, material );
 
 		<h2>Constructor</h2>
 
-		<h3>[name]( [page:Array points], [page:Boolean closed], [page:Float tension] )</h3>
+		<h3>[name]( [page:Array points], [page:Boolean closed], [page:String curveType], [page:Float tension] )</h3>
 		<div>
 			points – An array of [page:Vector3] points<br/>
-			closed – Whether the curve is closed. Default is *false*.
-			tension – Tension of the curve. Default is *false*.
+			closed – Whether the curve is closed. Default is *false*.<br/>
+			curveType – Type of the curve. Default is *centripetal*.<br/>
+			tension – Tension of the curve. Default is *0.5*.
 		</div>
 
 
@@ -66,10 +67,10 @@ var curveObject = new THREE.Line( geometry, material );
 		<div>The curve will loop back onto itself when this is true.</div>
 
 		<h3>[property:String curveType]</h3>
-		<div>Possible values are `centripetal` (default), `chordal` and `catmullrom`.</div>
+		<div>Possible values are *centripetal*, *chordal* and *catmullrom*.</div>
 
 		<h3>[property:float tension]</h3>
-		<div>When [page:.type] is `catmullrom`, defines catmullrom's tension. Defaults is *0.5*.</div>
+		<div>When [page:.type] is *catmullrom*, defines catmullrom's tension.</div>
 
 
 		<h2>Methods</h2>

+ 3 - 2
src/extras/curves/CatmullRomCurve3.js

@@ -83,7 +83,7 @@ function CubicPoly() {
 var tmp = new Vector3();
 var px = new CubicPoly(), py = new CubicPoly(), pz = new CubicPoly();
 
-function CatmullRomCurve3( points, closed, tension ) {
+function CatmullRomCurve3( points, closed, curveType, tension ) {
 
 	Curve.call( this );
 
@@ -91,8 +91,8 @@ function CatmullRomCurve3( points, closed, tension ) {
 
 	this.points = points || [];
 	this.closed = closed || false;
+	this.curveType = curveType || 'centripetal';
 	this.tension = tension || 0.5;
-	this.curveType = 'centripetal';
 
 }
 
@@ -200,6 +200,7 @@ CatmullRomCurve3.prototype.copy = function ( source ) {
 	}
 
 	this.closed = source.closed;
+	this.curveType = source.curveType;
 	this.tension = source.tension;
 
 	return this;