One Logo Pool Ball
Spatial · IOS API REFERENCE

Vector3D

struct · iOS 16.0+ · SDK 27.1

struct Vector3D

Members (55)

get · iOS 16.0+

isFinite

TypeScript
get isFinite(): boolean
Swift declaration
var isFinite: Bool { get }
get · iOS 16.0+

isNaN

TypeScript
get isNaN(): boolean
Swift declaration
var isNaN: Bool { get }
get · iOS 16.0+

isZero

TypeScript
get isZero(): boolean
Swift declaration
var isZero: Bool { get }
get · iOS 16.0+

zero

TypeScript
static get zero(): Vector3D
Swift declaration
static let zero: Vector3D
get · iOS 16.0+

infinity

TypeScript
static get infinity(): Vector3D
Swift declaration
static let infinity: Vector3D
get · iOS 16.0+

vector

TypeScript
get vector(): SDKHandle
Swift declaration
var vector: simd_double3 { get set }
set · iOS 16.0+

vector

TypeScript
set vector(value: SDKHandle)
Swift declaration
var vector: simd_double3 { get set }
get · iOS 16.0+

x

TypeScript
get x(): number
Swift declaration
var x: Double { get set }
set · iOS 16.0+

x

TypeScript
set x(value: number)
Swift declaration
var x: Double { get set }
get · iOS 16.0+

y

TypeScript
get y(): number
Swift declaration
var y: Double { get set }
set · iOS 16.0+

y

TypeScript
set y(value: number)
Swift declaration
var y: Double { get set }
get · iOS 16.0+

z

TypeScript
get z(): number
Swift declaration
var z: Double { get set }
set · iOS 16.0+

z

TypeScript
set z(value: number)
Swift declaration
var z: Double { get set }
init · iOS 16.0+

init

TypeScript
static initVector(vector: SDKHandle): Vector3D
Swift declaration
init(vector: simd_double3)
get · iOS 16.0+

normalized

TypeScript
get normalized(): Vector3D
Swift declaration
var normalized: Vector3D { get }

Returns this vector with a length of `1`.

static · iOS 26.0+

smoothstep

TypeScript
static smoothstep(edge0: Vector3D, edge1: Vector3D, x: Vector3D): Vector3D
Swift declaration
static func smoothstep(edge0: Vector3D, edge1: Vector3D, x: Vector3D) -> Vector3D

Returns a Spatial vector that represents the smooth interpolation at `x` between two vectors. - Parameter edge0: The lower edge of the interpolation function. - Parameter edge1: The upper edge of the interpolation function. - Parameter x: The value that the function interpolates at. - Returns: A new vector with each element set to `0` if `x <= edge0`, `1` if `x >= edge1`, and a Hermite interpolation between `0` and `1` if `edge0 < x < edge1`.

method · iOS 18.0+

unapplying

TypeScript
unapplying(scaledPose: ScaledPose3D): Vector3D
Swift declaration
func unapplying(_ scaledPose: ScaledPose3D) -> Vector3D

Returns the primitive that results from unapplying a scaled pose to the primitive. - Parameter pose: The scaled pose. - Returns The transformed primitive.

method · iOS 16.0+

unapplying

TypeScript
unapplying1261(transform: AffineTransform3D): Vector3D
Swift declaration
func unapplying(_ transform: AffineTransform3D) -> Vector3D

Returns the vector that results from unapplying an affine transform to the vector. - Parameter transform: The affine transform. - Returns The transformed primitive.

method · iOS 16.0+

unapplying

TypeScript
unapplying96568(transform: ProjectiveTransform3D): Vector3D
Swift declaration
func unapplying(_ transform: ProjectiveTransform3D) -> Vector3D

Returns the vector that results from unapplying a projective transform to the vector. - Parameter transform: The projective transform. - Returns The transformed primitive.

method · iOS 16.0+

unapplying

TypeScript
unapplying1497(pose: Pose3D): Vector3D
Swift declaration
func unapplying(_ pose: Pose3D) -> Vector3D

Returns the primitive that results from applying a pose to the primitive. - Parameter pose: The pose. - Returns The transformed primitive.

get · iOS 16.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.

get · iOS 18.0+

customMirror

TypeScript
get customMirror(): SDKHandle
Swift declaration
var customMirror: Mirror { get }

The custom mirror for this instance.

