|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.util.metric.Metric
The Metric class provides the functionality that is needed in
order to work with a logical coordinate system.
Metric class is not supposed to be instantiated. In order
to get an instance of this class one has to call the method
getInstance()
*
*
*
*
*
*
*
*
*
*
*
*
*
*
MetricConstants,
MetricExpression| Field Summary | |
static int |
FROM_METRIC
Determining the conversion direction for conversion methods. |
static double |
INCH_TO_CM
Conversion factor to calculate inch to centimeters |
static Metric |
SOLE_METRIC
The singleton instance of this class |
static int |
TO_METRIC
Determining the conversion direction for conversion methods. |
| Method Summary | |
double |
computeMeasuringUnitConversionFactor(int measuringUnitConvertTo)
Returns the conversion factor that has to be used in order to convert a value that is given in the units of this Metric instance
into the unit identified through the constant given by
measuringUnitConvertTo. |
static double |
computeMeasuringUnitConversionFactor(int measuringUnitConvertFrom,
int measuringUnitConvertTo)
Returns the conversion factor that has to be used in order to convert a value that is given in the measuring units identified through the constant given by measuringUnitConvertFrom into the
measuring units identified through the constant given by
measuringUNitConvertTo. |
double[] |
convert(double[] internPoints,
int direction)
Converts the given given array of point given in internal measurement units to the measurement unit set for this metric object. |
double |
convertMeasureValue(int measuringUnitConvertTo)
Converts the measure value of this Metric instance given in
the measuring unit of this Metric instance into the
corresponding measure value for the measuring unit identified through
the constant given by measuringUnitConvertTo. |
MetricExpression |
convertMetricExpression(double value,
int measuringUnitConvertFrom,
int measuringUnitConvertTo)
Converts the value given by value from one measuring unit
system into another measuring unit system and creates a
MetricExpression instance for the converted value.
|
MetricExpression |
convertMetricExpression(MetricExpression expression,
int measuringUnitConvertTo)
Converts the MetricExpression given by
expression into another MetricExpression whose
measuring unit system is identified through the constant given by
measuringUnitConvertTo.
|
double |
convertMetricExpressionValue(double value,
int measuringUnitConvertFrom,
int measuringUnitConvertTo)
Converts the value given by value from one measuring unit
system into another measuring unit system.
|
double |
convertMetricExpressionValue(MetricExpression expression,
int measuringUnitConvertTo)
Converts the value of the MetricExpression given by
expression from one measuring unit system into another
measuring unit system.
|
int |
getDisplayHeight()
Returns the value that is currently set as the display height. |
int |
getDisplayResolutionX()
Returns the value that is currently set as display resolution in x direction. |
int |
getDisplayResolutionY()
Returns the value that is currently set as display resolution in y direction. |
int |
getDisplayWidth()
Returns the value that is currently set as the display width. |
static Metric |
getInstance()
Returns the singleton instance of this class |
double |
getMeasureValue()
Returns the current measure value. |
int |
getMeasuringUnit()
Returns a constant that identifies the current measuring unit. |
void |
setDisplaySize(int displayWidthMM,
int displayHeightMM)
Sets the display size in millimeters to use for metric conversions |
void |
setScreenResolution(int screenWidth,
int screenHeight)
Sets the screen resolution to use for metric conversions |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final Metric SOLE_METRIC
public static final double INCH_TO_CM
public static final int FROM_METRIC
convert(double[], int),
Constant Field Valuespublic static final int TO_METRIC
convert(double[], int),
Constant Field Values| Method Detail |
public static final Metric getInstance()
public void setScreenResolution(int screenWidth,
int screenHeight)
screenWidth - The new screen width in pixels to usescreenHeight - The new screen height in pixels to use
public void setDisplaySize(int displayWidthMM,
int displayHeightMM)
displayWidthMM - The width of the monitor in millimetersdisplayHeightMM - The height of the monitor in millimeterspublic double getMeasureValue()
public int getMeasuringUnit()
public int getDisplayWidth()
public int getDisplayHeight()
public int getDisplayResolutionX()
public int getDisplayResolutionY()
public final double computeMeasuringUnitConversionFactor(int measuringUnitConvertTo)
Metric instance
into the unit identified through the constant given by
measuringUnitConvertTo.
measuringUnitConvertTo - the constant for the measuring unit a value
should be converted into
Metric instance into the given measuring unit
public static final double computeMeasuringUnitConversionFactor(int measuringUnitConvertFrom,
int measuringUnitConvertTo)
measuringUnitConvertFrom into the
measuring units identified through the constant given by
measuringUNitConvertTo.
measuringUnitConvertFrom - constant for the measuring unit to
convert frommeasuringUnitConvertTo - constant for the measuring unit to
convert into
public final MetricExpression convertMetricExpression(MetricExpression expression,
int measuringUnitConvertTo)
MetricExpression given by
expression into another MetricExpression whose
measuring unit system is identified through the constant given by
measuringUnitConvertTo.
MetricExpression.
measuringUnitConvertTo.
MetricExpression instance is not the same
as the one passed into this method.
expression - the MetricExpression whose value should
be convertedmeasuringUnitConvertTo - the constant for the measuring unit
system to convert to
MetricExpression
public final MetricExpression convertMetricExpression(double value,
int measuringUnitConvertFrom,
int measuringUnitConvertTo)
value from one measuring unit
system into another measuring unit system and creates a
MetricExpression instance for the converted value.
value
is given in, is identified through the constant given by
measuringUnitConvertFrom.
measuringUnitConvertTo.
value - the value that should be convertedmeasuringUnitConvertFrom - the constant for the measuring unit
system to convert frommeasuringUnitConvertTo - the constant for the measuring unit
system to convert into
MetricExpression
that carries the converted value
public final double convertMetricExpressionValue(MetricExpression expression,
int measuringUnitConvertTo)
MetricExpression given by
expression from one measuring unit system into another
measuring unit system.
MetricExpression.
measuringUnitConvertTo.
expression - the MetricExpression whose value should
be convertedmeasuringUnitConvertTo - the constant for the measuring unit
system to convert to
public final double convertMetricExpressionValue(double value,
int measuringUnitConvertFrom,
int measuringUnitConvertTo)
value from one measuring unit
system into another measuring unit system.
value
is given in, is identified through the constant given by
measuringUnitConvertFrom.
measuringUnitConvertTo.
value - the value that should be convertedmeasuringUnitConvertFrom - the constant for the measuring unit
system to convert frommeasuringUnitConvertTo - the constant for the measuring unit
system to convert to
public final double convertMeasureValue(int measuringUnitConvertTo)
Metric instance given in
the measuring unit of this Metric instance into the
corresponding measure value for the measuring unit identified through
the constant given by measuringUnitConvertTo.
measuringUnitConvertTo - the constant for the measuring unit to
convert the measuring value of the Metric instance into
Metric
instance
public double[] convert(double[] internPoints,
int direction)
internPoints - the points to convert given in intern units.direction - the direction to convert to. Valid values are
TO_METRIC and FROM_METRIC.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||