uk.ac.leeds.ccg.andyt.gws.core
Class AdaptiveGWS

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
      extended by uk.ac.leeds.ccg.andyt.gws.core.GWS
          extended by uk.ac.leeds.ccg.andyt.gws.core.AdaptiveGWS
All Implemented Interfaces:
java.io.Serializable

public class AdaptiveGWS
extends GWS

TODO: docs

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.leeds.ccg.andyt.gws.core.GWS
GWS.Point2DBigDecimal_DistanceBigDecimal_IDInt, GWS.Point2DDouble_DistanceDouble_IDInt
 
Field Summary
 
Fields inherited from class uk.ac.leeds.ccg.andyt.gws.core.GWS
cellsizeDouble, col, grid2DSquareCellProcessor, row, weightFactor, weightIntersect
 
Fields inherited from class uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
handleOutOfMemoryErrorFalse, handleOutOfMemoryErrorTrue, memoryReserve
 
Constructor Summary
AdaptiveGWS()
           
 
Method Summary
 uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble[] getAdaptiveKernelWeights(java.util.HashSet mt0PointIDs, java.awt.geom.Point2D.Double[] t0Points, java.util.HashSet mt1PointIDs, java.awt.geom.Point2D.Double[] t1Points, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble, int numberOfPoints, int numberOfPointsFactor, double setDistance, double weightIntersect, double weightFactor, double sumAdaptiveKernelWeights, int precision)
          Returns an Grid2DSquareCellDouble[] The first element of which is the Adaptive Kernel Weights for t0Points, the second element of which is the Adaptive Kernel Weights for t1Points (where the width of the kernel is the radius of the circle which contains at least numberOfPoints in t0Points AND at least numberOfPoints points in t1Points).
 uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble[] getAdaptiveKernelWeights(int divisions, java.awt.geom.Point2D.Double[] t0Points, java.awt.geom.Point2D.Double[] t1Points, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble, int numberOfPoints, int numberOfPointsFactor, double setDistance, double weightIntersect, double weightFactor, double sumAdaptiveKernelWeights, int precision)
          Returns an Grid2DSquareCellDouble[] The first element of which is the Adaptive Kernel Weights for t0Points, the second element of which is the Adaptive Kernel Weights for t1Points (where the width of the kernel is the radius of the circle which contains at least numberOfPoints in t0Points AND at least numberOfPoints points in t1Points).
 uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble getAdaptiveKernelWeights(java.awt.geom.Point2D.Double[] t0Points, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble, int numberOfPoints, double weightIntersect, double weightFactor, double sumAdaptiveKernelWeights, int precision)
          Returns an Grid2DSquareCellDouble thats values are the sums of adaptiveKernelWeights for cells in grid2DSquareCellDouble.
 uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble getAdaptiveKernelWeights(java.awt.geom.Point2D.Double[] t0Points, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble, int numberOfPoints, int numberOfPointsFactor, double weightIntersect, double weightFactor, double sumAdaptiveKernelWeights, int precision, double setDistance)
          Returns a Grid2DSquareCellDouble thats values are the sums of adaptiveKernelWeights for cells in grid2DSquareCellDouble.
 uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble[] getAdaptiveKernelWeights(java.awt.geom.Point2D.Double[] t0Points, java.awt.geom.Point2D.Double[] t1Points, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory, uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble, int numberOfPoints, int numberOfPointsFactor, double setDistance, double weightIntersect, double weightFactor, double sumAdaptiveKernelWeights, int precision)
          Returns an Grid2DSquareCellDouble[] The first element of which is the Adaptive Kernel Weights for t0Points, the second element of which is the Adaptive Kernel Weights for t1Points (where the width of the kernel is the radius of the circle which contains at least numberOfPoints in t0Points AND at least numberOfPoints points in t1Points).
 
Methods inherited from class uk.ac.leeds.ccg.andyt.gws.core.GWS
getInDistancePoint2DBigDecimal_DistanceBigDecimal_IDInts, getInDistancePoint2DBigDecimal_DistanceBigDecimal_IDInts, getInDistancePoint2DDouble_DistanceDouble_IDInts, getInDistancePoint2DDouble_DistanceDouble_IDInts, getInDistancePoint2DDouble_DistanceDouble_IDIntsArray, getInDistancePoint2DDouble_DistanceDouble_IDIntsArray, getInDistancePointIDs, getInDistancePointIDs, getNearestPoint2DDouble_DistanceDouble_IDInts, getNearestPoint2DDouble_DistanceDouble_IDInts, getNearestPoint2DDouble_DistanceDouble_IDInts, getNearestPoint2DDouble_DistanceDouble_IDIntsAndOtherInfo, getNearestPoint2DDouble_DistanceDouble_IDIntsAndOtherInfo
 
