/** 3D Voxel index * @author: Phil Gage */ class VoxelIndex { //probably should have used xyz fields instead of array... //seems to work better in Java, since no array typdef // public int x, y, z; public int xyz[] = new int[3]; VoxelIndex () { } VoxelIndex (VoxelIndex v) { this.xyz[0] = v.xyz[0]; this.xyz[1] = v.xyz[1]; this.xyz[2] = v.xyz[2]; } VoxelIndex (int x, int y, int z) { this.xyz[0] = x; this.xyz[1] = y; this.xyz[2] = z; } /** Copy v to this */ public void set (VoxelIndex v) { this.xyz[0] = v.xyz[0]; this.xyz[1] = v.xyz[1]; this.xyz[2] = v.xyz[2]; } /** Copy xyz to this */ public void set (int x, int y, int z) { this.xyz[0] = x; this.xyz[1] = y; this.xyz[2] = z; } /** Compare */ public boolean equals (VoxelIndex v) { return this.xyz[0] == v.xyz[0] && this.xyz[1] == v.xyz[1] && this.xyz[2] == v.xyz[2]; } public String toString () { return "VoxelIndex x=" + xyz[0] + " y=" + xyz[1] + " z=" + xyz[2]; } }