summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AutoVisual/IGPFamily.pde24
1 files changed, 12 insertions, 12 deletions
diff --git a/AutoVisual/IGPFamily.pde b/AutoVisual/IGPFamily.pde
index 737f57c..bf94717 100644
--- a/AutoVisual/IGPFamily.pde
+++ b/AutoVisual/IGPFamily.pde
@@ -214,23 +214,23 @@ class IGPFamily {
translate(mid.x*(-1), mid.y*(-1));
}
- PVector getLineIntersection(PVector p1, PVector p2, PVector p3, PVector p4) {
- PVector b = PVector.sub(p2, p1);
- PVector d = PVector.sub(p4, p3);
+ PVector getLineIntersection(PVector p1, PVector p2, PVector p3, PVector p4) {
+ PVector b = PVector.sub(p2, p1);
+ PVector d = PVector.sub(p4, p3);
- float b_dot_d_perp = b.x * d.y - b.y * d.x;
- if (b_dot_d_perp == 0) {
+ float b_dot_d_perp = b.x * d.y - b.y * d.x;
+ if (b_dot_d_perp == 0) {
return null;
}
- PVector c = PVector.sub(p3, p1);
- float t = (c.x * d.y - c.y * d.x) / b_dot_d_perp;
- if (t < 0 || t > 1) { return null; }
- float u = (c.x * b.y - c.y * b.x) / b_dot_d_perp;
- if (u < 0 || u > 1) { return null; }
+ PVector c = PVector.sub(p3, p1);
+ float t = (c.x * d.y - c.y * d.x) / b_dot_d_perp;
+ if (t < 0 || t > 1) { return null; }
+ float u = (c.x * b.y - c.y * b.x) / b_dot_d_perp;
+ if (u < 0 || u > 1) { return null; }
- return new PVector(p1.x+t*b.x, p1.y+t*b.y);
- }
+ return new PVector(p1.x+t*b.x, p1.y+t*b.y);
+ }
float getAngleBetweenTwoVectors (PVector p1, PVector p2) {
float angle = atan2(p1.y-p2.y, p1.x-p2.x);