repositories
/
SugarCubes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Helix][perf] Do not process points outside of the coil area
[SugarCubes.git]
/
ShaheenGandhi.pde
diff --git
a/ShaheenGandhi.pde
b/ShaheenGandhi.pde
index 5e2c88cd1c3bdfeac7a3822ae85bb226335b94f6..ff6ce2edcf82d4ce840eb105eaff462a5bda97a2 100644
(file)
--- a/
ShaheenGandhi.pde
+++ b/
ShaheenGandhi.pde
@@
-106,9
+106,16
@@
class HelixPattern extends SCPattern {
}
color colorOfPoint(final PVector p) {
}
color colorOfPoint(final PVector p) {
+ float t = axis.getTValue(p);
+
+ // For performance reasons, cut out points that are outside of
+ // the tube where the toroidal coil lives.
+ if (abs(PVector.dist(p, axis.getPointAt(t)) - radius) > girth*.5f) {
+ return color(0,0,0);
+ }
+
// Find the appropriate point for the current rotation
// of the helix.
// Find the appropriate point for the current rotation
// of the helix.
- float t = axis.getTValue(p);
PVector toroidPoint = pointOnToroidalAxis(t);
// The rotated point represents the middle of the girth of
PVector toroidPoint = pointOnToroidalAxis(t);
// The rotated point represents the middle of the girth of