repositories
/
SugarCubes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7992264
)
[Helix][perf] Reduce toroidal coil point calculations for spokes by half
author
Shaheen Gandhi
<shaheen@fb.com>
Mon, 19 Aug 2013 03:22:06 +0000
(20:22 -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 09f513f383d484f9379806685f017c7d725d691a..b757f407d7f51844db950b4c423e2fb416001ef1 100644
(file)
--- a/
ShaheenGandhi.pde
+++ b/
ShaheenGandhi.pde
@@
-180,14
+180,12
@@
class HelixPattern extends SCPattern {
float t = h1.getAxis().getTValue(pt) + spokePhase;
float spokeAxisTValue = floor(((t + spokePeriod/2) / spokePeriod)) * spokePeriod;
PVector h1point = h1.pointOnToroidalAxis(spokeAxisTValue);
float t = h1.getAxis().getTValue(pt) + spokePhase;
float spokeAxisTValue = floor(((t + spokePeriod/2) / spokePeriod)) * spokePeriod;
PVector h1point = h1.pointOnToroidalAxis(spokeAxisTValue);
- PVector h2point = h2.pointOnToroidalAxis(spokeAxisTValue);
- PVector spokeVector = PVector.sub(h2point, h1point);
+ // 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);
+ PVector spokeVector = PVector.sub(h1point, spokeCenter);
spokeVector.normalize();
Line spokeLine = new Line(h1point, spokeVector);
spokeVector.normalize();
Line spokeLine = new Line(h1point, spokeVector);
- float spokeLength = PVector.dist(h1point, h2point);
- // TODO(shaheen) investigate why h1.getAxis().getPointAt(spokeAxisTValue) doesn't quite
- // have the same value.
- PVector spokeCenter = PVector.add(h1point, PVector.mult(spokeVector, spokeLength/2.f));
PVector pointOnSpoke = spokeLine.projectPoint(pt);
float b = ((PVector.dist(pt, pointOnSpoke) < spokeGirth) && (PVector.dist(pointOnSpoke, spokeCenter) < spokeRadius)) ? 100.f : 0.f;
return color(100, 80.f, b);
PVector pointOnSpoke = spokeLine.projectPoint(pt);
float b = ((PVector.dist(pt, pointOnSpoke) < spokeGirth) && (PVector.dist(pointOnSpoke, spokeCenter) < spokeRadius)) ? 100.f : 0.f;
return color(100, 80.f, b);