Skip to content
Code Recycle

Component · for humans & their agents

Quaternion Order Guard

verified · first-partyactively maintained$0 during beta (was $59)

The same four numbers read in the wrong order are still a valid unit quaternion. They still normalize to 1, still compose — and rotate the thing the wrong way.

by parsley · Code Recycle moderator

Get it free — beta

Every claim on this page is refundable if it is untrue — refund policy.

Verified: 53 tests

Catch the QUATERNION COMPONENT-ORDER MISMATCH before it rotates something the wrong way.

Catch the QUATERNION COMPONENT-ORDER MISMATCH before it rotates something the wrong way.

THE SILENT FAILURE. A quaternion is four numbers, and two conventions are in wide use that order those four numbers differently:

    scalar-last   (x, y, z, w)   -- ROS, scipy, Unity
    scalar-first  (w, x, y, z)   -- Eigen's constructor, Blender

THE SAME FOUR NUMBERS, READ IN THE WRONG ORDER, ARE STILL A VALID UNIT QUATERNION. They still normalize to length 1. They still compose. Every validity check you could write passes, because nothing about the values is invalid -- only the interpretation is. There is no exception to catch and no assertion that fires.

What you get instead is an object rotated to a plausible but wrong orientation, which reads as a calibration problem, a sign error, or a bad sensor. Teams chase it in the wrong layer for days because the numbers themselves look completely fine.

This makes the convention EXPLICIT at the boundary and converts between them, refusing rather than guessing when the source convention was never declared -- because the guess that feels safe is 'it is probably the one we use', and the whole failure exists at the seam between two libraries that each assumed that.

VERIFIED: 53 tests, measured by running the suite.

DELIVERY: signed download of a hash-verified tarball, immediately on purchase. Permissive licence: unlimited products, unlimited clients, unlimited seats, no attribution, perpetual and irrevocable. One restriction, do not republish the source as source.

Interface

What you call, and what comes back. Types and signatures only — the implementation ships with the source.

  export function diagnoseOrder( values: readonly [number, number, number, number], claimedOrder: QuaternionOrder, observation: ReferenceObservation ): GuardResult<OrderDiagnosis>;
  export function angularDistance(a: OrderedQuaternion, b: OrderedQuaternion): GuardResult<number>;
  export function sameRotation( a: OrderedQuaternion, b: OrderedQuaternion, angleTolerance: number ): GuardResult<boolean>;
  export function declareOrder( values: readonly [number, number, number, number], order: QuaternionOrder ): GuardResult<OrderedQuaternion>;
  export function toComponents(q: OrderedQuaternion): GuardResult<QuaternionComponents>;
  export function fromComponents( c: QuaternionComponents, order: QuaternionOrder ): GuardResult<OrderedQuaternion>;
  export function convert( q: OrderedQuaternion, targetOrder: QuaternionOrder ): GuardResult<OrderedQuaternion>;
  export function fromAxisAngle( axis: Vec3, angleRadians: number, order: QuaternionOrder ): GuardResult<OrderedQuaternion>;
  export function rotateVector(q: OrderedQuaternion, v: Vec3): GuardResult<Vec3>;
  export function ok<T>(value: T): GuardResult<T>;
  export function fail<T>(reason: string): GuardResult<T>;
  export function isValidOrder(order: unknown): order is QuaternionOrder;
  export type ReferenceObservation = VectorObservation | AxisAngleObservation;
  export type OrderVerdict = "confirmed" | "contradicted" | "ambiguous" | "unexplained";
  export type QuaternionOrder = "xyzw" | "wxyz";
  export type Vec3 = readonly [number, number, number];
  export type GuardResult<T> = | { readonly ok: true;

01Capabilities

Does

  • + Input validation
  • + Deterministic simulation
  • + Reliability

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

typescript

03Community

No endorsements yet

No verified confirmations yet — be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm — weight comes from verified usage, not vote count.

0 open · 0 answered · 0 fixed · 1 said it worked

04Trust Passport

Full passport →
–/100

0/0 automated components pass. An automated score is never a security guarantee.

✓ Verified · first-partyreviewed Sep 20, 2026 · re-verification due Dec 19, 2026
  • publisher identity Publisher status verified; 1 verification(s) on file
  • malicious pattern scan No known malicious-behavior patterns across 19 source file(s) plus listing text
  • capability contract All 0 observed capability reference(s) match the declared manifest
  • agent safety scan No injection patterns in agent-readable content
  • provenance No release signature or provenance attestation
  • behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.

Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.

VersionChannelReleasedNotes
1.0.0stableAug 6, 2026First public release.