Search in sources :

Example 21 with PointAttachment

use of artisynth.core.mechmodels.PointAttachment in project artisynth_core by artisynth.

the class TransverseIsotropy method build.

@Override
public void build(String[] args) throws IOException {
    super.build(args);
    MechModel mech = new MechModel("mech");
    addModel(mech);
    double h = 0.1;
    double r = 0.005;
    RigidBody rb = RigidBody.createBox("box", 2 * r, 2 * r, 2 * r, 100, true);
    mech.addRigidBody(rb);
    rb.transformGeometry(new RigidTransform3d(new Vector3d(0, 0, -h / 2 - r), AxisAngle.IDENTITY));
    FemModel3d fem = FemFactory.createCylinder(null, h, r, 24, 40, 4);
    fem.setDensity(1000);
    mech.addModel(fem);
    TransverseLinearMaterial mat = new TransverseLinearMaterial();
    mat.setYoungsModulus(50000, 50000);
    mat.setPoissonsRatio(0.45, 0.45);
    double G = 50000 / (2 * (1 + 0.45));
    mat.setShearModulus(G);
    fem.setMaterial(mat);
    fem.setName("fem");
    fem.setSurfaceRendering(SurfaceRender.Shaded);
    RenderProps.setFaceColor(fem, Color.ORANGE);
    RenderProps.setVisible(fem.getElements(), false);
    double eps = 1e-10;
    for (FemNode3d node : fem.getNodes()) {
        if (node.getPosition().z > h / 2 - eps) {
            node.setDynamic(false);
        } else if (node.getPosition().z < -h / 2 + eps) {
            PointAttachment pa = rb.createPointAttachment(node);
            mech.addAttachment(pa);
        }
    }
}
Also used : MechModel(artisynth.core.mechmodels.MechModel) RigidTransform3d(maspack.matrix.RigidTransform3d) FemModel3d(artisynth.core.femmodels.FemModel3d) Vector3d(maspack.matrix.Vector3d) FemNode3d(artisynth.core.femmodels.FemNode3d) RigidBody(artisynth.core.mechmodels.RigidBody) PointAttachment(artisynth.core.mechmodels.PointAttachment) TransverseLinearMaterial(artisynth.core.materials.TransverseLinearMaterial)

Aggregations

PointAttachment (artisynth.core.mechmodels.PointAttachment)21 ContactPoint (artisynth.core.mechmodels.ContactPoint)17 Point (artisynth.core.mechmodels.Point)17 PointParticleAttachment (artisynth.core.mechmodels.PointParticleAttachment)16 Vertex3d (maspack.geometry.Vertex3d)10 FemNode (artisynth.core.femmodels.FemNode)9 PointFem3dAttachment (artisynth.core.femmodels.PointFem3dAttachment)9 VectorNd (maspack.matrix.VectorNd)7 PolygonalMesh (maspack.geometry.PolygonalMesh)6 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)3 Face (maspack.geometry.Face)3 Point3d (maspack.matrix.Point3d)3 FemNode3d (artisynth.core.femmodels.FemNode3d)2 ContactMaster (artisynth.core.mechmodels.ContactMaster)2 DynamicComponent (artisynth.core.mechmodels.DynamicComponent)2 IOException (java.io.IOException)2 BVFeatureQuery (maspack.geometry.BVFeatureQuery)2 MeshBase (maspack.geometry.MeshBase)2 Vector2d (maspack.matrix.Vector2d)2