EXTENSION
CGPoint
extension CGPoint
Methods
applyingAffineTransform(containerSize:viewSize:transform:)
public func applyingAffineTransform(containerSize: CGSize, viewSize: CGSize, transform: CGAffineTransform) -> CGPoint
Transforms a single point from the container coordinate space to the view coordinate space by:
- Normalizing the point relative to the container size,
- Applying an affine transform (assumed to map normalized coordinates),
- Scaling the result to the view size.
- Parameters:
- containerSize: The size of the container coordinate space.
- viewSize: The size of the target view coordinate space.
- transform: The affine transform to apply to normalized coordinates.
- Returns: The transformed point in the view coordinate space.
Parameters
| Name | Description |
|---|---|
| containerSize | The size of the container coordinate space. |
| viewSize | The size of the target view coordinate space. |
| transform | The affine transform to apply to normalized coordinates. |
applyingReprojection(containerSize:transform:)
public func applyingReprojection(containerSize: CGSize, transform: simd_float3x3) -> CGPoint
Applies a 3x3 homography (reprojection) to this point.
- Parameters:
- containerSize: The size of the container coordinate space. Coordinates are assumed to be relative to this space (e.g., image or view size) when applying the homography.
- transform: The 3x3 homography matrix that maps the point from the source coordinate space to the target coordinate space.
- Returns: A new CGPoint transformed by the provided homography.
Parameters
| Name | Description |
|---|---|
| containerSize | The size of the container coordinate space. Coordinates are assumed to be relative to this space (e.g., image or view size) when applying the homography. |
| transform | The 3x3 homography matrix that maps the point from the source coordinate space to the target coordinate space. |