, rayDir, sphereOrig=(0.0, 0.0, 0.0), sphereRadius=1.0, dtype=None)[source]

Calculate the points which a ray/line intersects a sphere (if any).

Get the 3D coordinate of the point which the ray intersects the sphere and the distance to the point from orig. The nearest point is returned if the line intersects the sphere at multiple locations. All coordinates should be in world/scene units.

  • rayOrig (array_like) – Origin of the ray in space [x, y, z].

  • rayDir (array_like) – Direction vector of the ray [x, y, z], should be normalized.

  • sphereOrig (array_like) – Origin of the sphere to test [x, y, z].

  • sphereRadius (float) – Sphere radius to test in scene units.

  • dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.


Coordinate in world space of the intersection and distance in scene units from orig. Returns None if there is no intersection.

Return type


Back to top