direction property
dynamic
get
direction
Returns the direction (or angle) of the vector, in radians.
This is only valid for 2D vectors. For vectors of other dimensions, an AssertionError is thrown.
Implementation
dynamic get direction {
assert(length == 2, 'Direction can only be calculated for 2D vectors');
return math.atan2(_data[1], _data[0]);
}