| 1 |
/************************************************************************* |
| 2 |
* * |
| 3 |
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * |
| 4 |
* All rights reserved. Email: [email protected] Web: www.q12.org * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of EITHER: * |
| 8 |
* (1) The GNU Lesser General Public License as published by the Free * |
| 9 |
* Software Foundation; either version 2.1 of the License, or (at * |
| 10 |
* your option) any later version. The text of the GNU Lesser * |
| 11 |
* General Public License is included with this library in the * |
| 12 |
* file LICENSE.TXT. * |
| 13 |
* (2) The BSD-style license that is included with this library in * |
| 14 |
* the file LICENSE-BSD.TXT. * |
| 15 |
* * |
| 16 |
* This library is distributed in the hope that it will be useful, * |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * |
| 19 |
* LICENSE.TXT and LICENSE-BSD.TXT for more details. * |
| 20 |
* * |
| 21 |
*************************************************************************/ |
| 22 |
|
| 23 |
#ifndef _ODE_JOINT_PISTON_H_ |
| 24 |
#define _ODE_JOINT_PISTON_H_ |
| 25 |
|
| 26 |
#include "joint.h" |
| 27 |
|
| 28 |
|
| 29 |
//////////////////////////////////////////////////////////////////////////////// |
| 30 |
/// Component of a Piston joint |
| 31 |
/// <PRE> |
| 32 |
/// |- Anchor point |
| 33 |
/// Body_1 | Body_2 |
| 34 |
/// +---------------+ V +------------------+ |
| 35 |
/// / /| / /| |
| 36 |
/// / / + |-- ______ / / + |
| 37 |
/// / x /./........x.......(_____()..../ x /.......> axis |
| 38 |
/// +---------------+ / |-- +------------------+ / |
| 39 |
/// | |/ | |/ |
| 40 |
/// +---------------+ +------------------+ |
| 41 |
/// | | |
| 42 |
/// | | |
| 43 |
/// |------------------> <----------------------------| |
| 44 |
/// anchor1 anchor2 |
| 45 |
/// |
| 46 |
/// |
| 47 |
/// </PRE> |
| 48 |
/// |
| 49 |
/// When the prismatic joint as been elongated (i.e. dJointGetPistonPosition) |
| 50 |
/// return a value > 0 |
| 51 |
/// <PRE> |
| 52 |
/// |- Anchor point |
| 53 |
/// Body_1 | Body_2 |
| 54 |
/// +---------------+ V +------------------+ |
| 55 |
/// / /| / /| |
| 56 |
/// / / + |-- ______ / / + |
| 57 |
/// / x /./........_____x.......(_____()..../ x /.......> axis |
| 58 |
/// +---------------+ / |-- +------------------+ / |
| 59 |
/// | |/ | |/ |
| 60 |
/// +---------------+ +------------------+ |
| 61 |
/// | | |
| 62 |
/// | | |
| 63 |
/// |------------------> <----------------------------| |
| 64 |
/// anchor1 |----| anchor2 |
| 65 |
/// ^ |
| 66 |
/// |-- This is what dJointGetPistonPosition will |
| 67 |
/// return |
| 68 |
/// </PRE> |
| 69 |
//////////////////////////////////////////////////////////////////////////////// |
| 70 |
struct dxJointPiston : public dxJoint |
| 71 |
{ |
| 72 |
dVector3 axis1; ///< Axis of the prismatic and rotoide w.r.t first body |
| 73 |
dVector3 axis2; ///< Axis of the prismatic and rotoide w.r.t second body |
| 74 |
|
| 75 |
|
| 76 |
dQuaternion qrel; ///< Initial relative rotation body1 -> body2 |
| 77 |
|
| 78 |
/// Anchor w.r.t first body. |
| 79 |
/// This is the same as the offset for the Slider joint |
| 80 |
/// @note To find the position of the anchor when the body 1 has moved |
| 81 |
/// you must add the position of the prismatic joint |
| 82 |
/// i.e anchor = R1 * anchor1 + dJointGetPistonPosition() * (R1 * axis1) |
| 83 |
dVector3 anchor1; |
| 84 |
dVector3 anchor2; //< anchor w.r.t second body |
| 85 |
|
| 86 |
/// limit and motor information for the prismatic |
| 87 |
/// part of the joint |
| 88 |
dxJointLimitMotor limotP; |
| 89 |
|
| 90 |
/// limit and motor information for the rotoide |
| 91 |
/// part of the joint |
| 92 |
dxJointLimitMotor limotR; |
| 93 |
|
| 94 |
dxJointPiston( dxWorld *w ); |
| 95 |
virtual void getSureMaxInfo( SureMaxInfo* info ); |
| 96 |
virtual void getInfo1( Info1* info ); |
| 97 |
virtual void getInfo2( dReal worldFPS, dReal worldERP, |
| 98 |
int rowskip, dReal *J1, dReal *J2, |
| 99 |
int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, |
| 100 |
int *findex ); |
| 101 |
virtual dJointType type() const; |
| 102 |
virtual size_t size() const; |
| 103 |
|
| 104 |
virtual void setRelativeValues(); |
| 105 |
|
| 106 |
void computeInitialRelativeRotation(); |
| 107 |
}; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
#endif |
| 112 |
|