From: <ega...@us...> - 2003-05-27 12:32:42
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv30934/src/org/jrman/primitive Modified Files: Paraboloid.java Log Message: Improved Paraboloid dice_Ng Index: Paraboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Paraboloid.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Paraboloid.java 27 May 2003 02:59:43 -0000 1.2 --- Paraboloid.java 27 May 2003 12:32:39 -0000 1.3 *************** *** 34,40 **** public class Paraboloid extends Quadric { ! private static Point3f tmp = new Point3f(); ! private static Vector3f vtmp = new Vector3f(); --- 34,40 ---- public class Paraboloid extends Quadric { ! private static Point3f tmp = new Point3f(); ! private static Vector3f vtmp = new Vector3f(); *************** *** 48,52 **** private float thetaMax; ! private float maxZ; --- 48,52 ---- private float thetaMax; ! private float maxZ; *************** *** 74,79 **** float cosThetaMax = (float) Math.cos(thetaMax); float sinThetaMax = (float) Math.sin(thetaMax); ! float rMax = radius * (float) Math.sqrt(zMax/maxZ); ! float rMin = radius * (float) Math.sqrt(zMin/maxZ); float xMin; float xMax = cosThetaMin * rMin; --- 74,79 ---- float cosThetaMax = (float) Math.cos(thetaMax); float sinThetaMax = (float) Math.sin(thetaMax); ! float rMax = radius * (float) Math.sqrt(zMax / maxZ); ! float rMin = radius * (float) Math.sqrt(zMin / maxZ); float xMin; float xMax = cosThetaMin * rMin; *************** *** 113,119 **** public Primitive[] split() { Primitive[] result = new Primitive[2]; ! float r = Math.max(radius * (float) Math.sqrt(zMin/maxZ), ! radius * (float) Math.sqrt(zMax/maxZ)); ! if ((thetaMax - thetaMin) *r > zMax - zMin) { result[0] = new Paraboloid( --- 113,121 ---- public Primitive[] split() { Primitive[] result = new Primitive[2]; ! float r = ! Math.max( ! radius * (float) Math.sqrt(zMin / maxZ), ! radius * (float) Math.sqrt(zMax / maxZ)); ! if ((thetaMax - thetaMin) * r > zMax - zMin) { result[0] = new Paraboloid( *************** *** 173,177 **** float z = zMin; for (int v = 0; v < vSize; v++) { ! float r = radius * (float)Math.sqrt(z/maxZ); tmp.x = r * cosTheta; tmp.y = r * sinTheta; --- 175,179 ---- float z = zMin; for (int v = 0; v < vSize; v++) { ! float r = radius * (float) Math.sqrt(z / maxZ); tmp.x = r * cosTheta; tmp.y = r * sinTheta; *************** *** 183,187 **** } } ! protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); --- 185,189 ---- } } ! protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); *************** *** 189,193 **** float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); float zDelta = (zMax - zMin) / (vSize - 1); ! float p = (float)maxZ/(radius * radius); Vector3fGrid Ng = shaderVariables.Ng; float theta = thetaMin; --- 191,195 ---- float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); float zDelta = (zMax - zMin) / (vSize - 1); ! float a = (float) maxZ / (radius * radius); Vector3fGrid Ng = shaderVariables.Ng; float theta = thetaMin; *************** *** 195,199 **** float z = zMin; for (int v = 0; v < vSize; v++) { ! float ang = (float) Math.atan(-p/ z); float cosAng = (float) Math.cos(ang); float sinAng = (float) Math.sin(ang); --- 197,201 ---- float z = zMin; for (int v = 0; v < vSize; v++) { ! float ang = (float) Math.atan(- (2 * a) / z); float cosAng = (float) Math.cos(ang); float sinAng = (float) Math.sin(ang); |