+ private static final double WAVE_FREQUENCY = 50d;
+ private static final double WAVE_AMPLITUDE = 50d;
+ private static final Color SQUARE_PLATE_COLOR = new Color("88F7");
+
+ private static void makeSquarePlate(final ShapeCollection shapeCollection,
+ final double y, final double x, final double z) {
+ final Point3D p1 = new Point3D(x, y, z);
+ final Point3D p2 = new Point3D(x + 20, y, z);
+ final Point3D p3 = new Point3D(x, y, z + 20);
+ final Point3D p4 = new Point3D(x + 20, y, z + 20);
+ final SolidPolygon polygon1 = new SolidPolygon(p1, p2, p3, SQUARE_PLATE_COLOR);
+ final SolidPolygon polygon2 = new SolidPolygon(p4, p2, p3, SQUARE_PLATE_COLOR);
+ shapeCollection.addShape(polygon1);
+ shapeCollection.addShape(polygon2);
+ }
+
+ /**
+ * @param surfaceElevation surface total elevation
+ */
+ private static void addWobblySurface(final ShapeCollection shapeCollection,
+ final double surfaceElevation) {
+ for (double x = -500; x < 500; x += 20)
+ for (double z = -500; z < 500; z += 20) {
+
+ // use Pythagorean theorem to compute distance from the center
+ final double distanceFromCenter = Math.sqrt((x * x) + (z * z));
+
+ double plateElevation = Math.sin(distanceFromCenter / WAVE_FREQUENCY) * WAVE_AMPLITUDE;
+
+ makeSquarePlate(shapeCollection, plateElevation + surfaceElevation, x,
+ z);
+ }
+ }
+