def intersect_face(bmf): pts = [Point_to_Point2D(bmv.co) for bmv in bmf.verts] pts = [pt for pt in pts if pt] pt0 = pts[0] for pt1, pt2 in zip(pts[1:-1], pts[2:]): if intersect_point_tri(v2d, pt0, pt1, pt2): return True return False
def compute_point_tri_dist(p, plane_origin, plane_a, plane_b, norm, tolerance): dist = distance_point_to_plane(p, plane_origin, norm) closest = p - norm * dist side = dist > 0 dist_abs = abs(dist) is_in_plane = dist_abs < tolerance closest_in_plane = intersect_point_tri(closest, plane_origin , plane_a, plane_b) is_in_segment = is_in_plane and closest_in_plane return dist_abs, is_in_segment, is_in_plane, list(closest), bool(closest_in_plane), side