Calculating perpendicular coordinates

Hello. I need to find a vertex at a certain distance from V2 (for example 1) and on a line that is perpendicular to V1-V2 and to the face normal N. I know the coordinates of V1, V2 and the normal vector. How do I find that coordinate?

Thank you very much!

P.S. I need it for python script (of course!) :smiley:


Off the top of my head, you can use the line from v2->v1 and the normal to generate the perpendicular vector. If you then normalize that vector and scale it by the length of v2->v1 then that gives you a point that is on the plane defined by the normal N + v2.

I don’t have time to think it all the way though but I suspect that you need to add some testing to ensure that you picked the point that is in the correct direction from v2 along the perpendicular. Also, there are no guarantees that this will generate a point that is contained in the face that you supplied. Note the image below, if you choose v1 and v2 listed below, the perpendicular point cannot fall within the face.

import bpy
from mathutils import Vector

def getVert(v1, v2, normal):
    v2v1 = v2 - v1
    perp = normal.cross(v2v1)
    perp = perp *v2v1.magnitude
    return perp + v2

if __name__ == "__main__":
    print(getVert(Vector((0, 0, 0)), Vector((1, 0, 0)), Vector((0, 0, 1))))

Thank you for the answer! No matter if the point is not in the face. I try it now! You told me functions that I didn’t know.