source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/src/extras/curves/EllipseCurve.js@ 28897

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: 1.0 KB
Line 
1/**************************************************************
2 * Ellipse curve
3 **************************************************************/
4
5THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) {
6
7 this.aX = aX;
8 this.aY = aY;
9
10 this.xRadius = xRadius;
11 this.yRadius = yRadius;
12
13 this.aStartAngle = aStartAngle;
14 this.aEndAngle = aEndAngle;
15
16 this.aClockwise = aClockwise;
17
18};
19
20THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype );
21
22THREE.EllipseCurve.prototype.getPoint = function ( t ) {
23
24 var angle;
25 var deltaAngle = this.aEndAngle - this.aStartAngle;
26
27 if ( deltaAngle < 0 ) deltaAngle += Math.PI * 2;
28 if ( deltaAngle > Math.PI * 2 ) deltaAngle -= Math.PI * 2;
29
30 if ( this.aClockwise === true ) {
31
32 angle = this.aEndAngle + ( 1 - t ) * ( Math.PI * 2 - deltaAngle );
33
34 } else {
35
36 angle = this.aStartAngle + t * deltaAngle;
37
38 }
39
40 var tx = this.aX + this.xRadius * Math.cos( angle );
41 var ty = this.aY + this.yRadius * Math.sin( angle );
42
43 return new THREE.Vector2( tx, ty );
44
45};
Note: See TracBrowser for help on using the repository browser.