public class Coordinate
extends java.lang.Object
Coordinate class stores the x and y values of a coordinate.| Constructor and Description |
|---|
Coordinate()
Constructor
|
Coordinate(double x,
double y)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static void |
applyScale(Coordinate[] xyCoords,
double xScale,
double yScale)
Apply the scale factor to the coordinates
|
static void |
applyShiftReference(Coordinate[] xyCoords,
int dataPointNum,
double firstX,
double lastX,
double offset,
double observedFreq,
int shiftRefType)
Applies the shift reference to all coordinates
|
Coordinate |
copy()
Returns a new coordinate that has the same x and y values of this
coordinate
|
static double |
deltaX(double last,
double first,
int numPoints)
Returns the Delta X value
|
boolean |
equals(Coordinate coord)
Indicates whether some other Coordinate is equal to this one
|
static double |
findXForPeakNearest(Coordinate[] xyCoords,
double x,
boolean isMin) |
static double |
getMaxX(Coordinate[] coords,
int start,
int end)
Returns the minimum x value of an array of
Coordinates |
static double |
getMaxX(java.util.List<JDXSpectrum> spectra,
jspecview.common.ViewData vd)
Returns the maximum x value value from an array of arrays of
Coordinates. |
static double |
getMaxY(Coordinate[] coords,
int start,
int end)
Returns the maximum y value of an array of
Coordinates |
static double |
getMaxYUser(java.util.List<JDXSpectrum> spectra,
jspecview.common.ViewData vd)
Returns the maximum y value value from an array of arrays of
Coordinates. |
static double |
getMinX(Coordinate[] coords,
int start,
int end)
Returns the minimum x value of an array of
Coordinates |
static double |
getMinX(java.util.List<JDXSpectrum> spectra,
jspecview.common.ViewData vd)
Returns the minimum x value value from an array of arrays of
Coordinates. |
static double |
getMinY(Coordinate[] coords,
int start,
int end)
Returns the minimum y value of an array of
Coordinates |
static double |
getMinYUser(java.util.List<JDXSpectrum> spectra,
jspecview.common.ViewData vd)
Returns the minimum y value value from an array of arrays of
Coordinates. |
static int |
getNearestIndexForX(Coordinate[] xyCoords,
double xPt) |
static double |
getNearestXWithYAbove(Coordinate[] xyCoords,
double x,
double y,
boolean inverted,
boolean andGreaterThanX)
discovers nearest peak left or right of x that is above threshold y
|
java.lang.String |
getXString()
Returns the x value of the coordinate formatted to a maximum of eight
decimal places
|
double |
getXVal()
Returns the x value of the coordinate
|
java.lang.String |
getYString()
Returns the y value of the coordinate formatted to a maximum of eight
decimal places
|
double |
getYVal()
Returns the y value of the coordinate
|
static double |
getYValueAt(Coordinate[] xyCoords,
double xPt) |
static double |
intoRange(double x,
double x0,
double x1) |
static int |
intoRange(int i,
int i0,
int i1) |
static boolean |
isYInRange(Coordinate[] xyCoords,
double min,
double max)
Determines if the y values of a spectrum are in a certain range
|
static Coordinate[] |
normalise(Coordinate[] xyCoords,
double min,
double max)
Normalises the y values of a spectrum to a certain range
|
static double |
parabolicInterpolation(Coordinate[] xyCoords,
int pt)
see https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html
|
static Coordinate[] |
parseDSV(java.lang.String dataPoints,
double xFactor,
double yFactor)
Parses data stored in x, y format
|
static void |
removeScale(Coordinate[] xyCoords,
double xScale,
double yScale)
Removes the scale factor from the coordinates
|
static Coordinate[] |
reverse(Coordinate[] x) |
void |
setXVal(double val)
Sets the x value of the coordinate
|
void |
setYVal(double val)
Sets the y value of the coordinate
|
java.lang.String |
toString()
Overides Objects toString() method
|
public Coordinate()
public Coordinate(double x,
double y)
x - the x valuey - the y valuepublic double getXVal()
public double getYVal()
public java.lang.String getXString()
public java.lang.String getYString()
public void setXVal(double val)
val - the x valuepublic void setYVal(double val)
val - the y valuepublic Coordinate copy()
public boolean equals(Coordinate coord)
coord - the reference coordinatepublic java.lang.String toString()
toString in class java.lang.Objectpublic static boolean isYInRange(Coordinate[] xyCoords, double min, double max)
xyCoords - min - max - public static Coordinate[] normalise(Coordinate[] xyCoords, double min, double max)
xyCoords - min - max - public static Coordinate[] reverse(Coordinate[] x)
public static Coordinate[] parseDSV(java.lang.String dataPoints, double xFactor, double yFactor)
dataPoints - the data as stringxFactor - the factor to apply to x valuesyFactor - the factor to apply to y valuesCoordinatespublic static double deltaX(double last,
double first,
int numPoints)
last - the last x valuefirst - the first x valuenumPoints - the number of data pointspublic static void removeScale(Coordinate[] xyCoords, double xScale, double yScale)
xyCoords - the array of coordinatesxScale - the scale for the x valuesyScale - the scale for the y valuespublic static void applyScale(Coordinate[] xyCoords, double xScale, double yScale)
xyCoords - the array of coordinatesxScale - the scale for the x valuesyScale - the scale for the y valuespublic static void applyShiftReference(Coordinate[] xyCoords, int dataPointNum, double firstX, double lastX, double offset, double observedFreq, int shiftRefType) throws java.lang.IndexOutOfBoundsException
xyCoords - an array of coordinatesdataPointNum - the number of the data point in the the spectrum, indexed from 1firstX - the first X valuelastX - the last X valueoffset - the offset valueobservedFreq - the observed frequencyshiftRefType - the type of shiftjava.lang.IndexOutOfBoundsExceptionpublic static double getMinX(Coordinate[] coords, int start, int end)
Coordinatescoords - the coordinatesstart - the starting indexend - the ending indexCoordinatespublic static double getMinX(java.util.List<JDXSpectrum> spectra, jspecview.common.ViewData vd)
Coordinates.spectra - vd - Coordinatespublic static double getMaxX(Coordinate[] coords, int start, int end)
Coordinatescoords - the coordinatesstart - the starting indexend - the ending indexCoordinatespublic static double getMaxX(java.util.List<JDXSpectrum> spectra, jspecview.common.ViewData vd)
Coordinates.spectra - vd - Coordinatespublic static double getMinY(Coordinate[] coords, int start, int end)
Coordinatescoords - the coordinatesstart - the starting indexend - the ending indexCoordinatespublic static double getMinYUser(java.util.List<JDXSpectrum> spectra, jspecview.common.ViewData vd)
Coordinates.spectra - vd - Coordinatespublic static double getMaxY(Coordinate[] coords, int start, int end)
Coordinatescoords - the coordinatesstart - the starting indexend - the ending indexCoordinatespublic static double getMaxYUser(java.util.List<JDXSpectrum> spectra, jspecview.common.ViewData vd)
Coordinates.spectra - vd - Coordinatespublic static double getYValueAt(Coordinate[] xyCoords, double xPt)
public static int intoRange(int i,
int i0,
int i1)
public static double intoRange(double x,
double x0,
double x1)
public static int getNearestIndexForX(Coordinate[] xyCoords, double xPt)
public static double findXForPeakNearest(Coordinate[] xyCoords, double x, boolean isMin)
public static double parabolicInterpolation(Coordinate[] xyCoords, int pt)
xyCoords - pt - public static double getNearestXWithYAbove(Coordinate[] xyCoords, double x, double y, boolean inverted, boolean andGreaterThanX)
xyCoords - x - y - inverted - andGreaterThanX -