<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Spatial",
  "identifier" : "/documentation/Spatial/AffineTransform3D",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Spatial"
    ],
    "preciseIdentifier" : "c:@SA@SPAffineTransform3D"
  },
  "title" : "AffineTransform3D"
}
-->

# AffineTransform3D

A 3D affine transformation matrix.

```
struct AffineTransform3D
```

## Topics

### Creating a 3D affine transform structure

[`init()`](/documentation/Spatial/AffineTransform3D/init()-2uqjl)

Creates an affine transform.

[`init()`](/documentation/Spatial/AffineTransform3D/init()-6ntm3)

Returns a new identity affine transform.

[`init(simd_float4x3)`](/documentation/Spatial/AffineTransform3D/init(_:)-52vpb)

Creates an affine transform from the specified single-precision matrix.

[`init(simd_double4x3)`](/documentation/Spatial/AffineTransform3D/init(_:)-722a2)

Creates an affine transform from the specified 4 x 3 double-precision matrix.

[`init(Transform)`](/documentation/Spatial/AffineTransform3D/init(_:)-e2xx)

Creates an affine transform from the specified transform.

[`init(matrix: simd_double4x3)`](/documentation/Spatial/AffineTransform3D/init(matrix:)-2inci)

Creates an affine transform from the specified double-precision matrix.

[`init(pose: Pose3D)`](/documentation/Spatial/AffineTransform3D/init(pose:))

Creates an affine transform from the specified pose structure.

[`init(scale: Size3D, rotation: Rotation3D, translation: Vector3D)`](/documentation/Spatial/AffineTransform3D/init(scale:rotation:translation:)-3somu)

Creates an affine transform from the specified scale, rotate, and translate transforms.

[`init(scaledPose: ScaledPose3D)`](/documentation/Spatial/AffineTransform3D/init(scaledPose:))

Creates an affine transform from the specified scale pose structure.

[`init(shear: AxisWithFactors)`](/documentation/Spatial/AffineTransform3D/init(shear:))

Creates an affine transform from the specified shear transform.

[`init(truncating: ProjectiveTransform3D)`](/documentation/Spatial/AffineTransform3D/init(truncating:)-40nzj)

Returns a new affine transform structure from the specified projective transform.

[`init(truncating: simd_float4x4)`](/documentation/Spatial/AffineTransform3D/init(truncating:)-5wjxy)

Returns a new affine transform structure from the specified single-precision 4 x 4 matrix truncated to a  4 x 3 matrix.

[`init(truncating: simd_double4x4)`](/documentation/Spatial/AffineTransform3D/init(truncating:)-9fd9g)

Returns a new affine transform structure from the specified 4 x 4 matrix truncated to a  4 x 3 matrix.

[`static SPAffineTransform3D SPAffineTransform3DMake(SPSize3D scale, SPRotation3D rotation, SPVector3D translation);`](/documentation/Spatial/SPAffineTransform3DMake-3a37f)

[`static SPAffineTransform3D SPAffineTransform3DMake(SPSize3D scale, SPRotation3D rotation, SPSize3D translation);`](/documentation/Spatial/SPAffineTransform3DMake-94le1)

Creates an affine transform from the specified scale, rotate, and translate transforms.

[`static SPAffineTransform3D SPAffineTransform3DMakeShear(SPAxis shearAxis, double shearFactor0, double shearFactor1);`](/documentation/Spatial/SPAffineTransform3DMakeShear)

Creates an affine transform from the specified shear transform.

[`static SPAffineTransform3D SPAffineTransform3DMakeWith4x4Matrix(simd_double4x4 matrix);`](/documentation/Spatial/SPAffineTransform3DMakeWith4x4Matrix)

Creates an affine transform from the specified 4 x 4 double-precision matrix.

[`static SPAffineTransform3D SPAffineTransform3DMakeWithPose(SPPose3D pose);`](/documentation/Spatial/SPAffineTransform3DMakeWithPose)

Creates an affine transform from the specified pose structure.

[`static SPAffineTransform3D SPAffineTransform3DMakeWithProjective(SPProjectiveTransform3D transform);`](/documentation/Spatial/SPAffineTransform3DMakeWithProjective)

Creates an affine transform from the specified projective transform.

[`static SPAffineTransform3D SPAffineTransform3DMakeWithScaledPose(SPScaledPose3D pose);`](/documentation/Spatial/SPAffineTransform3DMakeWithScaledPose)

Returns a new affine transform structure from the specified scaled pose structure.

### Transforming a 3D affine transform structure

[`struct Axis3D`](/documentation/Spatial/Axis3D)

