Search in sources :

Example 1 with RainbowColorMap

use of maspack.render.color.RainbowColorMap in project artisynth_core by artisynth.

the class ColoredFemBeam3d method build.

public void build(String[] args) {
    super.build(args);
    PolygonalMesh surf = myFemMod.getSurfaceMesh();
    surf.setVertexColoringEnabled();
    RainbowColorMap rcm = new RainbowColorMap();
    Point3d pmin = new Point3d(Point3d.POSITIVE_INFINITY);
    Point3d pmax = new Point3d(Point3d.NEGATIVE_INFINITY);
    myFemMod.updateBounds(pmin, pmax);
    for (int i = 0; i < surf.numVertices(); i++) {
        Point3d vpos = surf.getVertex(i).getPosition();
        surf.setColor(i, rcm.getColor((vpos.x - pmin.x) / (pmax.x - pmin.x)));
    }
}
Also used : Point3d(maspack.matrix.Point3d) RainbowColorMap(maspack.render.color.RainbowColorMap) PolygonalMesh(maspack.geometry.PolygonalMesh)

Aggregations

PolygonalMesh (maspack.geometry.PolygonalMesh)1 Point3d (maspack.matrix.Point3d)1 RainbowColorMap (maspack.render.color.RainbowColorMap)1