Module
Linear.V2
- Package
- purescript-linear
- Repository
- afcondon/purescript-linear
2-dimensional vectors.
This module provides the V2 type for 2D vector operations,
commonly used for 2D graphics, physics, and game development.
#V2 Source
#crossZ Source
crossZ :: forall a. Ring a => V2 a -> V2 a -> aThe z-component of the cross product of two 2D vectors.
This is useful for determining the orientation of two vectors:
- Positive: v2 is counter-clockwise from v1
- Negative: v2 is clockwise from v1
- Zero: vectors are parallel
crossZ (V2 1.0 0.0) (V2 0.0 1.0) = 1.0 -- counter-clockwise
crossZ (V2 0.0 1.0) (V2 1.0 0.0) = -1.0 -- clockwise