repositories
/
SugarCubes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d814f9a
)
[Helix][perf] Inline pointOnToroidalAxis
author
Shaheen Gandhi
<shaheen@fb.com>
Mon, 19 Aug 2013 03:50:01 +0000
(20:50 -0700)
committer
Shaheen Gandhi
<shaheen@fb.com>
Tue, 20 Aug 2013 07:18:30 +0000
(
00:18
-0700)
ShaheenGandhi.pde
patch
|
blob
|
blame
|
history
diff --git
a/ShaheenGandhi.pde
b/ShaheenGandhi.pde
index 816bd10d14cec76edd6fc8d2f7f6dce913657c4f..dcdb90800a84c754aa4bbb9a2f20a327d6ab0b24 100644
(file)
--- a/
ShaheenGandhi.pde
+++ b/
ShaheenGandhi.pde
@@
-94,6
+94,14
@@
class HelixPattern extends SCPattern {
Line getAxis() {
return axis;
}
Line getAxis() {
return axis;
}
+
+ PVector getPhaseNormal() {
+ return phaseNormal;
+ }
+
+ float getPhase() {
+ return phase;
+ }
void step(int deltaMs) {
// Rotate
void step(int deltaMs) {
// Rotate
@@
-119,7
+127,9
@@
class HelixPattern extends SCPattern {
// Find the appropriate point for the current rotation
// of the helix.
// Find the appropriate point for the current rotation
// of the helix.
- PVector toroidPoint = pointOnToroidalAxis(t);
+ PVector toroidPoint = axisPoint;
+ toroidPoint.add(phaseNormal);
+ toroidPoint = axis.rotatePoint(toroidPoint, (t / period) * TWO_PI + phase);
// The rotated point represents the middle of the girth of
// the helix. Figure out if the current point is inside that
// The rotated point represents the middle of the girth of
// the helix. Figure out if the current point is inside that
@@
-180,9
+190,12
@@
class HelixPattern extends SCPattern {
// axis. Until everything animates in the model reference
// frame, this has to be calculated at every step because
// the helices rotate.
// axis. Until everything animates in the model reference
// frame, this has to be calculated at every step because
// the helices rotate.
- float t = h1.getAxis().getTValue(pt) + spokePhase;
+ Line axis = h1.getAxis();
+ float t = axis.getTValue(pt) + spokePhase;
float spokeAxisTValue = floor(((t + spokePeriod/2) / spokePeriod)) * spokePeriod;
float spokeAxisTValue = floor(((t + spokePeriod/2) / spokePeriod)) * spokePeriod;
- PVector h1point = h1.pointOnToroidalAxis(spokeAxisTValue);
+ PVector h1point = axis.getPointAt(t);
+ h1point.add(h1.getPhaseNormal());
+ h1point = axis.rotatePoint(h1point, (t / helixCoilPeriod) * TWO_PI + h1.getPhase());
// TODO(shaheen) investigate why h1.getAxis().getPointAt(spokeAxisTValue) doesn't quite
// have the same value as finding the middle between h1point and h2point.
PVector spokeCenter = h1.getAxis().getPointAt(spokeAxisTValue);
// TODO(shaheen) investigate why h1.getAxis().getPointAt(spokeAxisTValue) doesn't quite
// have the same value as finding the middle between h1point and h2point.
PVector spokeCenter = h1.getAxis().getPointAt(spokeAxisTValue);