From 2a7c5e4d2e998420a6417156e428e45ce14b2462 Mon Sep 17 00:00:00 2001 From: Shaheen Gandhi Date: Sun, 18 Aug 2013 18:03:12 -0700 Subject: [PATCH] [Helix][perf] Do not process points outside of the coil area --- ShaheenGandhi.pde | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ShaheenGandhi.pde b/ShaheenGandhi.pde index 5e2c88c..ff6ce2e 100644 --- a/ShaheenGandhi.pde +++ b/ShaheenGandhi.pde @@ -106,9 +106,16 @@ class HelixPattern extends SCPattern { } 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. - float t = axis.getTValue(p); PVector toroidPoint = pointOnToroidalAxis(t); // The rotated point represents the middle of the girth of -- 2.34.1