class Grid extends Sphere implements java.io.Serializable { static final long serialVersionUID = -1834404875956759200L; Grid() { this(36, 36); } Grid(int u, int v) { super(false); //this(true); //} //public Sphere(boolean recalc) //{ inPnt = new cVector(); name = "Grid"; uDivs = u; vDivs = v; minUDivs = 1; minVDivs = 1; center = new cVector(); radius = 1; //if (recalc) { retile(); recalculate(); } } Object3D deepCopy() { Grid e = new Grid(); deepCopySelf(e); return e; } protected void deepCopyNode(Object3D other) { super.deepCopyNode(other); Grid e = (Grid)other; e.center = new cVector(); LA.vecCopy(center, e.center); e.radius = radius; } void generatePOV(StringBuffer buffer) { /* generateNameComment(buffer); generateIndent(buffer); buffer.append("sphere { "); LA.toPOVRay(center, buffer); buffer.append(", "); buffer.append(radius); buffer.append("\n"); generateTransform(buffer); generateIndent(buffer); buffer.append("}\n"); */ } double uStretch() { return 1; } double vFlip(double v) { return 1-v; } Vertex biparamFunction(double u, double v) { Vertex temp = new Vertex((2*v-1)*radius*4, 0 /*-radius,*/, (2*u-1)*radius*4); temp.norm = LA.newVector(0,1,0); return temp; } void createEditWindow(GroupEditor callee, boolean newWindow) { //editWindow = (new SphereEditor(this, deepCopy(), callee)).GetEditor(); // ???? if (newWindow) objectUI = new SphereEditor(this, deepCopy(), callee); else objectUI = new SphereEditor(this, callee); editWindow = objectUI.GetEditor(); } // july 2014 void getBounds(cVector minima, cVector maxima, boolean xform) // { // //for (int i=0; i < 3; i++) // { // minima.x = center.x - radius; // minima.y = center.y; // - radius; // minima.z = center.z - radius; // //maxima[i] = center[i] + radius; // maxima.x = center.x + radius; // maxima.y = center.y; // - radius; // maxima.z = center.z + radius; // } // // if (xform) // transformBounds(minima, maxima); // } boolean inside(double x, double y, double z, boolean xform) { if (xform) untransform(x, y, z, inPnt); else LA.setVector(inPnt, x, y, z); //LA.vecSub(inPnt, center, inPnt); //return inPnt.x * inPnt.x + inPnt.y * inPnt.y + inPnt.z * inPnt.z <= radius * radius; return inPnt.y < 0; } cVector center; double radius; protected cVector inPnt; }