-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lathe with Vector2 #7989
Lathe with Vector2 #7989
Conversation
LatheGeometry modified to use Vector2 and allowing axe choice by the called. The axe is designed by a letter because I didn't know where I should put a constance definition. The loop that create the geometry is not optimized for speed => the axis test is in the inner loop. Should not break any existing code. Doc and exemple not updated yet.
Oh, I was working on that. I think I would not have the
diff --git a/src/extras/geometries/LatheGeometry.js b/src/extras/geometries/LatheGeometry.js
index f702c4a..6f271bc 100644
--- a/src/extras/geometries/LatheGeometry.js
+++ b/src/extras/geometries/LatheGeometry.js
@@ -35,18 +35,18 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
var phi = phiStart + i * inverseSegments * phiLength;
- var c = Math.cos( phi ),
- s = Math.sin( phi );
+ var sin = Math.sin( phi );
+ var cos = Math.cos( phi );
for ( var j = 0, jl = points.length; j < jl; j ++ ) {
- var pt = points[ j ];
+ var point = points[ j ];
var vertex = new THREE.Vector3();
- vertex.x = c * pt.x - s * pt.y;
- vertex.y = s * pt.x + c * pt.y;
- vertex.z = pt.z;
+ vertex.x = point.x * cos;
+ vertex.y = point.y;
+ vertex.z = point.x * sin;
this.vertices.push( vertex ); |
I agree, but if someone is using LatheGeometry, his scene gonna change. |
I know, I know. But we can suggest to use |
I'll merge and simplify. |
Thanks! |
Do you want me to update the documentation and examples that are know broken ?
|
@rfm1201 that would be great! |
LatheGeometry modified to use Vector2 and allowing axe choice by the caller.
The axe is designed by a letter because I didn't know where I should put a constance definition.
The loop that create the geometry is not optimized for speed => the axis test is in the inner loop.
Should not break any existing code. Tested with all the examples that create a LatheGeometry.
Doc and examples not updated.
it's the next step of #7971 (comment)