use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.
the class PointModel method build.
public void build(DemoType demoType) {
myDemoType = demoType;
model = new MechModel("point");
model.setGravity(0, 0, 0);
model.setIntegrator(Integrator.Trapezoidal);
model.setMaxStepSize(0.01);
createModel(myDemoType);
setupRenderProps();
setWorkingDir(useReactionForceTargetP ? "reaction_force/" : "east/");
addTrackingController();
}
use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.
the class SimpleCollide method setTopObject.
public void setTopObject(ObjectType type) {
MechModel mechMod = (MechModel) models().get(0);
if (myTopType != type) {
if (myTopObject != null) {
if (myBottomObject != null) {
mechMod.clearCollisionBehavior(myTopObject, myBottomObject);
}
removeObject(myTopObject, myTopType);
}
Collidable comp = createObject("topObject", type);
setTopObject(comp, type);
addObject(comp, type);
createAndAddControlPanel("Top object", comp);
if (myBottomObject != null) {
mechMod.setCollisionBehavior(myTopObject, myBottomObject, true, myFriction);
}
}
}
use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.
the class SimpleCollide method setBottomObject.
public void setBottomObject(ObjectType type) {
MechModel mechMod = (MechModel) models().get(0);
if (myBottomType != type) {
if (myBottomObject != null) {
if (myTopObject != null) {
mechMod.clearCollisionBehavior(myTopObject, myBottomObject);
}
removeObject(myBottomObject, myBottomType);
}
Collidable comp = createObject("bottomObject", type);
setBottomObject(comp, type);
addObject(comp, type);
createAndAddControlPanel("Bottom object", comp);
if (myTopObject != null) {
mechMod.setCollisionBehavior(myTopObject, myBottomObject, true, myFriction);
}
// addBreakPoint (0.33);
}
}
use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.
the class SimpleCollide method setFriction.
public void setFriction(double mu) {
MechModel mechMod = (MechModel) models().get(0);
myFriction = mu;
if (mechMod != null) {
mechMod.setFriction(mu);
}
}
use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.
the class SimpleCollide method build.
public void build(String[] args) {
MechModel mechMod = new MechModel("mechModel");
mechMod.setMaxStepSize(0.01);
mechMod.setIntegrator(Integrator.ConstrainedBackwardEuler);
addModel(mechMod);
// for block/block friction test
// mySeparation = 1.09;
// mySeparation = .615;
CollisionManager cm = mechMod.getCollisionManager();
cm.setColliderType(ColliderType.SIGNED_DISTANCE);
cm.setDrawIntersectionContours(true);
RenderProps.setEdgeWidth(cm, 2);
RenderProps.setEdgeColor(cm, Color.YELLOW);
RenderProps.setVisible(cm, true);
setTopObject(ObjectType.FemEllipsoid);
setBottomObject(ObjectType.Box);
// for block/block friction test
// mechMod.transformGeometry (
// new RigidTransform3d (0, 0, 0, 0, 1, 0, Math.toRadians(20)));
mechMod.setProfiling(false);
ControlPanel panel = new ControlPanel("controls");
panel.addWidget(this, "topObject");
panel.addWidget(this, "bottomObject");
panel.addWidget(mechMod, "integrator");
panel.addWidget(this, "friction");
panel.addWidget(mechMod, "collisionManager:compliance");
panel.addWidget(mechMod, "collisionManager:damping");
addControlPanel(panel, 0);
// mechMod.transformGeometry (
// new RigidTransform3d (0, 0, 0, 0, 1, 0, Math.PI));
Main.getMain().arrangeControlPanels(this);
// panel.pack();
// panel.setVisible (true);
// java.awt.Point loc = Main.getMainFrame().getLocation();
// panel.setLocation(loc.x + Main.getMainFrame().getWidth(), loc.y);
// addControlPanel (panel);
NumericInputProbe iprobe = new NumericInputProbe(mechMod, "rigidBodies/bottomObject:targetOrientation", 0, 6);
// new NumericInputProbe (
// mechMod, "rigidBodies/bottomObject:targetPosition", 0, 6);
iprobe.addData(new double[] { 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 3, 0, 1, 0, 90, 5, 0, 1, 0, 180, 6, 0, 1, 0, 180 }, NumericInputProbe.EXPLICIT_TIME);
// iprobe.addData (
// new double[] { 0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 3, 0, 0,
// 2, 4, 0, 0, 0,},
// NumericInputProbe.EXPLICIT_TIME);
//
//
iprobe.setActive(true);
addInputProbe(iprobe);
addBreakPoint(1.34);
}
Aggregations