Skip to content

vec3

Struct | orca.geometry

3D vector structure

Overview

Fields

Field Type Description
x float X coordinate component
y float Y coordinate component
z float Z coordinate component

Methods

dot(vec3) → float

Calculates dot product with another vector

Parameter Type Description
other vec3 Vector to calculate dot product with

Returns: float — Dot product result

lengthsq() → float

Returns the squared length of the vector

Returns: float — Squared magnitude of the vector

len() → float

Returns the length (magnitude) of the vector

Returns: float — Length of the vector

bezier(vec3, vec3, vec3, float) → vec3

Cubic Bezier curve interpolation

Parameter Type Description
b vec3 Second control point
c vec3 Third control point
d vec3 Fourth control point
t float Curve parameter (0.0 to 1.0)

Returns: vec3 — Point on the Bezier curve

hermite(vec3, vec3, vec3, float) → vec3

Hermite spline interpolation

Parameter Type Description
b vec3 Second control point
c vec3 Third control point
d vec3 Fourth control point
t float Curve parameter (0.0 to 1.0)

Returns: vec3 — Point on the Hermite curve

lerp(vec3, float) → vec3

Linear interpolation between this vector and another

Parameter Type Description
other vec3 Target vector to interpolate towards
t float Interpolation factor (0.0 = this vector, 1.0 = other vector)

Returns: vec3 — Interpolated vector

cross(vec3) → vec3

Calculates cross product with another vector

Parameter Type Description
other vec3 Vector to calculate cross product with

Returns: vec3 — Cross product result vector

mad(float, vec3) → vec3

Multiply-add operation: returns this + (s * other)

Parameter Type Description
s float Scale factor for the other vector
other vec3 Vector to scale and add

Returns: vec3 — Result of multiply-add operation

scale(float) → vec3

Returns a scaled copy of the vector

Parameter Type Description
s float Scale factor to apply

Returns: vec3 — New scaled vector

normalize()

Normalizes the vector in place to unit length

set(float, float, float)

Sets the vector components

Parameter Type Description
x float New X component value
y float New Y component value
z float New Z component value

clear()

Sets all components to zero

distance(vec3) → float

Calculates distance to another vector

Parameter Type Description
other vec3 Target vector to measure distance to

Returns: float — Distance between the two vectors