{"record":{"id":"d187a391d91ce909","repo":"BabylonJS/Babylon.js","slug":"quaternion-maximize-does-not-make-sense","errorCode":null,"errorMessage":"Quaternion.Maximize does not make sense","messagePattern":"Quaternion\\.Maximize does not make sense","errorType":"exception","errorClass":"ReferenceError","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Maths/math.vector.pure.ts","lineNumber":6080,"sourceCode":"     */\r\n    public static RandomToRef<T extends Quaternion>(min: number = 0, max: number = 1, ref: T): T {\r\n        return ref.copyFromFloats(RandomRange(min, max), RandomRange(min, max), RandomRange(min, max), RandomRange(min, max));\r\n    }\r\n\r\n    /**\r\n     * Do not use\r\n     * @internal\r\n     */\r\n    public static Minimize(): Quaternion {\r\n        throw new ReferenceError(\"Quaternion.Minimize does not make sense\");\r\n    }\r\n\r\n    /**\r\n     * Do not use\r\n     * @internal\r\n     */\r\n    public static Maximize(): Quaternion {\r\n        throw new ReferenceError(\"Quaternion.Maximize does not make sense\");\r\n    }\r\n\r\n    /**\r\n     * Returns the distance (float) between the quaternions \"value1\" and \"value2\".\r\n     * @param value1 value to calulate the distance between\r\n     * @param value2 value to calulate the distance between\r\n     * @returns the distance between the two quaternions\r\n     */\r\n    public static Distance(value1: DeepImmutable<Quaternion>, value2: DeepImmutable<Quaternion>): number {\r\n        return Math.sqrt(Quaternion.DistanceSquared(value1, value2));\r\n    }\r\n    /**\r\n     * Returns the squared distance (float) between the quaternions \"value1\" and \"value2\".\r\n     * @param value1 value to calulate the distance between\r\n     * @param value2 value to calulate the distance between\r\n     * @returns the distance between the two quaternions squared\r\n     */\r\n    public static DistanceSquared(value1: DeepImmutable<Quaternion>, value2: DeepImmutable<Quaternion>): number {\r","sourceCodeStart":6062,"sourceCodeEnd":6098,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Maths/math.vector.pure.ts#L6062-L6098","documentation":"Quaternion.Maximize is a deliberately non-functional placeholder that always throws a ReferenceError. A component-wise maximum of quaternions has no geometric meaning for rotations, so Babylon.js keeps the static method only for API symmetry with Vector3/Vector4 and throws on any use.","triggerScenarios":"Calling the static method Quaternion.Maximize() with any arguments; it never returns normally.","commonSituations":"Mechanically converting Vector3.Maximize calls to Quaternion; generic minimax code iterating over vector-like types; IDE autocomplete selecting the placeholder method.","solutions":["Remove the call: component-wise max of quaternions is not a valid operation.","For blending rotations use Quaternion.Slerp / Quaternion.SlerpToRef.","If comparing orientations is the goal, compute the angular difference via Quaternion.Angle or Dot and select explicitly."],"exampleFix":"// before\nconst q = BABYLON.Quaternion.Maximize(q1, q2);\n\n// after\nconst angle = BABYLON.Quaternion.Angle(q1, q2); // pick rotation explicitly\nconst q = angle > 0 ? q1 : q2;","handlingStrategy":"validation","validationCode":"if (typeof BABYLON.Quaternion.Maximize === 'function') {\n  throw new Error('Quaternion.Maximize is a forbidden placeholder; select rotations via Quaternion.Angle/Dot instead');\n}","typeGuard":"const isUsableQuaternionOp = (op: Function | undefined): op is Function =>\n  typeof op === 'function' && op !== (BABYLON.Quaternion as any).Maximize;","tryCatchPattern":"try {\n  result = (BABYLON.Quaternion as any).Maximize(q1, q2);\n} catch (e) {\n  result = BABYLON.Quaternion.Angle(q1, q2) > 0 ? q1.clone() : q2.clone();\n}","preventionTips":["Never call Quaternion.Maximize; it exists only for API parity and always throws.","For orientation selection use Quaternion.Angle, Dot, or Slerp.","Document in team guidelines that Minimize/Maximize are Vector3/Vector4-only."],"tags":["math","quaternion","api-misuse"],"backgroundTag":"unimplemented-api-placeholder","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}