Last change
on this file since 28897 was 28897, checked in by davidb, 10 years ago |
GUI front-end to server base plus web page content
|
File size:
734 bytes
|
Line | |
---|
1 | /**************************************************************
|
---|
2 | * Line
|
---|
3 | **************************************************************/
|
---|
4 |
|
---|
5 | THREE.LineCurve = function ( v1, v2 ) {
|
---|
6 |
|
---|
7 | this.v1 = v1;
|
---|
8 | this.v2 = v2;
|
---|
9 |
|
---|
10 | };
|
---|
11 |
|
---|
12 | THREE.LineCurve.prototype = Object.create( THREE.Curve.prototype );
|
---|
13 |
|
---|
14 | THREE.LineCurve.prototype.getPoint = function ( t ) {
|
---|
15 |
|
---|
16 | var point = this.v2.clone().sub(this.v1);
|
---|
17 | point.multiplyScalar( t ).add( this.v1 );
|
---|
18 |
|
---|
19 | return point;
|
---|
20 |
|
---|
21 | };
|
---|
22 |
|
---|
23 | // Line curve is linear, so we can overwrite default getPointAt
|
---|
24 |
|
---|
25 | THREE.LineCurve.prototype.getPointAt = function ( u ) {
|
---|
26 |
|
---|
27 | return this.getPoint( u );
|
---|
28 |
|
---|
29 | };
|
---|
30 |
|
---|
31 | THREE.LineCurve.prototype.getTangent = function( t ) {
|
---|
32 |
|
---|
33 | var tangent = this.v2.clone().sub(this.v1);
|
---|
34 |
|
---|
35 | return tangent.normalize();
|
---|
36 |
|
---|
37 | }; |
---|
Note:
See
TracBrowser
for help on using the repository browser.