Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies...
-
Upload
alvin-harvey -
Category
Documents
-
view
228 -
download
0
description
Transcript of Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies...
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 = P1 + ua ( P2 - P1 ) //P1: starting point; (P2-P1):vector along line aPb = P3 + ub ( P4 - P3 ) //P3: starting point; (P4-P3):vector along line b
Pa : A point on line aPb: 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)
x1 + ua (x2 - x1) = x3 + ub (x4 - x3)
y1 + ua (y2 - y1) = y3 + ub (y4 - y3)
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 = x1 + ua (x2 - x1) y = y1 + ua (y2 - y1)
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 p1 × p2 can be interpreted as the signed area of the parallelogram formed by the points (0, 0), p1, p2, and p1 + p2 = (x1 + x2, y1 + y2).
Cross Product
• The cross product p1 × p2 can be interpreted as the signed area of the parallelogram formed by the points (0, 0), p1, p2, and p1 + p2 = (x1 + x2, y1 + y2).
• An equivalent definition gives the cross product as the determinant of a matrix:
Cross Product
• Actually, the cross product is a three-dimensional concept. It is a vector that is perpendicular to both p1 and p2 according to the “right-hand rule” and whose magnitude is |x1 y2 – x2 y1|.
• Below, we will just treat the cross product simply as the value of x1 y2 – x2 y1.
Q&A