2D line segment with a few math utility functions
Assembly: AnyPath.dll
Constructors
Declaration
public Line2D(float2 a, float2 b)
Parameters
| Type |
Name |
Description |
| float2 |
a |
|
| float2 |
b |
|
Properties
Shorthand for the center of the line
Declaration
public float2 Center { get; }
Property Value
Endpoint of the line segment
Declaration
public float2 a { readonly get; set; }
Property Value
Endpoint of the line segment
Declaration
public float2 b { readonly get; set; }
Property Value
Methods
Returns the closest point on this line from a point
Declaration
public float2 GetClosestPoint(float2 pos)
Parameters
| Type |
Name |
Description |
| float2 |
pos |
|
Returns
Returns a value between 0 and 1 describing how far along the line the closest point on this line is to a given point
Declaration
public float GetClosestPositionT(float2 pos)
Parameters
| Type |
Name |
Description |
| float2 |
pos |
|
Returns
Declaration
public float2 GetDirection()
Returns
Declaration
Returns
Check if this line segment intersects with a ray
Declaration
public bool IntersectsRay(Ray2D ray, out float2 pos)
Parameters
| Type |
Name |
Description |
| Ray2D |
ray |
The ray to test against
|
| float2 |
pos |
The position the line was hit
|
Returns
| Type |
Description |
| bool |
Wether the line was hit by a ray
|
Extension Methods