- MarchingCubes.march(new SampledField() {
- public float getSample(Point p) {
- double x = p.x;
- double y = p.y;
- double z = p.z;
- x-=1.1;
- y-=1.1;
- z-=1.1;
- return (float)(0.8-Math.sqrt(x*x+y*y+z*z));
- }
- },
- 0, 30, 0.1, mesh);
+ MarchingCubes.march(new VoxelData() {
+ float radius = 1.0f;
+ public float getMaxX() { return 1.0f; }
+ public float getMinX() { return -1.0f; }
+ public int getNumSamplesX() { return 10; }
+ public float getMaxY() { return 1.0f; }
+ public float getMinY() { return -1.0f; }
+ public int getNumSamplesY() { return 10; }
+ public float getMaxZ() { return 1.0f; }
+ public float getMinZ() { return -1.0f; }
+ public int getNumSamplesZ() { return 10; }
+ public float getSample(Point p) {
+ double x = p.x;
+ double y = p.y;
+ double z = p.z;
+ return (float)(radius-Math.sqrt(x*x+y*y+z*z));
+ }
+ },
+ mesh);