Search in sources :

Example 16 with Particle

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

the class MultiMuscleDemo method build.

public void build(String[] args) {
    super.build(args);
    MechModel mechMod = (MechModel) models().get("mechMod");
    RigidBody block = mechMod.rigidBodies().get("block");
    Particle p0 = new Particle(0.1, 0, -size * 3, size / 2);
    p0.setDynamic(false);
    mechMod.addParticle(p0);
    Particle p1 = new Particle(0.1, 0, size * 3, size / 2);
    p1.setDynamic(false);
    mechMod.addParticle(p1);
    FrameMarker mkr0 = new FrameMarker();
    mechMod.addFrameMarker(mkr0, block, new Point3d(0, -size / 2, size / 2));
    FrameMarker mkr1 = new FrameMarker();
    mechMod.addFrameMarker(mkr1, block, new Point3d(0, size / 2, size / 2));
    MultiPointMuscle muscle = new MultiPointMuscle();
    LinearAxialMuscle mat = new LinearAxialMuscle();
    mat.setForceScaling(1);
    mat.setMaxForce(10);
    mat.setMaxLength(size);
    mat.setPassiveFraction(0.1);
    muscle.setMaterial(mat);
    muscle.addPoint(p0);
    muscle.addPoint(mkr0);
    muscle.addPoint(mkr1);
    muscle.addPoint(p1);
    mechMod.addMultiPointSpring(muscle);
    RenderProps.setLineColor(mechMod, Color.BLUE);
    RenderProps.setLineStyle(muscle, LineStyle.SPINDLE);
    RenderProps.setLineRadius(muscle, 0.1);
    RenderProps.setLineColor(muscle, Color.RED);
}
Also used : Particle(artisynth.core.mechmodels.Particle) LinearAxialMuscle(artisynth.core.materials.LinearAxialMuscle) MechModel(artisynth.core.mechmodels.MechModel) FrameMarker(artisynth.core.mechmodels.FrameMarker) Point3d(maspack.matrix.Point3d) RigidBody(artisynth.core.mechmodels.RigidBody) MultiPointMuscle(artisynth.core.mechmodels.MultiPointMuscle)

Example 17 with Particle

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

the class SkinDemo method addAntagonist.

public void addAntagonist() {
    RigidBody lowerArm = model.rigidBodies().get("lower");
    if (lowerArm == null) {
        return;
    }
    Point3d markerBodyPos = new Point3d(-size.x / 2, 0, 0);
    // Point3d markerBodyPos = new Point3d(-size.x,0,-(size.z/2.0)/1.2);
    FrameMarker marker = new FrameMarker();
    model.addFrameMarker(marker, lowerArm, markerBodyPos);
    Particle fixed = new Particle(1.0, new Point3d(-size.z / 4, 0, -size.z / 2.0));
    // Particle fixed = new Particle(1.0,new Point3d(size.z/4,0,size.z));
    fixed.setDynamic(false);
    model.addParticle(fixed);
    AxialSpring spring = new AxialSpring(100.0, 2.0, 0.0);
    spring.setFirstPoint(marker);
    spring.setSecondPoint(fixed);
    RenderProps rp = new RenderProps(model.getRenderProps());
    rp.setLineStyle(Renderer.LineStyle.SPINDLE);
    rp.setShading(Renderer.Shading.FLAT);
    rp.setLineColor(Color.WHITE);
    spring.setRenderProps(rp);
    model.addAxialSpring(spring);
}
Also used : Particle(artisynth.core.mechmodels.Particle) FrameMarker(artisynth.core.mechmodels.FrameMarker) Point3d(maspack.matrix.Point3d) RenderProps(maspack.render.RenderProps) RigidBody(artisynth.core.mechmodels.RigidBody) AxialSpring(artisynth.core.mechmodels.AxialSpring)

Example 18 with Particle

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

the class FemBeamWithMuscle method build.

public void build(String[] args) throws IOException {
    // Create simple FEM beam
    super.build(args);
    // Add a particle fixed in space
    Particle p1 = new Particle(/*mass=*/
    0, -length / 2, 0, 2 * width);
    mech.addParticle(p1);
    p1.setDynamic(false);
    RenderProps.setSphericalPoints(p1, 0.02, Color.BLUE);
    // Add a marker at the end of the model
    FemMarker mkr = createMarker(fem, length / 2 - 0.1, 0, width / 2);
    // Create a muscle between the point an marker
    Muscle muscle = createMuscle();
    muscle.setPoints(p1, mkr);
    mech.addAxialSpring(muscle);
}
Also used : Particle(artisynth.core.mechmodels.Particle) Muscle(artisynth.core.mechmodels.Muscle) SimpleAxialMuscle(artisynth.core.materials.SimpleAxialMuscle) FemMarker(artisynth.core.femmodels.FemMarker)

