Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30698/src/org/jrman/grid Modified Files: BooleanGrid.java Color3fGrid.java FloatGrid.java Grid.java Point3fGrid.java Tuple3fGrid.java Vector3fGrid.java Log Message: Check for Catmull Clark scheme before trying to instance a Subdivision Mesh. Started reformatting source code to fit in 80 columns, remove tabs and ugly formatting done by Eclipse. Index: Vector3fGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/Vector3fGrid.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Vector3fGrid.java 11 Jan 2006 06:23:23 -0000 1.9 --- Vector3fGrid.java 26 Feb 2007 19:35:46 -0000 1.10 *************** *** 1,19 **** /* ! Vector3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Vector3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 39,43 **** * normalize */ - public void normalize(Vector3fGrid v) { Vector3f[] tdata = (Vector3f[]) data; --- 39,42 ---- *************** *** 58,62 **** * vtransform */ - public void vtransform(Vector3fGrid v, Transform transform) { Vector3f[] tdata = (Vector3f[]) data; --- 57,60 ---- *************** *** 78,82 **** * ntransform */ - public void ntransform(Vector3fGrid n, Transform transform) { Vector3f[] tdata = (Vector3f[]) data; --- 76,79 ---- *************** *** 98,102 **** * faceforward */ - public void faceforward(Vector3fGrid v, Vector3f light) { Vector3f[] tdata = (Vector3f[]) data; --- 95,98 ---- *************** *** 127,131 **** * cross */ - public void cross(Vector3fGrid v1, Vector3fGrid v2) { Vector3f[] vdata = (Vector3f[]) data; --- 123,126 ---- Index: Grid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/Grid.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Grid.java 22 May 2003 07:36:26 -0000 1.4 --- Grid.java 26 Feb 2007 19:35:46 -0000 1.5 *************** *** 1,19 **** /* ! Grid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Grid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Index: Tuple3fGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/Tuple3fGrid.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Tuple3fGrid.java 11 Jan 2006 06:23:23 -0000 1.11 --- Tuple3fGrid.java 26 Feb 2007 19:35:46 -0000 1.12 *************** *** 1,19 **** /* ! Tuple3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Tuple3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 51,55 **** * set */ - public void set(float in) { for (int i= 0; i < size; i++) { --- 51,54 ---- *************** *** 112,116 **** * negate */ - public void negate(Tuple3fGrid t) { for (int i= 0; i < size; i++) --- 111,114 ---- *************** *** 127,131 **** * add */ - public void add(Tuple3fGrid t1, Tuple3f t2) { for (int i= 0; i < size; i++) --- 125,128 ---- *************** *** 153,157 **** * sub */ - public void sub(Tuple3fGrid t1, Tuple3f t2) { for (int i= 0; i < size; i++) --- 150,153 ---- *************** *** 190,194 **** * mul */ - public void mul(Tuple3fGrid t1, float f) { for (int i= 0; i < size; i++) { --- 186,189 ---- *************** *** 236,240 **** * div */ - public void div(Tuple3fGrid t1, Tuple3f t2) { for (int i= 0; i < size; i++) { --- 231,234 ---- *************** *** 291,295 **** * min */ - public void min(Tuple3fGrid t1, Tuple3f t2) { for (int i= 0; i < size; i++) { --- 285,288 ---- *************** *** 329,333 **** * max */ - public void max(Tuple3fGrid t1, Tuple3f t2) { for (int i= 0; i < size; i++) { --- 322,325 ---- *************** *** 367,371 **** * clamp */ - public void clamp(Tuple3fGrid t, Tuple3f min, Tuple3f max) { for (int i= 0; i < size; i++) { --- 359,362 ---- *************** *** 389,393 **** * mix */ - public void mix(Tuple3f t1, Tuple3f t2, FloatGrid alpha) { for (int i= 0; i < size; i++) { --- 380,383 ---- *************** *** 522,526 **** * Du */ - public void Du(Tuple3fGrid t, FloatGrid du) { for (int i= 0; i < size; i += uSize) { --- 512,515 ---- *************** *** 553,557 **** * Dv */ - public void Dv(Tuple3fGrid t, FloatGrid dv) { for (int i= 0; i < size - uSize; i += uSize) --- 542,545 ---- *************** *** 583,587 **** * random */ - public void random() { for (int i= 0; i < size; i++) --- 571,574 ---- *************** *** 600,604 **** * noise */ - public void noise(FloatGrid x) { for (int i= 0; i < size; i++) { --- 587,590 ---- *************** *** 654,660 **** for (int i= 0; i < size; i++) { Tuple3f tup= t.data[i]; ! data[i].set(0.5f * PerlinNoise.noise4d(tup.x, tup.y, tup.z, w)+0.5f, ! 0.5f * PerlinNoise.noise4d(tup.x, tup.z, tup.y, w)+0.5f, ! 0.5f * PerlinNoise.noise4d(tup.z, tup.y, tup.x, w)+0.5f); } } --- 640,646 ---- for (int i= 0; i < size; i++) { Tuple3f tup= t.data[i]; ! data[i].set(0.5f * PerlinNoise.noise4d(tup.x, tup.y, tup.z,w)+0.5f, ! 0.5f * PerlinNoise.noise4d(tup.x, tup.z, tup.y,w)+0.5f, ! 0.5f * PerlinNoise.noise4d(tup.z, tup.y, tup.x,w)+0.5f); } } *************** *** 663,667 **** * snoise */ - public void snoise(FloatGrid x) { for (int i= 0; i < size; i++) { --- 649,652 ---- *************** *** 727,731 **** private float pnoiseInternal1(float x, float px) { // this method reuses the argument variables (they are passed by value) ! // to decrease allocation of additional temporary varables x = x > 0 ? x % px : (-x) % px; float pmx = px - x; --- 712,716 ---- private float pnoiseInternal1(float x, float px) { // this method reuses the argument variables (they are passed by value) ! // to decrease allocation of additional temporary variables x = x > 0 ? x % px : (-x) % px; float pmx = px - x; *************** *** 772,776 **** } ! private float pnoiseInternal3(float x, float y, float z, float px, float py, float pz) { // this method reuses the argument variables (they are passed by value) // to decrease allocation of additional temporary varables --- 757,762 ---- } ! private float pnoiseInternal3(float x, float y, float z, float px, ! float py, float pz) { // this method reuses the argument variables (they are passed by value) // to decrease allocation of additional temporary varables *************** *** 818,827 **** } } - // TODO implement Tuple3f pnoise /* * cellnoise */ - public void cellnoise(FloatGrid x) { for (int i= 0; i < size; i++) { --- 804,811 ---- *************** *** 877,883 **** for (int i= 0; i < size; i++) { Tuple3f tup= t.data[i]; ! data[i].set(0.5f*PerlinNoise.cellnoise4d(tup.x,tup.y,tup.z, w)+0.5f, ! 0.5f*PerlinNoise.cellnoise4d(tup.x,tup.z,tup.y, w)+0.5f, ! 0.5f*PerlinNoise.cellnoise4d(tup.z,tup.y,tup.x, w)+0.5f); } } --- 861,867 ---- for (int i= 0; i < size; i++) { Tuple3f tup= t.data[i]; ! data[i].set(0.5f*PerlinNoise.cellnoise4d(tup.x,tup.y,tup.z,w)+0.5f, ! 0.5f*PerlinNoise.cellnoise4d(tup.x,tup.z,tup.y,w)+0.5f, ! 0.5f*PerlinNoise.cellnoise4d(tup.z,tup.y,tup.x,w)+0.5f); } } *************** *** 886,890 **** * setxcomp */ - public void setxcomp(float x) { for (int i= 0; i < size; i++) --- 870,873 ---- *************** *** 912,916 **** * setycomp */ - public void setycomp(float y) { for (int i= 0; i < size; i++) --- 895,898 ---- *************** *** 938,942 **** * setzcomp */ - public void setzcomp(float z) { for (int i= 0; i < size; i++) --- 920,923 ---- Index: Color3fGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/Color3fGrid.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Color3fGrid.java 14 Nov 2005 02:00:19 -0000 1.10 --- Color3fGrid.java 26 Feb 2007 19:35:46 -0000 1.11 *************** *** 1,19 **** /* ! Color3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Color3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 30,34 **** private static Color3f tmpc = new Color3f(); ! private static void getColor(MipMap texture, float s, float t, float area, Color3f out) { texture.getData(s, t, area, mmData); out.x = mmData[0]; --- 30,35 ---- private static Color3f tmpc = new Color3f(); ! private static void getColor(MipMap texture, float s, float t, ! float area, Color3f out) { texture.getData(s, t, area, mmData); out.x = mmData[0]; *************** *** 50,55 **** * texture */ ! ! public void texture(String textureName, FloatGrid s, FloatGrid t, float blur) { MipMap texture = MipMap.getMipMap(textureName); for (int v = 0; v < vSize; v++) --- 51,56 ---- * texture */ ! public void texture(String textureName, FloatGrid s, FloatGrid t, ! float blur) { MipMap texture = MipMap.getMipMap(textureName); for (int v = 0; v < vSize; v++) *************** *** 62,75 **** v1 = v - 1; float area = ! ((s.get(u, v) + s.get(u1, v)) * (t.get(u, v) - t.get(u1, v)) ! + (s.get(u1, v) + s.get(u1, v1)) * (t.get(u1, v) - t.get(u1, v1)) ! + (s.get(u1, v1) + s.get(u, v1)) * (t.get(u1, v1) - t.get(u, v1)) ! + (s.get(u, v1) + s.get(u, v)) * (t.get(u, v1) - t.get(u, v))) ! / 2f; area = Math.abs(area) + blur; - /* - float avgS = (s.get(u, v) + s.get(u1, v) + s.get(u1, v1) + s.get(u, v1)) / 4f; - float avgT = (t.get(u, v) + t.get(u1, v) + t.get(u1, v1) + t.get(u, v1)) / 4f; - */ float avgS = s.get(u, v); float avgT = t.get(u, v); --- 63,75 ---- v1 = v - 1; float area = ! ((s.get(u, v) + s.get(u1, v)) * (t.get(u, v) - t.get(u1, v)) ! + (s.get(u1, v) + s.get(u1, v1)) * ! (t.get(u1, v) - t.get(u1, v1)) ! + (s.get(u1, v1) + s.get(u, v1)) * ! (t.get(u1, v1) - t.get(u, v1)) ! + (s.get(u, v1) + s.get(u, v)) * ! (t.get(u, v1) - t.get(u, v))) ! / 2f; area = Math.abs(area) + blur; float avgS = s.get(u, v); float avgT = t.get(u, v); Index: Point3fGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/Point3fGrid.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Point3fGrid.java 11 Jan 2006 06:23:23 -0000 1.6 --- Point3fGrid.java 26 Feb 2007 19:35:46 -0000 1.7 *************** *** 1,19 **** /* ! Point3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Point3fGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 39,43 **** * transform */ - public void transform(Point3fGrid p, Transform transform) { Point3f[] tdata = (Point3f[]) data; --- 39,42 ---- Index: FloatGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/FloatGrid.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FloatGrid.java 11 Jan 2006 06:23:23 -0000 1.27 --- FloatGrid.java 26 Feb 2007 19:35:46 -0000 1.28 *************** *** 73,77 **** * set */ - public void set(float f) { for (int i = 0; i < size; i++) --- 73,76 ---- *************** *** 99,103 **** * negate */ - public void negate(FloatGrid f) { for (int i = 0; i < size; i++) --- 98,101 ---- *************** *** 114,118 **** * add */ - public void add(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 112,115 ---- *************** *** 140,144 **** * sub */ - public void sub(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 137,140 ---- *************** *** 177,181 **** * mul */ - public void mul(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 173,176 ---- *************** *** 203,207 **** * div */ - public void div(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 198,201 ---- *************** *** 241,245 **** * toRadians */ - public void toRadians(FloatGrid f) { for (int i = 0; i < size; i++) --- 235,238 ---- *************** *** 256,260 **** * toDegrees */ - public void toDegrees(FloatGrid f) { for (int i = 0; i < size; i++) --- 249,252 ---- *************** *** 271,275 **** * sin */ - public void sin(FloatGrid f) { for (int i = 0; i < size; i++) --- 263,266 ---- *************** *** 286,290 **** * asin */ - public void asin(FloatGrid f) { for (int i = 0; i < size; i++) --- 277,280 ---- *************** *** 301,305 **** * cos */ - public void cos(FloatGrid f) { for (int i = 0; i < size; i++) --- 291,294 ---- *************** *** 316,320 **** * acos */ - public void acos(FloatGrid f) { for (int i = 0; i < size; i++) --- 305,308 ---- *************** *** 331,335 **** * tan */ - public void tan(FloatGrid f) { for (int i = 0; i < size; i++) --- 319,322 ---- *************** *** 346,350 **** * atan */ - public void atan(FloatGrid f) { for (int i = 0; i < size; i++) --- 333,336 ---- *************** *** 361,365 **** * atan (2 args) */ - public void atan(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 347,350 ---- *************** *** 398,402 **** * pow */ - public void pow(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 383,386 ---- *************** *** 435,439 **** * exp */ - public void exp(FloatGrid f) { for (int i = 0; i < size; i++) --- 419,422 ---- *************** *** 450,454 **** * sqrt */ - public void sqrt(FloatGrid f) { for (int i = 0; i < size; i++) --- 433,436 ---- *************** *** 465,469 **** * isqrt */ - public void isqrt(FloatGrid f) { for (int i = 0; i < size; i++) --- 447,450 ---- *************** *** 480,484 **** * log */ - public void log(FloatGrid f) { for (int i = 0; i < size; i++) --- 461,464 ---- *************** *** 495,499 **** * log base */ - public void log(FloatGrid f, float base) { double baseLog = Math.log(base); --- 475,478 ---- *************** *** 512,516 **** * mod */ - public void mod(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 491,494 ---- *************** *** 549,553 **** * abs */ - public void abs(FloatGrid f) { for (int i = 0; i < size; i++) --- 527,530 ---- *************** *** 564,568 **** * sign */ - public void sign(FloatGrid f) { for (int i = 0; i < size; i++) --- 541,544 ---- *************** *** 579,583 **** * min */ - public void min(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 555,558 ---- *************** *** 605,609 **** * max */ - public void max(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 580,583 ---- *************** *** 631,635 **** * clamp */ - public void clamp(FloatGrid f, float min, float max) { for (int i = 0; i < size; i++) --- 605,608 ---- *************** *** 646,650 **** * mix */ - public void mix(float f1, float f2, FloatGrid alpha) { for (int i = 0; i < size; i++) --- 619,622 ---- *************** *** 729,733 **** * floor */ - public void floor(FloatGrid f) { for (int i = 0; i < size; i++) --- 701,704 ---- *************** *** 744,748 **** * ceil */ - public void ceil(FloatGrid f) { for (int i = 0; i < size; i++) --- 715,718 ---- *************** *** 759,763 **** * round */ - public void round(FloatGrid f) { for (int i = 0; i < size; i++) --- 729,732 ---- *************** *** 774,778 **** * step */ - public void step(FloatGrid f1, float f2) { for (int i = 0; i < size; i++) --- 743,746 ---- *************** *** 811,815 **** * smoothstep */ - public void smoothstep(float f1, float f2, FloatGrid alpha) { for (int i = 0; i < size; i++) --- 779,782 ---- *************** *** 900,904 **** * filterstep */ - // TODO implement float filterstep --- 867,870 ---- *************** *** 906,910 **** * spline */ - // TODO implement float spline --- 872,875 ---- *************** *** 912,916 **** * Du */ - public void du(FloatGrid u) { for (int i = 0; i < size; i += uSize) { --- 877,880 ---- *************** *** 948,952 **** * Dv */ - public void dv(FloatGrid v) { for (int i = 0; i < size - uSize; i += uSize) --- 912,915 ---- *************** *** 980,984 **** * random */ - public void random() { for (int i = 0; i < size; i++) --- 943,946 ---- *************** *** 995,999 **** * noise */ - public void noise(FloatGrid x) { for (int i = 0; i < size; i++) --- 957,960 ---- *************** *** 1035,1039 **** * snoise */ - public void snoise(FloatGrid x) { for (int i = 0; i < size; i++) --- 996,999 ---- *************** *** 1071,1075 **** * pnoise */ - public void pnoise(FloatGrid x, float px) { assert px > 0f; --- 1031,1034 ---- *************** *** 1132,1144 **** } ! public void pnoise( ! FloatGrid x, ! FloatGrid y, ! FloatGrid z, ! float w, ! float px, ! float py, ! float pz, ! float pw) { assert px > 0f && py > 0f && pz > 0f && pw > 0f; float nw = w > 0 ? w % pw : (-w) % pw; --- 1091,1102 ---- } ! public void pnoise(FloatGrid x, ! FloatGrid y, ! FloatGrid z, ! float w, ! float px, ! float py, ! float pz, ! float pw) { assert px > 0f && py > 0f && pz > 0f && pw > 0f; float nw = w > 0 ? w % pw : (-w) % pw; *************** *** 1274,1319 **** /* - public static float pnoise(float x, float y, float px, float py) { - assert px > 0f && py > 0f; - x= x > 0 ? x % px : (-x) % px; - y= y > 0 ? y % py : (-y) % py; - float pmx= px - x; - float pmy= py - y; - float tmp= (PerlinNoise.noise2d(x, y) * pmx + PerlinNoise.noise2d(-pmx, y) * x) * pmy; - tmp += (PerlinNoise.noise2d(x, -pmy) * pmx + PerlinNoise.noise2d(-pmx, -pmy) * x) * y; - tmp /= px * py; - return .5f + tmp * .5f; - } - - public static void main(String[] args) { - float x, y, l= 4f, w= 4f, n, max= -Float.MAX_VALUE, min= Float.MAX_VALUE; - int i, j, il= 500, iw= 500; - float dx= w / iw, dy= l / il; - BufferedImage bi= new BufferedImage(iw, il, BufferedImage.TYPE_INT_ARGB); - long before= System.currentTimeMillis(); - for (i= 0, x= -2f; i < iw; i++, x += dx) { - for (j= 0, y= 2f; j < il; j++, y += dy) { - n= FloatGrid.pnoise(x, y, 2.5f, 1.7f); - bi.setRGB(i, j, Color.getHSBColor(0f, 0.f, n).getRGB()); - if (n > max) - max= n; - if (n < min) - min= n; - } - } - System.out.println("millis " + (System.currentTimeMillis() - before)); - System.out.println("max=" + max); - System.out.println("min=" + min); - JFrame f= new JFrame("periodic noise"); - f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - f.getContentPane().add(new JLabel(new ImageIcon(bi))); - f.pack(); - f.setVisible(true); - } - */ - /* * cellnoise */ - public void cellnoise(FloatGrid x) { for (int i = 0; i < size; i++) --- 1232,1237 ---- *************** *** 1352,1356 **** * xcomp */ - public void xcomp(Tuple3fGrid t) { for (int i = 0; i < size; i++) --- 1270,1273 ---- *************** *** 1367,1371 **** * ycomp */ - public void ycomp(Tuple3fGrid t) { for (int i = 0; i < size; i++) --- 1284,1287 ---- *************** *** 1382,1386 **** * zcomp */ - public void zcomp(Tuple3fGrid t) { for (int i = 0; i < size; i++) --- 1298,1301 ---- *************** *** 1397,1401 **** * length */ - public void length(Vector3fGrid v) { Vector3f[] vdata = (Vector3f[]) v.data; --- 1312,1315 ---- *************** *** 1414,1418 **** * distance */ - public void distance(Point3fGrid p1, Point3f p2) { Point3f[] p1data = (Point3f[]) p1.data; --- 1328,1331 ---- *************** *** 1446,1450 **** * dot */ - public void dot(Vector3fGrid p1, Vector3f p2) { Vector3f[] p1data = (Vector3f[]) p1.data; --- 1359,1362 ---- *************** *** 1478,1482 **** * ptlined */ - // TODO implement ptlined --- 1390,1393 ---- *************** *** 1484,1488 **** * area */ - public void area(Point3fGrid p) { Point3f[] pdata = (Point3f[]) p.data; --- 1395,1398 ---- *************** *** 1541,1545 **** * depth */ - public void depth(Point3fGrid p, float near, float far) { Point3f[] pdata = (Point3f[]) p.data; --- 1451,1454 ---- *************** *** 1558,1562 **** * texture */ - public void texture(String textureName, FloatGrid s, FloatGrid t, float blur, int band) { --- 1467,1470 ---- *************** *** 1592,1602 **** * shadow */ ! ! public void shadow( ! String shadowName, ! Point3fGrid p, ! float bias, ! float samples, ! float blur) { int isamples = (int) samples; float oneOverSamples = 1f / samples; --- 1500,1508 ---- * shadow */ ! public void shadow(String shadowName, ! Point3fGrid p, ! float bias, ! float samples, ! float blur) { int isamples = (int) samples; float oneOverSamples = 1f / samples; *************** *** 1625,1629 **** * simulPow */ - public void simulPow(FloatGrid f1, float n) { for (int i = 0; i < size; i++) { --- 1531,1534 ---- Index: BooleanGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/BooleanGrid.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BooleanGrid.java 25 Oct 2003 05:46:46 -0000 1.6 --- BooleanGrid.java 26 Feb 2007 19:35:46 -0000 1.7 *************** *** 1,19 **** /* ! BooleanGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! BooleanGrid.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |