Table of Contents

Class LengthVector2GeometryExtensions

Namespace
Thunder.UnitsNET.Vectors.Geometry
Assembly
Thunder.UnitsNET.Vectors.Geometry.dll

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

source LengthPoint2

The starting position.

target LengthPoint2

The destination position.

Returns

Direction2?

A unit-direction Direction2 from source to target, 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)
v0.7.0 ▼