Vector2Multiplicative
public protocol Vector2Multiplicative : Vector2Additive, VectorMultiplicative where Self.SubVector3 : Vector3Multiplicative
Protocol for 2D vector types with multiplicative scalars.
-
unitX
Default implementationGets the (x: 1, y: 0) vector of this type.
Default Implementation
Gets the (x: 1, y: 0) vector of this type.
Declaration
Swift
static var unitX: Self { get }
-
unitY
Default implementationGets the (x: 0, y: 1) vector of this type.
Default Implementation
Gets the (x: 0, y: 1) vector of this type.
Declaration
Swift
static var unitY: Self { get }
-
cross(_:
Default implementation) Calculates the cross product between this and another provided Vector. The resulting scalar would match the ‘z’ axis of the cross product between 3d vectors matching the x and y coordinates of the operands, with the ‘z’ coordinate being 0.
Also called perp-dot product, as it equates to taking the dot product of
self • other.perpendicular
. Provided inVector2Multiplicative
as a convenience, as the protocol constraints are more lax thanVector2Signed
.Default Implementation
Declaration
Swift
func cross(_ other: Self) -> Scalar
-
tripleProduct(_:
Default implementation_: ) Performs a 2D vector triple product between
self
,b
, andc
:a x (b x c)
.Can be used to derive a vector perpendicular to
ab
, such that it points in the direction ofac
.Default Implementation
Declaration
Swift
func tripleProduct(_ b: Self, _ c: Self) -> Self
-
winding(_:
Default implementation_: _: ) Returns the winding value of the three given input points.
Winding indicates whether the vectors are clockwise (> 0), colinear (== 0), or counter-clockwise (< 0)
Default Implementation
Returns the winding value of the three given input points.
Winding indicates whether the vectors are clockwise (> 0), colinear (== 0), or counter-clockwise (< 0)
Declaration
Swift
static func winding(_ p0: Self, _ p1: Self, _ p2: Self) -> Scalar
-
areClockwise(_:
Extension method_: _: ) Returns
true
if the three given input points are wound in clockwise order.Declaration
Swift
@inlinable static func areClockwise(_ p0: Self, _ p1: Self, _ p2: Self) -> Bool where Self.Scalar : Comparable