Exit Full View

Fizzy / docs / ref / Dimension.md

Dimension

Contains a Double, and units of measure.

The basic metric units are : mm, cm, m and km. There are also imperial units : inch, ft, yard.

There are also "Dymanic" units "pt" (points), which are used for font sizes, and line widths. Points are dynamic, because if you change the scale factor for a document, then the point sizes will change in respect to the other units.

This dynamic nature is important when creating scale diagrams, such as floor plans.

Creation

To create a Dimension, just add the units after a number. e.g.

100mm or 10cm or 0.1m etc

Operators

Mathematical operators work as you might expect :

LeftOperatorRight=Comments
Dimension+ or -DimensionDimension
Dimension* or /DoubleDimension
Dimension * DimensionArea
Dimension/DimensionDouble

Field

NameTypeComments
mmDoubleThe number of millimeters
cmDoubleThe number of centimeters
mDoubleThe number of meters
kmDoubleThe number of kilometers

Methods

NameParametersReturn TypeComments
toStringnoneStringConverts to a string, but may be ugly for non integer values.
formatStringStringUses Java's DecimalFormat
unitsnoneUnits
toUnitsUnitsDimensionConverts to different units, keeping the same length.
clampmin : Dimension, max : DimensionDimension
minother : DimensionDimensionThe minimum of this and other
maxother : DimensionDimensionThe maximum of this and other