mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 04:56:01 +10:00
add getTangentAt()
This commit is contained in:
@@ -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
|
||||
**************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user