<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "Spatial"
    ],
    "preciseIdentifier" : "Spatial"
  },
  "title" : "Spatial"
}
-->

# Spatial

Create and manipulate 3D mathematical primitives.

## Overview

The Spatial module is a lightweight 3D mathematical library that provides a simple API for working with 3D primitives. Much of its functionality is similar to the 2D geometry support in Core Graphics, but in three dimensions.

## Topics

### Data structures

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

A three-element vector.

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

A single-precision structure that defines a three-element vector

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

Constants that describe an axis.

### 2D primitives

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

A geometric angle with a value you access in either radians or degrees.

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

A single-precision geometric angle whose value you access in either radians or degrees.

### 3D primitives

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

A point in a 3D coordinate system.

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

A single-precision structure that contains a point in a three-dimensional coordinate system.

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

A size that describes width, height, and depth in a 3D coordinate system.

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

A single-precision structure that contains width, height, and depth values.

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

A rectangle in a 3D coordinate system.

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

A single-precision structure that contains the location and dimensions of a 3D rectangle.

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

A rotation in three dimensions.

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

A single-precision structure that represents a rotation in three dimensions.

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

A 3D rotation axis.

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

A 3D axis.

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

A structure that contains a 3D position and a 3D rotation.

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

A single-precision structure that contains a position and rotation.

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

A structure that contains a position, rotation, and scale.

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

A structure that contains a position, rotation, and scale.

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

A structure that defines spherical coordinates in radial, inclination, azimuthal order.

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

A single-precision structure that defines spherical coordinates in radial, inclination, azimuthal order.

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

A ray in a 3D coordinate system.

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

A single-precision structure that contains the origin and direction of a 3D ray.

### Affine and projective transforms

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

A 3D affine transformation matrix.

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

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

A 3D projective transformation matrix.

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

A single-precision 3D projective transformation matrix.

### Converting between coordinate spaces

[`protocol CoordinateSpace3D`](/documentation/Spatial/CoordinateSpace3D)

A type that represents a coordinate space which you can use to convert
values to and from other coordinate spaces.

[`protocol CoordinateSpace3DFloat`](/documentation/Spatial/CoordinateSpace3DFloat)

[`protocol CoordinateSpaceValue3D`](/documentation/Spatial/CoordinateSpaceValue3D)

An opaque value which can be resolved to a concrete value
in a `CoordinateSpace3D`

[`protocol ProjectiveTransformable3D`](/documentation/Spatial/ProjectiveTransformable3D)

[`protocol ProjectiveTransformable3DFloat`](/documentation/Spatial/ProjectiveTransformable3DFloat)

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

A coordinate space that represents a world reference point.

### Applying trigonometric functions

[`func cos(Angle2D) -> Double`](/documentation/Spatial/cos(_:)-609v4)

[`func cos(Angle2DFloat) -> Float`](/documentation/Spatial/cos(_:)-79fxe)

[`func cosh(Angle2D) -> Double`](/documentation/Spatial/cosh(_:)-6cg6v)

[`func cosh(Angle2DFloat) -> Float`](/documentation/Spatial/cosh(_:)-9mmhn)

[`func sin(Angle2DFloat) -> Float`](/documentation/Spatial/sin(_:)-46su7)

[`func sin(Angle2D) -> Double`](/documentation/Spatial/sin(_:)-5tddt)

[`func sinh(Angle2D) -> Double`](/documentation/Spatial/sinh(_:)-4m7ds)

[`func sinh(Angle2DFloat) -> Float`](/documentation/Spatial/sinh(_:)-8kigy)

[`func tan(Angle2D) -> Double`](/documentation/Spatial/tan(_:)-1sjgu)

[`func tan(Angle2DFloat) -> Float`](/documentation/Spatial/tan(_:)-9x99s)

[`func tanh(Angle2D) -> Double`](/documentation/Spatial/tanh(_:)-1f341)

[`func tanh(Angle2DFloat) -> Float`](/documentation/Spatial/tanh(_:)-5yozs)

### Protocols

[`protocol Primitive3D`](/documentation/Spatial/Primitive3D)

A set of methods common to Spatial primitives.

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

A set of methods that defines the interface to rotate Spatial entities.

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

A set of methods that defines the interface to scale Spatial entities.

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

A set of methods that defines the interface to shear Spatial entities.

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

A set of methods that defines the interface to translate Spatial entities.

[`protocol Volumetric`](/documentation/Spatial/Volumetric)

A set of methods for working with Spatial primitives with volume.

[`protocol ClampableWithinRectProtocol`](/documentation/Spatial/ClampableWithinRectProtocol)

A set of methods that defines the interface for Spatial entities that can be clamped to a volume.

### Macros

[Macros & Global Variables](/documentation/Spatial/Spatial-macros)

### Protocols

[`protocol Primitive3DProtocol`](/documentation/Spatial/Primitive3DProtocol)

A set of methods common to Spatial primitives.

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

A set of methods that defines the interface for Spatial entities that can rotate.

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

A set of methods that defines the interface for Spatial entities that can scale.

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

A set of methods that defines the interface for Spatial entities that can shear.

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

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

A set of methods that are common to transforms.

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

A set of methods that defines the interface for Spatial entities that can translate.

[`protocol VolumetricProtocol`](/documentation/Spatial/VolumetricProtocol)

A set of methods for working with Spatial primitives with volume.

### Structures

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

### Enumerations

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

The axis of a shear transform.

---

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)