/** * Draws a set of points at the given coordinates. For example, * the first point is at (x[0], y[0], z[0]). * Much more efficient than drawing individual points. */ public static Shape points (double[] x, double[] y, double[] z) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new PointArray(coords.length, PointArray.COORDINATES); geom.setCoordinates(0, coords); Shape3D shape = createShape3D(geom); return shape(shape); }
/** * Draws a set of points at the given coordinates. For example, * the first point is at (x[0], y[0], z[0]). * Much more efficient than drawing individual points. */ public static Shape points (double[] x, double[] y, double[] z) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new PointArray(coords.length, PointArray.COORDINATES); geom.setCoordinates(0, coords); Shape3D shape = createShape3D(geom); return shape(shape); }
/** * Draws a set of connected lines. For example, the first line is from (x[0], y[0], z[0]) to * (x[1], y[1], z[1]), and the second line is from (x[1], y[1], z[1]) to (x[2], y[2], z[2]). * Much more efficient than drawing individual lines. */ public static Shape lines (double[] x, double[] y, double[] z) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new LineStripArray (coords.length, LineArray.COORDINATES, new int[] {coords.length}); geom.setCoordinates(0, coords); Shape3D shape = createShape3D(geom); return shape(shape); }
/** * Draws a set of connected lines. For example, the first line is from (x[0], y[0], z[0]) to * (x[1], y[1], z[1]), and the second line is from (x[1], y[1], z[1]) to (x[2], y[2], z[2]). * Much more efficient than drawing individual lines. */ public static Shape lines (double[] x, double[] y, double[] z) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new LineStripArray (coords.length, LineArray.COORDINATES, new int[] {coords.length}); geom.setCoordinates(0, coords); Shape3D shape = createShape3D(geom); return shape(shape); }
/** * Draws a set of points at the given coordinates with the given colors. * For example, the first point is at (x[0], y[0], z[0]) with color colors[0]. * Much more efficient than drawing individual points. */ public static Shape points (double[] x, double[] y, double[] z, Color[] colors) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new PointArray(coords.length, PointArray.COORDINATES | PointArray.COLOR_4); geom.setCoordinates(0, coords); for (int i = 0; i < x.length; i++) geom.setColor(i, colors[i].getComponents(null)); Shape3D shape = createShape3D(geom); return customShape(shape); }
/** * Draws a set of points at the given coordinates with the given colors. * For example, the first point is at (x[0], y[0], z[0]) with color colors[0]. * Much more efficient than drawing individual points. */ public static Shape points (double[] x, double[] y, double[] z, Color[] colors) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new PointArray(coords.length, PointArray.COORDINATES | PointArray.COLOR_4); geom.setCoordinates(0, coords); for (int i = 0; i < x.length; i++) geom.setColor(i, colors[i].getComponents(null)); Shape3D shape = createShape3D(geom); return customShape(shape); }
/** * Draws a set of connected lines. For example, the first line is from (x[0], y[0], z[0]) to * (x[1], y[1], z[1]), and the second line is from (x[1], y[1], z[1]) to (x[2], y[2], z[2]). * Much more efficient than drawing individual lines. Vertex colors are specified by the given * array, and line colors are blends of its two vertex colors. */ public static Shape lines (double[] x, double[] y, double[] z, Color[] colors) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new LineStripArray (coords.length, LineArray.COORDINATES | LineArray.COLOR_4, new int[] {coords.length}); geom.setCoordinates(0, coords); for (int i = 0; i < x.length; i++) geom.setColor(i, colors[i].getComponents(null)); Shape3D shape = createShape3D(geom); return customShape(shape); }
/** * Draws a set of connected lines. For example, the first line is from (x[0], y[0], z[0]) to * (x[1], y[1], z[1]), and the second line is from (x[1], y[1], z[1]) to (x[2], y[2], z[2]). * Much more efficient than drawing individual lines. Vertex colors are specified by the given * array, and line colors are blends of its two vertex colors. */ public static Shape lines (double[] x, double[] y, double[] z, Color[] colors) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new LineStripArray (coords.length, LineArray.COORDINATES | LineArray.COLOR_4, new int[] {coords.length}); geom.setCoordinates(0, coords); for (int i = 0; i < x.length; i++) geom.setColor(i, colors[i].getComponents(null)); Shape3D shape = createShape3D(geom); return customShape(shape); }
/** * Draws a polygon with the given vertices, which is filled or outlined based on the argument. * * @param filled Is the polygon filled? */ private static Shape polygon (double[] x, double[] y, double[] z, boolean filled) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new TriangleFanArray(coords.length, LineArray.COORDINATES, new int[] {coords.length}); geom.setCoordinates(0, coords); GeometryInfo geoinfo = new GeometryInfo((GeometryArray)geom); NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals(geoinfo); Shape3D shape = createShape3D(geoinfo.getIndexedGeometryArray()); if (filled) return shape(shape); else return wireShape(shape); }
/** * Draws a polygon with the given vertices, which is filled or outlined based on the argument. * * @param filled Is the polygon filled? */ private static Shape polygon (double[] x, double[] y, double[] z, boolean filled) { Point3f[] coords = constructPoint3f(x, y, z); GeometryArray geom = new TriangleFanArray(coords.length, LineArray.COORDINATES, new int[] {coords.length}); geom.setCoordinates(0, coords); GeometryInfo geoinfo = new GeometryInfo((GeometryArray)geom); NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals(geoinfo); Shape3D shape = createShape3D(geoinfo.getIndexedGeometryArray()); if (filled) return shape(shape); else return wireShape(shape); }
private static Shape triangles (double[][] points, boolean filled) { int size = points.length; Point3f[] coords = new Point3f[size*3]; for (int i = 0; i < size; i++) { coords[3*i] = new Point3f(createVector3f(points[i][0], points[i][1], points[i][2])); coords[3*i+1] = new Point3f(createVector3f(points[i][3], points[i][4], points[i][5])); coords[3*i+2] = new Point3f(createVector3f(points[i][6], points[i][7], points[i][8])); } GeometryArray geom = new TriangleArray(size*3, TriangleArray.COORDINATES); geom.setCoordinates(0, coords); GeometryInfo geoinfo = new GeometryInfo(geom); NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals(geoinfo); Shape3D shape = createShape3D(geoinfo.getIndexedGeometryArray()); if (filled) return shape(shape); else return wireShape(shape); }
private static Shape triangles (double[][] points, boolean filled) { int size = points.length; Point3f[] coords = new Point3f[size*3]; for (int i = 0; i < size; i++) { coords[3*i] = new Point3f(createVector3f(points[i][0], points[i][1], points[i][2])); coords[3*i+1] = new Point3f(createVector3f(points[i][3], points[i][4], points[i][5])); coords[3*i+2] = new Point3f(createVector3f(points[i][6], points[i][7], points[i][8])); } GeometryArray geom = new TriangleArray(size*3, TriangleArray.COORDINATES); geom.setCoordinates(0, coords); GeometryInfo geoinfo = new GeometryInfo(geom); NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals(geoinfo); Shape3D shape = createShape3D(geoinfo.getIndexedGeometryArray()); if (filled) return shape(shape); else return wireShape(shape); }
private static Shape triangles (double[][] points, Color[] colors, boolean filled) { int size = points.length; Point3f[] coords = new Point3f[size*3]; for (int i = 0; i < size; i++) { coords[3*i] = new Point3f(createVector3f(points[i][0], points[i][1], points[i][2])); coords[3*i+1] = new Point3f(createVector3f(points[i][3], points[i][4], points[i][5])); coords[3*i+2] = new Point3f(createVector3f(points[i][6], points[i][7], points[i][8])); } GeometryArray geom = new TriangleArray(size*3, TriangleArray.COORDINATES | TriangleArray.COLOR_4); geom.setCoordinates(0, coords); for (int i = 0; i < colors.length; i++) { geom.setColor(3 * i + 0, colors[i].getComponents(null)); geom.setColor(3 * i + 1, colors[i].getComponents(null)); geom.setColor(3 * i + 2, colors[i].getComponents(null)); } GeometryInfo geoinfo = new GeometryInfo(geom); NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals(geoinfo); Shape3D shape = createShape3D(geoinfo.getIndexedGeometryArray()); if (filled) return shape(shape); else return wireShape(shape); }
private static Shape triangles (double[][] points, Color[] colors, boolean filled) { int size = points.length; Point3f[] coords = new Point3f[size*3]; for (int i = 0; i < size; i++) { coords[3*i] = new Point3f(createVector3f(points[i][0], points[i][1], points[i][2])); coords[3*i+1] = new Point3f(createVector3f(points[i][3], points[i][4], points[i][5])); coords[3*i+2] = new Point3f(createVector3f(points[i][6], points[i][7], points[i][8])); } GeometryArray geom = new TriangleArray(size*3, TriangleArray.COORDINATES | TriangleArray.COLOR_4); geom.setCoordinates(0, coords); for (int i = 0; i < colors.length; i++) { geom.setColor(3 * i + 0, colors[i].getComponents(null)); geom.setColor(3 * i + 1, colors[i].getComponents(null)); geom.setColor(3 * i + 2, colors[i].getComponents(null)); } GeometryInfo geoinfo = new GeometryInfo(geom); NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals(geoinfo); Shape3D shape = createShape3D(geoinfo.getIndexedGeometryArray()); if (filled) return shape(shape); else return wireShape(shape); }