use of artisynth.core.mechmodels.RigidBody in project artisynth_core by artisynth.
the class HydrostatDemo method addContactBlock.
public void addContactBlock(MechModel mech) {
RigidBody block = new RigidBody();
block.setName("block");
block.setMesh(MeshFactory.createQuadBox(100, 100, 20), null);
block.setInertia(SpatialInertia.createBoxInertia(1, 100, 100, 20));
block.setPose(new RigidTransform3d(new Vector3d(-50, 0, 40), new RotationMatrix3d()));
mech.addRigidBody(block);
}
use of artisynth.core.mechmodels.RigidBody in project artisynth_core by artisynth.
the class SkinDemo method addLoad.
public void addLoad() {
RigidBody lowerArm = model.rigidBodies().get("lower");
if (lowerArm == null) {
return;
}
double mass = 1.0;
Particle load = new Particle(mass, new Point3d(-14.14, 0, -14.14));
load.setName("load");
// Particle load = new Particle(mass,new Point3d(0,0,0));
RenderProps rp = new RenderProps(model.getRenderProps());
rp.setShading(Renderer.Shading.SMOOTH);
rp.setPointColor(Color.ORANGE);
rp.setPointRadius(len / 20);
load.setRenderProps(rp);
model.addParticle(load);
model.attachPoint(load, lowerArm, new Point3d(0, 0, len / 2));
}
use of artisynth.core.mechmodels.RigidBody in project artisynth_core by artisynth.
the class SkinDemo method addJoint.
public void addJoint() {
RigidBody upperArm = model.rigidBodies().get("upper");
RigidBody lowerArm = model.rigidBodies().get("lower");
if (upperArm == null || lowerArm == null) {
return;
}
RevoluteJoint j = new RevoluteJoint();
j.setName("elbow");
RigidTransform3d TCA = new RigidTransform3d();
TCA.p.z = -len / 2;
TCA.R.setAxisAngle(1, 0, 0, Math.PI / 2);
RigidTransform3d TCW = new RigidTransform3d();
TCW.R.setAxisAngle(1, 0, 0, Math.PI / 2);
j.setBodies(lowerArm, TCA, null, TCW);
j.setAxisLength(len / 3);
model.addBodyConnector(j);
upperArm.setDynamic(false);
}
use of artisynth.core.mechmodels.RigidBody in project artisynth_core by artisynth.
the class PointModel method addCenter.
public void addCenter() {
RigidBody body = new RigidBody("body");
body.setInertia(SpatialInertia.createSphereInertia(mass, len / 25));
model.addRigidBody(body);
RenderProps.setVisible(body, false);
RigidBody fixed = new RigidBody("fixed");
fixed.setInertia(SpatialInertia.createSphereInertia(mass, len / 25));
fixed.setDynamic(false);
model.addRigidBody(fixed);
RenderProps.setVisible(fixed, false);
if (useReactionForceTargetP) {
// add spherical joint for reaction force target testing
SphericalJoint joint = new SphericalJoint(body, fixed, Point3d.ZERO);
joint.setName("center_constraint");
model.addBodyConnector(joint);
addMonitor(new ConnectorForceRenderer(joint));
}
center = new FrameMarker();
center.setName("center");
center.setPointDamping(pointDamping);
model.addFrameMarker(center, body, Point3d.ZERO);
}
use of artisynth.core.mechmodels.RigidBody in project artisynth_core by artisynth.
the class SimpleCollide method removeObject.
private void removeObject(ModelComponent comp, ObjectType type) {
MechModel mechMod = (MechModel) models().get(0);
ComponentList<Probe> myProbes = getInputProbes();
for (Probe p : myProbes) {
System.out.println("type's name: " + type.name());
System.out.println("probe's name: " + p.getName());
if (type.name().equals(p.getName())) {
removeInputProbe(p);
}
}
switch(type) {
case FemEllipsoid:
case FemSphere:
case FemCube:
{
mechMod.removeModel((FemModel3d) comp);
break;
}
case Box:
case Molar:
case Bin:
case Paw:
case House:
{
mechMod.removeRigidBody((RigidBody) comp);
break;
}
default:
{
throw new InternalErrorException("Unimplemented type " + type);
}
}
}
Aggregations