repositories
/
SugarCubes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ee1f21c
)
[Helix] Fix toroidal coil calculation
author
Shaheen Gandhi
<shaheen@fb.com>
Sun, 18 Aug 2013 23:17:29 +0000
(16:17 -0700)
committer
Shaheen Gandhi
<shaheen@fb.com>
Mon, 19 Aug 2013 00:07:53 +0000
(17:07 -0700)
ShaheenGandhi.pde
patch
|
blob
|
blame
|
history
diff --git
a/ShaheenGandhi.pde
b/ShaheenGandhi.pde
index c25badd6a262ed99000ba8a86882138d93d89e5f..a842fcf4a343b423a61e813353211e10ae4a0e47 100644
(file)
--- a/
ShaheenGandhi.pde
+++ b/
ShaheenGandhi.pde
@@
-42,10
+42,11
@@
class HelixPattern extends SCPattern {
PVector rotatePoint(final PVector pt, final float rads) {
Vec3D axisVec3D = new Vec3D(vector.x, vector.y, vector.z);
PVector rotatePoint(final PVector pt, final float rads) {
Vec3D axisVec3D = new Vec3D(vector.x, vector.y, vector.z);
- Matrix4x4 mat = new Matrix4x4();
- mat.rotateAroundAxis(axisVec3D, rads);
- Vec3D ptVec3D = new Vec3D(pt.x, pt.y, pt.z);
- Vec3D rotatedPt = mat.applyTo(ptVec3D);
+ Vec3D originVec3D = new Vec3D(origin.x, origin.y, origin.z);
+ Matrix4x4 mat = new Matrix4x4().identity()
+ .rotateAroundAxis(axisVec3D, rads);
+ Vec3D ptVec3D = new Vec3D(pt.x, pt.y, pt.z).sub(originVec3D);
+ Vec3D rotatedPt = mat.applyTo(ptVec3D).add(originVec3D);
return new PVector(rotatedPt.x, rotatedPt.y, rotatedPt.z);
}
}
return new PVector(rotatedPt.x, rotatedPt.y, rotatedPt.z);
}
}