/** * Utilities used by uk.ac.leeds.ccg.andyt.gws library that might be more generally useful. * Copyright (C) 2005 Andy Turner, CCG, University of Leeds, UK. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ package uk.ac.leeds.ccg.andyt.gws.utilities; // java dependencies import java.awt.geom.Point2D; import java.math.BigDecimal; import java.math.BigInteger; import java.io.File; import java.io.StreamTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.FileInputStream; import java.util.Vector; import java.util.HashSet; import java.util.Iterator; // uk.ac.leeds.ccg.andyt.grids dependencies import uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellAbstract; // uk.ac.leeds.ccg.andyt.gws dependencies /** * TODO: * docs */ public class Utilities { /** Creates a new instance of Utilities */ public Utilities() { } /** * Returns a Point2D.Double[] of points loaded from inputFile. * @param inputFile */ public static Point2D.Double[] loadData( File inputFile ) { Vector pointsVector = new Vector(); try { StreamTokenizer st = new StreamTokenizer( new BufferedReader( new InputStreamReader( new FileInputStream( inputFile ) ) ) ); st.eolIsSignificant( false ); st.parseNumbers(); st.whitespaceChars( ',', ',' ); st.wordChars( '"', '"' ); int tokenType = st.nextToken(); int read = 0; double x = Double.NaN; double y = Double.NaN; Point2D.Double point = null; while ( tokenType != StreamTokenizer.TT_EOF ) { switch ( tokenType ) { case StreamTokenizer.TT_NUMBER : switch ( read ) { case 0 : x = st.nval; read = 1; break; case 1 : y = st.nval; read = 0; point = new Point2D.Double( x, y ); pointsVector.add( point ); break; } break; default : break; } tokenType = st.nextToken(); } } catch ( java.io.IOException e ) { System.out.println( e ); } Point2D.Double[] pointsArray = new Point2D.Double[ pointsVector.size() ]; for ( int i = 0; i < pointsArray.length; i ++ ) { pointsArray[ i ] = ( Point2D.Double ) pointsVector.elementAt( i ); } return pointsArray; } /** * Returns a Point2D.Double[] of points loaded from inputFile */ public static Point2D.Double[] loadData( Point2D.Double[] pointsToAddTo, File inputFile ) { Vector pointsVector = new Vector(); try { StreamTokenizer st = new StreamTokenizer( new BufferedReader( new InputStreamReader( new FileInputStream( inputFile ) ) ) ); st.eolIsSignificant( false ); st.parseNumbers(); st.whitespaceChars( ',', ',' ); st.wordChars( '"', '"' ); int tokenType = st.nextToken(); int read = 0; double x = Double.NaN; double y = Double.NaN; Point2D.Double point = null; while ( tokenType != StreamTokenizer.TT_EOF ) { switch ( tokenType ) { case StreamTokenizer.TT_NUMBER : switch ( read ) { case 0 : x = st.nval; read = 1; break; case 1 : y = st.nval; read = 0; point = new Point2D.Double( x, y ); pointsVector.add( point ); //System.out.println( "x " + x + ", y " + y ); break; } break; default : break; } tokenType = st.nextToken(); } } catch ( java.io.IOException e ) { System.out.println( e ); } for ( int i = 0; i < pointsToAddTo.length; i ++ ){ pointsVector.add( pointsToAddTo[ i ] ); } Point2D.Double[] pointsArray = new Point2D.Double[ pointsVector.size() ]; for ( int i = 0; i < pointsArray.length; i ++ ) { pointsArray[ i ] = ( Point2D.Double ) pointsVector.elementAt( i ); } return pointsArray; } /** * Returns a Point2D.Double[] of points loaded from inputFile that are in * bounds given by xmin, ymin, xmax, ymax */ public static Point2D.Double[] loadData( File inputFile, double xmin, double ymin, double xmax, double ymax ) { Vector pointsVector = new Vector(); try { StreamTokenizer st = new StreamTokenizer( new BufferedReader( new InputStreamReader( new FileInputStream( inputFile ) ) ) ); st.eolIsSignificant( false ); st.parseNumbers(); st.whitespaceChars( ',', ',' ); st.wordChars( '"', '"' ); int tokenType = st.nextToken(); int read = 0; double x = Double.NaN; double y = Double.NaN; Point2D.Double point = null; while ( tokenType != StreamTokenizer.TT_EOF ) { switch ( tokenType ) { case StreamTokenizer.TT_NUMBER : switch ( read ) { case 0 : x = st.nval; read = 1; break; case 1 : y = st.nval; read = 0; if ( x >= xmin && y >= ymin && x<= xmax && y <= ymax ) { point = new Point2D.Double( x, y ); pointsVector.add( point ); } break; } break; default : break; } tokenType = st.nextToken(); } } catch ( java.io.IOException e ) { System.out.println( e ); } Point2D.Double[] pointsArray = new Point2D.Double[ pointsVector.size() ]; for ( int i = 0; i < pointsArray.length; i ++ ) { pointsArray[ i ] = ( Point2D.Double ) pointsVector.elementAt( i ); } return pointsArray; } /** * Returns a Point2D.Double[] of points loaded from inputFile that are in * bounds given by dimensions. * @param inputFile * @param dimensions * TODO: * This can be improved by reading data into BigDecimal Point2DBigDecimal[] * and using BigDecimal.compareTo(); */ public static Point2D.Double[] loadData( File inputFile, BigDecimal[] dimensions ) { Vector pointsVector = new Vector(); double xmin = dimensions[ 1 ].doubleValue(); double ymin = dimensions[ 1 ].doubleValue(); double xmax = dimensions[ 1 ].doubleValue(); double ymax = dimensions[ 1 ].doubleValue(); try { StreamTokenizer st = new StreamTokenizer( new BufferedReader( new InputStreamReader( new FileInputStream( inputFile ) ) ) ); st.eolIsSignificant( false ); st.parseNumbers(); st.whitespaceChars( ',', ',' ); st.wordChars( '"', '"' ); int tokenType = st.nextToken(); int read = 0; double x = Double.NaN; double y = Double.NaN; Point2D.Double point = null; while ( tokenType != StreamTokenizer.TT_EOF ) { switch ( tokenType ) { case StreamTokenizer.TT_NUMBER : switch ( read ) { case 0 : x = st.nval; read = 1; break; case 1 : y = st.nval; read = 0; if ( x >= xmin && y >= ymin && x<= xmax && y <= ymax ) { point = new Point2D.Double( x, y ); pointsVector.add( point ); } break; } break; default : break; } tokenType = st.nextToken(); } } catch ( java.io.IOException e ) { System.out.println( e ); } Point2D.Double[] pointsArray = new Point2D.Double[ pointsVector.size() ]; for ( int i = 0; i < pointsArray.length; i ++ ) { pointsArray[ i ] = ( Point2D.Double ) pointsVector.elementAt( i ); } return pointsArray; } ///** //* //*/ //public static Point2D.Double[] loadData( File inputFile, Grid2DSquareCellAbstract grid2DSquareCell, double boundary ) { //BigDecimal[] dimensions = grid2DSquareCell.getDimensions(); //BigDecimal boundaryBigDecimal = new BigDecimal( boundary ); //double xmin = dimensions[ 1 ].subtract( boundaryBigDecimal ).doubleValue(); //double ymin = dimensions[ 2 ].subtract( boundaryBigDecimal ).doubleValue(); //double xmax = dimensions[ 3 ].add( boundaryBigDecimal ).doubleValue(); //double ymax = dimensions[ 4 ].add( boundaryBigDecimal ).doubleValue(); //Vector pointsVector = new Vector(); //try { // StreamTokenizer st = // new StreamTokenizer( // new BufferedReader( // new InputStreamReader( // new FileInputStream( inputFile ) ) ) ); // st.eolIsSignificant( false ); // st.parseNumbers(); // st.whitespaceChars( ',', ',' ); // st.wordChars( '"', '"' ); // int tokenType = st.nextToken(); // int read = 0; // double x = Double.NaN; // double y = Double.NaN; // Point2D.Double point = null; // while ( tokenType != StreamTokenizer.TT_EOF ) { // switch ( tokenType ) { // case StreamTokenizer.TT_NUMBER : // switch ( read ) { // case 0 : // x = st.nval; // read = 1; // break; // case 1 : // y = st.nval; // read = 0; // if ( x >= xmin && y >= ymin && x<= xmax && y <= ymax ) { // point = new Point2D.Double( x, y ); // pointsVector.add( point ); // grid2DSquareCell.addToCell( grid2DSquareCell.getNearestCellID( x, y ), 1.0d ); // } // break; // } // break; // default : // break; // } // tokenType = st.nextToken(); // } //} catch ( java.io.IOException e ) { // System.out.println( e ); //} //Point2D.Double[] pointsArray = new Point2D.Double[ pointsVector.size() ]; //for ( int i = 0; i < pointsArray.length; i ++ ) { // pointsArray[ i ] = ( Point2D.Double ) pointsVector.elementAt( i ); //} //return pointsArray; //} /** * Returns the IDs of points that are in distance of point as a HashSet. * The IDs are the positions in the array points given as Integers. */ public static HashSet getInDistancePointIDs( Point2D.Double[] points, Point2D.Double point, double distance ) { // @TODO If distance is very big then this will be all points so it can be done a faster way! HashSet inDistancePointIDs = new HashSet(); for ( int i = 0; i < points.length; i ++ ) { //if ( points[ i ].distance( point ) <= distance ) { if ( points[ i ].distance( point ) < distance ) { inDistancePointIDs.add( new Integer( i ) ); } } return inDistancePointIDs; } /** * Returns the IDs of points that are in distance of point as a HashSet. * The IDs are the positions in the array points given as Integers. */ public static HashSet getInDistancePointIDs( Point2DBigDecimal[] points, Point2DBigDecimal point, BigDecimal distance, int decimalPlaces ) { // @TODO If distance is very big then this will be all points so it can be done a faster way! HashSet inDistancePointIDs = new HashSet(); for ( int i = 0; i < points.length; i ++ ) { //if ( points[ i ].distance( point ) <= distance ) { if ( points[ i ].distance( point, decimalPlaces ).compareTo( distance ) == -1 ) { inDistancePointIDs.add( new Integer( i ) ); } } return inDistancePointIDs; } /** * Returns as a HashSet the IDs of points that are in distance of point. * Only those IDs in IDsHashSet need be tested. * It is assumed that all IDs in IDsHashSet are greater than 0 and less than * points.length. * The IDs are the positions in the array points given as Integers. */ public static HashSet getInDistancePointIDs( HashSet pointIDs, Point2D.Double[] points, Point2D.Double point, double distance ) { // TODO: // If distance is very big then this will be all points so it can be done a faster way! if ( pointIDs.size() > points.length / 2 ) { return getInDistancePointIDs( points, point, distance ); } else { HashSet inDistancePointIDs = new HashSet(); Iterator ite = pointIDs.iterator(); Integer ID; int i; while ( ite.hasNext() ) { ID = ( Integer ) ite.next(); i = ID.intValue(); //if ( points[ i ].distance( point ) <= distance ) { if ( points[ i ].distance( point ) < distance ) { inDistancePointIDs.add( ID ); } } return inDistancePointIDs; } } /** * Returns as a HashSet the IDs of points that are in distance of point. * Only those IDs in IDsHashSet need be tested. * It is assumed that all IDs in IDsHashSet are greater than 0 and less than * points.length. * The IDs are the positions in the array points given as Integers. */ public static HashSet getInDistancePointIDs( HashSet pointIDs, Point2DBigDecimal[] points, Point2DBigDecimal point, double distance, int decimalPlaces ) { // TODO: // If distance is very big then this will be all points so it can be done a faster way! BigDecimal distanceBigDecimal = new BigDecimal( distance ); if ( pointIDs.size() > points.length / 2 ) { return getInDistancePointIDs( points, point, distanceBigDecimal, decimalPlaces ); } else { HashSet inDistancePointIDs = new HashSet(); Iterator ite = pointIDs.iterator(); Integer ID; int i; while ( ite.hasNext() ) { ID = ( Integer ) ite.next(); i = ID.intValue(); if ( points[ i ].distance( point, decimalPlaces ).compareTo( distanceBigDecimal ) == -1 ) { inDistancePointIDs.add( ID ); } } return inDistancePointIDs; } } /** * Returns as a HashSet the IDs of points that intersect dimensions. * @param points * @param dimensions The dimensions used: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static HashSet getPointsIntersected( Point2DBigDecimal[] points, BigDecimal[] dimensions ) { HashSet inDistancePointIDs = new HashSet(); for ( int i = 0; i < points.length; i ++ ) { if ( isPointIntersected( points[ i ], dimensions ) ) { inDistancePointIDs.add( new Integer( i ) ); } } return inDistancePointIDs; } /** * Returns as a HashSet the IDs of points that intersect dimensions. * @param points * @param dimensions The dimensions used: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static HashSet getPointsIntersected( Point2D.Double[] points, BigDecimal[] dimensions ) { HashSet inDistancePointIDs = new HashSet(); for ( int i = 0; i < points.length; i ++ ) { if ( isPointIntersected( points[ i ], dimensions ) ) { inDistancePointIDs.add( new Integer( i ) ); } } return inDistancePointIDs; } /** * Returns as a HashSet the IDs of points that intersect dimensions. * Only those points with IDs in pointIDs need be tested. * It is assumed that all IDs in IDsHashSet are greater than 0 and less than * points.length. * The IDs are the positions in the array points given as Integers. * @param pointIDs * @param points * @param dimensions The dimensions used: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static HashSet getPointsIntersected( HashSet pointIDs, Point2D.Double[] points, BigDecimal[] dimensions ) { if ( pointIDs.size() > points.length / 2 ) { return getPointsIntersected( points, dimensions ); } else { HashSet inDistancePointIDs = new HashSet(); Iterator ite = pointIDs.iterator(); Integer ID; int i; while ( ite.hasNext() ) { ID = ( Integer ) ite.next(); i = ID.intValue(); if ( isPointIntersected( points[ i ], dimensions ) ) { inDistancePointIDs.add( ID ); } } return inDistancePointIDs; } } /** * Returns as a HashSet the IDs of points that intersect dimensions. * Only those points with IDs in pointIDs need be tested. * It is assumed that all IDs in IDsHashSet are greater than 0 and less than * points.length. * The IDs are the positions in the array points given as Integers. * @param pointIDs * @param points * @param dimensions The dimensions used: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static HashSet getPointsIntersected( HashSet pointIDs, Point2DBigDecimal[] points, BigDecimal[] dimensions ) { if ( pointIDs.size() > points.length / 2 ) { return getPointsIntersected( points, dimensions ); } else { HashSet inDistancePointIDs = new HashSet(); Iterator ite = pointIDs.iterator(); Integer ID; int i; while ( ite.hasNext() ) { ID = ( Integer ) ite.next(); i = ID.intValue(); if ( isPointIntersected( points[ i ], dimensions ) ) { inDistancePointIDs.add( ID ); } } return inDistancePointIDs; } } /** * Returns true iff point is contained in dimensions as in: * point.x > xmin, point.y > ymin, point.x < xmax, point.y < ymax * @param point the Point2DBigDecimal to be tested for intersection * @param dimensions The dimensions tested: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static boolean isPointContained( Point2DBigDecimal point, BigDecimal[] dimensions ) { BigDecimal x = point.getX(); BigDecimal y = point.getY(); if ( ( x.compareTo( dimensions[ 1 ] ) == 1 ) && ( y.compareTo( dimensions[ 2 ] ) == 1 ) && ( x.compareTo( dimensions[ 3 ] ) == -1 ) && ( y.compareTo( dimensions[ 4 ] ) == -1 ) ) { return true; } return false; } /** * Returns true iff point is contained in dimensions as in: * point.x >= xmin, point.y >= ymin, point.x <= xmax, point.y <= ymax * @param point the Point2DBigDecimal to be tested for intersection * @param dimensions The dimensions tested: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static boolean isPointIntersected( Point2DBigDecimal point, BigDecimal[] dimensions ) { BigDecimal x = point.getX(); BigDecimal y = point.getY(); if ( ( x.compareTo( dimensions[ 1 ] ) != -1 ) && ( y.compareTo( dimensions[ 2 ] ) != -1 ) && ( x.compareTo( dimensions[ 3 ] ) != 1 ) && ( y.compareTo( dimensions[ 4 ] ) != 1 ) ) { return true; } return false; } /** * Returns true iff point is contained in dimensions as in: * point.x >= xmin, point.y >= ymin, point.x <= xmax, point.y <= ymax * @param point the Point2DBigDecimal to be tested for intersection * @param dimensions The dimensions tested: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static boolean isPointIntersected( Point2D.Double point, BigDecimal[] dimensions ) { return isPointIntersected( new Point2DBigDecimal( point ), dimensions ); } /** * Returns true iff point is contained in dimensions as in: * point.x >= xmin, point.y >= ymin, point.x < xmax, point.y < ymax * @param point the Point2DBigDecimal to be tested for intersection * @param dimensions The dimensions tested: * dimensions[ 0 ] is reserved. This is because it stores cellsize in * Grid2DSquareCellAbstract.dimensions. * (N.B. developer: It might be worth using it here as a * parameter to extend the box tested for point intersection.) * dimensions[ 1 ] = xmin ( left-most coordinate of box ). * dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). * dimensions[ 3 ] = xmax ( right-most coordinate of box ). * dimensions[ 4 ] = ymax ( top-most coordinate of box ). */ public static boolean isPointIn( Point2DBigDecimal point, BigDecimal[] dimensions ) { BigDecimal x = point.getX(); BigDecimal y = point.getY(); if ( ( x.compareTo( dimensions[ 1 ] ) != -1 ) && ( y.compareTo( dimensions[ 2 ] ) != -1 ) && ( x.compareTo( dimensions[ 3 ] ) == -1 ) && ( y.compareTo( dimensions[ 4 ] ) == -1 ) ) { return true; } return false; } // /** Depricated use getPointsIntersected(Point2DBigDecimal[],BigDecimal[]) // * Returns as a HashSet the IDs of points that are in bounds given by // * dimensions[] // * The IDs are the positions in the array points given as Integers. // */ // protected static HashSet getInBoundPointIDs( Point2D.Double[] points, // BigDecimal[] dimensions ) { // HashSet inDistancePointIDs = new HashSet(); // for ( int i = 0; i < points.length; i ++ ) { // if ( isPointInBounds( points[ i ], dimensions ) ) { // inDistancePointIDs.add( new Integer( i ) ); // } // } // return inDistancePointIDs; // } // /** Depricated use getInBoundPointIDs(Point2D.Double[],BigDecimal[]) { // * Returns as a HashSet the IDs of points that are in bounds given by xmin, // * xmax, ymin, ymax. // * The IDs are the positions in the array points given as Integers. // */ // protected static HashSet getInBoundPointIDs( Point2D.Double[] points, double xmin, double ymin, double xmax, double ymax ) { // HashSet inDistancePointIDs = new HashSet(); // for ( int i = 0; i < points.length; i ++ ) { // if ( isPointInBounds( points[ i ], xmin, ymin, xmax, ymax ) ) { // inDistancePointIDs.add( new Integer( i ) ); // } // } // return inDistancePointIDs; // } // /** Depricated use getPointsIntersected(HashSet,Point2DBigDecimal[],BigDecimal[]) // * Returns as a HashSet the IDs of points that are in bounds given by xmin, // * xmax, ymin, ymax. // * Only those IDs in IDsHashSet need be tested. // * It is assumed that all IDs in IDsHashSet are greater than 0 and less than // * points.length. // * The IDs are the positions in the array points given as Integers. // */ // protected static HashSet getInBoundPointIDs( HashSet pointIDs, Point2D.Double[] points, double xmin, double ymin, double xmax, double ymax ) { // if ( pointIDs.size() > points.length / 2 ) { // return getInBoundPointIDs( points, xmin, ymin, xmax, ymax ); // } else { // HashSet inDistancePointIDs = new HashSet(); // Iterator ite = pointIDs.iterator(); // Integer ID; // int i; // while ( ite.hasNext() ) { // ID = ( Integer ) ite.next(); // i = ID.intValue(); // if ( isPointInBounds( points[ i ], xmin, ymin, xmax, ymax ) ) { // inDistancePointIDs.add( ID ); // } // } // return inDistancePointIDs; // } // } // /** Depricated see isPointContained(Point2DBigDecimal,BigDecimal[]) // * Returns true iff point is contained within the bounds given by minx miny maxx maxy // */ // protected static boolean isPointContained( Point2D.Double point, double xmin, double ymin, double xmax, double ymax ) { // //java.awt.geom.Rectangle2D.Double r = new java.awt.geom.Rectangle2D.Double( xmin, ymin, xmax, ymax ); // //return r.contains( point ); // double x = point.getX(); // double y = point.getY(); // if ( x > xmin && y > ymin && x < xmax && y < ymax ) { // return true; // } // return false; // } // /** // * Depreciated see isPointIntersected(Point2D.Double,double,double,double,double) // * Returns true iff point is contained in the bounds given by minx miny maxx maxy // */ // protected static boolean isPointInBounds( Point2D.Double point, double xmin, double ymin, double xmax, double ymax ) { // //java.awt.geom.Rectangle2D.Double r = new java.awt.geom.Rectangle2D.Double( xmin, ymin, xmax, ymax ); // //return r.contains( point ); // double x = point.getX(); // double y = point.getY(); // if ( x >= xmin && y >= ymin && x <= xmax && y <= ymax ) { // return true; // } // return false; // } // /** Depricated see isPointIntersected(Point2D.Double,BigDecimal[]) // * Returns true iff point is contained in the bounds given by minx miny maxx maxy // */ // protected static boolean isPointIntersected( Point2D.Double point, double xmin, double ymin, double xmax, double ymax ) { // //java.awt.geom.Rectangle2D.Double r = new java.awt.geom.Rectangle2D.Double( xmin, ymin, xmax, ymax ); // //return r.contains( point ); // double x = point.getX(); // double y = point.getY(); // if ( x >= xmin && y >= ymin && x <= xmax && y <= ymax ) { // return true; // } // return false; // } // /** Depricated see isPointIntersected(Point2DBigDecimal,BigDecimal[]) // * Returns true iff point is contained in the bounds given by minx miny maxx maxy // */ // protected static boolean isPointIntersected( Point2D.Double point, BigDecimal[] dimensions ) { // double x = point.getX(); // double y = point.getY(); // if ( x >= xmin && y >= ymin && x <= xmax && y <= ymax ) { // return true; // } // return false; // } }