Methods inherited from class uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
clearMemoryReserve, initMemoryReserve, initMemoryReserve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdaptiveGWS

public AdaptiveGWS()
Method Detail

getAdaptiveKernelWeights

public uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble getAdaptiveKernelWeights(java.awt.geom.Point2D.Double[] t0Points,
                                                                                        uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory,
                                                                                        uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble,
                                                                                        int numberOfPoints,
                                                                                        double weightIntersect,
                                                                                        double weightFactor,
                                                                                        double sumAdaptiveKernelWeights,
                                                                                        int precision)
Returns an Grid2DSquareCellDouble thats values are the sums of adaptiveKernelWeights for cells in grid2DSquareCellDouble. The weights are based on Points in points in a nearest neighbourhood given by numberOfPoints to each cell in grid2DSquareCellDouble. The kernel shape is defined by weightIntersect and weightFactor. The kernel volume is given by sumAdaptiveKernelWeights approximated using precision. This method can be slow. Each cell in grid is calculated by going through all t0Points. If this method is too slow then try using getAdaptiveKernelWeights( Point2D.Double[], Grid2DSquareCellDoubleFactory, AbstractGrid2DSquareCellDoube, int, int, double, double, double, int, double )

Parameters:
t0Points - the Point2D.Double[] from which kernel weights are calculated
grid2DSquareCellDoubleFactory - the Grid2DSquareCellDoubleFactory used to generate the result
grid - an Grid2DSquareCellDouble defining the frame and extent processed
numberOfPoints - the number of points accounted for in each kernel calculation
weightIntersect - an arbitrary double
weightFactor - defines the shape of the kernel distance decay
sumAdaptiveKernelWeights - the volume for the kernel
precision - the precision with which the kernels volume is approximated

getAdaptiveKernelWeights

public uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble getAdaptiveKernelWeights(java.awt.geom.Point2D.Double[] t0Points,
                                                                                        uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory,
                                                                                        uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble,
                                                                                        int numberOfPoints,
                                                                                        int numberOfPointsFactor,
                                                                                        double weightIntersect,
                                                                                        double weightFactor,
                                                                                        double sumAdaptiveKernelWeights,
                                                                                        int precision,
                                                                                        double setDistance)
