CGExtender
Useful extensions and functions used with coregraphics types like CGFloat, CGPoint, and CGSize
CGPoint
- VectorArithmetic Conformance
- Random Value in range
CGSize
- VectorArithmetic Conformance
- Random Value in range
Clamping Functions
Clamps within range of two given values
Geometry Functions
atanP
- function returns only positive values between [0, 2π]calculateDirection
-Calculates the direction between two points relative to the vector pointing in the trailing directionproject
- Projects the pointp
onto the line segment defined by the pointsL1
andL2
calculateParameter
- Projects the pointp
onto the vector defined by the pointsL1
andL2
, uses the parametric form of the line segment fromL1
toL2
to constrain the projected point to be on the line segmentdistance
- gets the distance between two points
Collision Functions
- Point/Line
- Point/Circle
- Point/Rectangle
- Point/Polygon
- Line/Line
- Line/Rectangle
- Line/Circle
- Line/Polygon
- Circle/Circle
- Circle/Rectangle
- Circle/Polygon
- Rectangle/Rectangle
- Rectangle/Polygon
- Polygon/Polygon