Search in sources :

Example 26 with FemModel3d

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;
}
Also used : FemModel3d(artisynth.core.femmodels.FemModel3d)

Example 27 with FemModel3d

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();
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) MechModel(artisynth.core.mechmodels.MechModel) FemModel3d(artisynth.core.femmodels.FemModel3d)

Example 28 with FemModel3d

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;
}
Also used : FemModel3d(artisynth.core.femmodels.FemModel3d) ControlPanel(artisynth.core.gui.ControlPanel) RigidBody(artisynth.core.mechmodels.RigidBody) InternalErrorException(maspack.util.InternalErrorException)

Example 29 with FemModel3d

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;
}
Also used : TransformableGeometry(artisynth.core.modelbase.TransformableGeometry) RigidTransform3d(maspack.matrix.RigidTransform3d) Renderable(maspack.render.Renderable) FemModel3d(artisynth.core.femmodels.FemModel3d) InternalErrorException(maspack.util.InternalErrorException)

Aggregations

FemModel3d (artisynth.core.femmodels.FemModel3d)29 MechModel (artisynth.core.mechmodels.MechModel)14 FemNode3d (artisynth.core.femmodels.FemNode3d)12 RigidTransform3d (maspack.matrix.RigidTransform3d)11 RigidBody (artisynth.core.mechmodels.RigidBody)7 InternalErrorException (maspack.util.InternalErrorException)6 LinearMaterial (artisynth.core.materials.LinearMaterial)5 Vector3d (maspack.matrix.Vector3d)5 RevoluteJoint (artisynth.core.mechmodels.RevoluteJoint)3 HexElement (artisynth.core.femmodels.HexElement)2 TransverseLinearMaterial (artisynth.core.materials.TransverseLinearMaterial)2 ModelComponent (artisynth.core.modelbase.ModelComponent)2 TransformableGeometry (artisynth.core.modelbase.TransformableGeometry)2 PolygonalMesh (maspack.geometry.PolygonalMesh)2 Point3d (maspack.matrix.Point3d)2 Renderable (maspack.render.Renderable)2 AuxMaterialBundle (artisynth.core.femmodels.AuxMaterialBundle)1 AuxMaterialElementDesc (artisynth.core.femmodels.AuxMaterialElementDesc)1 FemElement3d (artisynth.core.femmodels.FemElement3d)1 FemElementType (artisynth.core.femmodels.FemFactory.FemElementType)1