From: Shaheen Gandhi Date: Mon, 19 Aug 2013 01:03:12 +0000 (-0700) Subject: [Helix][perf] Do not process points outside of the coil area X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2a7c5e4d2e998420a6417156e428e45ce14b2462;p=SugarCubes.git [Helix][perf] Do not process points outside of the coil area --- 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