uk.ac.leeds.ccg.andyt.grids.utilities
Class Utilities

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.utilities.Utilities

public class Utilities
extends java.lang.Object

This class holds miscellaneous general utility methods


Constructor Summary
Utilities()
          Creates a new instance of Utilities
 
Method Summary
static java.lang.String _ReportTime(long time)
          Returns a string identifying the number of hours, minutes, seconds and milliseconds for the input _ReportTime in milliseconds.
static double angle(double x1, double y1, double x2, double y2)
          Returns the clockwise angle in radians to the y axis of the line from x1, y1 to x2, y2
static java.lang.Object[] densityPlot(AbstractGrid2DSquareCell xGrid, AbstractGrid2DSquareCell yGrid, int divisions, Grid2DSquareCellDoubleFactory gridFactory)
          Returns a density plot of xGrid values against yGrid values.
static double distance(double x1, double y1, double x2, double y2)
          Returns the distance between a pair of coordinates
static java.awt.geom.Point2D.Double[] getSamplePoints(java.awt.geom.Point2D.Double point, double angle, double maxDistance, double samplingDistance, double samplingAngle, int numberOfSamples)
          TODO: documentation
static java.awt.geom.Point2D.Double[] getSamplePoints(java.awt.geom.Point2D.Double point, double angle, double maxDistance, int numberOfSamplingDistances, int numberOfSamplingAngles)
          TODO: documentation
static double getValueALittleBitLarger(double value)
          TODO: documentation
static double getValueALittleBitSmaller(double value)
          TODO: documentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Creates a new instance of Utilities

Method Detail

_ReportTime

public static java.lang.String _ReportTime(long time)
Returns a string identifying the number of hours, minutes, seconds and milliseconds for the input _ReportTime in milliseconds.


getValueALittleBitLarger

public static double getValueALittleBitLarger(double value)
TODO: documentation


getValueALittleBitSmaller

public static double getValueALittleBitSmaller(double value)
TODO: documentation


getSamplePoints

public static java.awt.geom.Point2D.Double[] getSamplePoints(java.awt.geom.Point2D.Double point,
                                                             double angle,
                                                             double maxDistance,
                                                             int numberOfSamplingDistances,
                                                             int numberOfSamplingAngles)
TODO: documentation

Parameters:
point - point at centre of sampling
angle - angle in radians to the vertical (y axis) for first sampling
maxDistance - the maximum sampling distance
numberOfSamplingDistances - the number of sampling distances upto maxDistance
numberOfSamplingAngles - sets how many samplesPoints to take at each sample distance. Always the first sample is at angle from the vertical or y-axis. The angles at which samples are taken are all the same.

getSamplePoints

public static java.awt.geom.Point2D.Double[] getSamplePoints(java.awt.geom.Point2D.Double point,
                                                             double angle,
                                                             double maxDistance,
                                                             double samplingDistance,
                                                             double samplingAngle,
                                                             int numberOfSamples)
TODO: documentation


distance

public static final double distance(double x1,
                                    double y1,
                                    double x2,
                                    double y2)
Returns the distance between a pair of coordinates

Parameters:
x1 - - the x coordinate of one point
y1 - - the y coordinate of one point
x2 - - the x coordinate of another point
y2 - - the y coordinate of another point

angle

public static final double angle(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
Returns the clockwise angle in radians to the y axis of the line from x1, y1 to x2, y2

Parameters:
x1 - - the x coordinate of one point
y1 - - the y coordinate of one point
x2 - - the x coordinate of another point
y2 - - the y coordinate of another point

densityPlot

public static java.lang.Object[] densityPlot(AbstractGrid2DSquareCell xGrid,
                                             AbstractGrid2DSquareCell yGrid,
                                             int divisions,
                                             Grid2DSquareCellDoubleFactory gridFactory)
Returns a density plot of xGrid values against yGrid values. A density plot is like a scatterplot, but rather than plotting individual point these are aggregated first to cells. The values of yGrid are scaled to be in the same range as the values of xGrid and the number of divisions for each axis is given by divisions. NB1 For this implementation xGrid and yGrid must have the same spatial frame. NB2 The result returned has a set cellsize of 1 and origin at ( 0, 0 ) (This enables easy comparison with other density plots)