> For the complete documentation index, see [llms.txt](https://primer2.dynamobim.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://primer2.dynamobim.org/ja/8_coding_in_dynamo/8-2_geometry-with-design-script/9-geometric-booleans.md).

# ジオメトリのブール演算

*Intersect*、*Trim*、および *SelectTrim* は、点、曲線、サーフェスなどの低い次元のジオメトリに主に使用されます。一方、ソリッド ジオメトリには、*Trim* と同様の方法でマテリアルを取り除くことおよび要素を結合して全体を大きくすることの両方によって構築後に形状を修正するための、一連のメソッドが追加されています。

### 和

*Union* メソッドでは、2 つのソリッド オブジェクトが使用され、両方のオブジェクトによってカバーされる空間から単一のソリッド オブジェクトが作成されます。オブジェクト間で重複する空間は最終形状に結合されます。この例では、球と直方体が結合して単一のソリッドの球-立方体形状となります。

![](https://4202566639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJPSLCt5YLZNNPlPsMyh4%2Fuploads%2Fgit-blob-6b8338b9d9afdfdd3643f952c82262ea014920fd%2FGeometricBooleans_01.png?alt=media\&token=01b39fa0-814c-4df7-b2bc-c5cc8cfaf8f3)

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

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

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

### 差

*Difference* メソッドでは、*Trim* のように、ベースとなるソリッドから入力されたツールとなるソリッドの内容が取り除かれます。この例では、球から小さなくぼみが削り出されています。

![](https://4202566639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJPSLCt5YLZNNPlPsMyh4%2Fuploads%2Fgit-blob-c79870bf07df076b5978d7b655700cf93a951525%2FGeometricBooleans_02.png?alt=media\&token=d336809d-ba82-43ef-954b-772a0d3a82b4)

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

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

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

### 交差

*Intersect* メソッドでは、2 つのソリッド入力間の重複するソリッドが生成されます。次の例では、*Difference* が *Intersect* に変更され、結果として得られるソリッドは、最初に削り出されていた空間がなくなっています。

![](https://4202566639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJPSLCt5YLZNNPlPsMyh4%2Fuploads%2Fgit-blob-b8fd0bd6151ff1313c4a1199c2300e7dbeeb53dd%2FGeometricBooleans_03.png?alt=media\&token=a957610b-12f9-4894-80fd-62d1a8eb004e)

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

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

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