Intersection meshingΒΆ

In this example we will see how to define a mesh from the intersection of several meshes.

import math
import openturns as ot
import openturns.viewer as otv
import otmeshing as otm

First mesh: a box

mesh1 = ot.IntervalMesher([1] * 2).build(ot.Interval([-1.2] * 2, [1.2] * 2))

Plot first mesh

Mesh 1

Second mesh: an arch

mesh2 = ot.IntervalMesher([10, 10]).build(ot.Interval([1.0, 0.0], [2.0, math.pi]))
f = ot.SymbolicFunction(["r", "theta"], ["r*cos(theta)", "r*sin(theta)"])
mesh2.setVertices(f(mesh2.getVertices()))

Plot second mesh

Mesh 2

Compute the intersection

mesher = otm.IntersectionMesher()
intersection = mesher.build([mesh1, mesh2])

Plot union

Mesh intersection