Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

No Downloads

Total views

17,710

On SlideShare

0

From Embeds

0

Number of Embeds

5

Shares

0

Downloads

17

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Closest Point on line segment to point<br />
- 2. Let AB be a line segment specified by the endpoints A and B. Given an arbitrary<br />point C, the problem is to determine the point D on AB closest to C. As shown in<br />Figure 5.2, projecting C onto the extended line through AB provides the solution. If<br />the projection point P lies within the segment, P itself is the correct answer. <br />
- 3. Any point on the line through AB can be expressed parametrically as P(t) = A + t (B − A). Using the projective properties of the dot product, the t corresponding to the projection of C onto the line is given by t = (C − A) · n/ _B − A_, where n = (B − A)/ _B − A_ is a unit vector in the direction of AB.<br />
- 4. Because the closest point on the line segment is required, t must be clamped to the interval 0 ≤ t ≤ 1, after which D can be obtained by substituting t into the parametric equation. <br />
- 5. Closest points on two lines<br />
- 6. We know that lines in 2D always intersect unless they are parallel. 3D is otherwise. They almost never intersect. It may seem that they do but due to rounding errors they just get really close but never intersect.<br />
- 7. The closest points of two lines can be determined as follows:<br />Let the lines L1 and L2 be specified parametrically by the points P1 and Q1 and P2 and Q2:<br />L1(s) = P1 + sd1, d1 = Q1 − P1<br />L2(t) = P2 + td2, d2 = Q2 − P2<br />
- 8. For some pair of values for s and t, L1(s) and L2(t) correspond to the closest points on the lines, and v(s, t) = L1(s)−L2(t) describes a vector between them.<br />
- 9. The points are at their closest when v is of minimum length. The key realization is that this happens when v is perpendicular to both L1 and L2. To see this, consider that the shortest distance between a point P and a line L is the length of a straight line between P and the point Q corresponding to the orthogonal projection of P onto L.<br />Consequently, the line PQ is orthogonal to L. Because this reasoning holds for both L1(s) with respect to L2 and L2(t) with respect to L1, v must be perpendicular to both lines. For nonparallel lines, v is unique.<br />
- 10. The problem is now finding values for s and t satisfying these two perpendicularity<br />constraints:<br /> <br />d1 · v(s, t) = 0<br />d2 · v(s, t) = 0.<br /> <br />Substituting the parametric equation for v(s, t) gives:<br /> <br />d1 · (L1(s) − L2(t)) = d1 · ((P1 − P2) + sd1 − td2) = 0<br />d2 · (L1(s) − L2(t)) = d2 · ((P1 − P2) + sd1 − td2) = 0.<br /> <br />This can be expressed as the 2 × 2 system of linear equations<br /> <br />(d1 · d1)s − (d1 · d2)t = −(d1 · r)<br />(d2 · d1)s − (d2 · d2)t = −(d2 · r),<br /> <br />where r = P1 − P2.<br />
- 11. Written symbolically, in matrix notation, this corresponds to:<br />
- 12. SOURCES:<br />Real Time Collision Detection by Morgan Kaufmann (book)<br />http://pastie.org/1066490<br />

No public clipboards found for this slide

Be the first to comment