summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AutoVisual/IGPFamily.pde14
1 files changed, 12 insertions, 2 deletions
diff --git a/AutoVisual/IGPFamily.pde b/AutoVisual/IGPFamily.pde
index 78e3f2f..7b97c6f 100644
--- a/AutoVisual/IGPFamily.pde
+++ b/AutoVisual/IGPFamily.pde
@@ -241,10 +241,20 @@ class IGPFamily {
PVector getVectorOnExtendedLine(PVector startPoint, PVector endPoint, float boundary, boolean vertical){
float m,n;
- m = (endPoint.y-startPoint.y)/(endPoint.x-startPoint.x);
+ boolean dirac = false;
+ if (endPoint.x-startPoint.x == 0){
+ dirac = true;
+ m = 0;
+ } else {
+ m = (endPoint.y-startPoint.y)/(endPoint.x-startPoint.x);
+ }
n = endPoint.y-m*endPoint.x;
if (vertical){
- return new PVector((boundary-n)/m, boundary);
+ if (dirac){
+ return new PVector(startPoint.x, boundary);
+ }else{
+ return new PVector((boundary-n)/m, boundary);
+ }
} else {
return new PVector(boundary, (m*boundary)+n);
}