From b8f61125ba62e4d775afff07ce1cf6ca2b6dd394 Mon Sep 17 00:00:00 2001 From: Shaheen Gandhi Date: Sun, 18 Aug 2013 20:50:27 -0700 Subject: [PATCH] [Helix][perf] Reduce number of point calculations. --- ShaheenGandhi.pde | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } -- 2.34.1