SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Closest Point on line segment to point
Let AB be a line segment specified by the endpoints A and B. Given an arbitrary point C, the problem is to determine the point D on AB closest to C. As shown in Figure 5.2, projecting C onto the extended line through AB provides the solution. If the projection point P lies within the segment, P itself is the correct answer.
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.
	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.
Closest points on two lines
	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.
The closest points of two lines can be determined as follows: Let the lines L1 and L2 be specified parametrically by the points P1 and Q1 and P2 and Q2: L1(s) = P1 + sd1, d1 = Q1 − P1 L2(t) = P2 + td2, d2 = Q2 − P2
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.
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. 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.
The problem is now finding values for s and t satisfying these two perpendicularity constraints:   d1 · v(s, t) = 0 d2 · v(s, t) = 0.   Substituting the parametric equation for v(s, t) gives:   d1 · (L1(s) − L2(t)) = d1 · ((P1 − P2) + sd1 − td2) = 0 d2 · (L1(s) − L2(t)) = d2 · ((P1 − P2) + sd1 − td2) = 0.   This can be expressed as the 2 × 2 system of linear equations   (d1 · d1)s − (d1 · d2)t = −(d1 · r) (d2 · d1)s − (d2 · d2)t = −(d2 · r),   where r = P1 − P2.
Written symbolically, in matrix notation, this corresponds to:
SOURCES: Real Time Collision Detection by Morgan Kaufmann (book) http://pastie.org/1066490

Weitere ähnliche Inhalte

Was ist angesagt?

Betweeness & collinearity
Betweeness & collinearityBetweeness & collinearity
Betweeness & collinearityJoseph Nilo
 
1.2 Ruler Postulates
1.2 Ruler Postulates1.2 Ruler Postulates
1.2 Ruler PostulatesDee Black
 
3002 a more with parrallel lines and anglesupdated 10 22-13
3002 a  more with parrallel lines and anglesupdated 10 22-133002 a  more with parrallel lines and anglesupdated 10 22-13
3002 a more with parrallel lines and anglesupdated 10 22-13jbianco9910
 
Geom 1point2
Geom 1point2Geom 1point2
Geom 1point2herbison
 
Differential calculus
Differential calculusDifferential calculus
Differential calculusShubham .
 
SBTP - Activity sheet for proving law of sines and cosines DavNor Div
SBTP - Activity sheet for proving law of sines and cosines DavNor DivSBTP - Activity sheet for proving law of sines and cosines DavNor Div
SBTP - Activity sheet for proving law of sines and cosines DavNor DivDods Dodong
 
Three dimensional geometry
Three dimensional geometry Three dimensional geometry
Three dimensional geometry Seyid Kadher
 
Class 12 Maths - Vectors
Class 12 Maths - VectorsClass 12 Maths - Vectors
Class 12 Maths - VectorsEdnexa
 
Similar figures and_proportions
Similar figures and_proportionsSimilar figures and_proportions
Similar figures and_proportionskaren wagoner
 
THREE DIMENSIONAL GEOMETRY
THREE DIMENSIONAL GEOMETRYTHREE DIMENSIONAL GEOMETRY
THREE DIMENSIONAL GEOMETRYUrmila Bhardwaj
 
Math unit38 vectors
Math unit38 vectorsMath unit38 vectors
Math unit38 vectorseLearningJa
 

Was ist angesagt? (19)

COORDINATE GEOMETRY
COORDINATE GEOMETRYCOORDINATE GEOMETRY
COORDINATE GEOMETRY
 
Betweeness & collinearity
Betweeness & collinearityBetweeness & collinearity
Betweeness & collinearity
 
Geomettry
GeomettryGeomettry
Geomettry
 
1.2 Ruler Postulates
1.2 Ruler Postulates1.2 Ruler Postulates
1.2 Ruler Postulates
 
3002 a more with parrallel lines and anglesupdated 10 22-13
3002 a  more with parrallel lines and anglesupdated 10 22-133002 a  more with parrallel lines and anglesupdated 10 22-13
3002 a more with parrallel lines and anglesupdated 10 22-13
 