Returns a Grid2DSquareCellDouble thats values are the sums of adaptiveKernelWeights for cells in grid2DSquareCellDouble. The weights are based on Points in points in a nearest neighbourhood given by numberOfPoints to each cell in grid2DSquareCellDouble. The kernel shape is defined by weightIntersect and weightFactor. The kernel volume is given by sumAdaptiveKernelWeights approximated using precision. The parameter setDistance is used to speed up processing by keeping a memory of what points have recently been examined. If sufficient then this memory is sometimes (when safe) used to calculate the weight for the next cell. A more basic way to process would be to go through the entire points array for each cell as in getAdaptiveKernelWeights( Point2D.Double[], Grid2DSquareCellDoubleFactory, Grid2DSquareCellDoubeAbstract, int, double, double, double, int ) however this can be slow (especially since a spatial indexing (or a spatial database) is not being used. This method is a speed up that will return the same answer as the above mentioned method. The main speed up comes from keeping a memory of a larger number of nearby points and using this when it can be guaranteed to work when calculating the adaptive kernel weight sum. The parameters setDistance and numberOfPointsFactor control the size of the memory. If setDistance and numberOfPointsFactor are set too high this method may be slow. Typically: numberOfPointsFactor will be between 1 and 10 depending on numberOfPoints; and, setDistance will be greater than the grid cellsize.

Parameters:
points - the Point2D.Double[] from which kernel weights are calculated
grid2DSquareCellDoubleFactory - the Grid2DSquareCellDoubleFactory used to generate the result
grid - an Grid2DSquareCellDouble defining the frame and extent processed
numberOfPoints - the number of points accounted for in each kernel calculation
numberOfPointsFactor - a memory control
weightIntersect - an arbitrary double
weightFactor - defines the shape of the kernel distance decay
sumAdaptiveKernelWeights - the volume for the kernel
precision - the precision with which the kernels volume is approximated
setDistance - a memory control

getAdaptiveKernelWeights

public uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble[] getAdaptiveKernelWeights(java.awt.geom.Point2D.Double[] t0Points,
                                                                                          java.awt.geom.Point2D.Double[] t1Points,
                                                                                          uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory,
                                                                                          uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble,
                                                                                          int numberOfPoints,
                                                                                          int numberOfPointsFactor,
                                                                                          double setDistance,
                                                                                          double weightIntersect,
                                                                                          double weightFactor,
                                                                                          double sumAdaptiveKernelWeights,
                                                                                          int precision)
Returns an Grid2DSquareCellDouble[] The first element of which is the Adaptive Kernel Weights for t0Points, the second element of which is the Adaptive Kernel Weights for t1Points (where the width of the kernel is the radius of the circle which contains at least numberOfPoints in t0Points AND at least numberOfPoints points in t1Points).

Parameters:
t0Points - one of the two Point2D.Double[] from which kernel weights are calculated
t1Points - one of the two Point2D.Double[] from which kernel weights are calculated
grid2DSquareCellDoubleFactory - the Grid2DSquareCellDoubleFactory used to generate the result
grid - an Grid2DSquareCellDouble defining the frame and extent processed
numberOfPoints - the number of points accounted for in each kernel calculation
weightIntersect - an arbitrary double
weightFactor - defines the shape of the kernel distance decay
xmin - the minimum x-coordinate for any point considered
ymin - the minimum y-coordinate for any point considered
xmax - the maximum x-coordinate for any point considered
ymax - the maximum y-coordinate for any point considered
sumAdaptiveKerneWeights - the volume under the kernel to be preserved
precision - the precision with which the kernel volume is estimated

getAdaptiveKernelWeights

public uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble[] getAdaptiveKernelWeights(java.util.HashSet mt0PointIDs,
                                                                                          java.awt.geom.Point2D.Double[] t0Points,
                                                                                          java.util.HashSet mt1PointIDs,
                                                                                          java.awt.geom.Point2D.Double[] t1Points,
                                                                                          uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory,
                                                                                          uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble,
                                                                                          int numberOfPoints,
                                                                                          int numberOfPointsFactor,
                                                                                          double setDistance,
                                                                                          double weightIntersect,
                                                                                          double weightFactor,
                                                                                          double sumAdaptiveKernelWeights,
                                                                                          int precision)
Returns an Grid2DSquareCellDouble[] The first element of which is the Adaptive Kernel Weights for t0Points, the second element of which is the Adaptive Kernel Weights for t1Points (where the width of the kernel is the radius of the circle which contains at least numberOfPoints in t0Points AND at least numberOfPoints points in t1Points).

Parameters:
t0PointIDs - this is a HashSet for restricting which of t0Points need to be used in the calculation.
t0Points - one of the two Point2D.Double[] from which kernel weights are calculated
t1PointIDs - this is a HashSet for restricting which of t1Points need to be used in the calculation.
t1Points - one of the two Point2D.Double[] from which kernel weights are calculated
grid2DSquareCellDoubleFactory - the Grid2DSquareCellDoubleFactory used to generate the result
grid - an Grid2DSquareCellDouble defining the frame and extent processed
numberOfPoints - the number of points accounted for in each kernel calculation
weightIntersect - an arbitrary double
weightFactor - defines the shape of the kernel distance decay
xmin - the minimum x-coordinate for any point considered
ymin - the minimum y-coordinate for any point considered
xmax - the maximum x-coordinate for any point considered
ymax - the maximum y-coordinate for any point considered
sumAdaptiveKerneWeights - the volume under the kernel to be preserved
precision - the precision with which the kernel volume is estimated

getAdaptiveKernelWeights

public uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble[] getAdaptiveKernelWeights(int divisions,
                                                                                          java.awt.geom.Point2D.Double[] t0Points,
                                                                                          java.awt.geom.Point2D.Double[] t1Points,
                                                                                          uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDoubleFactory grid2DSquareCellDoubleFactory,
                                                                                          uk.ac.leeds.ccg.andyt.grids.core.Grid2DSquareCellDouble grid2DSquareCellDouble,
                                                                                          int numberOfPoints,
                                                                                          int numberOfPointsFactor,
                                                                                          double setDistance,
                                                                                          double weightIntersect,
                                                                                          double weightFactor,
                                                                                          double sumAdaptiveKernelWeights,
                                                                                          int precision)
Returns an Grid2DSquareCellDouble[] The first element of which is the Adaptive Kernel Weights for t0Points, the second element of which is the Adaptive Kernel Weights for t1Points (where the width of the kernel is the radius of the circle which contains at least numberOfPoints in t0Points AND at least numberOfPoints points in t1Points).

Parameters:
divisions - controls the number of times the problem is divided
t0Points - one of the two Point2D.Double[] from which kernel weights are calculated
t1Points - one of the two Point2D.Double[] from which kernel weights are calculated
grid2DSquareCellDoubleFactory - the Grid2DSquareCellDoubleFactory used to generate the result
grid - an Grid2DSquareCellDouble defining the frame and extent processed
numberOfPoints - the number of points accounted for in each kernel calculation
weightIntersect - an arbitrary double
weightFactor - defines the shape of the kernel distance decay
xmin - the minimum x-coordinate for any point considered
ymin - the minimum y-coordinate for any point considered
xmax - the maximum x-coordinate for any point considered
ymax - the maximum y-coordinate for any point considered
sumAdaptiveKerneWeights - the volume under the kernel to be preserved
precision - the precision with which the kernel volume is estimated