Java Code Examples for org.apache.commons.math3.geometry.partitioning.Region#getTree()

The following examples show how to use org.apache.commons.math3.geometry.partitioning.Region#getTree() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NPEfix10_ten_s.java    From coming with MIT License 6 votes vote down vote up
/** Build a parallellepipedic box boundary.
     * @param xMin low bound along the x direction
     * @param xMax high bound along the x direction
     * @param yMin low bound along the y direction
     * @param yMax high bound along the y direction
     * @param zMin low bound along the z direction
     * @param zMax high bound along the z direction
     * @param tolerance tolerance below which points are considered identical
     * @return boundary tree
     * @since 3.3
     */
    private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                      final double yMin, final double yMax,
                                                      final double zMin, final double zMax,
                                                      final double tolerance) {
//    	FIX
//        if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) {
//            // too thin box, build an empty polygons set
//            return new BSPTree<Euclidean3D>(Boolean.FALSE);
//        }
        final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I, tolerance);
        final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I,  tolerance);
        final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J, tolerance);
        final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J,  tolerance);
        final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K, tolerance);
        final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K,  tolerance);
        @SuppressWarnings("unchecked")
        final Region<Euclidean3D> boundary =
                new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
        return boundary.getTree(false);
    }
 
Example 2
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Build a parallellepipedic box boundary.
 * @param xMin low bound along the x direction
 * @param xMax high bound along the x direction
 * @param yMin low bound along the y direction
 * @param yMax high bound along the y direction
 * @param zMin low bound along the z direction
 * @param zMax high bound along the z direction
 * @param tolerance tolerance below which points are considered identical
 * @return boundary tree
 * @since 3.3
 */
private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                  final double yMin, final double yMax,
                                                  final double zMin, final double zMax,
                                                  final double tolerance) {
    if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) {
        // too thin box, build an empty polygons set
        return new BSPTree<Euclidean3D>(Boolean.FALSE);
    }
    final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I, tolerance);
    final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I,  tolerance);
    final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J, tolerance);
    final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J,  tolerance);
    final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K, tolerance);
    final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K,  tolerance);
    @SuppressWarnings("unchecked")
    final Region<Euclidean3D> boundary =
    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
    return boundary.getTree(false);
}
 
Example 3
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Build a parallellepipedic box boundary.
 * @param xMin low bound along the x direction
 * @param xMax high bound along the x direction
 * @param yMin low bound along the y direction
 * @param yMax high bound along the y direction
 * @param zMin low bound along the z direction
 * @param zMax high bound along the z direction
 * @param tolerance tolerance below which points are considered identical
 * @return boundary tree
 * @since 3.3
 */
private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                  final double yMin, final double yMax,
                                                  final double zMin, final double zMax,
                                                  final double tolerance) {
    if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) {
        // too thin box, build an empty polygons set
        return new BSPTree<Euclidean3D>(Boolean.FALSE);
    }
    final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I, tolerance);
    final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I,  tolerance);
    final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J, tolerance);
    final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J,  tolerance);
    final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K, tolerance);
    final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K,  tolerance);
    @SuppressWarnings("unchecked")
    final Region<Euclidean3D> boundary =
    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
    return boundary.getTree(false);
}
 
Example 4
Source File: NPEfix10_ten_t.java    From coming with MIT License 5 votes vote down vote up
/** Build a parallellepipedic box boundary.
     * @param xMin low bound along the x direction
     * @param xMax high bound along the x direction
     * @param yMin low bound along the y direction
     * @param yMax high bound along the y direction
     * @param zMin low bound along the z direction
     * @param zMax high bound along the z direction
     * @param tolerance tolerance below which points are considered identical
     * @return boundary tree
     * @since 3.3
     */
    private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                      final double yMin, final double yMax,
                                                      final double zMin, final double zMax,
                                                      final double tolerance) {
//    	FIX
//        if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) {
//            // too thin box, build an empty polygons set
//            return new BSPTree<Euclidean3D>(Boolean.FALSE);
//        }

        if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) {
            // too thin box, build an empty polygons set
            return new BSPTree<Euclidean3D>(Boolean.FALSE);
        }



        final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I, tolerance);
        final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I,  tolerance);
        final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J, tolerance);
        final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J,  tolerance);
        final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K, tolerance);
        final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K,  tolerance);
        @SuppressWarnings("unchecked")
        final Region<Euclidean3D> boundary =
                new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
        return boundary.getTree(false);
    }
 
Example 5
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Build a parallellepipedic box boundary.
 * @param xMin low bound along the x direction
 * @param xMax high bound along the x direction
 * @param yMin low bound along the y direction
 * @param yMax high bound along the y direction
 * @param zMin low bound along the z direction
 * @param zMax high bound along the z direction
 * @return boundary tree
 */
private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                  final double yMin, final double yMax,
                                                  final double zMin, final double zMax) {
    final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I);
    final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I);
    final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J);
    final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J);
    final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K);
    final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K);
    @SuppressWarnings("unchecked")
    final Region<Euclidean3D> boundary =
    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
    return boundary.getTree(false);
}
 
Example 6
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Build a parallellepipedic box boundary.
 * @param xMin low bound along the x direction
 * @param xMax high bound along the x direction
 * @param yMin low bound along the y direction
 * @param yMax high bound along the y direction
 * @param zMin low bound along the z direction
 * @param zMax high bound along the z direction
 * @return boundary tree
 */
private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                  final double yMin, final double yMax,
                                                  final double zMin, final double zMax) {
    final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I);
    final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I);
    final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J);
    final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J);
    final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K);
    final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K);
    @SuppressWarnings("unchecked")
    final Region<Euclidean3D> boundary =
    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
    return boundary.getTree(false);
}
 
Example 7
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Build a parallellepipedic box boundary.
 * @param xMin low bound along the x direction
 * @param xMax high bound along the x direction
 * @param yMin low bound along the y direction
 * @param yMax high bound along the y direction
 * @param zMin low bound along the z direction
 * @param zMax high bound along the z direction
 * @return boundary tree
 */
private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                  final double yMin, final double yMax,
                                                  final double zMin, final double zMax) {
    final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I);
    final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I);
    final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J);
    final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J);
    final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K);
    final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K);
    @SuppressWarnings("unchecked")
    final Region<Euclidean3D> boundary =
    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
    return boundary.getTree(false);
}
 
Example 8
Source File: PolyhedronsSet.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Build a parallellepipedic box boundary.
 * @param xMin low bound along the x direction
 * @param xMax high bound along the x direction
 * @param yMin low bound along the y direction
 * @param yMax high bound along the y direction
 * @param zMin low bound along the z direction
 * @param zMax high bound along the z direction
 * @return boundary tree
 */
private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
                                                  final double yMin, final double yMax,
                                                  final double zMin, final double zMax) {
    final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I);
    final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I);
    final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J);
    final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J);
    final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K);
    final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K);
    @SuppressWarnings("unchecked")
    final Region<Euclidean3D> boundary =
    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
    return boundary.getTree(false);
}