Linear Equation
Linear EquationLinear Equation
Linear Equation
 
Linear Equation
Linear EquationLinear Equation
Linear Equation
 
Geom 1point2
Geom 1point2Geom 1point2
Geom 1point2
 
Math14 lesson 5
Math14 lesson 5Math14 lesson 5
Math14 lesson 5
 
Differential calculus
Differential calculusDifferential calculus
Differential calculus
 
SBTP - Activity sheet for proving law of sines and cosines DavNor Div
SBTP - Activity sheet for proving law of sines and cosines DavNor DivSBTP - Activity sheet for proving law of sines and cosines DavNor Div
SBTP - Activity sheet for proving law of sines and cosines DavNor Div
 
7 2
7 27 2
7 2
 
Three dimensional geometry
Three dimensional geometry Three dimensional geometry
Three dimensional geometry
 
Class 12 Maths - Vectors
Class 12 Maths - VectorsClass 12 Maths - Vectors
Class 12 Maths - Vectors
 
H0431038048
H0431038048H0431038048
H0431038048
 
Similar figures and_proportions
Similar figures and_proportionsSimilar figures and_proportions
Similar figures and_proportions
 
Linear Equations
Linear EquationsLinear Equations
Linear Equations
 
THREE DIMENSIONAL GEOMETRY
THREE DIMENSIONAL GEOMETRYTHREE DIMENSIONAL GEOMETRY
THREE DIMENSIONAL GEOMETRY
 
Math unit38 vectors
Math unit38 vectorsMath unit38 vectors
Math unit38 vectors
 

Ähnlich wie Closest point on line segment to point

Gmat quant topic 6 co ordinate geometry solutions
Gmat quant topic 6 co ordinate geometry solutionsGmat quant topic 6 co ordinate geometry solutions
Gmat quant topic 6 co ordinate geometry solutionsRushabh Vora
 
10 parametric eequations of lines
10 parametric eequations of lines10 parametric eequations of lines
10 parametric eequations of linesmath267
 
Olimpiade matematika di kanada 2017
Olimpiade matematika di kanada 2017Olimpiade matematika di kanada 2017
Olimpiade matematika di kanada 2017radar radius
 
267 5 parametric eequations of lines
267 5 parametric eequations of lines267 5 parametric eequations of lines
267 5 parametric eequations of linesmath260
 
Three dim. geometry
Three dim. geometryThree dim. geometry
Three dim. geometryindu thakur
 
Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)Gem WeBlog
 
straight lines
straight lines straight lines
straight lines david
 
Chapter 12 vectors and the geometry of space merged
Chapter 12 vectors and the geometry of space mergedChapter 12 vectors and the geometry of space merged
Chapter 12 vectors and the geometry of space mergedEasyStudy3
 
IITJEE - 2009 ii - mathematics
IITJEE - 2009    ii - mathematicsIITJEE - 2009    ii - mathematics
IITJEE - 2009 ii - mathematicsVasista Vinuthan
 
7.5 lines and_planes_in_space
7.5 lines and_planes_in_space7.5 lines and_planes_in_space
7.5 lines and_planes_in_spaceMahbub Alwathoni
 
Through the Eyes of Menaechmus
Through the Eyes of MenaechmusThrough the Eyes of Menaechmus
Through the Eyes of MenaechmusAfshin Tiraie
 
Approximating offset curves using B ´ ezier curves with high accuracy
Approximating offset curves using B ´ ezier curves with high accuracyApproximating offset curves using B ´ ezier curves with high accuracy
Approximating offset curves using B ´ ezier curves with high accuracyIJECEIAES
 

Ähnlich wie Closest point on line segment to point (20)

2. la recta
2. la recta2. la recta
2. la recta
 
Gmat quant topic 6 co ordinate geometry solutions
Gmat quant topic 6 co ordinate geometry solutionsGmat quant topic 6 co ordinate geometry solutions
Gmat quant topic 6 co ordinate geometry solutions
 
