Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies...

15
Computational Geometry 2012/10/23

description

Intersection Point of Two Lines The equations of the lines are P a = P1 + u a ( P2 - P1 ) //P1: starting point; (P2-P1):vector along line a P b = P3 + u b ( P4 - P3 ) //P3: starting point; (P4-P3):vector along line b P a : A point on line a P b : A point on line b

Transcript of Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies...

Page 1: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

Computational Geometry

2012/10/23

Page 2: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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.

Page 3: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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

Page 4: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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)

Page 5: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

Solving ua and ub

Page 6: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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)

Page 7: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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.

Page 8: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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.

Page 9: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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).

Page 10: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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:

Page 11: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

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.

Page 12: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:
Page 13: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:
Page 14: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:
Page 15: Computational Geometry 2012/10/23. Computational Geometry A branch of computer science that studies algorithms for solving geometric problems Applications:

Q&A