Merging

Geometries and meshes can be merged into a single geometric object as illustrated in the following example. The resulting type depends on the combination of input types, and can be a Mesh or Multi geometry.

Base.mergeMethod
merge(object₁, object₂)

Merge object₁ with object₂, i.e. concatenate the vertices and adjust the connectivities accordingly.

source
g = CartesianGrid(2, 2)
t = Triangle((3, 0), (4, 0), (3, 1))

m = merge(g, t)
5 SimpleMesh
  12 vertices
  ├─ Point(x: 0.0 m, y: 0.0 m)
  ├─ Point(x: 1.0 m, y: 0.0 m)
  ├─ Point(x: 2.0 m, y: 0.0 m)
  ├─ Point(x: 0.0 m, y: 1.0 m)
  ├─ Point(x: 1.0 m, y: 1.0 m)
  ⋮
  ├─ Point(x: 1.0 m, y: 2.0 m)
  ├─ Point(x: 2.0 m, y: 2.0 m)
  ├─ Point(x: 3.0 m, y: 0.0 m)
  ├─ Point(x: 4.0 m, y: 0.0 m)
  └─ Point(x: 3.0 m, y: 1.0 m)
  5 elements
  ├─ Quadrangle(1, 2, 5, 4)
  ├─ Quadrangle(2, 3, 6, 5)
  ├─ Quadrangle(4, 5, 8, 7)
  ├─ Quadrangle(5, 6, 9, 8)
  └─ Triangle(10, 11, 12)