def to_2d_coordinates(points, plane_normal):
    """Convert 3D points to 2D using the plane defined by its normal."""
    # Compute two perpendicular vectors on the plane
    u = np.cross(plane_normal, [1, 0, 0])
    if np.linalg.norm(u) < 1e-10:
        u = np.cross(plane_normal, [0, 1, 0])
    u /= np.linalg.norm(u)
    v = np.cross(plane_normal, u)
    v /= np.linalg.norm(v)

    # Convert 3D points to 2D using dot products
    return np.column_stack([points.dot(u), points.dot(v)])
Convert 3D points to 2D using the plane defined by its normal.
infinigen/core/constraints/evaluator/indoor_util.py