/** * 3D bounding box * @author: Phil Gage */ class Extent { /** Minimum values of box */ Point min; /** Maximum values of box */ Point max; Extent () { min = new Point(0,0,0); max = new Point(0,0,0); } Extent (Point min, Point max) { this.min = new Point(min); this.max = new Point(max); } Extent (Extent extent) { min = extent.min; max = extent.max; } /** Return true if point is inside extent, add epsilon to avoid surface defects */ boolean inside (Point p) { return p.x >= min.x - Constants.EPSILON && p.x <= max.x + Constants.EPSILON && p.y >= min.y - Constants.EPSILON && p.y <= max.y + Constants.EPSILON && p.z >= min.z - Constants.EPSILON && p.z <= max.z + Constants.EPSILON; } public String toString () { return "Extent min=" + min + " max=" + max; } }