|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.composite.coordinate.CoordinateSystem
The modern Cartesian coordinate system in two
dimensions (also called a rectangular coordinate system) is commonly
defined by two axes, at right angles to each other, forming an xy
plane. These axes are measured using a Scale for each
dimension: one for the x-axis and one for the y-axis (or one for the
degree and one for the radius when using polar-coordinates).
In a three-dimensional coordinate system, another axis is added to provide a third dimension of spatial measurement. These axes are commonly defined as being mutually orthogonal to each other. Many other coordinate systems have been developed since the time of Descartes. One is the aforementioned polar-coordinate system. Astronomers, for example, often use spherical coordinates, a type of polar coordinate system.
To avoid creating identical CoordinateSystem objects (using
the same Scale types and intervals), objects are pooled in the
CoordinateSystemPool singleton. Since many clients may have a
reference to the very same instance, CoordinateSystem objects
are immutable. A mutable version is defined by the
MutableCoordinateSystem interface.
In a graphical context, every object must lie within a coordinate system. Very often, you have a complex situation where coordinate systems are nested. This class can therefore convert coordinates from an outer coordinate system to an inner coordinate system and vice versa.
scale(int, double, double, double)descale(int, double, double, double)getTransform2D(double, double, double, double)getTransform2D_inverse(double, double, double, double)
This class uses and depends on the Scale interface.
| Field Summary | |
static CoordinateSystem |
DEFAULT_SYSTEM
A default coordinate-system with minimum and maximum values set to zero. |
static int |
SCALE_X
Constant that tells about which direction is meant |
static int |
SCALE_Y
Constant that tells about which direction is meant |
static int |
SCALE_Z
Constant that tells about which direction is meant |
protected Scale[] |
scales
Array of scales used for the coordinate system |
| Method Summary | |
double |
descale(int direction,
double minimum,
double maximum,
double valueToDescale)
Converts the value given by valueToDescale to the range
given by minimum and maximum to the range
Scale in the given direction. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getCanonicalDescription()
Returns the canonical description of this coordinate system instance |
double |
getScaleMaximum(int direction)
Returns the maximal-value of the scale in the given direction. |
double |
getScaleMinimum(int direction)
Returns the minimal-value of the scale in the given direction. |
double |
getScaleRange(int direction)
Returns the set range for the scale in the given direction. |
Transform2D |
getTransform2D_inverse(double minimumX,
double maximumX,
double minimumY,
double maximumY)
Returns the inverse Transform2D resulting from the given
min and max values (defining a bounding-box) and the scalefactors used by
the Scales of this CoordinateSystem. |
Transform2D |
getTransform2D(double minimumX,
double maximumX,
double minimumY,
double maximumY)
Returns the Transform2D resulting from the given min and
max values (defining a bounding-box) and the scalefactors used by the
Scales of this CoordinateSystem. |
int |
hashCode()
|
double |
scale(int direction,
double minimum,
double maximum,
double valueToScale)
Converts the value given by valueToScale from the range of
the Scale in the given direction to the range given by
minimum and maximum. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final CoordinateSystem DEFAULT_SYSTEM
public static final int SCALE_X
public static final int SCALE_Y
public static final int SCALE_Z
protected Scale[] scales
| Method Detail |
public double getScaleMinimum(int direction)
direction - the direction to return the scale minimum for.
public double getScaleMaximum(int direction)
direction - the direction to return the scale minimum for.
public double getScaleRange(int direction)
direction - the direction to return the scale range for.
public double scale(int direction,
double minimum,
double maximum,
double valueToScale)
valueToScale from the range of
the Scale in the given direction to the range given by
minimum and maximum.
direction - the direction in which to scale. Valid values are
SCALE_X, SCALE_Y and SCALE_Z.minimum - the minimum value of the range to convert to.maximum - the maximum value of the range to convert to.valueToScale - the value to convert.
Scale.scale(double, double, double)
public double descale(int direction,
double minimum,
double maximum,
double valueToDescale)
valueToDescale to the range
given by minimum and maximum to the range
Scale in the given direction.
direction - the direction in which to scale. Valid values are
SCALE_X, SCALE_Y and SCALE_Z.minimum - the minimum value of the range to convert from.maximum - the maximum value of the range to convert from.valueToDescale - the value to convert.
Scale.descale(double, double, double)
public Transform2D getTransform2D(double minimumX,
double maximumX,
double minimumY,
double maximumY)
Transform2D resulting from the given min and
max values (defining a bounding-box) and the scalefactors used by the
Scales of this CoordinateSystem.
minimumX - minimum in x-direction.maximumX - maximum in x-direction.minimumY - minimum in y-direction.maximumY - maximum in y-direction.
Transform2D.
public Transform2D getTransform2D_inverse(double minimumX,
double maximumX,
double minimumY,
double maximumY)
Transform2D resulting from the given
min and max values (defining a bounding-box) and the scalefactors used by
the Scales of this CoordinateSystem.
minimumX - minimum in x-direction.maximumX - maximum in x-direction.minimumY - minimum in y-direction.maximumY - maximum in y-direction.
Transform2D.public java.lang.String toString()
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String getCanonicalDescription()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||