UtilIntersectLineSphere(Vector3, Vector3, Vector3, Double, Double) Method |
Intersect a line with a sphere (using supplied epsilon as a tolerance in equality).
Namespace: Demo3D.CommonAssembly: Demo3D.Common (in Demo3D.Common.dll) Version: 19.01.00
Syntaxpublic static Vector3[] IntersectLineSphere(
Vector3 A,
Vector3 B,
Vector3 sphereCenter,
double sphereRadius,
double epsilon
)
Parameters
- A Vector3
- First point on line.
- B Vector3
- Second point on line.
- sphereCenter Vector3
- Center of the sphere.
- sphereRadius Double
- Radius of the sphere.
- epsilon Double
- Tolerance for floating point comparisons.
Return Value
Vector3
null meaning no intersections, or a
Vector3[], containing the two intersections, or just a single intersection
if the line and sphere are just touching.
See Also