pyransac3d.aux_functions¶
get_rotationMatrix_from_vectors¶
def get_rotationMatrix_from_vectors(u: ArrayLike,
v: ArrayLike) -> NDArray[np.float64]
Create a rotation matrix that rotates the space from a 3D vector u to a 3D vector v
Arguments:
u: Orign vectornp.array (1,3).v: Destiny vectornp.array (1,3).
Returns:
Rotation matrix np.array (3, 3)¶
convex_hull_2d¶
def convex_hull_2d(points: ArrayLike) -> NDArray[np.float64]
Find the convex hull of a set of 2D points using Andrew's monotone chain algorithm.
Arguments:
points: Set of 2D pointsnp.array (N,2).
Returns:
Hull vertices in counter-clockwise order as a closed polygon, which means the
first vertex is repeated at the end np.array (M+1, 2)
min_bounding_rect¶
def min_bounding_rect(
hull_points: ArrayLike
) -> tuple[np.float64, np.float64, np.float64, np.float64, NDArray[np.float64],
NDArray[np.float64]]
Find the minimum-area rectangle which encloses a 2D convex hull.
The rectangle is aligned with one of the hull edges, so we only have to test the orientation of each edge and keep the one which gives the smallest area.
Arguments:
hull_points: Convex hull as a closed polygonnp.array (N,2), as returned byconvex_hull_2d(.).
Returns:
angle: Rotation of the rectangle in radians, inside the first quadrantfloatarea: Area of the rectanglefloatwidth: Size of the rectangle along its first axisfloatheight: Size of the rectangle along its second axisfloatcenter: Center of the rectanglenp.array (2,)corners: Corners of the rectanglenp.array (4, 2)
rodrigues_rot¶
def rodrigues_rot(P: ArrayLike, n0: ArrayLike,
n1: ArrayLike) -> NDArray[np.float64]
Rotate a set of point between two normal vectors using Rodrigues' formula.
Arguments:
P: Set of pointsnp.array (N,3).n0: Orign vectornp.array (1,3).n1: Destiny vectornp.array (1,3).
Returns: