Search in sources :

Example 81 with RenderProps

use of maspack.render.RenderProps in project artisynth_core by artisynth.

the class MotionTargetTerm method initSourceRenderProps.

public void initSourceRenderProps() {
    sourceRenderProps = new RenderProps();
    sourceRenderProps.setDrawEdges(true);
    sourceRenderProps.setFaceStyle(FaceStyle.NONE);
    sourceRenderProps.setLineColor(Color.CYAN);
    sourceRenderProps.setLineWidth(2);
    sourceRenderProps.setPointColor(Color.CYAN);
    sourceRenderProps.setPointStyle(PointStyle.SPHERE);
// modRenderProps.setAlpha(0.5);
}
Also used : RenderProps(maspack.render.RenderProps)

Example 82 with RenderProps

use of maspack.render.RenderProps in project artisynth_core by artisynth.

the class PointModel method setupRenderProps.

public void setupRenderProps() {
    // set render properties for model
    RenderProps rp = new RenderProps();
    rp.setShading(Shading.SMOOTH);
    rp.setPointStyle(Renderer.PointStyle.SPHERE);
    rp.setPointColor(Color.LIGHT_GRAY);
    rp.setPointRadius(len / 30);
    rp.setLineColor(Color.BLUE.darker());
    // rp.setLineStyle(LineStyle.SPINDLE);
    // rp.setLineRadius(len/25);
    rp.setLineStyle(LineStyle.CYLINDER);
    rp.setLineRadius(0.1604);
    model.setRenderProps(rp);
    RenderProps.setPointColor(center, Color.WHITE);
    RenderProps.setPointRadius(center, len / 25);
}
Also used : RenderProps(maspack.render.RenderProps)

Example 83 with RenderProps

use of maspack.render.RenderProps in project artisynth_core by artisynth.

the class FemMuscleArm method addFemMuscle.

public void addFemMuscle(Point3d upper, Point3d lower) throws IOException {
    upperArm = model.rigidBodies().get("upper");
    RigidBody lowerArm = model.rigidBodies().get("lower");
    if (upperArm == null || lowerArm == null) {
        return;
    }
    muscle = new PointToPointMuscle("muscle", 1.0, 0.85, "muscle", true);
    model.addModel(muscle);
    RigidTransform3d X = new RigidTransform3d();
    // Point3d upper = new Point3d(2.4, 0, 20), lower = new Point3d(3, 0, -7);
    FemNode3d first = muscle.getFirstNode(), last = muscle.getLastNode();
    double scale = (upper.distance(lower) / first.getPosition().distance(last.getPosition()));
    System.out.println(scale);
    AffineTransform3d scaling = new AffineTransform3d();
    scaling.setIdentity();
    scaling.applyScaling(scale, scale, scale);
    // muscle.transformGeometry(scaling);
    Vector3d translate = new Vector3d();
    translate.sub(upper, first.getPosition());
    muscle.transformGeometry(new RigidTransform3d(translate, new AxisAngle()));
    Vector3d offfem = new Vector3d(), offtarget = new Vector3d();
    offfem.sub(last.getPosition(), first.getPosition());
    offtarget.sub(lower, upper);
    double angle = offfem.angle(offtarget);
    offfem.cross(offtarget);
    muscle.transformGeometry(new RigidTransform3d(new Vector3d(-upper.x, -upper.y, -upper.z), new AxisAngle()));
    muscle.transformGeometry(new RigidTransform3d(upper, new AxisAngle(offfem, angle)));
    muscle.getFirstNode().setDynamic(false);
    // ant.getFirstNode().setPosition(new Point3d(2.381, 0.000, 20));
    // model.AttachPoint(ant.getFirstNode(),upperArm,new Point3d(-size.x,0,-(size.z/2.0)/1.2));
    model.attachPoint(muscle.getLastNode(), lowerArm);
    muscle.setMaxForce(300000);
    muscle.setExcitation(0.0);
    RenderProps rp = new RenderProps(model.getRenderProps());
    rp.setFaceColor(Color.RED);
    rp.setLineStyle(Renderer.LineStyle.LINE);
    rp.setPointStyle(Renderer.PointStyle.POINT);
    rp.setShading(Renderer.Shading.SMOOTH);
    rp.setLineColor(Color.WHITE);
    muscle.setRenderProps(rp);
    muscle.setSurfaceRendering(SurfaceRender.Shaded);
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) AxisAngle(maspack.matrix.AxisAngle) Vector3d(maspack.matrix.Vector3d) FemNode3d(artisynth.core.femmodels.FemNode3d) RenderProps(maspack.render.RenderProps) PointToPointMuscle(artisynth.core.femmodels.PointToPointMuscle) RigidBody(artisynth.core.mechmodels.RigidBody) AffineTransform3d(maspack.matrix.AffineTransform3d)

Example 84 with RenderProps

use of maspack.render.RenderProps in project artisynth_core by artisynth.

the class SpongeModel method initializeModel.

protected void initializeModel() throws IOException {
    createGeometry("spongeMesh", numX * len, numY * len, numZ * len / thining, numX, numY, numZ, 1);
    RenderProps props = createRenderProps();
    props.setLineWidth(2);
    props.setLineColor(Color.GRAY);
    props.setPointStyle(Renderer.PointStyle.SPHERE);
    props.setAlpha(1);
    props.setPointRadius(len / 20);
    props.setPointColor(Color.GREEN);
    setRenderProps(props);
    setGravity(0, 0, 0);
    setDensity(100);
    // setPoissonsRatio (0.499);
    // setYoungsModulus (4000);
    setLinearMaterial(4000, 0.499, true);
    setParticleDamping(4);
    setStiffnessDamping(0.2);
    setImplicitIterations(100);
    setImplicitPrecision(0.001);
    setMaxStepSize(0.01);
    setIntegrator(Integrator.BackwardEuler);
}
Also used : RenderProps(maspack.render.RenderProps)

Example 85 with RenderProps

use of maspack.render.RenderProps in project artisynth_core by artisynth.

the class DoubleArmDemo method setupRenderProps.

public void setupRenderProps() {
    // set render properties for model
    RenderProps rp = new RenderProps();
    rp.setPointStyle(Renderer.PointStyle.SPHERE);
    rp.setPointColor(Color.LIGHT_GRAY);
    rp.setPointRadius(0.0);
    rp.setLineStyle(Renderer.LineStyle.SPINDLE);
    rp.setLineColor(Color.WHITE);
    rp.setLineRadius(0.4);
    model.setRenderProps(rp);
}
Also used : RenderProps(maspack.render.RenderProps)

Aggregations

RenderProps (maspack.render.RenderProps)86 Color (java.awt.Color)17 Vector3d (maspack.matrix.Vector3d)17 RigidBody (artisynth.core.mechmodels.RigidBody)11 RigidTransform3d (maspack.matrix.RigidTransform3d)11 Shading (maspack.render.Renderer.Shading)10 PolygonalMesh (maspack.geometry.PolygonalMesh)8 Point3d (maspack.matrix.Point3d)8 RenderObject (maspack.render.RenderObject)7 FrameMarker (artisynth.core.mechmodels.FrameMarker)6 File (java.io.File)6 IOException (java.io.IOException)6 Vertex3d (maspack.geometry.Vertex3d)6 AffineTransform3d (maspack.matrix.AffineTransform3d)4 ColorMapProps (maspack.render.ColorMapProps)4 HasRenderProps (maspack.render.HasRenderProps)4 LineRenderProps (maspack.render.LineRenderProps)4 AxialSpring (artisynth.core.mechmodels.AxialSpring)3 Muscle (artisynth.core.mechmodels.Muscle)3 LinkedList (java.util.LinkedList)3