Function perpendicularCCW
Rotates a vector counter-clockwise by 90 degrees.
The algebraic transformation is:
(x, y) -> (-y, x)
The scalar type is preserved. This is ordinary Vector2 algebra rather
than a metric computation, so no MetricScalar promotion is performed.
Signed-integral negation follows the same scalar semantics as existing
unary vector negation; this operation does not promise overflow-free
mathematical negation for T.
Floating-point NaN and infinity propagate through ordinary component arithmetic.
Returns
A Vector2!T representing the counter-clockwise quarter turn.
No allocation is performed.
Complexity
O(1) time and O(1) auxiliary space.
Example
Example rotating a vector counter-clockwise through the public package API.
import geo;
auto vector = Vector2!int(2, 3);
assert(
perpendicularCCW(vector) ==
Vector2!int(-3, 2)
);