# How to add a vertex to the plane of a triangle without changing this plane?

The "clean up" -> "make planar faces" function transforms the plane. I like to add a vertex to a given triangle where the plane keeps uneffected. Manually one would just calculate the normal on the plane through the specific vertex and than move the vertex along the normal as long as it is within the given plane.

Is there any way to do this with build-in functions or with a plugin?

Mathutils.geometry

There are two methods in mathutils.geometry. distance_point_to_plane returns the distance from the plane. The plane is defined by a point on the plane and its normal. intersect_point_tri takes 4 arguments, the point and the three points that define the triangle. If outside the triangle it returns None.

import bpy
from mathutils import Vector
from mathutils.geometry import (
intersect_point_tri,
distance_point_to_plane)

# define a plane by three points
# z=0 xy plane for simplicity
pt1 = Vector((0, 0, 0))
pt2 = Vector((1, 1, 0))
pt3 = Vector((1, -1, 0))
# define the plane
plane_co = pt1
plane_no = (pt3 - pt1).cross(pt2 - pt1).normalized()

pt = Vector((.4, .4, .4))
# find distance to plane
d = distance_point_to_plane(pt, plane_co, plane_no)
print("move", pt, d, "units to", pt + d * plane_no)
p = intersect_point_tri(pt, pt1, pt2, pt3)
if p:
print("point on triangle", p)
else:
print("point outside triangle")

Not sure if you were after a scripting answer.