tfg.geometry.representation.ray.intersection_ray_sphere

Finds positions and surface normals where the sphere and the ray intersect.

tfg.geometry.representation.ray.intersection_ray_sphere(
    sphere_center,
    sphere_radius,
    ray,
    point_on_ray,
    name=None
)

Defined in geometry/representation/ray.py.

Note:

In the following, A1 to An are optional batch dimensions.

Args:

  • sphere_center: A tensor of shape [3] representing the 3d sphere center.
  • sphere_radius: A tensor of shape [1] containing a strictly positive value defining the radius of the sphere.
  • ray: A tensor of shape [A1, ..., An, 3] containing normalized 3D vectors.
  • point_on_ray: A tensor of shape [A1, ..., An, 3].
  • name: A name for this op. The default value of None means "ray_intersection_ray_sphere".

Returns:

A tensor of shape [2, A1, ..., An, 3] containing the position of the intersections, and a tensor of shape [2, A1, ..., An, 3] the associated surface normals at that point. Both tensors contain NaNs when there is no intersections. The first dimension of the returned tensor provides access to the first and second intersections of the ray with the sphere.

Raises:

  • ValueError: if the shape of sphere_center, sphere_radius, ray or point_on_ray is not supported.
  • tf.errors.InvalidArgumentError: If ray is not normalized.