Fwd: fair() from polygon mesh processing package produces NaN points

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: fair() from polygon mesh processing package produces NaN points

danielyan86129
Dear CGAL,

I'm trying to use the fair() function in the polygon mesh processing package to fair the patch of a hole. I have the patch P, and I grabbed the N-rings of the vertices on the hole boundary to use as the constraint faces S. Denote the CGAL mesh M to be the union of P and S. I can then fair only the vertices of the patch using some pseudo-code like this:

fair_vtsRange <- vts(P) \ vts(S) // S is not changing at all
fair(M, fair_vtsRange, fairing_continuity(C)); // C = 0, 1, 2

When C == 0, and the result looks fine (wireframe is shown):

This shows the fair'ed patch and the constraint faces (used 10-rings, but even 1-ring would work).

However I couldn't get fair() to produce any meaningful result when I set C = 1 or 2, no matter how big N-rings I have (below I also use 10-rings, which should be enough constraint).

Meshlab gives me this error indicating the vertices of the patched region after fairing are invalid: "Warning mesh contains 92 vertices with NAN coords and 0 degenerate faces". Even though the hole appears to be not-patched, meshlab tells me there is 0 boundary. So the patch does exist, it's just the geometry is really bad.

I know the fair() might be not be using the best linear solver and cotangent computation can give bad values if the angles are close to 0, but in this test example numerics should be fine.

Any help is appreciated!

- Yajie

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: fair() from polygon mesh processing package produces NaN points

andreas.fabri
Can you put a selfcontained program and data set on gidt.github.com please

On 31 May 2019, at 00:09, Yajie Yan <[hidden email]> wrote:

Dear CGAL,

I'm trying to use the fair() function in the polygon mesh processing package to fair the patch of a hole. I have the patch P, and I grabbed the N-rings of the vertices on the hole boundary to use as the constraint faces S. Denote the CGAL mesh M to be the union of P and S. I can then fair only the vertices of the patch using some pseudo-code like this:

fair_vtsRange <- vts(P) \ vts(S) // S is not changing at all
fair(M, fair_vtsRange, fairing_continuity(C)); // C = 0, 1, 2

When C == 0, and the result looks fine (wireframe is shown):

This shows the fair'ed patch and the constraint faces (used 10-rings, but even 1-ring would work).

However I couldn't get fair() to produce any meaningful result when I set C = 1 or 2, no matter how big N-rings I have (below I also use 10-rings, which should be enough constraint).

Meshlab gives me this error indicating the vertices of the patched region after fairing are invalid: "Warning mesh contains 92 vertices with NAN coords and 0 degenerate faces". Even though the hole appears to be not-patched, meshlab tells me there is 0 boundary. So the patch does exist, it's just the geometry is really bad.

I know the fair() might be not be using the best linear solver and cotangent computation can give bad values if the angles are close to 0, but in this test example numerics should be fine.

Any help is appreciated!

- Yajie

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: fair() from polygon mesh processing package produces NaN points

danielyan86129
This post was updated on .
Here is the cube with a hole:
https://drive.google.com/open?id=1Z4D4YWAkIMxDk54Pa2umDKKNXeOWQFkC
<https://drive.google.com/open?id=1Z4D4YWAkIMxDk54Pa2umDKKNXeOWQFkC

The code example takes time to make. I will try. What I'm doing is the
following:
Input: a mesh represented in our own data structure
For each hole of the mesh:
- get the hole of the mesh -> H, neighboring faces of H -> S (to be used as
constraint)
- patch the hole: triangulate_hole_polyline(), denote the patch faces P
- lift P along normals of the boundary of H, and connect the boundary of P
and boundary of H with a strip of triangle faces Q. This is to guarantee
only P can change during refinement, while boundary of H stays untouched
- refine P using refine()
- perform fairing on Union{P, Q}, with S as constraint

Note: before fair(), none of P, Q, or S contains thin triangles.

Since our mesh is pretty big, and may contain other artifacts, we can't
convert it to CGAL's mesh structure. Instead we chose to convert small
region around the hole to CGAL's Surface_mesh as each hole is processed.

Meanwhile, may I ask which section is implemented by fair() in the paper "On
Linear Variational Surface Deformation Methods"? Since it's a survey, does
it reference an older paper that describes exactly what fair() does?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Fwd: fair() from polygon mesh processing package produces NaN points

danielyan86129
Here is a code sample:
https://gist.github.com/danielyan86129/6c8607b7bbc3c1d121789cd289cdc27a

Using this mesh model:
https://drive.google.com/open?id=1K2ZFtiSDRFc8zM9fPR_zJH6ZgWv-hbWk

For simplicity, the code fills, refines, and fairs just the first hole it
finds. All the holes can be processed if performed iteratively.

Interestingly, I couldn't reproduce the issue. fair() seems to be working
now if thin triangles are properly dealt with (here I apply random
perturbation if any arise). The difference is the code sample here start
from the cgal mesh directly rather than works with our proprietary data
structure. I'll keep looking. Meanwhile, I still think it's useful to have
some CGAL experts look at my code to give feedback, or spot potential
issues.

Thanks.



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss