public Object clone() { RectangularBox region = new RectangularBox(); for (int i = 0; i < parameterList.length; i++) { region.setParameter(new String(parameterList[i].parameterName), parameterList[i].getValue()); } return region; }
public static SphericalRegion getEnclosingSphere(RectangularBox box) { Point3f centre = new Point3f( (box.getHighestXValue() + box.getLowestXValue()) / 2, (box.getHighestYValue() + box.getLowestYValue()) / 2, (box.getHighestZValue() + box.getLowestZValue()) / 2); float radius = centre.distance( new Point3f(box.getLowestXValue(), box.getLowestYValue(), box.getLowestZValue())); SphericalRegion newSphere = new SphericalRegion(centre.x, centre.y, centre.z, radius); return newSphere; }
public static void main(String[] args) { RectangularBox rb = new RectangularBox(); System.out.println("Created: " + rb); Point3f p = new Point3f(95, 18f, 98); System.out.println("Moved: " + rb.getTranslatedRegion(new Vector3f(p))); System.out.println("Sphere around: " + RectangularBox.getEnclosingSphere(rb)); SimpleCell cell = new SimpleCell("fff"); Vector3f origLoc = new Vector3f(cell.getFirstSomaSegment().getStartPointPosition()); origLoc.scale(-1); CellTopologyHelper.translateAllPositions(cell, origLoc); System.out.println("Cell: " + CellTopologyHelper.printShortDetails(cell)); System.out.println("Is point: " + p + " in region: " + rb.isCellWithinRegion(p, cell, true)); }