colour.geometry.intersect_ray_circle_2d#

colour.geometry.intersect_ray_circle_2d(ray_origin: ArrayLike, ray_direction: ArrayLike, circle_radius: float) NDArrayFloat[source]#

Compute the intersection distance of 2D ray(s) with a circle centred at the origin.

Supports batched inputs: if ray_origin and ray_direction have shape (..., 2), the result has shape (...).

Parameters:
  • ray_origin (ArrayLike) – Ray origin(s) as 2D point(s) [..., 2].

  • ray_direction (ArrayLike) – Ray direction(s) as 2D vector(s) [..., 2] (does not need to be normalised).

  • circle_radius (float) – Radius of the circle centred at the origin.

Returns:

Distance(s) along the ray to the nearest forward intersection, or np.nan where no forward intersection exists.

Return type:

numpy.ndarray

Examples

>>> intersect_ray_circle_2d([0, 5], [0, 1], 10)
5.0
>>> intersect_ray_circle_2d([0, 15], [0, 1], 10)
nan