Code Monkey home page Code Monkey logo

Comments (7)

mlivesu avatar mlivesu commented on May 23, 2024 1

Ok. Then it may be a bug. I will investigate it and let you know.
I'll keep the issue open as a personal reminder :)

from cinolib.

mlivesu avatar mlivesu commented on May 23, 2024

Hi @Mengesh, thanks for appreciating the project!

In the example you mention the dual mesh also contains clipped (boundary) cells. Are the problems you are mentioning involving boundary faces of those clipped elements?

This is the only issue that comes to my mind, because that primal mesh is Delaunay, hence its dual should be a plain Voronoi diagram with all planar faces

from cinolib.

Mengesh avatar Mengesh commented on May 23, 2024

Unfortunately no.

cino-re-1
cino-re-2
cino-re-3

from cinolib.

mlivesu avatar mlivesu commented on May 23, 2024

I've had some time to investigate this issue. It seems that the reason why dual faces are not planar is because in the dualization code I take the centroid of each primal element, whereas to reproduce the Voronoi diagram starting from a Delaunay mesh I should take the center of the sphere passing through the four vertices of the tetrahedron (i.e. its circumcenter).

Note that dual_mesh is more general, and it's not meant to be a tool to pass from Voronoi to Dealunay, or vice-versa. As such, it does not make any assumption on the primal mesh, which is not required to be a Delaunay mesh. Not even to be a tetmesh, actually.

For your specific case, to obtain the desired result I suggest you first make a dual mesh as usual, and then update the vertices of the each dual vertex with the circumcenter of the primal element they correspond to. The first NP vertices in the dual mesh are in 1:1 relation with the polyhedra in the prima mesh. I have created a new function, called tetrahedron_circumcenter, which you can find inside <cinolib/geometry/tetrahedron_utils.h>. You can use it to compute the circumcenter.

from cinolib.

Mengesh avatar Mengesh commented on May 23, 2024

Thank you very much! I did it like this

for (int i=0; i<m_tet.num_polys(); ++i)
  {
std::vector<vec3d> tetraverts = m_tet.poly_verts(i);
m_poly.vert(i) = tetrahedron_circumcenter(tetraverts.at(0),
					  tetraverts.at(1),
					  tetraverts.at(2),
					  tetraverts.at(3));
  };

and it seems to work for non-boundary edges. However, the results for boundary edges are wild :) The faces are not only non-planar, but sometimes also scattered, as you can see on the image below. The arrows are there just so I can check if face normal and edge are parallel.

I guess this happens because of the clipping mechanism. Do you have any suggestion how to fix this?

cino

from cinolib.

mlivesu avatar mlivesu commented on May 23, 2024

Correct, this is due to clipped cells, for which there are no guarantees that the dual faces will be planar.
For the scattering, I am not sure I understand what you are doing/mean, but if you are restricting your processing to non clipped cells only, there may certainly be gaps (e.g. when two opposite clipped cells are adjacent to one another).

To my knowledge and understanding, the only meshing algorithm that will give you what you are looking for is VoroCrust. They have had a simple yet great idea: rather than clipping cells, they carefully position Voronoi seeds so that the cells will conform to the target geometry. In this case there will be no clipped cells at all. This ensures that the mesh natively meets the orthogonality condition, which is important in CFD. Is this your field?

from cinolib.

Mengesh avatar Mengesh commented on May 23, 2024

Yes, partially.

I actually found about VoroCrust before cinolib, but I was unable to get in touch with Mohamed Ebeida. I see their website went through some serious update, so I'll try to contact them again. Thank you for the reminder 🙂

from cinolib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.