Boolean Operation
Polygon can be combined using boolean operation. The following boolean operation is supported :
let sq = square(10);
let ci = circle(5).position(V2(7,0));
let result = boolean.union(sq, ci);
draw(sq, ci, result.fill('lightblue'));
boolean.union (
d1
:
Diagram , d2
:
Diagram , tolerance?
:
number )
:
Diagram
let sq = square(10);
let ci = circle(5).position(V2(7,0));
let result = boolean.union(sq, ci);
draw(sq, ci, result.fill('lightblue'));
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.difference(sq, ci);
draw(sq, ci, result.fill('lightblue'));
boolean.difference (
d1
:
Diagram , d2
:
Diagram , tolerance?
:
number )
:
Diagram
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.difference(sq, ci);
draw(sq, ci, result.fill('lightblue'));
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.difference(ci, sq);
draw(sq, ci, result.fill('lightblue'));
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.difference(ci, sq);
draw(sq, ci, result.fill('lightblue'));
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.intersect(sq, ci);
draw(sq, ci, result.fill('lightblue'));
boolean.intersect (
d1
:
Diagram , d2
:
Diagram , tolerance?
:
number )
:
Diagram
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.intersect(sq, ci);
draw(sq, ci, result.fill('lightblue'));
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.xor(sq, ci);
draw(sq, ci, result.fill('lightblue'));
boolean.xor (
d1
:
Diagram , d2
:
Diagram , tolerance?
:
number )
:
Diagram
let sq = square(10)
.stroke('gray').strokedasharray([5]);
let ci = circle(5).position(V2(7,0))
.stroke('gray').strokedasharray([5]);
let result = boolean.xor(sq, ci);
draw(sq, ci, result.fill('lightblue'));
* For all the boolean operations, there is an optional parameter tolerance
which is used to determine the tolerance for the operation.
The default value is 1e-10
.