---
title: Vector3D
framework: spatial
role: symbol
role_heading: Structure
path: spatial/vector3d
---

# Vector3D

A three-element vector.

## Declaration

```swift
struct Vector3D
```

## Topics

### Creating a vector

- [init()](spatial/vector3d/init().md)
- [init(x:y:z:)](spatial/vector3d/init(x:y:z:)-2ejxw.md)
- [init(x:y:z:)](spatial/vector3d/init(x:y:z:)-29hwg.md)
- [init(_:)](spatial/vector3d/init(_:)-73gdm.md)
- [init(_:)](spatial/vector3d/init(_:)-1a9i3.md)
- [init(vector:)](spatial/vector3d/init(vector:).md)
- [init(_:)](spatial/vector3d/init(_:)-3br9h.md)
- [init(_:)](spatial/vector3d/init(_:)-8vcph.md)
- [init(_:)](spatial/vector3d/init(_:)-8egfs.md)
- [init(_:)](spatial/vector3d/init(_:)-9ker1.md)

### Inspecting a vector’s properties

- [x](spatial/vector3d/x.md)
- [y](spatial/vector3d/y.md)
- [z](spatial/vector3d/z.md)
- [vector](spatial/vector3d/vector.md)

### Checking characteristics

- [rotation(to:)](spatial/vector3d/rotation(to:).md)

### Geometry functions

- [cross(_:)](spatial/vector3d/cross(_:).md)
- [dot(_:)](spatial/vector3d/dot(_:).md)
- [length](spatial/vector3d/length.md)
- [lengthSquared](spatial/vector3d/lengthsquared.md)
- [normalize()](spatial/vector3d/normalize().md)
- [normalized](spatial/vector3d/normalized.md)
- [projected(_:)](spatial/vector3d/projected(_:).md)
- [reflected(_:)](spatial/vector3d/reflected(_:).md)

### Transforming a vector

- [applying(_:)](spatial/vector3d/applying(_:)-1d0mh.md)
- [applying(_:)](spatial/vector3d/applying(_:)-5y3xb.md)
- [applying(_:)](spatial/vector3d/applying(_:)-4k2qi.md)
- [unapplying(_:)](spatial/vector3d/unapplying(_:)-6vl3o.md)
- [unapplying(_:)](spatial/vector3d/unapplying(_:)-8ookb.md)
- [unapplying(_:)](spatial/vector3d/unapplying(_:)-1gzyd.md)
- [rotated(by:)](spatial/vector3d/rotated(by:)-2gcq4.md)
- [rotated(by:)](spatial/vector3d/rotated(by:)-8bwna.md)
- [scaled(by:)](spatial/vector3d/scaled(by:).md)
- [scaledBy(x:y:z:)](spatial/vector3d/scaledby(x:y:z:).md)
- [uniformlyScaled(by:)](spatial/vector3d/uniformlyscaled(by:).md)
- [sheared(_:)](spatial/vector3d/sheared(_:).md)
- [applying(_:)](spatial/vector3d/applying(_:)-8fn6a.md)
- [unapplying(_:)](spatial/vector3d/unapplying(_:)-4uxr2.md)

### Comparing values

- [==(_:_:)](spatial/vector3d/==(_:_:).md)

### Encoding and decoding a vector

- [init(from:)](spatial/vector3d/init(from:).md)
- [encode(to:)](spatial/vector3d/encode(to:).md)

### Type properties

- [forward](spatial/vector3d/forward.md)
- [right](spatial/vector3d/right.md)
- [up](spatial/vector3d/up.md)

### Applying arithmetic operations