Constants that describe an axis.

[`enum AxisWithFactors`](/documentation/Spatial/AxisWithFactors)

Constants that describe the axis of a shear transform.

[`func changeBasis(from: AffineTransform3D, to: AffineTransform3D) -> AffineTransform3D?`](/documentation/Spatial/AffineTransform3D/changeBasis(from:to:))

Returns a new affine transform structure by applying a change-of-basis.

[`func flip(along: Axis3D)`](/documentation/Spatial/AffineTransform3D/flip(along:))

Flips an affine transform along the specified axis.

[`func flipped(along: Axis3D) -> AffineTransform3D`](/documentation/Spatial/AffineTransform3D/flipped(along:))

Returns an affine transform that results from flipping it along the specified axis.

[`var inverse: AffineTransform3D?`](/documentation/Spatial/AffineTransform3D/inverse)

The affine transform’s inverse.

[`func scaledBy(x: Double, y: Double, z: Double) -> AffineTransform3D`](/documentation/Spatial/AffineTransform3D/scaledBy(x:y:z:))

Returns a transform that results from scaling with specified double-precision values.

[`func sheared(AxisWithFactors) -> AffineTransform3D`](/documentation/Spatial/AffineTransform3D/sheared(_:))

Returns an affine transform that results from shearing over an axis by shear factors for the other two axes.

[`static SPAffineTransform3D SPAffineTransform3DChangeBasis(SPAffineTransform3D transform, SPAffineTransform3D from, SPAffineTransform3D to);`](/documentation/Spatial/SPAffineTransform3DChangeBasis)

Returns a new affine transform structure by applying a change-of-basis.

[`static SPAffineTransform3D SPAffineTransform3DFlip(SPAffineTransform3D transform, SPAxis flipAxis);`](/documentation/Spatial/SPAffineTransform3DFlip)

Returns an affine transform that results from flipping it along the specified axis.

[`static const SPAffineTransform3D SPAffineTransform3DInvalid;`](/documentation/Spatial/SPAffineTransform3DInvalid)

An affine transform that represents an invalid transform.

[`static SPAffineTransform3D SPAffineTransform3DInverted(SPAffineTransform3D transform);`](/documentation/Spatial/SPAffineTransform3DInverted)

Returns a new transform that results from inverting an existing affine transform.

[`static SPAffineTransform3D SPAffineTransform3DRotate(SPAffineTransform3D transform, SPRotation3D rotation);`](/documentation/Spatial/SPAffineTransform3DRotate)

Returns a transform that results from applying the specified rotation.

[`static SPAffineTransform3D SPAffineTransform3DRotateByQuaternion(SPAffineTransform3D transform, simd_quatd quaternion);`](/documentation/Spatial/SPAffineTransform3DRotateByQuaternion)

Returns a transform that results from rotating with the specified quaternion.

[`static SPAffineTransform3D SPAffineTransform3DScaleBy(SPAffineTransform3D transform, double x, double y, double z);`](/documentation/Spatial/SPAffineTransform3DScaleBy)

Returns a transform that results from scaling with the specified double-precision values.

[`static SPAffineTransform3D SPAffineTransform3DScaleBySize(SPAffineTransform3D transform, SPSize3D scale);`](/documentation/Spatial/SPAffineTransform3DScaleBySize)

Returns a transform that results from scaling with the specified size structure.

[`static SPAffineTransform3D SPAffineTransform3DScaleUniform(SPAffineTransform3D transform, double scale);`](/documentation/Spatial/SPAffineTransform3DScaleUniform)

Returns a transform that results from uniformly scaling with the specified double-precision value.

[`static void SPAffineTransform3DSetTranslation(SPAffineTransform3D *transform, SPVector3D offset);`](/documentation/Spatial/SPAffineTransform3DSetTranslation)

Sets the translation of an affine transform.

[`static SPAffineTransform3D SPAffineTransform3DShear(SPAffineTransform3D transform, SPAxis shearAxis, double shearFactor0, double shearFactor1);`](/documentation/Spatial/SPAffineTransform3DShear)

Returns an affine transform that results from shearing over an axis by shear factors for the other two axes.

[`static SPAffineTransform3D SPAffineTransform3DTranslate(SPAffineTransform3D transform, SPSize3D size);`](/documentation/Spatial/SPAffineTransform3DTranslate-5pm5m)

Returns a transform with an origin that’s offset by the specified size.

[`static SPAffineTransform3D SPAffineTransform3DTranslate(SPAffineTransform3D transform, SPVector3D offset);`](/documentation/Spatial/SPAffineTransform3DTranslate-yb5g)

