Package toxi.math.conversion
Class UnitTranslator
java.lang.Object
toxi.math.conversion.UnitTranslator
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
Number of millimeters per inchstatic final double
Number of points per inch -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
millisToPixels
(double mm, int dpi) Converts millimeters into pixels.static double
millisToPoints
(double mm) Converts millimeters into PostScript points.static double
pixelsToInch
(int pix, int dpi) Converts pixels into inches.static double
pixelsToMillis
(int pix, int dpi) Converts pixels into millimeters.static double
pixelsToPoints
(int pix, int dpi) Converts pixels into points.static double
pointsToMillis
(double pt) Converts points into millimeters.static int
pointsToPixels
(double pt, int dpi) Converts points into pixels.static double
squareInchToMillis
(double area) Converts an area measure in square inch to square millimeters.static double
squarePointsToInch
(double area) Converts an area measure in points to square inch.static double
squarePointsToMillis
(double area) Converts an area measure in points to square millimeters.
-
Field Details
-
INCH_MM
public static final double INCH_MMNumber of millimeters per inch- See Also:
-
POINT_POSTSCRIPT
public static final double POINT_POSTSCRIPTNumber of points per inch- See Also:
-
-
Constructor Details
-
UnitTranslator
public UnitTranslator()
-
-
Method Details
-
millisToPixels
public static int millisToPixels(double mm, int dpi) Converts millimeters into pixels.- Parameters:
mm
- millimetersdpi
- DPI resolution- Returns:
- number of pixels
-
millisToPoints
public static double millisToPoints(double mm) Converts millimeters into PostScript points.- Parameters:
mm
- millimeters- Returns:
- number of points
-
pixelsToInch
public static double pixelsToInch(int pix, int dpi) Converts pixels into inches.- Parameters:
pix
- pixelsdpi
- DPI resolution to use- Returns:
- number of inches
-
pixelsToMillis
public static double pixelsToMillis(int pix, int dpi) Converts pixels into millimeters.- Parameters:
pix
- pixelsdpi
- DPI resolution- Returns:
- number of millimeters
-
pixelsToPoints
public static double pixelsToPoints(int pix, int dpi) Converts pixels into points.- Parameters:
pix
- pixelsdpi
- DPI resolution- Returns:
- number of points
-
pointsToMillis
public static double pointsToMillis(double pt) Converts points into millimeters.- Parameters:
pt
-- Returns:
- number of millimeters
-
pointsToPixels
public static int pointsToPixels(double pt, int dpi) Converts points into pixels.- Parameters:
pt
- pointsdpi
- DPI resolution- Returns:
- number of pixels
-
squareInchToMillis
public static double squareInchToMillis(double area) Converts an area measure in square inch to square millimeters.- Parameters:
area
-- Returns:
- square mm
-
squarePointsToInch
public static double squarePointsToInch(double area) Converts an area measure in points to square inch.- Parameters:
area
-- Returns:
- square inch
-
squarePointsToMillis
public static double squarePointsToMillis(double area) Converts an area measure in points to square millimeters.- Parameters:
area
-- Returns:
- square mm
-