get · iOS 16.0+

lengthSquared

TypeScript
get lengthSquared(): number
Swift declaration
var lengthSquared: Double { get }
method · iOS 16.0+

uniformlyScaled

TypeScript
uniformlyScaled(scale: number): Vector3D
Swift declaration
func uniformlyScaled(by scale: Double) -> Vector3D

Returns the entity uniformly scaled by the specified scalar value. - Parameter scale: The value that defines that scale. - Returns The scaled vector.

init · iOS 16.0+

init

TypeScript
static initXYZ(x?: number, y?: number, z?: number): Vector3D
Swift declaration
init(x: Double = 0, y: Double = 0, z: Double = 0)

Returns a vector from the specified values. - Parameter x: The first element of the vector. - Parameter y: The second element of the vector. - Parameter z: The third element of the vector.

init · iOS 16.0+

init

TypeScript
static initXYZ86701(x: number, y: number, z: number): Vector3D
Swift declaration
init<T>(x: T, y: T, z: T) where T : BinaryFloatingPoint

Returns a new vector from the floating-point values. - note: This function is provided as a convenience. All Spatial storage and calculations are double-precision.

get · iOS 16.0+

up

TypeScript
static get up(): Vector3D
Swift declaration
static let up: Vector3D

A vector with values `[0, 1, 0]`.

method · iOS 16.0+

dot

TypeScript
dot(other: Vector3D): number
Swift declaration
func dot(_ other: Vector3D) -> Double

Returns the dot product of this vector and the specified vector.

static · iOS 26.0+

lerp

TypeScript
static lerp(from: Vector3D, to: Vector3D, t: Vector3D): Vector3D
Swift declaration
static func lerp(from: Vector3D, to: Vector3D, t: Vector3D) -> Vector3D

Returns a Spatial vector that represents the linear interpolation at `t` between two vectors. - Parameter from: The starting vector. - Parameter to: The ending vector. - Parameter t: The value, between `0` and `1`, that the function interpolates at. - Returns: A new rotation. When `t=0`, the result is the `from` vector. When `t=1.0`, the result is the `to` vector. For any other value of `t`, the result is a linear linear interpolation between the two vectors.

method · iOS 16.0+

cross

TypeScript
cross(other: Vector3D): Vector3D
Swift declaration
func cross(_ other: Vector3D) -> Vector3D

Returns the cross product of this vector and the specified vector.

get · iOS 16.0+

right

TypeScript
static get right(): Vector3D
Swift declaration
static let right: Vector3D

A vector with values `[1, 0, 0]`.

get · iOS 16.0+

length

TypeScript
get length(): number
Swift declaration
var length: Double { get }
method · iOS 16.0+

scaled

TypeScript
scaled(size: Size3D): Vector3D
Swift declaration
func scaled(by size: Size3D) -> Vector3D

Returns the vector scaled by the specified size. - Parameter size: The size structure that defines that scale. - Returns The scaled vector.

get · iOS 16.0+

forward

TypeScript
static get forward(): Vector3D
Swift declaration
static let forward: Vector3D

A vector with values `[0, 0, 1]`.

method · iOS 16.0+

rotated

TypeScript
rotatedBy(quaternion: SDKHandle): Vector3D
Swift declaration
func rotated(by quaternion: simd_quatd) -> Vector3D

Returns the vector rotated by the specified quaternion around the origin. - Parameter quaternion: The quaternion that defines the rotation. - Returns The rotated vector.

method · iOS 16.0+

rotated

TypeScript
rotatedBy32266(rotation: Rotation3D): Vector3D
Swift declaration
func rotated(by rotation: Rotation3D) -> Vector3D

Returns the vector rotated by the specified rotation around the origin. - Parameter rotation: The rotation. - Returns The rotated vector.

method · iOS 16.0+

sheared

TypeScript
sheared(shear: AxisWithFactors): Vector3D
Swift declaration
func sheared(_ shear: AxisWithFactors) -> Vector3D

Returns a sheared vector. - Parameter shear: The axis and shear factors. - Returns The sheared vector.

method · iOS 18.0+

applying

TypeScript
applying(scaledPose: ScaledPose3D): Vector3D
Swift declaration
func applying(_ scaledPose: ScaledPose3D) -> Vector3D

Returns the primitive that results from applying a scaled pose to the primitive. - Parameter pose: The scaled pose. - Returns The transformed primitive.

