dsSetColor(.3f, .3f, 1f); dsDrawBox(kbox.getPosition(), kbox.getRotation(), lengths); double radius = kpole.getRadius(); double length = kpole.getLength(); dsSetTexture(DS_TEXTURE_NUMBER.DS_CHECKERED); dsSetColor(1, 1, 0); dsDrawCylinder(kpole.getPosition(), kpole.getRotation(), length, radius);
DQuaternion qAng = new DQuaternion(); dQFromAxisAndAngle (qAng,axisR1.get(X), axisR1.get(Y), axisR1.get(Z), ang1); DQuaternionC q = geomAXIS1.getQuaternion (); dsDrawCylinder (anchorPos, R, geomAXIS1.getLength(), geomAXIS1.getRadius()); DQuaternion qAng = new DQuaternion(); DQuaternion qq = new DQuaternion(), qq1 = new DQuaternion(); DQuaternionC q = geomAXIS2.getQuaternion(); dsDrawCylinder (anchorPos, R, geomAXIS2.getLength(), geomAXIS2.getRadius());
geomAXIS1.setRotation (R); geomAXIS1.setCategoryBits (catBits[AXIS1]); geomAXIS1.setCollideBits ( catBits[ALL] & ~catBits[JOINT] & ~catBits[W] & ~catBits[D]); geomAXIS2.setRotation (R); geomAXIS2.setCategoryBits (catBits[AXIS2]); geomAXIS2.setCollideBits ( catBits[ALL] & ~catBits[JOINT] & ~catBits[W] & ~catBits[D]); geomAXIS1.setPosition (0,0,2.5); geomAXIS2.setPosition (0,0,2.5);
cylbody.setMass (m); cylgeom = OdeHelper.createCylinder(null, RADIUS, WHEELW); cylgeom.setBody (cylbody); cylgeom.setOffsetRotation(mat); cylgeom.destroy();
kbox.setBody(kbody); kpole = OdeHelper.createCylinder(space, .125, 1.5); kpole.setBody(kbody); kpole.setOffsetPosition(0, 0, 0.8);
kbox.setBody(kbody); kpole = OdeHelper.createCylinder(space, .125, 1.5); kpole.setBody(kbody); dGeomSetOffsetPosition(kpole, 0, 0, 0.8);
double length, radius; radius = kpole.getRadius(); length = kpole.getLength(); dsSetTexture(DS_TEXTURE_NUMBER.DS_CHECKERED); dsSetColor(1, 1, 0); dsDrawCylinder(kpole.getPosition(), kpole.getRotation(), length, radius);
private Buoy[] generateBuoys(int bn, DCylinder geom) { double length = geom.getLength(); double radius = geom.getRadius(); double bRadius = Math.min(0.25 * length, 0.5 * radius); int segments = 2; Buoy[] buoys = new Buoy[bn * segments]; int i = 0; for (int bz = 0; bz < segments; bz++) { float pz = (float) (((float) bz / (segments - 1) - 0.5) * (length - bRadius)); for (int bc = 0; bc < bn; bc++) { double a = 2 * Math.PI * bc / bn; float px = (float) ((radius - bRadius) * Math.cos(a)); float py = (float) ((radius - bRadius) * Math.sin(a)); buoys[i++] = new Buoy(px, py, pz, (float) bRadius, 1); } } return buoys; }
private void drawGeom (DGeom g) { DVector3C pos = g.getPosition(); DMatrix3C R = g.getRotation(); //int type = dGeomGetClass (g); if (g instanceof DBox) { DVector3C sides = ((DBox)g).getLengths (); dsDrawBox (pos,R,sides); } if (g instanceof DCylinder) { double r = ((DCylinder)g).getRadius(); double l = ((DCylinder)g).getLength(); dsDrawCylinder (pos, R, l, r); } }
private void drawGeom(DGeom g) { DVector3C pos = g.getPosition(); DMatrix3C rot = g.getRotation(); if (g instanceof DCylinder) { DCylinder cyl = (DCylinder) g; if (g == geom1) { dsSetColorAlpha(1, 0, 0, 1); } else { dsSetColorAlpha(0, 1, 0, 1); } dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); dsDrawCylinder(pos, rot, cyl.getLength(), cyl.getRadius()); } else { System.exit(0); } }
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); } }