EXTENSION
CGRect
extension CGRect
Methods
applyingAffineTransform(containerSize:viewSize:transform:)
public func applyingAffineTransform(containerSize: CGSize, viewSize: CGSize, transform: CGAffineTransform) -> CGRect
Transforms a rectangle from the container coordinate space to view by applying a given affine transform to its corner points.
- Parameters:
- containerSize: The size of the original container coordinate space.
- viewSize: The size of the target view coordinate space.
- transform: The affine transform to apply (expected to operate on normalized coordinates).
- Returns: A new rectangle transformed into the view coordinate space.
Parameters
| Name | Description |
|---|---|
| containerSize | The size of the original container coordinate space. |
| viewSize | The size of the target view coordinate space. |
| transform | The affine transform to apply (expected to operate on normalized coordinates). |
applyingReprojection(containerSize:transform:)
public func applyingReprojection(containerSize: CGSize, transform: simd_float3x3) -> CGRect
Applies a 3x3 homography (reprojection) to this rectangle and returns the resulting bounding box in a specified container coordinate space.
- 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 points from the source coordinate space to the target coordinate space.
- Returns: A new CGRect representing the transformed rectangle.
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 points from the source coordinate space to the target coordinate space. |