From: Matthias B. <mb...@us...> - 2006-05-30 14:23:56
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918/src Modified Files: declarations.pyx mass.pyx Log Message: Applied Chris Bainbridge's patch that adds the Mass.setBoxTotal() method, and while I was at it I added the other set*Total() methods, too. Index: mass.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/mass.pyx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mass.pyx 15 Nov 2004 20:16:03 -0000 1.6 --- mass.pyx 30 May 2006 14:23:44 -0000 1.7 *************** *** 91,94 **** --- 91,107 ---- dMassSetSphere(&self._mass, density, radius) + def setSphereTotal(self, total_mass, radius): + """setSphereTotal(total_mass, radius) + + Set the mass parameters to represent a sphere of the given radius + and mass, with the center of mass at (0,0,0) relative to the body. + + @param total_mass: The total mass of the sphere + @param radius: The radius of the sphere + @type total_mass: float + @type radius: float + """ + dMassSetSphere(&self._mass, total_mass, radius) + def setCappedCylinder(self, density, direction, r, h): """setCappedCylinder(density, direction, r, h) *************** *** 113,116 **** --- 126,151 ---- dMassSetCappedCylinder(&self._mass, density, direction, r, h) + def setCappedCylinderTotal(self, total_mass, direction, r, h): + """setCappedCylinderTotal(total_mass, direction, r, h) + + Set the mass parameters to represent a capped cylinder of the + given parameters and mass, with the center of mass at + (0,0,0) relative to the body. The radius of the cylinder (and + the spherical cap) is r. The length of the cylinder (not + counting the spherical cap) is h. The cylinder's long axis is + oriented along the body's x, y or z axis according to the + value of direction (1=x, 2=y, 3=z). + + @param total_mass: The total mass of the cylinder + @param direction: The direction of the cylinder (1=x axis, 2=y axis, 3=z axis) + @param r: The radius of the cylinder + @param h: The length of the cylinder (without the caps) + @type total_mass: float + @type direction: int + @type r: float + @type h: float + """ + dMassSetCappedCylinderTotal(&self._mass, total_mass, direction, r, h) + def setCylinder(self, density, direction, r, h): """setCylinder(density, direction, r, h) *************** *** 134,137 **** --- 169,193 ---- dMassSetCylinder(&self._mass, density, direction, r, h) + def setCylinderTotal(self, total_mass, direction, r, h): + """setCylinderTotal(total_mass, direction, r, h) + + Set the mass parameters to represent a flat-ended cylinder of + the given parameters and mass, with the center of mass at + (0,0,0) relative to the body. The radius of the cylinder is r. + The length of the cylinder is h. The cylinder's long axis is + oriented along the body's x, y or z axis according to the value + of direction (1=x, 2=y, 3=z). + + @param total_mass: The total mass of the cylinder + @param direction: The direction of the cylinder (1=x axis, 2=y axis, 3=z axis) + @param r: The radius of the cylinder + @param h: The length of the cylinder + @type total_mass: float + @type direction: int + @type r: float + @type h: float + """ + dMassSetCylinderTotal(&self._mass, total_mass, direction, r, h) + def setBox(self, density, lx, ly, lz): """setBox(density, lx, ly, lz) *************** *** 153,156 **** --- 209,231 ---- dMassSetBox(&self._mass, density, lx, ly, lz) + def setBoxTotal(self, total_mass, lx, ly, lz): + """setBoxTotal(total_mass, lx, ly, lz) + + Set the mass parameters to represent a box of the given + dimensions and mass, with the center of mass at (0,0,0) + relative to the body. The side lengths of the box along the x, + y and z axes are lx, ly and lz. + + @param total_mass: The total mass of the box + @param lx: The length along the x axis + @param ly: The length along the y axis + @param lz: The length along the z axis + @type total_mass: float + @type lx: float + @type ly: float + @type lz: float + """ + dMassSetBoxTotal(&self._mass, total_mass, lx, ly, lz) + def adjust(self, newmass): """adjust(newmass) Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** declarations.pyx 13 Apr 2006 13:20:17 -0000 1.15 --- declarations.pyx 30 May 2006 14:23:44 -0000 1.16 *************** *** 297,306 **** --- 297,313 ---- dReal I12, dReal I13, dReal I23) void dMassSetSphere (dMass *, dReal density, dReal radius) + void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius) void dMassSetCappedCylinder (dMass *, dReal density, int direction, dReal a, dReal b) + void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction, + dReal a, dReal b) void dMassSetCylinder (dMass *, dReal density, int direction, dReal radius, dReal length) + void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction, + dReal radius, dReal length) void dMassSetBox (dMass *, dReal density, dReal lx, dReal ly, dReal lz) + void dMassSetBoxTotal (dMass *, dReal total_mass, + dReal lx, dReal ly, dReal lz) void dMassAdjust (dMass *, dReal newmass) void dMassTranslate (dMass *, dReal x, dReal y, dReal z) |