Solution prob 2 i ph o 30
Solution prob 2 i ph o 30Solution prob 2 i ph o 30
Solution prob 2 i ph o 30
 
10 parametric eequations of lines
10 parametric eequations of lines10 parametric eequations of lines
10 parametric eequations of lines
 
Olimpiade matematika di kanada 2017
Olimpiade matematika di kanada 2017Olimpiade matematika di kanada 2017
Olimpiade matematika di kanada 2017
 
Topic 2
Topic 2Topic 2
Topic 2
 
267 5 parametric eequations of lines
267 5 parametric eequations of lines267 5 parametric eequations of lines
267 5 parametric eequations of lines
 
Three dim. geometry
Three dim. geometryThree dim. geometry
Three dim. geometry
 
Vector differential Calculus
Vector differential CalculusVector differential Calculus
Vector differential Calculus
 
3-6 Perpendiculars and Distance.pdf
3-6 Perpendiculars and Distance.pdf3-6 Perpendiculars and Distance.pdf
3-6 Perpendiculars and Distance.pdf
 
Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)
 
Ac1.3gPracticeProblems
Ac1.3gPracticeProblemsAc1.3gPracticeProblems
Ac1.3gPracticeProblems
 
straight lines
straight lines straight lines
straight lines
 
Coordinate geometry
Coordinate geometryCoordinate geometry
Coordinate geometry
 
Chapter 12 vectors and the geometry of space merged
Chapter 12 vectors and the geometry of space mergedChapter 12 vectors and the geometry of space merged
Chapter 12 vectors and the geometry of space merged
 
IITJEE - 2009 ii - mathematics
IITJEE - 2009    ii - mathematicsIITJEE - 2009    ii - mathematics
IITJEE - 2009 ii - mathematics
 
7.5 lines and_planes_in_space
7.5 lines and_planes_in_space7.5 lines and_planes_in_space
7.5 lines and_planes_in_space
 
Through the Eyes of Menaechmus
Through the Eyes of MenaechmusThrough the Eyes of Menaechmus
Through the Eyes of Menaechmus
 
Approximating offset curves using B ´ ezier curves with high accuracy
Approximating offset curves using B ´ ezier curves with high accuracyApproximating offset curves using B ´ ezier curves with high accuracy
Approximating offset curves using B ´ ezier curves with high accuracy
 
Sol50
Sol50Sol50
Sol50
 

Closest point on line segment to point

  • 1. Closest Point on line segment to point
  • 2. Let AB be a line segment specified by the endpoints A and B. Given an arbitrary point C, the problem is to determine the point D on AB closest to C. As shown in Figure 5.2, projecting C onto the extended line through AB provides the solution. If the projection point P lies within the segment, P itself is the correct answer.
  • 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.
  • 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.
  • 5. Closest points on two lines
  • 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.
  • 7. The closest points of two lines can be determined as follows: Let the lines L1 and L2 be specified parametrically by the points P1 and Q1 and P2 and Q2: L1(s) = P1 + sd1, d1 = Q1 − P1 L2(t) = P2 + td2, d2 = Q2 − P2
  • 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.
  • 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. 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.
  • 10. The problem is now finding values for s and t satisfying these two perpendicularity constraints:   d1 · v(s, t) = 0 d2 · v(s, t) = 0.   Substituting the parametric equation for v(s, t) gives:   d1 · (L1(s) − L2(t)) = d1 · ((P1 − P2) + sd1 − td2) = 0 d2 · (L1(s) − L2(t)) = d2 · ((P1 − P2) + sd1 − td2) = 0.   This can be expressed as the 2 × 2 system of linear equations   (d1 · d1)s − (d1 · d2)t = −(d1 · r) (d2 · d1)s − (d2 · d2)t = −(d2 · r),   where r = P1 − P2.
  • 11. Written symbolically, in matrix notation, this corresponds to:
  • 12. SOURCES: Real Time Collision Detection by Morgan Kaufmann (book) http://pastie.org/1066490