mrdja.geometry.get_intersection_points_of_line_with_cube

mrdja.geometry.get_intersection_points_of_line_with_cube(line: ndarray, cube_min: ndarray, cube_max: ndarray) ndarray[source]

Get the intersection points of a line with a cube.

Parameters:
  • line (np.ndarray) – Line described as two points.

  • cube_min (np.ndarray) – Minimum point of the cube.

  • cube_max (np.ndarray) – Maximum point of the cube.

Returns:

Intersection points.

Return type:

np.ndarray

Example:

>>> import mrdja.geometry as geom
>>> import mrdja.drawing as drawing
>>> import numpy as np
>>> line = np.array([[0, 0, 0], [1, 1, 1]])
>>> cube_min = np.array([-2, -2, -1])
>>> cube_max = np.array([1, 2, 2])
>>> intersection_points = geom.get_intersection_points_of_line_with_cube(line, cube_min, cube_max)
>>> intersection_points
array([[ 1.,  1.,  1.],
      [-1., -1., -1.]])