Mercurial > hg > orthanc-stone
view Resources/Computations/IntersectSegmentAndHorizontalLine.py @ 1370:28eb7106ef44 broker
Changes to GuiAdapter to allow it to work correctly with both new and old
Emscripten event selection rules that are defined by the DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR linker flag.
Doc has been added to GuiAdapter.cpp, should you require more info on
what has been done.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 20 Apr 2020 13:08:43 +0200 |
parents | 35c2b85836ce |
children |
line wrap: on
line source
#!/usr/bin/env python from sympy import * # Intersection between the 2D line segment (prevX,prevY)-(curX,curY) and the # horizontal line "y = y0" using homogeneous coordinates prevX, prevY, curX, curY, y0 = symbols('prevX prevY curX curY y0') p1 = Matrix([prevX, prevY, 1]) p2 = Matrix([curX, curY, 1]) l1 = p1.cross(p2) h1 = Matrix([0, y0, 1]) h2 = Matrix([1, y0, 1]) l2 = h1.cross(h2) a = l1.cross(l2) #pprint(cse(a/a[2], symbols = symbols('a b'))) pprint(a / a[2])