00001 00002 00003 00004 00005 // ChangeLog 00006 // Jun 22, 2005 - Bruno de Oliveira Schneider 00007 // - Fixed documentation: file and version commands were wrong and were confusing doxygen. 00008 // - Replaced tabs with spaces for proper indentation. 00009 // - Fixed date on changelog entry below. Fixed assert include (from C style to C++). 00010 // Jun 09, 2005 - Marta Becker Villamil 00011 // - Code typing has been cleaned. Doxygen documentation started. 00012 // - Removed 'vp' preffix of every method name. 00013 // - Reimplemented "AddDof(VPDof*)" according to changes in VPDof and VPJoint. 00014 // - Commented out old constructors because they leak memory and because of changes 00015 // in VPJoint and VPDof. 00016 // Jan 15, 2001 - Anderson Maciel 00017 // - Class and new methods declaration. 00018 // Jan 16, 2000 - Anderson Maciel 00019 // - Methods implementation. 00020 00021 #include "vppolyaxialjoint.h" 00022 #include <cassert> 00023 00024 using namespace std; 00025 00026 VPPolyaxialJoint::VPPolyaxialJoint() { 00027 } 00028 00029 /* 00030 VPPolyaxialJoint::VPPolyaxialJoint( void ):VPJoint(){ 00031 vpSetParent( NULL ); 00032 VPDof *d1 = new VPDof( VPVector3D( 0, 0, 1 ), VPPoint3D(), new VPBezier() ); 00033 VPDof *d2 = new VPDof( VPVector3D( 1, 0, 0 ), VPPoint3D(), new VPBezier() ); 00034 VPDof *d3 = new VPDof( VPVector3D( 0, 1, 0 ), VPPoint3D(), new VPBezier() ); 00035 d1->vpSetOwnerJoint( this ); 00036 d2->vpSetOwnerJoint( this ); 00037 d3->vpSetOwnerJoint( this ); 00038 vpAddDof( d1 ); 00039 vpAddDof( d2 ); 00040 vpAddDof( d3 ); 00041 vpMakeLim(); 00042 } 00043 00044 VPPolyaxialJoint::VPPolyaxialJoint( VPJoint *parent ):VPJoint(){ 00045 vpSetParent( parent ); 00046 VPDof *d1 = new VPDof( VPVector3D( 0, 0, 1 ), VPPoint3D(), new VPBezier() ); 00047 VPDof *d2 = new VPDof( VPVector3D( 1, 0, 0 ), VPPoint3D(), new VPBezier() ); 00048 VPDof *d3 = new VPDof( VPVector3D( 0, 1, 0 ), VPPoint3D(), new VPBezier() ); 00049 d1->vpSetOwnerJoint( this ); 00050 d2->vpSetOwnerJoint( this ); 00051 d3->vpSetOwnerJoint( this ); 00052 vpAddDof( d1 ); 00053 vpAddDof( d2 ); 00054 vpAddDof( d3 ); 00055 vpMakeLim(); 00056 } 00057 00058 VPPolyaxialJoint::VPPolyaxialJoint( VPJoint *parent, VPDof *dof1, VPDof *dof2, VPDof *dof3 ):VPJoint(){ 00059 vpSetParent( parent ); 00060 dof1->vpSetOwnerJoint( this ); 00061 dof2->vpSetOwnerJoint( this ); 00062 dof3->vpSetOwnerJoint( this ); 00063 vpAddDof( dof1 ); 00064 vpAddDof( dof2 ); 00065 vpAddDof( dof3 ); 00066 vpMakeLim(); 00067 } 00068 */ 00069 void VPPolyaxialJoint::SetFlexionTo(float value) { 00070 VPDof* ptrFirstDof = dofList.front(); 00071 ptrFirstDof->MoveTo(value); 00072 } 00073 00074 void VPPolyaxialJoint::SetAductionTo(float value) { 00075 list<VPDof*>::iterator iter = dofList.begin(); 00076 ++iter; 00077 VPDof* ptrSecondDof = *iter; 00078 ptrSecondDof->MoveTo(value); 00079 } 00080 00081 void VPPolyaxialJoint::SetTwistTo(float value) { 00082 list<VPDof*>::iterator iter = dofList.begin(); 00083 ++iter; 00084 ++iter; 00085 VPDof* ptrThirdDof = *iter; 00086 ptrThirdDof->MoveTo(value); 00087 } 00088 00089 void VPPolyaxialJoint::AddDof(VPDof* dof) { 00090 assert (GetNumDofs() < 3); 00091 VPJoint::AddDof(dof); 00092 // If the third DOF was added, the joint should be made ready for use. 00093 if (GetNumDofs() == 3) MakeLim(); 00094 }