Documentation / @sw-file-lib/core / math / Orientation
Class: Orientation
class Orientation {
constructor(x: AxisMapping, y: AxisMapping, z: AxisMapping);
readonly x: AxisMapping;
readonly y: AxisMapping;
readonly z: AxisMapping;
readonly Identity: Orientation;
readonly RotateX90: Orientation;
readonly RotateX180: Orientation;
readonly RotateX270: Orientation;
readonly RotateY90: Orientation;
readonly RotateY180: Orientation;
readonly RotateY270: Orientation;
readonly RotateZ90: Orientation;
readonly RotateZ180: Orientation;
readonly RotateZ270: Orientation;
readonly FlipX: Orientation;
readonly FlipY: Orientation;
readonly FlipZ: Orientation;
multiply(other: Orientation): Orientation;
transformPosition(src: ReadonlyVec3): Vec3;
toMat3(): Mat3;
equals(other: Orientation): boolean;
}Defined in: math/orientation.ts:20
Axis-aligned orientation for Stormworks' left-handed coordinate system.
Rotations use Stormworks-positive directions (x right, y up, z forward). toMat3() returns a row-major matrix.
Constructors
Constructor
new Orientation(
x: AxisMapping,
y: AxisMapping,
z: AxisMapping): Orientation;Defined in: math/orientation.ts:22
Create an orientation from signed mappings for the output x, y, and z axes.
Parameters
| Parameter | Type |
|---|---|
x | AxisMapping |
y | AxisMapping |
z | AxisMapping |
Returns
Orientation
Properties
x
readonly x: AxisMapping;Defined in: math/orientation.ts:23
y
readonly y: AxisMapping;Defined in: math/orientation.ts:24
z
readonly z: AxisMapping;Defined in: math/orientation.ts:25
Identity
readonly static Identity: Orientation;Defined in: math/orientation.ts:29
No rotation or reflection.
RotateX90
readonly static RotateX90: Orientation;Defined in: math/orientation.ts:36
Positive 90 degree rotation around the X axis in Stormworks left-handed space.
RotateX180
readonly static RotateX180: Orientation;Defined in: math/orientation.ts:43
180 degree rotation around the X axis.
RotateX270
readonly static RotateX270: Orientation;Defined in: math/orientation.ts:50
Positive 270 degree rotation around the X axis in Stormworks left-handed space.
RotateY90
readonly static RotateY90: Orientation;Defined in: math/orientation.ts:57
Positive 90 degree rotation around the Y axis in Stormworks left-handed space.
RotateY180
readonly static RotateY180: Orientation;Defined in: math/orientation.ts:64
180 degree rotation around the Y axis.
RotateY270
readonly static RotateY270: Orientation;Defined in: math/orientation.ts:71
Positive 270 degree rotation around the Y axis in Stormworks left-handed space.
RotateZ90
readonly static RotateZ90: Orientation;Defined in: math/orientation.ts:78
Positive 90 degree rotation around the Z axis in Stormworks left-handed space.
RotateZ180
readonly static RotateZ180: Orientation;Defined in: math/orientation.ts:85
180 degree rotation around the Z axis.
RotateZ270
readonly static RotateZ270: Orientation;Defined in: math/orientation.ts:92
Positive 270 degree rotation around the Z axis in Stormworks left-handed space.
FlipX
readonly static FlipX: Orientation;Defined in: math/orientation.ts:99
Mirror across the X axis.
FlipY
readonly static FlipY: Orientation;Defined in: math/orientation.ts:106
Mirror across the Y axis.
FlipZ
readonly static FlipZ: Orientation;Defined in: math/orientation.ts:113
Mirror across the Z axis.
Methods
multiply()
multiply(other: Orientation): Orientation;Defined in: math/orientation.ts:120
Compose this orientation with another orientation.
Parameters
| Parameter | Type |
|---|---|
other | Orientation |
Returns
Orientation
transformPosition()
transformPosition(src: ReadonlyVec3): Vec3;Defined in: math/orientation.ts:133
Transform a position or direction vector by this orientation.
Parameters
| Parameter | Type |
|---|---|
src | ReadonlyVec3 |
Returns
toMat3()
toMat3(): Mat3;Defined in: math/orientation.ts:144
Convert this orientation to a row-major 3x3 matrix.
Returns
equals()
equals(other: Orientation): boolean;Defined in: math/orientation.ts:160
Return true when both orientations describe the same axis mapping.
Parameters
| Parameter | Type |
|---|---|
other | Orientation |
Returns
boolean