dualsense-ts
Version:
The natural interface for your DualSense Classic and DualSense Access controllers, with Typescript
30 lines • 1.16 kB
TypeScript
/**
* Minimal quaternion math for AHRS sensor fusion.
*
* Quaternions are represented as [w, x, y, z] tuples where w is the
* scalar part. All functions are pure — no mutations, no allocations
* beyond the returned tuple.
*/
/** A unit quaternion [w, x, y, z] representing a 3D orientation. */
export type Quaternion = [number, number, number, number];
/** Euler angles in radians, extracted from a quaternion. */
export interface EulerAngles {
/** Rotation around X axis (radians, -PI to PI) */
pitch: number;
/** Rotation around Y axis (radians, -PI to PI) */
yaw: number;
/** Rotation around Z axis (radians, -PI to PI) */
roll: number;
}
/** Identity quaternion — no rotation. */
export declare const IDENTITY: Quaternion;
/** Normalize a quaternion to unit length. */
export declare function normalize(q: Quaternion): Quaternion;
/**
* Extract Euler angles (Tait-Bryan ZYX intrinsic) from a unit quaternion.
*
* Convention: pitch = X-axis, yaw = Y-axis, roll = Z-axis.
* All angles in radians, range (-PI, PI].
*/
export declare function toEuler(q: Quaternion): EulerAngles;
//# sourceMappingURL=quaternion.d.ts.map