<<>> <> <> <> <> <> <> <> <> <<>> <> <<``Animating Rotation with Quaternion Curves'', SIGGRAPH '85 Proceedings, and>> <<``Quaternion Calculus and Fast Animation,'' in SIGGRAPH '87 tutorial #10.>> <<>> DIRECTORY G3dBasic, G3dMatrix, Rope; G3dQuaternion: CEDAR DEFINITIONS ~ BEGIN <> Pair: TYPE ~ G3dBasic.Pair; Triple: TYPE ~ G3dBasic.Triple; Quad: TYPE ~ G3dBasic.Quad; Matrix: TYPE ~ G3dMatrix.Matrix; Quaternion: TYPE ~ G3dBasic.Quad ¬ [x: 0.0, y: 0.0, z: 0.0, w: 1.0]; AxisAngle: TYPE ~ RECORD [unitAxis: Triple, theta: REAL]; QuaternionSequence: TYPE ~ REF QuaternionSequenceRep; QuaternionSequenceRep: TYPE ~ RECORD [ length: CARDINAL ¬ 0, element: SEQUENCE maxLength: CARDINAL OF Quaternion ]; <> origin: Triple ~ G3dBasic.origin; qZero: READONLY Quaternion; -- All components 0, sum identity, does not give a rotation quW: READONLY Quaternion; -- Pure w component, product identity, gives null rotation quX: READONLY Quaternion; -- Pure x component, gives rotation by quY: READONLY Quaternion; -- Pure y component, gives rotation by quZ: READONLY Quaternion; -- Pure z component, gives rotation by <> FromComponents: PROC [x, y, z, w: REAL] RETURNS [qq: Quaternion]; <> FromVectorScalar: PROC [v: Triple, w: REAL ¬ 1.0] RETURNS [qq: Quaternion]; <> <> FromVector: PROC [v: Triple] RETURNS [qq: Quaternion]; <> FromScalar: PROC [w: REAL ¬ 1.0] RETURNS [qq: Quaternion]; <> FromAxisAngle: PROC [unitAxis: Triple, theta: REAL] RETURNS [qu: Quaternion]; <> <> FromXYZAngles: PROC [forX, forY, forZ: REAL] RETURNS [qu: Quaternion]; <> FromMatrix: PROC [mat: Matrix] RETURNS [qu: Quaternion]; <> <> <> ToMatrix: PROC [q: Quaternion, out: Matrix ¬ NIL] RETURNS [Matrix]; <> <> <> ToAxisAngle: PROC [qu: Quaternion] RETURNS [AxisAngle]; <> <<(in radians). Note that a rotation with an angle of zero will have an undefined axis. Note>> <> <<>> ToXYZAngles: PROC [qu: Quaternion] RETURNS [Triple]; <> <> MakeRotateQ: PROC [q: Quaternion, out: Matrix ¬ NIL] RETURNS [Matrix]; <> <> <> MakeRotateAboutQ: PROC [q: Quaternion, base: Triple ¬ origin, out: Matrix ¬ NIL] RETURNS [Matrix]; <> <> <> <> <> Id: PROC RETURNS [qu: Quaternion]; <> Zero: PROC RETURNS [qq: Quaternion]; <> Components: PROC [q: Quaternion] RETURNS [Quad]; <> Vector: PROC [q: Quaternion] RETURNS [Triple]; <> Scalar: PROC [q: Quaternion] RETURNS [REAL]; <> PureVector: PROC [q: Quaternion] RETURNS [qq: Quaternion]; <> <> <<>> Norm: PROC [q: Quaternion] RETURNS [REAL]; <> Neg: PROC [q: Quaternion] RETURNS [qq: Quaternion]; <> Conjugate: PROC [q: Quaternion] RETURNS [qq: Quaternion]; <> Inverse: PROC [q: Quaternion] RETURNS [qq: Quaternion]; <> Unit: PROC [q: Quaternion] RETURNS [qu: Quaternion]; <> Add: PROC [qL, qR: Quaternion] RETURNS [qq: Quaternion]; <> Sub: PROC [qL, qR: Quaternion] RETURNS [qq: Quaternion]; <> Mul: PROC [qL, qR: Quaternion] RETURNS [qq: Quaternion]; <> Scale: PROC [q: Quaternion, w: REAL] RETURNS [qq: Quaternion]; <> Exp: PROC [q: Quaternion] RETURNS [qq: Quaternion]; <> Ln: PROC [q: Quaternion] RETURNS [qq: Quaternion]; <> Rot: PROC [qu: Quaternion, v: Triple] RETURNS [vr: Triple]; <> Dot: PROC [qa, qb: Quaternion] RETURNS [REAL]; <> <> <> <> <<>> << [Artwork node; type 'Artwork on' to command tool] >> <<>> Slerp: PROC [qu0, qu1: Quaternion, t: REAL] RETURNS [qut: Quaternion]; <> Bisect: PROC [qu0, qu1: Quaternion] RETURNS [qu: Quaternion]; <> Double: PROC [qu0, qu1: Quaternion] RETURNS [qu: Quaternion]; <> Squad: PROC [qu0, qu1, quq0, quq1: Quaternion, t: REAL] RETURNS [qut: Quaternion]; <> <> Bezier: PROC [qu0, qua0, qub1, qu1: Quaternion, t: REAL] RETURNS [qut: Quaternion]; <> <> BSpline: PUBLIC PROC [qu0, qu1, qu2, qu3: Quaternion, t1, t2, t3, t4, t5, t6, t: REAL] RETURNS [qut: Quaternion]; <> <> CatmullRom: PUBLIC PROC [qu0, qu1, qu2, qu3: Quaternion, t: REAL] RETURNS [qut: Quaternion]; <> <> <<>> TangentVector: PROC [quNm1, quN, quNp1: Quaternion] RETURNS [vt: Triple]; <> <> SquadTanFromPoints: PROC [quNm1, quN, quNp1: Quaternion] RETURNS [quqN: Quaternion]; <> <> <<>> BezierTanFromPoints: PROC [quNm1, quN, quNp1: Quaternion] RETURNS [quaN: Quaternion]; <> <> SquadTanFromVector: PROC [quN, quNp1: Quaternion, vt: Triple] RETURNS [quqN: Quaternion]; <> <> <<>> BezierTanFromVector: PROC [quN: Quaternion, vt: Triple] RETURNS [quaN: Quaternion]; <> <> <> ConformQuaternionSequence: PROC [qs: QuaternionSequence]; <> CopyQuaternionSequence: PROC [qs: QuaternionSequence] RETURNS [new: QuaternionSequence]; <> <<>> AddToQuaternionSequence: PROC [qs: QuaternionSequence, q: Quaternion] RETURNS [QuaternionSequence]; <> <<>> LengthenQuaternionSequence: PROC [qs: QuaternionSequence, amount: REAL ¬ 1.3] RETURNS [new: QuaternionSequence]; <> <<>> END.