For this question, we usually think about a formula learned in junior high school:
but there are some issues where we find it difficult to define the values of A, B, and C, therefore we have a more convenient formula as follows:
float length = dot(ab, ap) / dot(ab, ab) // caculate distance p point to ab line
which can generate the projected length of ap
line on ab
line. This is the projection scale factor. Then multiply ap
vector by this length to obtain an ad
vector, a line segment on ap
. At last, we use lenght()
function to compute the distance of pd
line segment that is the distance p point to the ab straight line.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)