1 /*************************************************************************
2  *                          D bindings for ODE                           *
3  *                                                                       *
4  *       C header port by Daniel "q66" Kolesa <quaker66@gmail.com>       *
5  *                                                                       *
6  * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
7  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
8  *                                                                       *
9  * This library is free software; you can redistribute it and/or         *
10  * modify it under the terms of EITHER:                                  *
11  *   (1) The GNU Lesser General Public License as published by the Free  *
12  *       Software Foundation; either version 2.1 of the License, or (at  *
13  *       your option) any later version. The text of the GNU Lesser      *
14  *       General Public License is included with this library in the     *
15  *       file LICENSE.TXT.                                               *
16  *   (2) The BSD-style license that is included with this library in     *
17  *       the file LICENSE-BSD.TXT.                                       *
18  *                                                                       *
19  * This library is distributed in the hope that it will be useful,       *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
22  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
23  *                                                                       *
24  *************************************************************************/
25 
26 module deimos.ode.rotation;
27 
28 private import deimos.ode.common;
29 private import core.stdc.stdio: FILE;
30 
31 extern (C):
32 nothrow:
33 
34 void dRSetIdentity(dMatrix3 R);
35 
36 void dRFromAxisAndAngle(dMatrix3 R, dReal ax, dReal ay, dReal az, dReal angle);
37 
38 void dRFromEulerAngles(dMatrix3 R, dReal phi, dReal theta, dReal psi);
39 
40 void dRFrom2Axes(dMatrix3 R, dReal ax, dReal ay, dReal az, dReal bx, dReal by, dReal bz);
41 
42 void dRFromZAxis(dMatrix3 R, dReal ax, dReal ay, dReal az);
43 
44 void dQSetIdentity(dQuaternion q);
45 
46 void dQFromAxisAndAngle(dQuaternion q, dReal ax, dReal ay, dReal az, dReal angle);
47 
48 /* Quaternion multiplication, analogous to the matrix multiplication routines. */
49 /* qa = rotate by qc, then qb */
50 void dQMultiply0(dQuaternion qa, in dQuaternion qb, in dQuaternion qc);
51 /* qa = rotate by qc, then by inverse of qb */
52 void dQMultiply1(dQuaternion qa, in dQuaternion qb, in dQuaternion qc);
53 /* qa = rotate by inverse of qc, then by qb */
54 void dQMultiply2(dQuaternion qa, in dQuaternion qb, in dQuaternion qc);
55 /* qa = rotate by inverse of qc, then by inverse of qb */
56 void dQMultiply3(dQuaternion qa, in dQuaternion qb, in dQuaternion qc);
57 
58 void dRfromQ(dMatrix3 R, in dQuaternion q);
59 void dQfromR(dQuaternion q, in dMatrix3 R);
60 void dDQfromW(ref dReal[4] dq, in dVector3 w, in dQuaternion q);