- java.lang.Object
-
- org.arakhne.afc.math.physics.MeasureUnitUtil
-
public final class MeasureUnitUtil extends Object
This class permits to manipulate measure units.A foot is a unit of length, in a number of different systems, including English units, Imperial units, and United States customary units. Its size can vary from system to system, but in each is around a quarter to a third of a meter. The most commonly used foot today is the international foot. There are 3 feet in a yard and 12 inches in a foot.
An inch is the name of a unit of length in a number of different systems, including English units, Imperial units, and United States customary units. Its size can vary from system to system. There are 36 inches in a yard and 12 inches in a foot.
The fathoms is the name of a unit of length, in a number of different systems, including English units, Imperial units, and United States customary units. The name derives from the Old English word fæthm (plural) meaning 'outstretched arms' which was the original definition of the unit's measure.
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:49
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathphysics
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
convert(double value, TimeUnit inputUnit, TimeUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.static double
convert(double value, AngularUnit inputUnit, AngularUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.static double
convert(double value, SpaceUnit inputUnit, SpaceUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.static double
convert(double value, SpeedUnit inputUnit, SpeedUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.static double
convert(long value, TimeUnit inputUnit, TimeUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.static double
fh2ft(double fh)
Translate fathoms to feets.static double
fromMeters(double value, SpaceUnit outputUnit)
Convert the given value expressed in meters to the given unit.static double
fromMetersPerSecond(double value, SpeedUnit outputUnit)
Convert the given value expressed in meters per second to the given unit.static double
fromRadiansPerSecond(double value, AngularUnit outputUnit)
Convert the given value expressed in radians per second to the given unit.static double
fromSeconds(double value, TimeUnit outputUnit)
Convert the given value expressed in seconds to the given unit.static double
ft2fh(double ft)
Translate feets to fathoms.static double
ft2in(double ft)
Translate feets to inches.static SpaceUnit
getSmallestUnit(double amount, SpaceUnit unit)
Compute the smallest unit that permits to have a metric value with its integer part positive.static double
in2fh(double in)
Translate inches to fathoms.static double
in2ft(double in)
Translate inches to feets.static double
inchToMetric(double i)
Replies the metrics from inches.static double
km2m(double km)
Translate kilometers to meters.static double
kmh2ms(double kmh)
Translate km/h to m/s.static double
m2fh(double m)
Translate meters to fathoms.static double
m2ft(double m)
Translate meters to feets.static double
m2in(double m)
Translate meters to inches.static double
m2km(double m)
Translate meters to kilometers.static double
metricToInch(double m)
Replies the inches from metrics.static double
micro2milli(double micro)
Translate from micro (10^-6) to milli (10^-3).static double
micro2nano(double milli)
Translate from micro (10^-6) to nano (10^-9).static double
micro2unit(double micro)
Translate from micro (10^-6) to unit (10^0).static double
milli2micro(double milli)
Translate from milli (10^-3) to micro (10^-6).static double
milli2nano(double milli)
Translate from milli (10^-3) to nano (10^-9).static double
milli2unit(double milli)
Translate from milli (10^-3) to unit (10^0).static double
ms2kmh(double ms)
Translate m/s to km/h.static double
nano2micro(double nano)
Translate from nano (10^-9) to micro (10^-6).static double
nano2milli(double nano)
Translate from nano (10^-9) to milli (10^-3).static double
nano2unit(double nano)
Translate from nano (10^-9) to unit (10^0).static int
pix2pix(double pixelCoord)
Translate from "long" pixel coordinate to "system" pixel coordinate.static int
pix2pix(float pixel_coord)
Translate from "long" pixel coordinate to "system" pixel coordinate.static int
pix2pix(long pixelCoord)
Translate from "long" pixel coordinate to "system" pixel coordinate.static double
toMeters(double value, SpaceUnit inputUnit)
Convert the given value expressed in the given unit to meters.static double
toMetersPerSecond(double value, SpeedUnit inputUnit)
Convert the given value expressed in the given unit to meters per second.static double
toRadiansPerSecond(double value, AngularUnit inputUnit)
Convert the given value expressed in the given unit to radians per second.static double
toSeconds(double value, TimeUnit inputUnit)
Convert the given value expressed in the given unit to seconds.static double
unit2micro(double unit)
Translate from unit (10^0) to micro (10^-6).static double
unit2milli(double unit)
Translate from unit (10^0) to milli (10^-3).static double
unit2nano(double unit)
Translate from unit (10^0) to nano (10^-9).
-
-
-
Method Detail
-
ms2kmh
@Pure public static double ms2kmh(double ms)
Translate m/s to km/h.- Parameters:
ms
- the value- Returns:
ms
* 3.6
-
kmh2ms
@Pure public static double kmh2ms(double kmh)
Translate km/h to m/s.- Parameters:
kmh
- the value- Returns:
kmh
/ 3.6
-
m2km
@Pure public static double m2km(double m)
Translate meters to kilometers.- Parameters:
m
- the value- Returns:
m
/ 1000
-
km2m
@Pure public static double km2m(double km)
Translate kilometers to meters.- Parameters:
km
- the value- Returns:
km
* 1000
-
pix2pix
@Pure public static int pix2pix(double pixelCoord)
Translate from "long" pixel coordinate to "system" pixel coordinate.- Parameters:
pixelCoord
- is the pixel coordinate to translate.- Returns:
- the given value rounded to the nearest integer.
-
pix2pix
@Pure public static int pix2pix(long pixelCoord)
Translate from "long" pixel coordinate to "system" pixel coordinate.- Parameters:
pixelCoord
- is the pixel coordinate to translate.- Returns:
- the given value rounded to the nearest integer.
-
pix2pix
@Pure public static int pix2pix(float pixel_coord)
Translate from "long" pixel coordinate to "system" pixel coordinate.- Parameters:
pixel_coord
- is the pixel coordinate to translate.- Returns:
- the given value rounded to the nearest integer.
-
unit2nano
@Pure public static double unit2nano(double unit)
Translate from unit (10^0) to nano (10^-9).- Parameters:
unit
- the value- Returns:
unit
/ 1e-9
-
nano2unit
@Pure public static double nano2unit(double nano)
Translate from nano (10^-9) to unit (10^0).- Parameters:
nano
- the value- Returns:
nano
* 1e-9
-
unit2micro
@Pure public static double unit2micro(double unit)
Translate from unit (10^0) to micro (10^-6).- Parameters:
unit
- the value- Returns:
unit
/ 1e-6
-
micro2unit
@Pure public static double micro2unit(double micro)
Translate from micro (10^-6) to unit (10^0).- Parameters:
micro
- the value- Returns:
micro
* 1e-6
-
unit2milli
@Pure public static double unit2milli(double unit)
Translate from unit (10^0) to milli (10^-3).- Parameters:
unit
- the value- Returns:
unit
/ 1e-3
-
milli2unit
@Pure public static double milli2unit(double milli)
Translate from milli (10^-3) to unit (10^0).- Parameters:
milli
- the value- Returns:
milli
* 1e-3
-
milli2micro
@Pure public static double milli2micro(double milli)
Translate from milli (10^-3) to micro (10^-6).- Parameters:
milli
- the value- Returns:
milli
/ 1e-3
-
milli2nano
@Pure public static double milli2nano(double milli)
Translate from milli (10^-3) to nano (10^-9).- Parameters:
milli
- the value- Returns:
milli
/ 1e-6
-
micro2nano
@Pure public static double micro2nano(double milli)
Translate from micro (10^-6) to nano (10^-9).- Parameters:
milli
- the value- Returns:
milli
/ 1e-3
-
micro2milli
@Pure public static double micro2milli(double micro)
Translate from micro (10^-6) to milli (10^-3).- Parameters:
micro
- the value- Returns:
micro
* 1e-3
-
nano2micro
@Pure public static double nano2micro(double nano)
Translate from nano (10^-9) to micro (10^-6).- Parameters:
nano
- the value- Returns:
nano
* 1e-3
-
nano2milli
@Pure public static double nano2milli(double nano)
Translate from nano (10^-9) to milli (10^-3).- Parameters:
nano
- the value- Returns:
nano
* 1e-6
-
m2fh
@Pure public static double m2fh(double m)
Translate meters to fathoms.- Parameters:
m
- the value- Returns:
m
* 0.5468
-
ft2fh
@Pure public static double ft2fh(double ft)
Translate feets to fathoms.- Parameters:
ft
- the value- Returns:
ft
* 0.1667
-
in2fh
@Pure public static double in2fh(double in)
Translate inches to fathoms.- Parameters:
in
- the value- Returns:
in
/ 72
-
m2ft
@Pure public static double m2ft(double m)
Translate meters to feets.- Parameters:
m
- the value- Returns:
m
* 0.3048
-
in2ft
@Pure public static double in2ft(double in)
Translate inches to feets.- Parameters:
in
- the value- Returns:
in
/ 12
-
fh2ft
@Pure public static double fh2ft(double fh)
Translate fathoms to feets.- Parameters:
fh
- the value- Returns:
fh
/ 0.1667
-
m2in
@Pure public static double m2in(double m)
Translate meters to inches.- Parameters:
m
- the value- Returns:
m
* 0.025
-
ft2in
@Pure public static double ft2in(double ft)
Translate feets to inches.- Parameters:
ft
- the value- Returns:
ft
* 12
-
inchToMetric
@Pure public static double inchToMetric(double i)
Replies the metrics from inches.- Parameters:
i
- the inch value- Returns:
- a value in centimeters
-
metricToInch
@Pure public static double metricToInch(double m)
Replies the inches from metrics.- Parameters:
m
- the metric value- Returns:
- a value in inches
-
toSeconds
@Pure public static double toSeconds(double value, TimeUnit inputUnit)
Convert the given value expressed in the given unit to seconds.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
- Returns:
- the result of the convertion.
-
toMeters
@Pure public static double toMeters(double value, SpaceUnit inputUnit)
Convert the given value expressed in the given unit to meters.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
- Returns:
- the result of the convertion.
-
fromMeters
@Pure public static double fromMeters(double value, SpaceUnit outputUnit)
Convert the given value expressed in meters to the given unit.- Parameters:
value
- is the value to convertoutputUnit
- is the unit of the replied value.- Returns:
- the result of the convertion.
-
fromSeconds
@Pure public static double fromSeconds(double value, TimeUnit outputUnit)
Convert the given value expressed in seconds to the given unit.- Parameters:
value
- is the value to convertoutputUnit
- is the unit of result.- Returns:
- the result of the convertion.
-
convert
@Pure public static double convert(long value, TimeUnit inputUnit, TimeUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
outputUnit
- is the unit for the replied value.- Returns:
- the result of the convertion.
-
convert
@Pure public static double convert(double value, TimeUnit inputUnit, TimeUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
outputUnit
- is the unit for the replied value.- Returns:
- the result of the convertion.
-
convert
@Pure public static double convert(double value, SpeedUnit inputUnit, SpeedUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
outputUnit
- is the unit for the replied value.- Returns:
- the result of the convertion.
-
convert
@Pure public static double convert(double value, AngularUnit inputUnit, AngularUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
outputUnit
- is the unit for the replied value.- Returns:
- the result of the convertion.
-
convert
@Pure public static double convert(double value, SpaceUnit inputUnit, SpaceUnit outputUnit)
Convert the given value expressed in the given unit to the second given unit.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
outputUnit
- is the unit for the replied value.- Returns:
- the result of the convertion.
-
toMetersPerSecond
@Pure public static double toMetersPerSecond(double value, SpeedUnit inputUnit)
Convert the given value expressed in the given unit to meters per second.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
- Returns:
- the result of the convertion.
-
toRadiansPerSecond
@Pure public static double toRadiansPerSecond(double value, AngularUnit inputUnit)
Convert the given value expressed in the given unit to radians per second.- Parameters:
value
- is the value to convertinputUnit
- is the unit of thevalue
- Returns:
- the result of the convertion.
-
fromMetersPerSecond
@Pure public static double fromMetersPerSecond(double value, SpeedUnit outputUnit)
Convert the given value expressed in meters per second to the given unit.- Parameters:
value
- is the value to convertoutputUnit
- is the unit of result.- Returns:
- the result of the convertion.
-
fromRadiansPerSecond
@Pure public static double fromRadiansPerSecond(double value, AngularUnit outputUnit)
Convert the given value expressed in radians per second to the given unit.- Parameters:
value
- is the value to convertoutputUnit
- is the unit of result.- Returns:
- the result of the convertion.
-
getSmallestUnit
@Pure public static SpaceUnit getSmallestUnit(double amount, SpaceUnit unit)
Compute the smallest unit that permits to have a metric value with its integer part positive.- Parameters:
amount
- is the amount expressed in the given unit.unit
- is the unit of the given amount.- Returns:
- the smallest unit that permits to obtain the smallest positive mathematical integer that corresponds to the integer part of the given amount after its convertion to the selected unit.
-
-