public static double dGeomCapsulePointDepth (DCapsule ccylinder, double x, double y, double z) { return ccylinder.getPointDepth(new DVector3(x, y, z)); }
public static void dGeomCapsuleSetParams (DCapsule ccylinder, double radius, double length) { ccylinder.setParams(radius, length); } //ODE_API
ccyl.setParams (r,l); dMakeRandomVector (p,1.0); ccyl.setPosition (p); dRFromAxisAndAngle (R,dRandReal()*2-1,dRandReal()*2-1, dRandReal()*2-1,dRandReal()*10-5); ccyl.setRotation (R); if (dFabs(ccyl.getPointDepth (a) - r) >= tol) if (testFAILED()) return false; beta = dRandReal()-0.5; for (j=0; j<3; j++) a.set(j, p.get(j) + x*R.get(j,0) + y*R.get(j,1) + l*beta*R.get(j,2) ); if (dFabs(ccyl.getPointDepth (a)) >= tol) if (testFAILED()) return false; if (dFabs(ccyl.getPointDepth (a)) >= tol) if (testFAILED()) return false; beta = dRandReal()-0.5; for (j=0; j<3; j++) a.set(j, p.get(j) + a.get(j)*r*0.99 + l*beta*R.get(j,2) ); if (ccyl.getPointDepth (a) < 0) if (testFAILED()) return false; beta = dRandReal()-0.5; for (j=0; j<3; j++) a.set(j, p.get(j) + x*R.get(j,0) + y*R.get(j,1) + l*beta*R.get(j,2) ); if (dFabs(ccyl.getPointDepth (a) - d) >= tol) if (testFAILED()) return false; if (dFabs(ccyl.getPointDepth (a) - d) >= tol) if (testFAILED()) return false;
body.setMass(m); DCapsule geom = OdeHelper.createCapsule(space, radius, cyllen); geom.setBody(body); DVector3 za = new DVector3(p2); (za.sub(p1)).safeNormalize();
ccyl.setParams (r,l); dMakeRandomVector (p,1.0); ccyl.setPosition (p); dRFromAxisAndAngle (R,dRandReal()*2-1,dRandReal()*2-1, dRandReal()*2-1,dRandReal()*10-5); ccyl.setRotation (R); if (OdeHelper.collide (ray,ccyl,1,contacts) != 1) if (testFAILED()) return false; if (dFabs (ccyl.getPointDepth (contacts.get(0).pos)) > tol) if (testFAILED()) return false; if (OdeHelper.collide (ray,ccyl,1,contacts) != 1) if (testFAILED()) return false; if (dFabs (ccyl.getPointDepth (contacts.get(0).pos)) > tol) if (testFAILED()) return false; if (dFabs (ccyl.getPointDepth (contacts.get(0).pos)) > tol) if (testFAILED()) return false;
body.setMass(m); DCapsule geom = OdeHelper.createCapsule(space, radius, cyllen); geom.setBody(body); DVector3 za = new DVector3(p2); (za.sub(p1)).safeNormalize();
public static void dGeomCapsuleSetParams (DCapsule ccylinder, double radius, double length) { ccylinder.setParams(radius, length); } //ODE_API
public static double dGeomCapsulePointDepth (DCapsule ccylinder, double x, double y, double z) { return ccylinder.getPointDepth(new DVector3(x, y, z)); }
private Buoy[] generateBuoys(int bn, DCapsule geom) { double length = geom.getLength(); double radius = geom.getRadius(); Buoy[] buoys = new Buoy[bn]; int i = 0; for (int bz = 0; bz < bn; bz++) { float pz = (float) (((float) bz / (bn - 1) - 0.5) * length); buoys[i++] = new Buoy(0, 0, pz, (float) radius, 1); } return buoys; }
private void drawGeom (DGeom g, DVector3C pos, DMatrix3C R) { if (g==null) return; if (pos==null) pos = g.getPosition (); if (R==null) R = g.getRotation (); if (g instanceof DBox) { DVector3C sides = ((DBox)g).getLengths(); dsDrawBox (pos,R,sides); } else if (g instanceof DSphere) { dsDrawSphere( pos,R, ((DSphere)g).getRadius() ); } else if (g instanceof DCapsule) { DCapsule c = (DCapsule) g; dsDrawCapsule( pos, R, c.getLength(), c.getRadius() ); } else if (g instanceof DCylinder) { DCylinder c = (DCylinder) g; dsDrawCylinder (pos, R, c.getLength(), c.getRadius()); } else if (g instanceof DConvex) { //dVector3 sides={0.50,0.50,0.50}; dsDrawConvex(pos,R,ConvexCubeGeom.planes, ConvexCubeGeom.planecount, ConvexCubeGeom.points, ConvexCubeGeom.pointcount, ConvexCubeGeom.polygons); } }