|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectVectorPair
public class VectorPair
Utility methods related to a pair of Vector objects. The VectorPair constructor
expects two vectors in argument, namely X and Y. Every operations defined
in this class create views of the given vectors; they never copy or calculate data
values. Because they are views, callers should not change the values of the original vectors,
unless propagation to the views is really wanted.
| utility/geotk-utility (download) | View source code for this class |
| Field Summary | |
|---|---|
protected Vector |
X
The vectors specified to the VectorPair constructor,
or the result of the last operation performed on this object. |
protected Vector |
Y
The vectors specified to the VectorPair constructor,
or the result of the last operation performed on this object. |
| Constructor Summary | |
|---|---|
VectorPair(Vector X,
Vector Y)
Creates a new pair of vector. |
|
| Method Summary | |
|---|---|
Vector |
getX()
Returns the vector of x values. |
Vector |
getY()
Returns the vector of y values. |
int |
length()
Returns the length of the two vectors, or thrown an exception if they don't have the same length. |
void |
makeStepwise(int direction)
Computes views of (X,Y) vectors where every diagonal line is replaced by a horizontal line followed by a vertical line. |
void |
omitColinearPoints(double xTolerance,
double yTolerance)
Merges consecutive colinear segments, if any. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Vector X
VectorPair constructor,
or the result of the last operation performed on this object.
protected Vector Y
VectorPair constructor,
or the result of the last operation performed on this object.
| Constructor Detail |
|---|
public VectorPair(Vector X,
Vector Y)
X - The first vector of the pair.Y - The second vector of the pair.| Method Detail |
|---|
public Vector getX()
public Vector getY()
public int length()
throws MismatchedSizeException
MismatchedSizeException - if the two vectors don't have the same length.
public void omitColinearPoints(double xTolerance,
double yTolerance)
throws MismatchedSizeException
(x[i], y[i]) lies on the line segment defined by
the two end points (x[i-1], y[i-1]) and (x[i+1], y[i+1]), then the point at
index i will be dropped.
If the (X,Y) vectors are data to be plotted, then this method can be used for simplifying the data without visual impact.
xTolerance - The maximal distance measured along the x axis to consider
that a point lies on a line segment.yTolerance - The maximal distance measured along the y axis to consider
that a point lies on a line segment.
MismatchedSizeException - If the X and Y vectors don't have
the same length.
public void makeStepwise(int direction)
throws MismatchedSizeException
When invoked with direction=0, This method can be used before to plot
(X,Y) data where X can takes only some fixed values,
in order to visualy emphase its discontinuous nature. When invoked with positive or
negative direction argument, this method can be used for plotting upper or lower
limit respectively (for example computed from a standard deviation) of the above data.
On input
Starting with Xi and Yi as the input vectors before
this method is invoked, take s to be the length of the Yi vector,
then the length of the Xi vector must be s+1.
On output
Let define Xo and Yo the output vectors after
this method has been invoked. The length of those two vectors will be at most 2s
(they will be exactly of that length if abs(direction) <= 1). The first point and the
last point in the output vectors will be the same than the first point and the last point in
the input vectors. More specifically, assuming that the output vectors have the maximal length:
It is often a good idea to invoke omitColinearPoints(double, double) after this method.
direction - Controls the order of horizontal and vertical lines.direction is +1) or lower
(if direction is -1) than they would otherwise be. So direction can
be interpreted as the sign of the allowed change of y values.direction is +2, the removal of lower point when the y
values are going down and up again at the same x value.direction is -2, the removal of higher point when the y
values are going up and down again at the same x value.MismatchedSizeException - If the length of the X vector is not equal to
the length of the Y vector + 1.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||