# Distance_to_line without treating the line as infinite I am measuring the distance between points (the center of the circles) and lines (marked in blue) using Point3d#distance_to_line.

Since this method treats lines as infinite, both cases give the same result (zero). However this isn’t valid for my use-case; I need a way to distinguish the first case from the second.

I understand that it looks like I can check if the point touches the line via traversal (e.g. `vertex.edges`) but in reality the point is very slightly offset from the line so they are not actually touching.

So, I am asking here if anyone knows a way to check “distance_to_line” but without treating the line as infinite.

I can think of a workaround, which is to resample the line (basically, construct a bunch of points along it) and then test the distance between each of those points with the circled point. I’m pretty sure that would work, but I’m curious if there’s an easier way.

Thank you!

The point in the circle has a vector to the blue edge’s start and end vertices’ points.
If those two vectors are in the same direction then the point in the circle is not on the blue edge [although it might be on the blue edge’s line…]
But if the two vectors are parallel but in opposite directions then the point in the circle is on the blue edge…

You could project the point to the line of the edge you are checking, and then check if that point is between the vertices of the edge:

https://bitbucket.org/thomthom/tt-library-2/src/b44b8a298946d7aee04bccdf671c2bdf02053789/TT_Lib2/point3d.rb#lines-28:38