수학/기하학

(게임수학) 점과 직선 사이 거리 계산 공식

행복햐 2017. 8. 18. 13:34

두점을 지나는 직선과 한 점 사이의 거리(길이) 계산 공식

 

점1 (x1, y1), (x2, y2), (x0, y0)

$$거리 ={|(y2-y1)x0-(x2-x1)x0+x2y1-y2x1| \over \sqrt{( x2-x1 )^2 + ( y2-y1 )^2}} $$

 

출처

 

https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line

 

http://www.ambrsoft.com/MathCalc/Line/Line_.htm