UxrMathUtils.FindLineCircleIntersections2D Method
Tries to find the intersection(s) between a 2D line and a 2D circle Code from: http://csharphelper.com/blog/2014/09/determine-where-a-line-intersects-a-circle-in-c/
Namespace: UltimateXR.Core.Math
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static int FindLineCircleIntersections2D(
Vector2 linePoint1,
Vector2 linePoint2,
Vector2 circlePos,
float radius,
out Vector2 intersection1,
out Vector2 intersection2
)
Parameters
- linePoint1
- Type: Vector2
Point A in the line - linePoint2
- Type: Vector2
Point B in the line - circlePos
- Type: Vector2
Circle position - radius
- Type: System.Single
Circle radius - intersection1
- Type: Vector2
Intersection 1 result, if it exists - intersection2
- Type: Vector2
Intersection 2 result, if it exists
Return Value
Type: Int32
Number of intersections found (0, 1 or 2)