Quantity Types
The following quantity types are currently supported in µcad:
| Type | Metric Units | Imperial Units |
|---|---|---|
Scalar | % or none | - |
Length | µm, mm, cm, m | in or ", ft or ', yd |
Angle | ° or deg, grad, turn,rad | |
Area | µm²,mm²,cm²,m² | in², ft² , yd² |
Volume | µm³, mm³,cm³,m³,ml,cl,l, µl | in³, ft³ , yd³ |
Density | g/mm³ | - |
Weight | g, kg | lb, oz |
[!TIP] Special characters like
µ,°,², and³have ASCII1 replacements you may use if your keyboard misses these letters (see this appendix for more information).
Scalar
The type Scalar contains a floating number (without any unit) and must be written with at least one decimal place (or in percent).
zero = 0;
pi = 3.1415;
percent = 55%;
Length
Length is used to describe a concrete length.
millimeters = 1000mm;
centimeters = 100cm;
meters = 1m;
inches = 39.37007874015748in;
std::debug::assert_eq([millimeters, centimeters, meters, inches]);
Angle
Angles are used with rotations and in constrains when proving measures.
pi = std::math::PI;
radian = 1rad * pi;
degree = 180°;
degree_ = 180deg;
grad = 200grad;
turn = 0.5turns;
std::debug::assert_eq([degree, degree_, grad, turn, radian]);
Area
An Area is a two-dimensional quantity. It is the result when multiplying two Lengths.
a = 3cm;
b = 2cm;
area = a * b;
std::debug::assert(area == 6cm²);
Here is an example of how to use different areal units:
square_millimeter = 100000mm²;
square_centimeter = 1000cm2;
square_meter = 0.1m²;
square_inch = 155in²;
std::debug::assert_eq([square_millimeter, square_centimeter]);
Volume
A Volume is a three-dimensional quantity. It is the result when multiplying three Lengths.
a = 3mm;
b = 2mm;
c = 4mm;
volume = a * b * c;
std::debug::assert(volume == 24mm³);
Here is an example for units:
cubic_millimeter = 1000000.0mm³;
cubic_centimeter = 100.0cl;
cubic_meter = 0.001m3;
cubic_inch = 61.0237in³;
liter = 1.0l;
centiliter = 100.0cl;
milliliter = 1000.0ml;
std::debug::assert_eq(
[
cubic_millimeter,
cubic_centimeter,
cubic_meter,
centiliter,
milliliter,
],
);
Density
Currently Density has not specific use in µcad and only can use unit g/mm³.
gramm_per_square_centimeters = 19.302g/mm³;
Weight
Weights can be calculated by applying volumes to materials.
gram = 1000.0g;
kilogram = 1.0kg;
pound = 2.204623lb;
std::debug::assert_eq([gram, kilogram]);