Returns a transform with an origin that’s offset by the specified vector.

### Decomposing a 3D affine transform

[`var rotation: Rotation3D?`](/documentation/Spatial/AffineTransform3D/rotation)

The affine transform’s rotation.

[`var scale: Size3D`](/documentation/Spatial/AffineTransform3D/scale)

The affine transform’s scale.

[`var translation: Vector3D`](/documentation/Spatial/AffineTransform3D/translation)

The translation component of the affine transform.

[`static SPVector3D SPAffineTransform3DGetOffset(SPAffineTransform3D transform);`](/documentation/Spatial/SPAffineTransform3DGetOffset)

The affine transform’s translation.

[`static SPRotation3D SPAffineTransform3DGetRotation(SPAffineTransform3D transform);`](/documentation/Spatial/SPAffineTransform3DGetRotation)

The affine transform’s rotation.

### Checking characteristics

[`struct Dimension3DSet`](/documentation/Spatial/Dimension3DSet)

A set of dimensions.

[`var isInvertible: Bool`](/documentation/Spatial/AffineTransform3D/isInvertible)

Returns a Boolean value that indicates whether the transform is invertible.

[`func isUniform(overDimensions: Dimension3DSet) -> Bool`](/documentation/Spatial/AffineTransform3D/isUniform(overDimensions:))

Returns a Boolean value that indicates whether the transform scales equally over the specified dimensions.

[`var matrix: simd_double4x3`](/documentation/Spatial/AffineTransform3D/matrix)

The affine transform’s underlying matrix.

[`var matrix3x3: simd_double3x3`](/documentation/Spatial/AffineTransform3D/matrix3x3)

The first three columns of an affine transform’s underlying matrix.

[`var matrix4x4: simd_double4x4`](/documentation/Spatial/AffineTransform3D/matrix4x4)

A 4 x 4 matrix that results from constructing the affine transform’s underlying matrix.

[`static bool SPAffineTransform3DIsUniformOverDimensions(SPAffineTransform3D transform, SPAxis dimensionFlags);`](/documentation/Spatial/SPAffineTransform3DIsUniformOverDimensions)

Returns a Boolean value that indicates whether the transform scales equally over the specified dimensions.

[`static bool SPAffineTransform3DIsValid(SPAffineTransform3D transform);`](/documentation/Spatial/SPAffineTransform3DIsValid)

A Boolean value that indicates whether the transform is a valid transform.

### Comparing values

[`static func == (AffineTransform3D, AffineTransform3D) -> Bool`](/documentation/Spatial/AffineTransform3D/==(_:_:))

Returns a Boolean value that indicates whether two values are equal.

[`func isApproximatelyEqual(to: AffineTransform3D, tolerance: Double) -> Bool`](/documentation/Spatial/AffineTransform3D/isApproximatelyEqual(to:tolerance:))

Returns a Boolean value that indicates whether two transforms are equal within a specified tolerance.

[`static bool SPAffineTransform3DAlmostEqualToTransform(SPAffineTransform3D t1, SPAffineTransform3D t2);`](/documentation/Spatial/SPAffineTransform3DAlmostEqualToTransform-16ryg)

[`static bool SPAffineTransform3DAlmostEqualToTransform(SPAffineTransform3D t1, SPAffineTransform3D t2, double tolerance);`](/documentation/Spatial/SPAffineTransform3DAlmostEqualToTransform-9ma98)

### Applying arithmetic operations