- [*(_:_:)](spatial/vector3d/*(_:_:)-dcwn.md)
- [*(_:_:)](spatial/vector3d/*(_:_:)-64lzt.md)
- [*(_:_:)](spatial/vector3d/*(_:_:)-6rxsr.md)
- [*(_:_:)](spatial/vector3d/*(_:_:)-3dpli.md)
- [*(_:_:)](spatial/vector3d/*(_:_:)-8y7xq.md)
- [+(_:_:)](spatial/vector3d/+(_:_:)-7gbcj.md)
- [+(_:_:)](spatial/vector3d/+(_:_:)-9xfxv.md)
- [+(_:_:)](spatial/vector3d/+(_:_:)-1xufx.md)
- [+(_:_:)](spatial/vector3d/+(_:_:)-1bq1m.md)
- [+(_:_:)](spatial/vector3d/+(_:_:)-4rsou.md)
- [-(_:)](spatial/vector3d/-(_:).md)
- [-(_:_:)](spatial/vector3d/-(_:_:)-6zam.md)
- [-(_:_:)](spatial/vector3d/-(_:_:)-6lui1.md)
- [-(_:_:)](spatial/vector3d/-(_:_:)-3qpww.md)
- [-(_:_:)](spatial/vector3d/-(_:_:)-1nz82.md)
- [-(_:_:)](spatial/vector3d/-(_:_:)-8sgai.md)
- [*=(_:_:)](spatial/vector3d/*=(_:_:).md)
- [+=(_:_:)](spatial/vector3d/+=(_:_:).md)
- [-=(_:_:)](spatial/vector3d/-=(_:_:).md)
- [/(_:_:)](spatial/vector3d/_(_:_:).md)
- [/=(_:_:)](spatial/vector3d/_=(_:_:).md)

### Initializers

- [init(_:)](spatial/vector3d/init(_:)-23qst.md)
- [init(_:)](spatial/vector3d/init(_:)-272sg.md)

### Type Methods

- [lerp(from:to:t:)](spatial/vector3d/lerp(from:to:t:).md)
- [smoothstep(edge0:edge1:x:)](spatial/vector3d/smoothstep(edge0:edge1:x:).md)

### Default Implementations

- [AdditiveArithmetic Implementations](spatial/vector3d/additivearithmetic-implementations.md)
- [CustomReflectable Implementations](spatial/vector3d/customreflectable-implementations.md)
- [Decodable Implementations](spatial/vector3d/decodable-implementations.md)
- [Encodable Implementations](spatial/vector3d/encodable-implementations.md)
- [Equatable Implementations](spatial/vector3d/equatable-implementations.md)
- [Hashable Implementations](spatial/vector3d/hashable-implementations.md)
- [Primitive3DProtocol Implementations](spatial/vector3d/primitive3dprotocol-implementations.md)
- [ProjectiveTransformable3D Implementations](spatial/vector3d/projectivetransformable3d-implementations.md)
- [Rotatable3DProtocol Implementations](spatial/vector3d/rotatable3dprotocol-implementations.md)
- [Scalable3DProtocol Implementations](spatial/vector3d/scalable3dprotocol-implementations.md)
- [Shearable3D Implementations](spatial/vector3d/shearable3d-implementations.md)

## Relationships

### Conforms To

- [AdditiveArithmetic](swift/additivearithmetic.md)
- [Animatable](swiftui/animatable.md)
- [Copyable](swift/copyable.md)
- [CustomReflectable](swift/customreflectable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Primitive3D](spatial/primitive3d.md)
- [Primitive3DProtocol](spatial/primitive3dprotocol.md)
- [ProjectiveTransformable3D](spatial/projectivetransformable3d.md)
- [Rotatable3D](spatial/rotatable3d.md)
- [Rotatable3DProtocol](spatial/rotatable3dprotocol.md)
- [Scalable3D](spatial/scalable3d.md)
- [Scalable3DProtocol](spatial/scalable3dprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Shearable3D](spatial/shearable3d.md)
- [SpatialTypeProtocol](spatial/spatialtypeprotocol.md)
- [VectorArithmetic](swiftui/vectorarithmetic.md)

## See Also

### Data structures

- [Vector3DFloat](spatial/vector3dfloat.md)
- [Axis3D](spatial/axis3d.md)
