Check if the point is on a three-dimensional line?

I know how to check if a point is on the 2nd line or not, but I would like to do it in 3D. Any ideas?

// slope from point 1 to point 3 var p13:Number = (Math.atan2 (end.x - start.x, end.y - start.y)) * toDegrees; // slope from point 1 to point 2 -- matches? var p12:Number = (Math.atan2 (point.x - start.x, point.y - start.y)) * toDegrees; return Math.round(p12) == Math.round(p13); 
+4
source share
3 answers

Normalize vectors. Check for normal.

Find the largest value, divide all other values ​​by this value to get a normal vector.

Any point on the line must have the same normal vector.

+5
source

A point can never be an 'on' string in real coordinates. you need to calculate the distance to the nearest point to the line and decide if this is enough for you.

+2
source

Straight line equation

v (t) = v0 + t * dir

Where v0 is some point on the line, and dir is the direction. Just check if your point matches this linear equation with sufficient accuracy.

0
source

Source: https://habr.com/ru/post/1340345/


All Articles