- float t = h1.getAxis().getTValue(pt) + spokePhase;
- float spokeAxisTValue = floor(((t + spokePeriod/2) / spokePeriod)) * spokePeriod;
- PVector h1point = h1.pointOnToroidalAxis(spokeAxisTValue);
- PVector h2point = h2.pointOnToroidalAxis(spokeAxisTValue);
- PVector spokeVector = PVector.sub(h2point, h1point);
- spokeVector.normalize();
- Line spokeLine = new Line(h1point, spokeVector);
- float spokeLength = PVector.dist(h1point, h2point);
- // TODO(shaheen) investigate why h1.getAxis().getPointAt(spokeAxisTValue) doesn't quite
- // have the same value.
- PVector spokeCenter = PVector.add(h1point, PVector.mult(spokeVector, spokeLength/2.f));
+ Line axis = h1.getAxis();
+ float t = axis.getTValue(pt) + spokePhase;
+ int spokeIndex = (int)floor((t - tMin + spokePeriod/2) / spokePeriod);
+ if (spokeIndex < 0 || spokeIndex >= basePairs.length) {
+ return lx.hsb(0,0,0);
+ }
+ BasePairInfo basePair = basePairs[spokeIndex];
+ Line spokeLine = basePair.line;