Class LengthVector2GeometryExtensions
Extension methods for LengthVector2 that require types from the
Thunder.UnitsNET.Vectors.Geometry assembly (e.g. Direction2).
These cannot be instance methods on LengthVector2 because
Thunder.UnitsNET.Vectors does not reference the Geometry assembly.
public static class LengthVector2GeometryExtensions
- Inheritance
-
LengthVector2GeometryExtensions
- Inherited Members
Methods
DirectionTo(LengthPoint2, LengthPoint2)
Returns the Direction2 pointing from source
towards target.
If source and target are the same point
(i.e. the displacement is zero-length), null is returned.
public static Direction2? DirectionTo(this LengthPoint2 source, LengthPoint2 target)
Parameters
sourceLengthPoint2The starting position.
targetLengthPoint2The destination position.
Returns
- Direction2?
A unit-direction Direction2 from
sourcetotarget, or null when the two points are coincident.
Examples
var a = LengthPoint2.FromMeters(0, 0);
var b = LengthPoint2.FromMeters(3, 4);
Direction2? dir = a.DirectionTo(b); // ≈ 53.13° (north-east)