summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorNicolas Schodet2012-05-04 21:59:56 +0200
committerNicolas Schodet2012-05-04 22:01:21 +0200
commit4c2c509aad3740528df96248c9d14289770da1be (patch)
tree71a1ab7c5fc39a56ad74333caf8960269ddeba3e /host
parent188009a106c14de0e35f10c7cc05a015764e0e31 (diff)
host/simu/utils/intersect: fix sign of expression
This does not change anything because sign is inverted on numerator and denominator.
Diffstat (limited to 'host')
-rw-r--r--host/simu/utils/intersect.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/host/simu/utils/intersect.py b/host/simu/utils/intersect.py
index 6074dda0..35ac38af 100644
--- a/host/simu/utils/intersect.py
+++ b/host/simu/utils/intersect.py
@@ -50,24 +50,24 @@ def segment_segment (a, b, c, d):
# v = -----------------------------------------
# (xb - xa) (yd - yc) - (xd - xc) (yb - ya)
#
- # u = (vac . vcd.normal()) / (vab . vcd.normal())
- # v = (vac . vab.normal()) / (vab . vcd.normal())
+ # u = (vac.normal() . vcd) / (vab.normal() . vcd)
+ # v = (vac.normal() . vab) / (vab.normal() . vcd)
#
- # If vab . vcd.normal () is 0, AB and CD are parallel.
+ # If vab.normal() . vcd is 0, AB and CD are parallel.
vab = b - a
vcd = d - c
vac = c - a
# Cannot test for 0 because we are using float, cannot test for a very
# small number because we do not know what is small enough, therefore,
# compare with numerator.
- den = vab * vcd.normal ()
- unum = vac * vcd.normal ()
+ den = vab.normal () * vcd
+ unum = vac.normal () * vcd
if abs (den) <= 1e-6 * abs (unum):
return None
else:
u = unum / den
if u >= 0 and u <= 1:
- v = vac * vab.normal () / den
+ v = vac.normal () * vab / den
if v >= 0 and v <= 1:
return u * vab.norm ()
return None