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

Model Expressions

Things change when an expression consists of models instead of just values. We call this a model expression:

test

std::geo2d::Rect(1cm) - std::geo2d::Circle(radius = 3mm);

In this expression which consists of a subtraction operation of the results of two calls to Rect and Circle.

Output :output

Building a group (using curly braces) of both operands and applying the builtin method subtract to it is equivalent to the above code:

test

use __builtin::ops::subtract;

{
    std::geo2d::Rect(1cm);
    std::geo2d::Circle(radius = 3mm);
}.subtract();

Output :output

The following operations can be applied to 2D or 3D models:

OperatorBuiltin OperationDescription
-__builtin::ops::subtractGeometrical difference
|__builtin::ops::unionGeometrical union
&__builtin::ops::intersectGeometrical intersection