浏览代码

Merge remote-tracking branch 'zz85/master' into dev

Mr.doob 13 年之前
父节点
当前提交
9116ca3876
共有 1 个文件被更改,包括 13 次插入3 次删除
  1. 13 3
      src/extras/core/Curve.js

+ 13 - 3
src/extras/core/Curve.js

@@ -1,6 +1,12 @@
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
  * Extensible curve object
+ * 
+ * Some common of Curve methods
+ * .getPoint(t), getTangent(t)
+ * .getPointAt(u), getTagentAt(u)
+ * .getPoints(), .getSpacedPoints()
+ * .getLength()
  *
  * This file contains following classes:
  *
@@ -237,9 +243,6 @@ THREE.Curve.prototype.getTangent = function( t ) {
 
 	var pt1 = this.getPoint( t1 );
 	var pt2 = this.getPoint( t2 );
-
-	// var vec = new THREE.Vector2();
-	// vec.sub( pt2, pt1 );
 	
 	var vec = pt1.clone().subSelf(pt2);
 	return vec.normalize();
@@ -247,6 +250,13 @@ THREE.Curve.prototype.getTangent = function( t ) {
 };
 
 
+THREE.Curve.prototype.getTangentAt = function ( u ) {
+
+	var t = this.getUtoTmapping( u );
+	return this.getTangent( t );
+
+};
+
 /**************************************************************
  *	Line
  **************************************************************/