method · iOS 16.0+

applying

TypeScript
applying33501(transform: AffineTransform3D): Vector3D
Swift declaration
func applying(_ transform: AffineTransform3D) -> Vector3D

Returns the vector that results from applying an affine transform to the vector. - Parameter transform: The affine transform. - Returns The transformed primitive.

method · iOS 16.0+

applying

TypeScript
applying26088(transform: ProjectiveTransform3D): Vector3D
Swift declaration
func applying(_ transform: ProjectiveTransform3D) -> Vector3D

Returns the vector that results from applying a projective transform to the vector. - Parameter transform: The projective transform. - Returns The transformed primitive.

method · iOS 16.0+

applying

TypeScript
applying9385(pose: Pose3D): Vector3D
Swift declaration
func applying(_ pose: Pose3D) -> Vector3D

Returns the primitive that results from applying a pose to the primitive. - Parameter pose: The pose. - Returns The transformed primitive.

method · iOS 16.0+

rotation

TypeScript
rotation(other: Vector3D): Rotation3D
Swift declaration
func rotation(to other: Vector3D) -> Rotation3D

Returns the rotation from the normalized first vector to the normalized second vector.

method · iOS 16.0+

scaledBy

TypeScript
scaledBy(x?: number, y?: number, z?: number): Vector3D
Swift declaration
func scaledBy(x: Double = 1, y: Double = 1, z: Double = 1) -> Vector3D

Returns the vector scaled by the specified values. - Parameter x: The scale factor on the `x` dimension. - Parameter y: The scale factor on the `y` dimension. - Parameter z: The scale factor on the `z` dimension. - Returns The scaled vector.

method · iOS 16.0+

normalize

TypeScript
normalize(): void
Swift declaration
mutating func normalize()

Normalizes the vector.

method · iOS 16.0+

projected

TypeScript
projected(other: Vector3D): Vector3D
Swift declaration
func projected(_ other: Vector3D) -> Vector3D

Returns this vector projected onto the specified vector.

method · iOS 16.0+

reflected

TypeScript
reflected(normal: Vector3D): Vector3D
Swift declaration
func reflected(_ normal: Vector3D) -> Vector3D

Returns the reflection direction of this incident vector and the specified unit normal vector.

init · iOS 26.0+

init

TypeScript
static init(vector: Vector3DFloat): Vector3D
Swift declaration
init(_ vector: Vector3DFloat)

Returns a double-precision vector from a single-precision vector.

init · iOS 16.0+

init

TypeScript
static init65124(axis: RotationAxis3D): Vector3D
Swift declaration
init(_ axis: RotationAxis3D)

Returns a new vector from a rotation axis. - Parameter axis: The source rotation axis.

init · iOS 18.0+

init

TypeScript
static init57812(coords: SphericalCoordinates3D): Vector3D
Swift declaration
init(_ coords: SphericalCoordinates3D)

Creates a new vector structure that contains the spherical coordinates converted to Cartesian coordinates. - Parameter coords: The spherical coordinates.

init · iOS 16.0+

init

TypeScript
static init96699(size: Size3D): Vector3D
Swift declaration
init(_ size: Size3D)

Returns a new vector from a size. - Parameter size: The source size.

init · iOS 16.0+

init

TypeScript
static init26545(point: Point3D): Vector3D
Swift declaration
init(_ point: Point3D)

Returns a new vector from a point. - Parameter point: The source point.

init · iOS 16.0+

init

TypeScript
static init51462(xyz: SDKHandle): Vector3D
Swift declaration
init(_ xyz: simd_double3)

Returns a new vector from a double-precision vector. - Parameter xyz: The source vector.

init · iOS 16.0+

init

TypeScript
static init78140(xyz: SDKHandle): Vector3D
Swift declaration
init(_ xyz: simd_float3)

Returns a vector point from a single-precision vector. - note: This function is provided as a convenience. All Spatial storage and calculations are double-precision.

init · iOS 26.0+

init

TypeScript
static init28359(source: SDKHandle): Vector3D
Swift declaration
init(_ source: simd_packed_double4)

Creates a Spatial vector from a simd packed vector.

init · iOS 16.0+

init

TypeScript
static init65919(): Vector3D
Swift declaration
init()

Skipped declarations

No declarations were skipped in this snapshot.

All Spatial types →