I have a surface that can be described by f(u,v), and I would like to generate a mesh of this object (so that I can later put it in Blender/Paraview). Any guidelines on how to do it in Julia?
There are multiple ways of doing it. If you are doing a lot of geometry processing try:
Maybe you can instantiate specific vertices in the Cartesian product of the parameter space (u,v) and connect with quadrangles?
I can’t seem to find quadrangles in the documentation? I was reading this library, but I can’t figure out how to do this from the documentation. (Also I’ve never had to manually construct a mesh)
Try to read the tests of the package as they are quite exhaustive.
I understand that you can simply instantiate vertices with your parametrization, for instance you have a function:
f(u,v) = Point3(x(u,v), y(u,v), z(u,v))
So you can create a lattice:
vertices = [f(u,v) for u in us for v in vs]
and connect a few of them, for example with a grid topology:
topology = GridTopology(length(us)-1, length(vs)-1)
The simple mesh is then:
mesh = SimpleMesh(vertices, topology)
In more recent versions, you can also use RectilinearGrid(x, y, z)
as an alternative where x
, y
and z
are vectors.