/** Check if an internal node has a direct oriented point. * @param node internal node to check * @return true if the oriented point is direct */ private boolean isDirect(final BSPTree<Euclidean1D> node) { return ((OrientedPoint) node.getCut().getHyperplane()).isDirect(); }
/** {@inheritDoc} */ public SubHyperplane<Euclidean1D> apply(final SubHyperplane<Euclidean1D> sub, final Hyperplane<Euclidean2D> original, final Hyperplane<Euclidean2D> transformed) { final OrientedPoint op = (OrientedPoint) sub.getHyperplane(); final Line originalLine = (Line) original; final Line transformedLine = (Line) transformed; final Vector1D newLoc = transformedLine.toSubSpace(apply(originalLine.toSpace(op.getLocation()))); return new OrientedPoint(newLoc, op.isDirect(), originalLine.tolerance).wholeHyperplane(); }
/** Get the highest value belonging to the instance. * @return highest value belonging to the instance * ({@code Double.POSITIVE_INFINITY} if the instance doesn't * have any high bound, {@code Double.NEGATIVE_INFINITY} if the * instance is empty) */ public double getSup() { BSPTree<Euclidean1D> node = getTree(false); double sup = Double.NEGATIVE_INFINITY; while (node.getCut() != null) { final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane(); sup = op.getLocation().getX(); node = op.isDirect() ? node.getPlus() : node.getMinus(); } return ((Boolean) node.getAttribute()) ? Double.POSITIVE_INFINITY : sup; }
/** Get the lowest value belonging to the instance. * @return lowest value belonging to the instance * ({@code Double.NEGATIVE_INFINITY} if the instance doesn't * have any low bound, {@code Double.POSITIVE_INFINITY} if the * instance is empty) */ public double getInf() { BSPTree<Euclidean1D> node = getTree(false); double inf = Double.POSITIVE_INFINITY; while (node.getCut() != null) { final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane(); inf = op.getLocation().getX(); node = op.isDirect() ? node.getMinus() : node.getPlus(); } return ((Boolean) node.getAttribute()) ? Double.NEGATIVE_INFINITY : inf; }
/** Check if an internal node has a direct oriented point. * @param node internal node to check * @return true if the oriented point is direct */ private boolean isDirect(final BSPTree<Euclidean1D> node) { return ((OrientedPoint) node.getCut().getHyperplane()).isDirect(); }
/** {@inheritDoc} */ public SubHyperplane<Euclidean1D> apply(final SubHyperplane<Euclidean1D> sub, final Hyperplane<Euclidean2D> original, final Hyperplane<Euclidean2D> transformed) { final OrientedPoint op = (OrientedPoint) sub.getHyperplane(); final Line originalLine = (Line) original; final Line transformedLine = (Line) transformed; final Vector1D newLoc = transformedLine.toSubSpace(apply(originalLine.toSpace(op.getLocation()))); return new OrientedPoint(newLoc, op.isDirect(), originalLine.tolerance).wholeHyperplane(); }
/** Get the highest value belonging to the instance. * @return highest value belonging to the instance * ({@code Double.POSITIVE_INFINITY} if the instance doesn't * have any high bound, {@code Double.NEGATIVE_INFINITY} if the * instance is empty) */ public double getSup() { BSPTree<Euclidean1D> node = getTree(false); double sup = Double.NEGATIVE_INFINITY; while (node.getCut() != null) { final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane(); sup = op.getLocation().getX(); node = op.isDirect() ? node.getPlus() : node.getMinus(); } return ((Boolean) node.getAttribute()) ? Double.POSITIVE_INFINITY : sup; }
/** Get the lowest value belonging to the instance. * @return lowest value belonging to the instance * ({@code Double.NEGATIVE_INFINITY} if the instance doesn't * have any low bound, {@code Double.POSITIVE_INFINITY} if the * instance is empty) */ public double getInf() { BSPTree<Euclidean1D> node = getTree(false); double inf = Double.POSITIVE_INFINITY; while (node.getCut() != null) { final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane(); inf = op.getLocation().getX(); node = op.isDirect() ? node.getMinus() : node.getPlus(); } return ((Boolean) node.getAttribute()) ? Double.NEGATIVE_INFINITY : inf; }