- float d = MAX_FLOAT;
- for (Plane plane : planes) {
- d = min(d, abs(plane.av*(p.fx-model.xMax/2.) + plane.bv*(p.fy-model.yMax/2.) + plane.cv) / plane.denom);
- }
- colors[p.index] = color(
- (lx.getBaseHuef() + abs(p.fx-model.xMax/2.)*.3 + p.fy*.8) % 360,
- max(0, 100 - .8*abs(p.fx - model.xMax/2.)),
- constrain(140 - 10.*d, 0, 100)
- );
+ float d = MAX_FLOAT;
+ for (Plane plane : planes) {
+ if (plane.denom != 0) {
+ d = min(d, abs(plane.av*(p.fx-model.cx) + plane.bv*(p.fy-model.cy) + plane.cv) / plane.denom);
+ }
+ }
+ colors[p.index] = color(
+ (huev + abs(p.fx-model.cx)*.3 + p.fy*.8) % 360,
+ max(0, 100 - .8*abs(p.fx - model.cx)),
+ constrain(140 - 10.*d, 0, 100)
+ );