From: Matthias B. <mb...@us...> - 2004-07-31 12:27:39
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14481/src Modified Files: body.pyx declarations.pyx world.pyx Log Message: Added some more missing methods and doc strings. Index: world.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/world.pyx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** world.pyx 27 Jun 2004 20:46:17 -0000 1.1 --- world.pyx 31 Jul 2004 12:27:27 -0000 1.2 *************** *** 5,8 **** --- 5,13 ---- The world object is a container for rigid bodies and joints. + + + Constructor:: + + World() """ *************** *** 18,27 **** # setGravity def setGravity(self, gravity): ! """Set the world's global gravity vector.""" dWorldSetGravity(self.wid, gravity[0], gravity[1], gravity[2]) # getGravity def getGravity(self): ! """Get the world's global gravity vector.""" cdef dVector3 g dWorldGetGravity(self.wid, g) --- 23,41 ---- # setGravity def setGravity(self, gravity): ! """setGravity(gravity) ! ! Set the world's global gravity vector. ! ! @param gravity: Gravity vector ! @type gravity: 3-sequence of floats ! """ dWorldSetGravity(self.wid, gravity[0], gravity[1], gravity[2]) # getGravity def getGravity(self): ! """getGravity() -> 3-tuple ! ! Return the world's global gravity vector as a 3-tuple of floats. ! """ cdef dVector3 g dWorldGetGravity(self.wid, g) *************** *** 30,88 **** # setERP def setERP(self, erp): dWorldSetERP(self.wid, erp) # getERP def getERP(self): return dWorldGetERP(self.wid) # setCFM def setCFM(self, cfm): dWorldSetCFM(self.wid, cfm) # getCFM def getCFM(self): return dWorldGetCFM(self.wid) # step def step(self, stepsize): dWorldStep(self.wid, stepsize) # quickStep def quickStep(self, stepsize): dWorldQuickStep(self.wid, stepsize) # setQuickStepNumIterations def setQuickStepNumIterations(self, num): dWorldSetQuickStepNumIterations(self.wid, num) # getQuickStepNumIterations def getQuickStepNumIterations(self): return dWorldGetQuickStepNumIterations(self.wid) # createBody ! def createBody(self): ! return Body(self) # createBallJoint ! def createBallJoint(self, jointgroup=None): ! return BallJoint(self, jointgroup) # createHingeJoint ! def createHingeJoint(self, jointgroup=None): ! return HingeJoint(self, jointgroup) # createHinge2Joint ! def createHinge2Joint(self, jointgroup=None): ! return Hinge2Joint(self, jointgroup) # createSliderJoint ! def createSliderJoint(self, jointgroup=None): ! return SliderJoint(self, jointgroup) # createFixedJoint ! def createFixedJoint(self, jointgroup=None): ! return FixedJoint(self, jointgroup) # createContactJoint ! def createContactJoint(self, jointgroup, contact): ! return ContactJoint(self, jointgroup, contact) --- 44,350 ---- # setERP def setERP(self, erp): + """setERP(erp) + + Set the global ERP value, that controls how much error + correction is performed in each time step. Typical values are + in the range 0.1-0.8. The default is 0.2. + + @param erp: Global ERP value + @type erp: float + """ dWorldSetERP(self.wid, erp) # getERP def getERP(self): + """getERP() -> float + + Get the global ERP value, that controls how much error + correction is performed in each time step. Typical values are + in the range 0.1-0.8. The default is 0.2. + """ return dWorldGetERP(self.wid) # setCFM def setCFM(self, cfm): + """setCFM(cfm) + + Set the global CFM (constraint force mixing) value. Typical + values are in the range 10E-9 - 1. The default is 10E-5 if + single precision is being used, or 10E-10 if double precision + is being used. + + @param cfm: Constraint force mixing value + @type cfm: float + """ dWorldSetCFM(self.wid, cfm) # getCFM def getCFM(self): + """getCFM() -> float + + Get the global CFM (constraint force mixing) value. Typical + values are in the range 10E-9 - 1. The default is 10E-5 if + single precision is being used, or 10E-10 if double precision + is being used. + """ return dWorldGetCFM(self.wid) # step def step(self, stepsize): + """step(stepsize) + + Step the world. This uses a "big matrix" method that takes + time on the order of O(m3) and memory on the order of O(m2), where m + is the total number of constraint rows. + + For large systems this will use a lot of memory and can be + very slow, but this is currently the most accurate method. + + @param stepsize: Time step + @type stepsize: float + """ + dWorldStep(self.wid, stepsize) # quickStep def quickStep(self, stepsize): + """quickStep(stepsize) + + Step the world. This uses an iterative method that takes time + on the order of O(m*N) and memory on the order of O(m), where m is + the total number of constraint rows and N is the number of + iterations. + + For large systems this is a lot faster than dWorldStep, but it + is less accurate. + + @param stepsize: Time step + @type stepsize: float + """ dWorldQuickStep(self.wid, stepsize) # setQuickStepNumIterations def setQuickStepNumIterations(self, num): + """setQuickStepNumIterations(num) + + Set the number of iterations that the QuickStep method + performs per step. More iterations will give a more accurate + solution, but will take longer to compute. The default is 20 + iterations. + + @param num: Number of iterations + @type num: int + """ + dWorldSetQuickStepNumIterations(self.wid, num) # getQuickStepNumIterations def getQuickStepNumIterations(self): + """getQuickStepNumIterations() -> int + + Get the number of iterations that the QuickStep method + performs per step. More iterations will give a more accurate + solution, but will take longer to compute. The default is 20 + iterations. + """ return dWorldGetQuickStepNumIterations(self.wid) + # setQuickStepNumIterations + def setContactMaxCorrectingVel(self, vel): + """setContactMaxCorrectingVel(vel) + + Set the maximum correcting velocity that contacts are allowed + to generate. The default value is infinity (i.e. no + limit). Reducing this value can help prevent "popping" of + deeply embedded objects. + + @param vel: Maximum correcting velocity + @type vel: float + """ + dWorldSetContactMaxCorrectingVel(self.wid, vel) + + # getQuickStepNumIterations + def getContactMaxCorrectingVel(self): + """getContactMaxCorrectingVel() -> float + + Get the maximum correcting velocity that contacts are allowed + to generate. The default value is infinity (i.e. no + limit). Reducing this value can help prevent "popping" of + deeply embedded objects. + """ + return dWorldGetContactMaxCorrectingVel(self.wid) + + # setContactSurfaceLayer + def setContactSurfaceLayer(self, depth): + """setContactSurfaceLayer(depth) + + Set the depth of the surface layer around all geometry + objects. Contacts are allowed to sink into the surface layer + up to the given depth before coming to rest. The default value + is zero. Increasing this to some small value (e.g. 0.001) can + help prevent jittering problems due to contacts being + repeatedly made and broken. + + @param depth: Surface layer depth + @type depth: float + """ + dWorldSetContactSurfaceLayer(self.wid, depth) + + # getContactSurfaceLayer + def getContactSurfaceLayer(self): + """getContactSurfaceLayer() + + Get the depth of the surface layer around all geometry + objects. Contacts are allowed to sink into the surface layer + up to the given depth before coming to rest. The default value + is zero. Increasing this to some small value (e.g. 0.001) can + help prevent jittering problems due to contacts being + repeatedly made and broken. + """ + return dWorldGetContactSurfaceLayer(self.wid) + + # setAutoDisableFlag + def setAutoDisableFlag(self, flag): + """setAutoDisableFlag(flag) + + Set the default auto-disable flag for newly created bodies. + + @param flag: True = Do auto disable + @type flag: bool + """ + dWorldSetAutoDisableFlag(self.wid, flag) + + # getAutoDisableFlag + def getAutoDisableFlag(self): + """getAutoDisableFlag() -> bool + + Get the default auto-disable flag for newly created bodies. + """ + return dWorldGetAutoDisableFlag(self.wid) + + + # setAutoDisableLinearThreshold + def setAutoDisableLinearThreshold(self, threshold): + """setAutoDisableLinearThreshold(threshold) + + Set the default auto-disable linear threshold for newly created + bodies. + + @param threshold: Linear threshold + @type threshold: float + """ + dWorldSetAutoDisableLinearThreshold(self.wid, threshold) + + # getAutoDisableLinearThreshold + def getAutoDisableLinearThreshold(self): + """getAutoDisableLinearThreshold() -> float + + Get the default auto-disable linear threshold for newly created + bodies. + """ + return dWorldGetAutoDisableLinearThreshold(self.wid) + + # setAutoDisableAngularThreshold + def setAutoDisableAngularThreshold(self, threshold): + """setAutoDisableAngularThreshold(threshold) + + Set the default auto-disable angular threshold for newly created + bodies. + + @param threshold: Angular threshold + @type threshold: float + """ + dWorldSetAutoDisableAngularThreshold(self.wid, threshold) + + # getAutoDisableAngularThreshold + def getAutoDisableAngularThreshold(self): + """getAutoDisableAngularThreshold() -> float + + Get the default auto-disable angular threshold for newly created + bodies. + """ + return dWorldGetAutoDisableAngularThreshold(self.wid) + + # setAutoDisableSteps + def setAutoDisableSteps(self, steps): + """setAutoDisableSteps(steps) + + Set the default auto-disable steps for newly created bodies. + + @param steps: Auto disable steps + @type steps: int + """ + dWorldSetAutoDisableSteps(self.wid, steps) + + # getAutoDisableSteps + def getAutoDisableSteps(self): + """getAutoDisableSteps() -> int + + Get the default auto-disable steps for newly created bodies. + """ + return dWorldGetAutoDisableSteps(self.wid) + + # setAutoDisableTime + def setAutoDisableTime(self, time): + """setAutoDisableTime(time) + + Set the default auto-disable time for newly created bodies. + + @param time: Auto disable time + @type time: float + """ + dWorldSetAutoDisableTime(self.wid, time) + + # getAutoDisableTime + def getAutoDisableTime(self): + """getAutoDisableTime() -> float + + Get the default auto-disable time for newly created bodies. + """ + return dWorldGetAutoDisableTime(self.wid) + + # impulseToForce + def impulseToForce(self, stepsize, impulse): + """impulseToForce(stepsize, impulse) -> 3-tuple + + If you want to apply a linear or angular impulse to a rigid + body, instead of a force or a torque, then you can use this + function to convert the desired impulse into a force/torque + vector before calling the dBodyAdd... function. + + @param stepsize: Time step + @param impulse: Impulse vector + @type stepsize: float + @type impulse: 3-tuple of floats + """ + cdef dVector3 force + dWorldImpulseToForce(self.wid, stepsize, impulse[0], impulse[1], impulse[2], force) + return (force[0], force[1], force[2]) + # createBody ! # def createBody(self): ! # return Body(self) # createBallJoint ! # def createBallJoint(self, jointgroup=None): ! # return BallJoint(self, jointgroup) # createHingeJoint ! # def createHingeJoint(self, jointgroup=None): ! # return HingeJoint(self, jointgroup) # createHinge2Joint ! # def createHinge2Joint(self, jointgroup=None): ! # return Hinge2Joint(self, jointgroup) # createSliderJoint ! # def createSliderJoint(self, jointgroup=None): ! # return SliderJoint(self, jointgroup) # createFixedJoint ! # def createFixedJoint(self, jointgroup=None): ! # return FixedJoint(self, jointgroup) # createContactJoint ! # def createContactJoint(self, jointgroup, contact): ! # return ContactJoint(self, jointgroup, contact) Index: body.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/body.pyx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** body.pyx 12 Jul 2004 17:30:08 -0000 1.3 --- body.pyx 31 Jul 2004 12:27:27 -0000 1.4 *************** *** 359,362 **** --- 359,452 ---- """ dBodySetTorque(self.bid, t[0], t[1], t[2]) + + # getRelPointPos + def getRelPointPos(self, p): + """getRelPointPos(p) -> 3-tuple + + Utility function that takes a point p on a body and returns + that point's position in global coordinates. The point p + must be given in body relative coordinates. + + @param p: Body point (local coordinates) + @type p: 3-sequence of floats + """ + + cdef dVector3 res + dBodyGetRelPointPos(self.bid, p[0], p[1], p[2], res) + return (res[0], res[1], res[2]) + + # getRelPointVel + def getRelPointVel(self, p): + """getRelPointVel(p) -> 3-tuple + + Utility function that takes a point p on a body and returns + that point's velocity in global coordinates. The point p + must be given in body relative coordinates. + + @param p: Body point (local coordinates) + @type p: 3-sequence of floats + """ + cdef dVector3 res + dBodyGetRelPointVel(self.bid, p[0], p[1], p[2], res) + return (res[0], res[1], res[2]) + + # getPointVel + def getPointVel(self, p): + """getPointVel(p) -> 3-tuple + + Utility function that takes a point p on a body and returns + that point's velocity in global coordinates. The point p + must be given in global coordinates. + + @param p: Body point (global coordinates) + @type p: 3-sequence of floats + """ + cdef dVector3 res + dBodyGetPointVel(self.bid, p[0], p[1], p[2], res) + return (res[0], res[1], res[2]) + + # getPosRelPoint + def getPosRelPoint(self, p): + """getPosRelPoint(p) -> 3-tuple + + This is the inverse of getRelPointPos(). It takes a point p in + global coordinates and returns the point's position in + body-relative coordinates. + + @param p: Body point (global coordinates) + @type p: 3-sequence of floats + """ + cdef dVector3 res + dBodyGetPosRelPoint(self.bid, p[0], p[1], p[2], res) + return (res[0], res[1], res[2]) + + # vectorToWorld + def vectorToWorld(self, v): + """vectorToWorld(v) -> 3-tuple + + Given a vector v expressed in the body coordinate system, rotate + it to the world coordinate system. + + @param v: Vector in body coordinate system + @type v: 3-sequence of floats + """ + cdef dVector3 res + dBodyVectorToWorld(self.bid, v[0], v[1], v[2], res) + return (res[0], res[1], res[2]) + + # vectorFromWorld + def vectorFromWorld(self, v): + """vectorFromWorld(v) -> 3-tuple + + Given a vector v expressed in the world coordinate system, rotate + it to the body coordinate system. + + @param v: Vector in world coordinate system + @type v: 3-sequence of floats + """ + cdef dVector3 res + dBodyVectorFromWorld(self.bid, v[0], v[1], v[2], res) + return (res[0], res[1], res[2]) + # Enable Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** declarations.pyx 29 Jul 2004 14:59:19 -0000 1.7 --- declarations.pyx 31 Jul 2004 12:27:27 -0000 1.8 *************** *** 115,118 **** --- 115,134 ---- void dWorldSetQuickStepNumIterations (dWorldID, int num) int dWorldGetQuickStepNumIterations (dWorldID) + void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel) + dReal dWorldGetContactMaxCorrectingVel (dWorldID) + void dWorldSetContactSurfaceLayer (dWorldID, dReal depth) + dReal dWorldGetContactSurfaceLayer (dWorldID) + void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable) + int dWorldGetAutoDisableFlag (dWorldID) + void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold) + dReal dWorldGetAutoDisableLinearThreshold (dWorldID) + void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold) + dReal dWorldGetAutoDisableAngularThreshold (dWorldID) + void dWorldSetAutoDisableSteps (dWorldID, int steps) + int dWorldGetAutoDisableSteps (dWorldID) + void dWorldSetAutoDisableTime (dWorldID, dReal time) + dReal dWorldGetAutoDisableTime (dWorldID) + void dWorldImpulseToForce (dWorldID, dReal stepsize, + dReal ix, dReal iy, dReal iz, dVector3 force) # Body *************** *** 154,157 **** --- 170,181 ---- void dBodyGetRelPointPos (dBodyID, dReal px, dReal py, dReal pz, dVector3 result) void dBodyGetRelPointVel (dBodyID, dReal px, dReal py, dReal pz, dVector3 result) + void dBodyGetPointVel (dBodyID, dReal px, dReal py, dReal pz, + dVector3 result) + void dBodyGetPosRelPoint (dBodyID, dReal px, dReal py, dReal pz, + dVector3 result) + void dBodyVectorToWorld (dBodyID, dReal px, dReal py, dReal pz, + dVector3 result) + void dBodyVectorFromWorld (dBodyID, dReal px, dReal py, dReal pz, + dVector3 result) void dBodySetFiniteRotationMode (dBodyID, int mode) |