use of artisynth.core.femmodels.FemModel3d in project artisynth_core by artisynth.
the class FemSkinDemo method createFem.
protected FemModel3d createFem(String name, double wx, double wy, double wz) {
FemModel3d femMod = new FemModel3d(name);
femMod.setDensity(myDensity);
FemFactory.createHexGrid(femMod, wx, wy, wz, 6, 2, 2);
femMod.setLinearMaterial(200000, 0.4, true);
femMod.setStiffnessDamping(0.002);
Renderable elements = femMod.getElements();
RenderProps.setLineWidth(elements, 2);
RenderProps.setLineColor(elements, Color.BLUE);
Renderable nodes = femMod.getNodes();
RenderProps.setPointStyle(nodes, Renderer.PointStyle.SPHERE);
RenderProps.setPointRadius(nodes, 0.010);
RenderProps.setPointColor(nodes, new Color(153, 0, 204));
RenderProps.setFaceColor(femMod, new Color(128, 128, 255));
femMod.setSurfaceRendering(FemModel3d.SurfaceRender.Shaded);
myMech.addModel(femMod);
return femMod;
}
use of artisynth.core.femmodels.FemModel3d in project artisynth_core by artisynth.
the class QuadraticLockingDemo method build.
public void build(String[] args) {
myTetMod = new FemModel3d("tet");
FemFactory.createTetGrid(myTetMod, WIDTH, WIDTH, LENGTH, NX, NY, NZ);
myTetMod.transformGeometry(new RigidTransform3d(-3 * WIDTH / 4, 0, 0));
setModelProperties(myTetMod);
myQuadtetMod = new FemModel3d("quadtet");
FemFactory.createQuadtetGrid(myQuadtetMod, WIDTH, WIDTH, LENGTH, NX, NY, NZ);
setModelProperties(myQuadtetMod);
myQuadtetMod.transformGeometry(new RigidTransform3d(3 * WIDTH / 4, 0, 0));
myHexMod = new FemModel3d("hex");
FemFactory.createHexGrid(myHexMod, WIDTH, WIDTH, LENGTH, NX, NY, NZ);
setModelProperties(myHexMod);
myHexMod.transformGeometry(new RigidTransform3d(9 * WIDTH / 4, 0, 0));
myMechMod = new MechModel("mech");
myMechMod.addModel(myTetMod);
myMechMod.addModel(myQuadtetMod);
myMechMod.addModel(myHexMod);
addModel(myMechMod);
addControlPanel();
}
use of artisynth.core.femmodels.FemModel3d in project artisynth_core by artisynth.
the class SimpleCollide method createAndAddControlPanel.
ControlPanel createAndAddControlPanel(String name, ModelComponent comp) {
ControlPanel panel = new ControlPanel(name);
if (comp instanceof FemModel3d) {
panel.addWidget(comp, "material");
panel.addWidget(comp, "density");
panel.addWidget(comp, "incompressible");
panel.addWidget(comp, "volume");
} else if (comp instanceof RigidBody) {
panel.addWidget(comp, "position");
panel.addWidget(comp, "orientation");
} else {
throw new InternalErrorException("No control panel code for components of type " + comp.getClass());
}
ControlPanel existingPanel = getControlPanels().get(name);
if (existingPanel != null) {
int idx = getControlPanels().indexOf(existingPanel);
removeControlPanel(existingPanel);
existingPanel.dispose();
addControlPanel(panel, idx);
Main.getMain().arrangeControlPanels(this);
} else {
addControlPanel(panel);
}
return panel;
}
use of artisynth.core.femmodels.FemModel3d in project artisynth_core by artisynth.
the class SimpleCollide method setTopObject.
private void setTopObject(Collidable comp, ObjectType type) {
Renderable rcomp = (Renderable) comp;
((TransformableGeometry) comp).transformGeometry(new RigidTransform3d(0, /*-0.3*/
0.0, mySeparation));
((TransformableGeometry) comp).transformGeometry(AffineTransform3d.createScaling(myTopScale));
RenderProps.setFaceColor(rcomp, Color.red);
switch(type) {
case FemEllipsoid:
case FemSphere:
case FemCube:
{
RenderProps.setPointColor(rcomp, Color.gray);
RenderProps.setAlpha(rcomp, 0.3);
RenderProps.setDrawEdges(rcomp, true);
RenderProps.setVisible(((FemModel3d) rcomp).getElements(), false);
break;
}
case House:
{
((TransformableGeometry) comp).transformGeometry(new RigidTransform3d(0, 0, 2 * mySeparation, 1, 1, 0, Math.toRadians(170)));
break;
}
case Box:
case Molar:
case Bin:
case Paw:
{
break;
}
default:
{
throw new InternalErrorException("Unimplemented type " + type);
}
}
myTopObject = comp;
myTopType = type;
}
Aggregations