diff options
author | David Runge <dave@sleepmap.de> | 2016-01-07 00:58:14 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-01-07 00:58:14 +0100 |
commit | 32ab627da8c461907855759e0076ae33f59183fa (patch) | |
tree | c6691d45d13e1e410a11382c8c4965eb57e9a5bc /AutoVisual | |
parent | beeb1d100a462d5825913f46c8560dec87e4b708 (diff) | |
download | processing-sketchbook-32ab627da8c461907855759e0076ae33f59183fa.tar.gz processing-sketchbook-32ab627da8c461907855759e0076ae33f59183fa.tar.bz2 processing-sketchbook-32ab627da8c461907855759e0076ae33f59183fa.tar.xz processing-sketchbook-32ab627da8c461907855759e0076ae33f59183fa.zip |
AutoVisual/IGPFamily.pde: Retabbing.
Diffstat (limited to 'AutoVisual')
-rw-r--r-- | AutoVisual/IGPFamily.pde | 24 |
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); |