# Booleovské operace geometrií

Metody *Průnik*, *Oříznutí* a *SelectTrim* se používají zejména u méněrozměrných geometrií, například u bodů, křivek a ploch. Geometrie těles obsahují další sadu metod, které umožňují upravovat jejich tvar, například odebráním materiálu podobně jako u metody *Trim*, nebo prvky kombinovat a vytvářet tak větší celky.

### Sjednocení

Metoda *Sjednocení* přijímá dvě tělesa a z prostoru, který tyto objekty zaujímají, vytváří jedno těleso. Překrývající se prostor mezi objekty se zkombinuje do konečného tvaru. Tento příklad kombinuje kouli a kvádr do jednoho tvaru:

![](/files/3vgdUanGNyffIz3Srhnn)

```js
s1 = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin, 6);

s2 = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin.Translate(4, 0,
    0), 6);

combined = s1.Union(s2);
```

### Rozdíl

Metoda *Rozdíl* funguje podobně jako metoda *Oříznutí* odečítá obsah vstupního tělesa od základního tělesa. V tomto příkladu odřízneme od koule malý kus:

![](/files/xkuiJRmd2moOzIwkmqiH)

```js
s = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin, 6);

tool = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin.Translate(10, 0,
    0), 6);

result = s.Difference(tool);
```

### Průnik

Metoda *Průnik* vrací těleso tvořené překrývajícím se prostorem dvou vstupních těles. V následujícím příkladu je metoda *Rozdíl* změněna na *Průnik*, výsledným tělesem je kus, který byl v předchozím příkladu odříznut:

![](/files/0s9cuQHTvCOIuytkBwbu)

```js
s = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin, 6);

tool = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin.Translate(10, 0,
    0), 6);

result = s.Intersect(tool);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://primer2.dynamobim.org/cs/8_coding_in_dynamo/8-2_geometry-with-design-script/9-geometric-booleans.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
