/** * Adds a triangle group for a sampled function z = f(x,y). * @param sx sampling of x coordinates; may be non-uniform. * @param sy sampling of y coordinates; may be non-uniform. * @param z array[nx][ny] of z coordinates z = f(x,y). */ public TriangleGroup addTriangles(Sampling sx, Sampling sy, float[][] z) { return addTriangles(new TriangleGroup(true,sx,sy,z)); }
/** * Adds a triangle group with specified vertex coordinates and colors. * @param xyz array of packed vertex coordinates. * @param rgb array of packed color components. * @return the triangle group. */ public TriangleGroup addTriangles(float[] xyz, float[] rgb) { return addTriangles(new TriangleGroup(true,xyz,rgb)); }
/** * Adds a triangle group with specified vertex coordinates. * @param xyz array of packed vertex coordinates. * @return the triangle group. */ public TriangleGroup addTriangles(float[] xyz) { return addTriangles(new TriangleGroup(true,xyz,null)); }
/** * Returns a new simple frame with a triangle group. * @param tg a triangle group. * @return the simple frame. */ public static SimpleFrame asTriangles(TriangleGroup tg) { SimpleFrame sf = new SimpleFrame(); sf.addTriangles(tg); sf.getOrbitView().setWorldSphere(tg.getBoundingSphere(true)); return sf; }
public static void go(String[] args) { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); SimpleFrame sf = new SimpleFrame(); TriangleGroup tg = sf.addTriangles(xyz); tg.setColor(Color.BLUE); if (args.length>0) sf.paintToFile(args[0]); }