Class | ODE::AngularMotorJoint |
In: |
ext/body.c
(CVS)
|
Parent: | ODE::ParameterizedJoint |
ODE::AngularMotorJoint#initialize( world, jointGroup ) — Create and return a new ODE::AngularMotorJoint.
/* * ODE::AngularMotorJoint#initialize( world, jointGroup ) * -- * Create and return a new ODE::AngularMotorJoint. */ static VALUE ode_aMotorJoint_init( argc, argv, self ) int argc; VALUE *argv, self; { return ode_joint_construct( argc, argv, self, dJointCreateAMotor, 0 ); }
ODE::AngularMotorJoint#axis1() — Set the first axis of the joint, which must be parallel to the second axis. The vector argument can be any object which returns an array of three numeric values when to_ary is called on it, such as a ODE::Vector, an ODE::Vector, or an Array with three numeric elements.
/* * ODE::AngularMotorJoint#axis1() * -- * Set the first axis of the joint, which must be parallel to the second * axis. The <tt>vector</tt> argument can be any object which returns an array * of three numeric values when <tt>to_ary</tt> is called on it, such as a * ODE::Vector, an ODE::Vector, or an Array with three numeric elements. */ static VALUE ode_aMotorJoint_axis1( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return ode_get_amotor_joint_param3( ptr->id, dJointGetAMotorAxis, ode_cOdeVector ); }
ODE::AngularMotorJoint#axis1Rel() —
/* * ODE::AngularMotorJoint#axis1Rel() * -- * */ static VALUE ode_aMotorJoint_axis1_rel( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return INT2FIX( dJointGetAMotorAxisRel(ptr->id, 1) ); }
ODE::AngularMotorJoint#axis2() —
/* * ODE::AngularMotorJoint#axis2() * -- * */ static VALUE ode_aMotorJoint_axis2( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return ode_get_amotor_joint_param3( ptr->id, 2, dJointGetAMotorAxis, ode_cOdeVector ); }
ODE::AngularMotorJoint#axis2Rel() —
/* * ODE::AngularMotorJoint#axis2Rel() * -- * */ static VALUE ode_aMotorJoint_axis2_rel( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return INT2FIX( dJointGetAMotorAxisRel(ptr->id, 2) ); }
ODE::AngularMotorJoint#axis3() —
/* * ODE::AngularMotorJoint#axis3() * -- * */ static VALUE ode_aMotorJoint_axis3( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return ode_get_amotor_joint_param3( ptr->id, 3, dJointGetAMotorAxis, ode_cOdeVector ); }
ODE::AngularMotorJoint#axis3Rel() —
/* * ODE::AngularMotorJoint#axis3Rel() * -- * */ static VALUE ode_aMotorJoint_axis3_rel( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return INT2FIX( dJointGetAMotorAxisRel(ptr->id, 3) ); }
ODE::AngularMotorJoint#eulerMode=( boolean ) — If set to true, the angular motor mode is set to automatically compute Euler angles. The first axis is also automatically computed. The AMotor axes must be set correctly when in this mode, as described below. When this mode is initially set the current relative orientations of the bodies will correspond to all euler angles at zero. If set to false (the default), the angular motor axes and joint angle settings are entirely controlled by the user.
/* * ODE::AngularMotorJoint#eulerMode=( boolean ) * -- * If set to <tt>true</tt>, the angular motor mode is set to automatically * compute Euler angles. The first axis is also automatically computed. The * AMotor axes must be set correctly when in this mode, as described below. When * this mode is initially set the current relative orientations of the bodies * will correspond to all euler angles at zero. If set to <tt>false</tt> (the * default), the angular motor axes and joint angle settings are entirely * controlled by the user. */ static VALUE ode_aMotorJoint_euler_mode_eq( self, mode ) VALUE self, mode; { ode_JOINT *ptr = get_joint( self ); if ( RTEST(mode) ) dJointSetAMotorMode( ptr->id, dAMotorEuler ); else dJointSetAMotorMode( ptr->id, dAMotorUser ); return (RTEST(mode) ? Qtrue : Qfalse); }
ODE::AngularMotorJoint#eulerMode? — Returns true if the joint has been set to Euler mode.
/* * ODE::AngularMotorJoint#eulerMode? * -- * Returns true if the joint has been set to Euler mode. */ static VALUE ode_aMotorJoint_euler_mode_p( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); if ( dJointGetAMotorMode(ptr->id) == dAMotorEuler ) return Qtrue; else return Qfalse; }
ODE::AngularMotorJoint#motor1Angle() —
/* * ODE::AngularMotorJoint#motor1Angle() * -- * */ static VALUE ode_aMotorJoint_motor1_angle( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return rb_float_new( dJointGetAMotorAngle(ptr->id, 1) ); }
ODE::AngularMotorJoint#motor1Angle=( angle ) —
/* * ODE::AngularMotorJoint#motor1Angle=( angle ) * -- * */ static VALUE ode_aMotorJoint_motor1_angle_eq( self, angle ) VALUE self, angle; { ode_JOINT *ptr = get_joint( self ); dJointSetAMotorAngle( ptr->id, 1, (dReal)NUM2DBL(angle) ); return angle; }
ODE::AngularMotorJoint#motor1AngleRate() —
/* * ODE::AngularMotorJoint#motor1AngleRate() * -- * */ static VALUE ode_aMotorJoint_motor1_angle_rate( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return rb_float_new( dJointGetAMotorAngleRate(ptr->id, 1) ); }
ODE::AngularMotorJoint#motor2Angle() —
/* * ODE::AngularMotorJoint#motor2Angle() * -- * */ static VALUE ode_aMotorJoint_motor2_angle( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return rb_float_new( dJointGetAMotorAngle(ptr->id, 2) ); }
ODE::AngularMotorJoint#motor2Angle=( angle ) —
/* * ODE::AngularMotorJoint#motor2Angle=( angle ) * -- * */ static VALUE ode_aMotorJoint_motor2_angle_eq( self, angle ) VALUE self, angle; { ode_JOINT *ptr = get_joint( self ); dJointSetAMotorAngle( ptr->id, 2, (dReal)NUM2DBL(angle) ); return angle; }
ODE::AngularMotorJoint#motor2AngleRate() —
/* * ODE::AngularMotorJoint#motor2AngleRate() * -- * */ static VALUE ode_aMotorJoint_motor2_angle_rate( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return rb_float_new( dJointGetAMotorAngleRate(ptr->id, 2) ); }
ODE::AngularMotorJoint#motor3Angle() —
/* * ODE::AngularMotorJoint#motor3Angle() * -- * */ static VALUE ode_aMotorJoint_motor3_angle( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return rb_float_new( dJointGetAMotorAngle(ptr->id, 3) ); }
ODE::AngularMotorJoint#motor3Angle=( angle ) —
/* * ODE::AngularMotorJoint#motor3Angle=( angle ) * -- * */ static VALUE ode_aMotorJoint_motor3_angle_eq( self, angle ) VALUE self, angle; { ode_JOINT *ptr = get_joint( self ); dJointSetAMotorAngle( ptr->id, 3, (dReal)NUM2DBL(angle) ); return angle; }
ODE::AngularMotorJoint#motor3AngleRate() —
/* * ODE::AngularMotorJoint#motor3AngleRate() * -- * */ static VALUE ode_aMotorJoint_motor3_angle_rate( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return rb_float_new( dJointGetAMotorAngleRate(ptr->id, 3) ); }
ODE::AngularMotorJoint#numAxes — Get the number of angular axes that will be controlled by the AMotor.
/* * ODE::AngularMotorJoint#numAxes * -- * Get the number of angular axes that will be controlled by the AMotor. */ static VALUE ode_aMotorJoint_num_axes( self ) VALUE self; { ode_JOINT *ptr = get_joint( self ); return INT2FIX( dJointGetAMotorNumAxes(ptr->id) ); }
ODE::AngularMotorJoint#numAxes=( num ) — Set the number of angular axes that will be controlled by the AMotor. The num argument can range from 0 (which effectively deactivates the joint) to
/* * ODE::AngularMotorJoint#numAxes=( num ) * -- * Set the number of angular axes that will be controlled by the AMotor. The num * argument can range from 0 (which effectively deactivates the joint) to * 3. This is automatically set to 3 in eulerMode. */ static VALUE ode_aMotorJoint_num_axes_eq( self, arg ) VALUE self, arg; { ode_JOINT *ptr = get_joint( self ); int num = NUM2INT( arg ); if ( num < 0 || num > 3 ) rb_raise( rb_eRangeError, "Argument out of bounds: must be between 0 and 3." ); dJointSetAMotorNumAxes( ptr->id, num ); return INT2FIX( dJointGetAMotorNumAxes(ptr->id) ); }
ODE::AngularMotorJoint#setAxis1( mode, axis ) — Set the 1st axis of the AngularMotorJoint to the given mode and axis. Each axis can have one of three ``relative orientation’’ modes, selected by mode:
ODE::Joint::GlobalFrameOrientation: | The axis is anchored to the global frame. |
ODE::Joint::Body1Orientation: | The axis is anchored to the first body. |
ODE::Joint::Body2Orientation: | The axis is anchored to the second body. |
The axis vector, specified in global coordinates regardless of the mode, can be any object which returns an array with 3 numeric values when to_ary is called on it, such as an ODE::Position object, a ODE::Vector, or an Array with 3 numeric values.
/* * ODE::AngularMotorJoint#setAxis1( mode, axis ) * -- * Set the 1st axis of the AngularMotorJoint to the given mode and axis. Each * axis can have one of three ``relative orientation'' modes, selected by <tt>mode</tt>: * * <tt>ODE::Joint::GlobalFrameOrientation</tt>:: The axis is anchored to the global frame. * <tt>ODE::Joint::Body1Orientation</tt>:: The axis is anchored to the first body. * <tt>ODE::Joint::Body2Orientation</tt>:: The axis is anchored to the second body. * * The axis vector, specified in global coordinates regardless of the * <tt>mode</tt>, can be any object which returns an array with 3 numeric values * when <tt>to_ary</tt> is called on it, such as an ODE::Position object, a * ODE::Vector, or an Array with 3 numeric values. */ static VALUE ode_aMotorJoint_set_axis1( self, mode, axis ) VALUE self, mode, axis; { ode_JOINT *ptr = get_joint( self ); VALUE axisArray; int rel = NUM2INT(mode); /* Bounds-check the relmode */ if ( rel < 0 || rel > 2 ) rb_raise( rb_eArgError, "Invalid mode '%d': Must be 0, 1, or 2.", rel ); /* Convert the axis argument to a 3rd order vector */ if ( RARRAY(axis)->len == 1 ) axisArray = ode_obj_to_ary3( *(RARRAY(axis)->ptr), "axis vector" ); else axisArray = ode_obj_to_ary3( axis, "axis vector" ); /* Set the axis */ dJointSetAMotorAxis( ptr->id, 1, rel, (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr )), (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr + 1)), (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr + 2)) ); return Qtrue; }
ODE::AngularMotorJoint#setAxis2( mode, axis ) — Set the 2nd axis of the AngularMotorJoint to the given mode and axis. Each axis can have one of three ``relative orientation’’ modes, selected by mode:
ODE::Joint::GlobalFrameOrientation: | The axis is anchored to the global frame. |
ODE::Joint::Body1Orientation: | The axis is anchored to the first body. |
ODE::Joint::Body2Orientation: | The axis is anchored to the second body. |
The axis vector, specified in global coordinates regardless of the mode, can be any object which returns an array with 3 numeric values when to_ary is called on it, such as an ODE::Position object, a ODE::Vector, or an Array with 3 numeric values.
/* * ODE::AngularMotorJoint#setAxis2( mode, axis ) * -- * Set the 2nd axis of the AngularMotorJoint to the given mode and axis. Each * axis can have one of three ``relative orientation'' modes, selected by * <tt>mode</tt>: * * <tt>ODE::Joint::GlobalFrameOrientation</tt>:: The axis is anchored to the global frame. * <tt>ODE::Joint::Body1Orientation</tt>:: The axis is anchored to the first body. * <tt>ODE::Joint::Body2Orientation</tt>:: The axis is anchored to the second body. * * The axis vector, specified in global coordinates regardless of the * <tt>mode</tt>, can be any object which returns an array with 3 numeric values * when <tt>to_ary</tt> is called on it, such as an ODE::Position object, a * ODE::Vector, or an Array with 3 numeric values. */ static VALUE ode_aMotorJoint_set_axis2( self, mode, axis ) VALUE self, mode, axis; { ode_JOINT *ptr = get_joint( self ); VALUE axisArray; int rel = NUM2INT(mode); /* Bounds-check the relmode */ if ( rel < 0 || rel > 2 ) rb_raise( rb_eArgError, "Invalid mode '%d': Must be 0, 1, or 2.", rel ); /* Convert the axis argument to a 3rd order vector */ if ( RARRAY(axis)->len == 1 ) axisArray = ode_obj_to_ary3( *(RARRAY(axis)->ptr), "axis vector" ); else axisArray = ode_obj_to_ary3( axis, "axis vector" ); /* Set the axis */ dJointSetAMotorAxis( ptr->id, 2, rel, (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr )), (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr + 1)), (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr + 2)) ); return Qtrue; }
ODE::AngularMotorJoint#setAxis3( mode, axis ) — Set the 3rd axis of the AngularMotorJoint to the given mode and axis. Each axis can have one of three ``relative orientation’’ modes, selected by mode:
ODE::Joint::GlobalFrameOrientation: | The axis is anchored to the global frame. |
ODE::Joint::Body1Orientation: | The axis is anchored to the first body. |
ODE::Joint::Body2Orientation: | The axis is anchored to the second body. |
The axis vector, specified in global coordinates regardless of the mode, can be any object which returns an array with 3 numeric values when to_ary is called on it, such as an ODE::Position object, a ODE::Vector, or an Array with 3 numeric values.
/* * ODE::AngularMotorJoint#setAxis3( mode, axis ) * -- * Set the 3rd axis of the AngularMotorJoint to the given mode and axis. Each * axis can have one of three ``relative orientation'' modes, selected by * <tt>mode</tt>: * * <tt>ODE::Joint::GlobalFrameOrientation</tt>:: The axis is anchored to the global frame. * <tt>ODE::Joint::Body1Orientation</tt>:: The axis is anchored to the first body. * <tt>ODE::Joint::Body2Orientation</tt>:: The axis is anchored to the second body. * * The axis vector, specified in global coordinates regardless of the * <tt>mode</tt>, can be any object which returns an array with 3 numeric values * when <tt>to_ary</tt> is called on it, such as an ODE::Position object, a * ODE::Vector, or an Array with 3 numeric values. */ static VALUE ode_aMotorJoint_set_axis3( self, mode, axis ) VALUE self, mode, axis; { ode_JOINT *ptr = get_joint( self ); VALUE axisArray; int rel = NUM2INT(mode); /* Bounds-check the relmode */ if ( rel < 0 || rel > 2 ) rb_raise( rb_eArgError, "Invalid mode '%d': Must be 0, 1, or 2.", rel ); /* Convert the axis argument to a 3rd order vector */ if ( RARRAY(axis)->len == 1 ) axisArray = ode_obj_to_ary3( *(RARRAY(axis)->ptr), "axis vector" ); else axisArray = ode_obj_to_ary3( axis, "axis vector" ); /* Set the axis */ dJointSetAMotorAxis( ptr->id, 3, rel, (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr )), (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr + 1)), (dReal)NUM2DBL(*(RARRAY(axisArray)->ptr + 2)) ); return Qtrue; }