# Determining if a point is perpendicular to a line

I am trying to walk a line that is intersecting a mesh, and given the point on the line I need to see what vertices may be perpendicular to it. My initial idea was to attempt a dot product between the line's direction vector and the direction vector from the point on the line to the mesh's vertex, and then only accept values that were near 0. This resulted in a collection of vertices behind the point on my line. Playing with the threshold values for the dot product check do not seem to help either. Any ideas?

## Code

//actual_pos = position of the vertex
//trav_in_soace = point along the line
//m_fireDir = normalized direction vector of the line

Vector3 dir_to_point = actual_pos - trav_in_space;
dir_to_point.Normalize();

float dot_accept = DotProduct(m_fireDir, dir_to_point);
if (dot_accept > max_threshold || dot_accept < min_threshold)
continue;


## Picture with threshold values near 0.5

This is best result I can get and it is still really inaccurate. The orange verts are the points on the purple line, the red and blue are what should be the desired vertices. • How can a point be perpendicular to anything? Jan 11, 2018 at 4:13
• Think of it as the line between the point on the line and vertex as what is perpendicular. Jan 11, 2018 at 4:27
• Wouldn't it be simpler to just calculate the normal vector to the plane that passes through the given point, then use that to determine a point on the plane... then find the nearest vertex (lattice point, I assume) to that? Jan 11, 2018 at 4:58
• You can measure the distance between a point and a plane
– Jay
Jan 11, 2018 at 6:46
• I don't understand the question. "Think of it as the line between the point on the line and vertex as what is perpendicular." For any line and any point, there is such point on the line that the original line and the line between two points are perpendicular. Jan 11, 2018 at 16:21