From: Shaheen Gandhi Date: Mon, 19 Aug 2013 03:50:27 +0000 (-0700) Subject: [Helix][perf] Reduce number of point calculations. X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=b8f61125ba62e4d775afff07ce1cf6ca2b6dd394 [Helix][perf] Reduce number of point calculations. --- diff --git a/ShaheenGandhi.pde b/ShaheenGandhi.pde index dcdb908..d562e3b 100644 --- a/ShaheenGandhi.pde +++ b/ShaheenGandhi.pde @@ -117,11 +117,12 @@ class HelixPattern extends SCPattern { } color colorOfPoint(final PVector p) { - float t = axis.getTValue(p); + final float t = axis.getTValue(p); + final PVector axisPoint = axis.getPointAt(t); // 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) { + if (abs(PVector.dist(p, axisPoint) - radius) > girth*.5f) { return color(0,0,0); }