ct.solver

Functions for solving problems related to camera calibration and 3D geometry.

ct.solver.line_intersection_3d(src_points, dst_points)[source]

Estimate 3D intersection of lines with least squares.

Parameters:
  • src_points (Float[ndarray, 'n 3']) – (N, 3) matrix containing starting point of N lines

  • dst_points (Float[ndarray, 'n 3']) – (N, 3) matrix containing end point of N lines

Returns:

Estimated intersection point.

Return type:

Float[ndarray, ‘3’]

Ref:

https://math.stackexchange.com/a/1762491/209055

ct.solver.closest_points_of_line_pair(src_o, src_d, dst_o, dst_d)[source]

Find the closest points of two lines. The distance between the closest points is the shortest distance between the two lines. Used the batched version closest_points_of_line_pairs() when possible.

Parameters:
  • src_o (Float[ndarray, '3']) – (3,), origin of the src line

  • src_d (Float[ndarray, '3']) – (3,), direction of the src line

  • dst_o (Float[ndarray, '3']) – (3,), origin of the dst line

  • dst_d (Float[ndarray, '3']) – (3,), direction of the dst line

Returns:

  • src_p: (3,), closest point of the src line

  • dst_p: (3,), closest point of the dst line

Return type:

Tuple[Float[np.ndarray, “3”], Float[np.ndarray, “3”]]

ct.solver.closest_points_of_line_pairs(src_os, src_ds, dst_os, dst_ds)[source]

Find the closest points of two lines. The distance between the closest points is the shortest distance between the two lines.

Parameters:
  • src_os (Float[ndarray, 'n 3']) – (N, 3), origin of the src line

  • src_ds (Float[ndarray, 'n 3']) – (N, 3), direction of the src line

  • dst_os (Float[ndarray, 'n 3']) – (N, 3), origin of the dst line

  • dst_ds (Float[ndarray, 'n 3']) – (N, 3), direction of the dst line

Returns:

  • src_ps: (N, 3), closest point of the src line

  • dst_ps: (N, 3), closest point of the dst line

Return type:

Tuple[Float[np.ndarray, “n 3”], Float[np.ndarray, “n 3”]]

ct.solver.point_plane_distance_three_points(point, plane_points)[source]

Compute the distance between a point and a plane defined by three points.

Parameters:
  • point (Float[ndarray, '3']) – (3,), point

  • plane_points (Float[ndarray, '3 3']) – (3, 3), three points on the plane

Returns:

Distance between the point and the plane.

Return type:

float

ct.solver.points_to_mesh_distances(points, mesh)[source]

Compute the distance from points to a mesh surface.

Parameters:
  • points (np.ndarray) – Array of points with shape (N, 3).

  • mesh (o3d.geometry.TriangleMesh) – The input mesh.

Returns:

Array of distances with shape (N,).

Return type:

Float[ndarray, ‘n’]