[`static func * (AffineTransform3D, AffineTransform3D) -> AffineTransform3D`](/documentation/Spatial/AffineTransform3D/*(_:_:))

Returns the concatenation of two affine transforms.

[`static func *= (inout AffineTransform3D, AffineTransform3D)`](/documentation/Spatial/AffineTransform3D/*=(_:_:))

Concatenates two affine transforms and stores the result in the left-hand-side variable.

### Deprecated symbols

[`init?(simd_float4x4)`](/documentation/Spatial/AffineTransform3D/init(_:)-41dx7)

Creates an affine transform from the specified 4 x 4 single-precision matrix.

[`init?(simd_double4x4)`](/documentation/Spatial/AffineTransform3D/init(_:)-6bm4k)

Creates an affine transform from the specified 4 x 4 double-precision matrix.

[`init?(matrix: simd_double4x4)`](/documentation/Spatial/AffineTransform3D/init(matrix:)-2tgp8)

Creates an affine transform from the specified 4 x 4 double-precision matrix.

[`init(matrix: simd_float4x3)`](/documentation/Spatial/AffineTransform3D/init(matrix:)-6icxq)

Creates an affine transform from the specified single-precision matrix.

[`init?(matrix: simd_float4x4)`](/documentation/Spatial/AffineTransform3D/init(matrix:)-82rxz)

Creates an affine transform from the specified 4 x 4 single-precision matrix.

[`init?(projectiveTransform: ProjectiveTransform3D)`](/documentation/Spatial/AffineTransform3D/init(projectiveTransform:))

Creates an affine transform from the specified projective transform.

[`init(scale: Size3D, rotation: Rotation3D, translation: Size3D)`](/documentation/Spatial/AffineTransform3D/init(scale:rotation:translation:)-40dow)

Creates an affine transform from the specified scale, rotate, and translate transforms.

[`init(translation: Size3D)`](/documentation/Spatial/AffineTransform3D/init(translation:))

[`func inverted() -> AffineTransform3D?`](/documentation/Spatial/AffineTransform3D/inverted())

Returns a new transform that results from inverting an existing affine transform.

[`var offset: Vector3D`](/documentation/Spatial/AffineTransform3D/offset)

The affine transform’s translation.

[`static SPVector3D SPAffineTransform3DGetTranslation(SPAffineTransform3D transform);`](/documentation/Spatial/SPAffineTransform3DGetTranslation)

The affine transform’s translation.

[`static SPAffineTransform3D SPAffineTransform3DMakeTranslation(SPSize3D translation);`](/documentation/Spatial/SPAffineTransform3DMakeTranslation-2y1t6)

Creates an affine transform from the specified translate transform.

[`static void SPAffineTransform3DSetOffset(SPAffineTransform3D *transform, SPVector3D offset);`](/documentation/Spatial/SPAffineTransform3DSetOffset)

Sets the translation of an affine transform.

[`static SPAffineTransform3D SPAffineTransform3DTranslate(SPAffineTransform3D transform, SPSize3D size);`](/documentation/Spatial/SPAffineTransform3DTranslate-5pm5m)

Returns a transform with an origin that’s offset by the specified size.

### Initializers

[`init(AffineTransform3DFloat)`](/documentation/Spatial/AffineTransform3D/init(_:)-7eksa)

Returns a double-precision affine transformation from a single-precision affine transformation.

### Instance Properties

[`var columns: (Vector3D, Vector3D, Vector3D, Vector3D)`](/documentation/Spatial/AffineTransform3D/columns)

The columns of the underlying matrix.

### Default Implementations

[CustomReflectable Implementations](/documentation/Spatial/AffineTransform3D/CustomReflectable-Implementations)

[Decodable Implementations](/documentation/Spatial/AffineTransform3D/Decodable-Implementations)

[Encodable Implementations](/documentation/Spatial/AffineTransform3D/Encodable-Implementations)

[Equatable Implementations](/documentation/Spatial/AffineTransform3D/Equatable-Implementations)

[Hashable Implementations](/documentation/Spatial/AffineTransform3D/Hashable-Implementations)

[Scalable3DProtocol Implementations](/documentation/Spatial/AffineTransform3D/Scalable3DProtocol-Implementations)

[Shearable3DProtocol Implementations](/documentation/Spatial/AffineTransform3D/Shearable3DProtocol-Implementations)

[Transform3DProtocol Implementations](/documentation/Spatial/AffineTransform3D/Transform3DProtocol-Implementations)

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Rotatable3D`](/documentation/Spatial/Rotatable3D)

[`Shearable3DProtocol`](/documentation/Spatial/Shearable3DProtocol)

[`Encodable`](/documentation/Swift/Encodable)

[`Sendable`](/documentation/Swift/Sendable)

[`SpatialTypeProtocol`](/documentation/Spatial/SpatialTypeProtocol)

[`Transform3DProtocol`](/documentation/Spatial/Transform3DProtocol)

[`Escapable`](/documentation/Swift/Escapable)

[`Hashable`](/documentation/Swift/Hashable)

[`Rotatable3DProtocol`](/documentation/Spatial/Rotatable3DProtocol)

[`Scalable3DProtocol`](/documentation/Spatial/Scalable3DProtocol)

[`Scalable3D`](/documentation/Spatial/Scalable3D)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`CustomReflectable`](/documentation/Swift/CustomReflectable)

[`Translatable3DProtocol`](/documentation/Spatial/Translatable3DProtocol)

[`Copyable`](/documentation/Swift/Copyable)

[`Translatable3D`](/documentation/Spatial/Translatable3D)

[`Shearable3D`](/documentation/Spatial/Shearable3D)

[`Decodable`](/documentation/Swift/Decodable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)