package graphics; import java.util.ArrayList; public class Shape implements Cloneable { //num of latitudes/longitudes //(should be overridden) protected int M = 1; protected int N = 1; protected double[][] vertices; //nv * 6 protected boolean[] vFlags; //was vertex calculated? protected int[][] faces; //nf * 4 protected ArrayList[] vertex2faces; //lists of faces including each vertex //whether to wrap around M protected boolean wrap = true; //the shape's transformation matrix public Matrix3D matrix; //center of the object - not used here public double[] center; //shape's colors private double shininess; private int[] diffuseColor = {0,0,0}; private int[] specularColor = {0,0,0}; //how much of the shape to draw public double uStart = 0.0, uEnd = 1.0, vStart = 0.0, vEnd = 1.0; Shape() { init(); } Shape(int newM, int newN) { M = newM; N = newN; init(); } protected void init() { matrix = new Matrix3D(); center = new double[3]; vertices = new double[M * N][6]; faces = new int[M * (N-1)][4]; //System.err.println("nv = " + numVertices()); //System.err.println("nf = " + numFaces()); } //deep copy vertices and faces public Object clone() { Shape newShape = new Shape(M, N); for (int i=0; i