Click or drag to resize

UtilIntersectLineSphere Method (Vector3, Vector3, Vector3, Double, Double)

Intersect a line with a sphere (using supplied epsilon as a tolerance in equality).

Namespace:  Demo3D.Common
Assembly:  Demo3D.Common (in Demo3D.Common.dll) Version: 15.0.2.11458
Syntax
C#
public static Vector3[] IntersectLineSphere(
	Vector3 A,
	Vector3 B,
	Vector3 sphereCenter,
	double sphereRadius,
	double epsilon
)

Parameters

A
Type: Microsoft.DirectXVector3
First point on line.
B
Type: Microsoft.DirectXVector3
Second point on line.
sphereCenter
Type: Microsoft.DirectXVector3
Center of the sphere.
sphereRadius
Type: SystemDouble
Radius of the sphere.
epsilon
Type: SystemDouble
Tolerance for floating point comparisons.

Return Value

Type: 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