mymesh.rays.RaySegmentIntersection#

mymesh.rays.RaySegmentIntersection(pt, ray, segment, return_intersection=False, endpt_inclusive=True, eps=0)[source]#

Detect intersections between a ray and a line segment.

Parameters:
  • pt (array_like) – 3D coordinates for the starting point of the ray.

  • ray (array_like) – 3D vector giving the orientation of the ray.

  • segment (array_like) – Coordinates of the two points of the line segment (shape=(2,3))

  • return_intersection (bool, optional) – If True, return the coordinates of the intersection point. If no intersection, np.empty((0,3)) is returned. By default False

  • endpt_inclusive (bool, optional) – If True, one end point lying exactly on the other segment will be considered an intersection, by default True

  • eps (int, optional) – Small tolerance parameter used when excluding endpoint intersections, by default 0

Returns:

  • Intersection (bool) – Specifies whether the two line segments intersect

  • pt (np.ndarray, optional) – Point where the two lines intersect, returned if return_intersection=True. If the two lines don’t intersect, np.empty((0,3)) is returned.