Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quantity Types

The following quantity types are currently supported in µcad:

TypeMetric UnitsImperial Units
Scalar% or none-
Lengthµm, mm, cm, min or ", ft or ', yd
Angle° or deg, grad, turn,rad
Areaµm²,mm²,cm²,in², ft² , yd²
Volumeµm³, mm³,cm³,,ml,cl,l, µlin³, ft³ , yd³
Densityg/mm³-
Weightg, kglb, 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).

test

zero = 0;
pi = 3.1415;
percent = 55%;

Length

Length is used to describe a concrete length.

test

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.

test

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.

test

a = 3cm;
b = 2cm;
area = a * b;
std::debug::assert(area == 6cm²);

Here is an example of how to use different areal units:

test

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.

test

a = 3mm;
b = 2mm;
c = 4mm;

volume = a * b * c;

std::debug::assert(volume == 24mm³);

Here is an example for units:

test

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³.

test

gramm_per_square_centimeters = 19.302g/mm³;

Weight

Weights can be calculated by applying volumes to materials.

test

gram = 1000.0g;
kilogram = 1.0kg;
pound = 2.204623lb;

std::debug::assert_eq([gram, kilogram]);

  1. see wikipedia about ASCII