Computational Geometry 20121023 Computational Geometry A branch of
Computational Geometry 2012/10/23
Computational Geometry • A branch of computer science that studies algorithms for solving geometric problems • Applications: computer graphics, robotics, VLSI design, computer aided design, and statistics.
Intersection Point of Two Lines The equations of the lines are Pa = P 1 + ua ( P 2 - P 1 ) //P 1: starting point; (P 2 -P 1): vector along line a Pb = P 3 + ub ( P 4 - P 3 ) //P 3: starting point; (P 4 -P 3): vector along line b Pa : A point on line a Pb: A point on line b
Intersection Point of Two Lines • Solving for the point where Pa = Pb gives the following two equations in two unknowns (ua and ub) Øx 1 + ua (x 2 - x 1) = x 3 + ub (x 4 - x 3) Øy 1 + ua (y 2 - y 1) = y 3 + ub (y 4 - y 3)
Solving ua and ub
Intersection Point of Two Lines • Substituting either ua or ub into the corresponding equation for the line gives the intersection point. Øx = x 1 + ua (x 2 - x 1) Øy = y 1 + ua (y 2 - y 1)
Intersection Point of Two Lines • The denominators for the equations for ua and ub are the same. • If the denominator for the equations for ua and ub is 0 then the two lines are parallel. • If the denominator and numerator for the equations for ua and ub are 0 then the two lines are coincident.
Intersection Point of Two Lines • The equations apply to lines, if the intersection of line segments is required then it is only necessary to test if ua and ub lie between 0 and 1. • Whichever one lies within that range then the corresponding line segment contains the intersection point. If both lie within the range of 0 to 1 then the intersection point is within both line segments.
Cross Product • The cross product p 1 × p 2 can be interpreted as the signed area of the parallelogram formed by the points (0, 0), p 1, p 2, and p 1 + p 2 = (x 1 + x 2, y 1 + y 2).
Cross Product • The cross product p 1 × p 2 can be interpreted as the signed area of the parallelogram formed by the points (0, 0), p 1, p 2, and p 1 + p 2 = (x 1 + x 2, y 1 + y 2). • An equivalent definition gives the cross product as the determinant of a matrix:
Cross Product • Actually, the cross product is a threedimensional concept. It is a vector that is perpendicular to both p 1 and p 2 according to the “right-hand rule” and whose magnitude is |x 1 y 2 – x 2 y 1|. • Below, we will just treat the cross product simply as the value of x 1 y 2 – x 2 y 1.
Q&A
- Slides: 15