Example 19 with Particle

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

the class MultiSpringTest method addSpringMesh.

protected void addSpringMesh(MechModel mech) {
    Particle p0 = new Particle(0.5, -0.10, 0, 0.20);
    p0.setDynamic(false);
    Particle p1 = new Particle(0.5, 0, 0, 0.25);
    Particle p2 = new Particle(0.5, 0, 0, 0.15);
    Particle p3 = new Particle(0.5, 0.10, 0, 0.20);
    AxialSpring[] springs = new AxialSpring[10];
    for (int i = 0; i < springs.length; i++) {
        springs[i] = new AxialSpring(0.50, 0.20, 0.10);
    }
    // mech.particles().addNumbered (p0, 5);
    mech.particles().addNumbered(p1, 4);
    mech.particles().addNumbered(p2, 0);
    // mech.particles().addNumbered (p3, 1);
    // mech.attachAxialSpring (p0, p1, springs[0]);
    // mech.attachAxialSpring (p0, p2, springs[1]);
    mech.attachAxialSpring(p2, p1, springs[2]);
// mech.attachAxialSpring (p1, p3, springs[3]);
// mech.attachAxialSpring (p2, p3, springs[4]);
// Particle p10 = new Particle (0.5, 0.10, 0, 0.20);
// Particle p11 = new Particle (0.5, 0.05, 0, 0.10);
// Particle p12 = new Particle (0.5, 0.15, 0, 0.10);
// Particle p13 = new Particle (0.5, 0.10, 0, 0);
// 
// mech.addParticle (p10);
// mech.addParticle (p11);
// mech.addParticle (p12);
// mech.addParticle (p13);
// 
// mech.attachAxialSpring (p10, p11, springs[5]);
// mech.attachAxialSpring (p10, p12, springs[6]);
// mech.attachAxialSpring (p11, p12, springs[7]);
// mech.attachAxialSpring (p11, p13, springs[8]);
// mech.attachAxialSpring (p12, p13, springs[9]);
}
Also used : Particle(artisynth.core.mechmodels.Particle) AxialSpring(artisynth.core.mechmodels.AxialSpring)

Example 20 with Particle

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

the class PointModel method addSprings.

public void addSprings(RigidTransform3d X, int num, double offset) {
    for (int i = 0; i < num; i++) {
        double a = 2 * Math.PI * ((double) i / num);
        Point3d pnt = new Point3d(len * Math.sin(a), 0.0, len * Math.cos(a));
        pnt.transform(X.R);
        Particle fixed = new Particle(1.0, pnt);
        fixed.setDynamic(false);
        model.addParticle(fixed);
        addAxialSpring(fixed, center);
    }
}
Also used : Particle(artisynth.core.mechmodels.Particle) Point3d(maspack.matrix.Point3d) Point(artisynth.core.mechmodels.Point) SphericalJoint(artisynth.core.mechmodels.SphericalJoint)

Aggregations

Particle (artisynth.core.mechmodels.Particle)21 Point3d (maspack.matrix.Point3d)12 AxialSpring (artisynth.core.mechmodels.AxialSpring)10 MechModel (artisynth.core.mechmodels.MechModel)8 RigidBody (artisynth.core.mechmodels.RigidBody)5 FrameMarker (artisynth.core.mechmodels.FrameMarker)4 Muscle (artisynth.core.mechmodels.Muscle)4 Point (artisynth.core.mechmodels.Point)4 SphericalJoint (artisynth.core.mechmodels.SphericalJoint)4 RigidTransform3d (maspack.matrix.RigidTransform3d)4 MultiPointSpring (artisynth.core.mechmodels.MultiPointSpring)3 RenderProps (maspack.render.RenderProps)3 FemMarker (artisynth.core.femmodels.FemMarker)2 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)2 SimpleAxialMuscle (artisynth.core.materials.SimpleAxialMuscle)2 PolygonalMesh (maspack.geometry.PolygonalMesh)2 FemElement (artisynth.core.femmodels.FemElement)1 FemNode (artisynth.core.femmodels.FemNode)1 FemNode3d (artisynth.core.femmodels.FemNode3d)1 ConnectorForceRenderer (artisynth.core.inverse.ConnectorForceRenderer)1