Facets from 3D Mesh Generation

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

Facets from 3D Mesh Generation

Mukherjee, Soham
Hi All,
Is there any way to extract all the facets (not just the boundary facets) that belong to tetrahedra of C3T3::Triangulation? What I am doing is following:
1. Iterate over finite faces of C3T3::Triangulation object obtained from the function call refine_mesh(…..) 
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
C3t3::Triangulation tr = c3t3.triangulation();
for(auto fit=tr.finite_facets_begin();fit!=tr.finite_facets_end();fit++){
C3t3::Triangulation::Cell_handle c = fit->first;
int i = fit->second;
std::vector<unsigned> face_id;
face_id.push_back(vid[c->vertex((i+1)%4)]);
face_id.push_back(vid[c->vertex((i+2)%4)]);
face_id.push_back(vid[c->vertex((i+3)%4)]);
// Write this vertex indices of face i.e. connectivity information to file
}
But when I output the whole c3t3 to unstructuredgridVtk by calling output_to_vtu(c3t3) it is nicer (the way Delaunay Refined 3D Mesh should look like) and not like the mesh I obtained from manually outputting the info.
Am I missing something? That is needed to be taken care of?For sake of clarity I am attaching two pictures with this email.
Manual Output:




.
Output to vtu:
Reply | Threaded
Open this post in threaded view
|

Re: Facets from 3D Mesh Generation

andreas.fabri
The finite facets are all facets of the triangulation of the convex hull of the input. That is you only do not get facets with a vertex at infinity. 
Andreas

On 16 Aug 2019, at 06:22, Mukherjee, Soham <[hidden email]> wrote:

Hi All,
Is there any way to extract all the facets (not just the boundary facets) that belong to tetrahedra of C3T3::Triangulation? What I am doing is following:
1. Iterate over finite faces of C3T3::Triangulation object obtained from the function call refine_mesh(…..) 
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
C3t3::Triangulation tr = c3t3.triangulation();
for(auto fit=tr.finite_facets_begin();fit!=tr.finite_facets_end();fit++){
C3t3::Triangulation::Cell_handle c = fit->first;
int i = fit->second;
std::vector<unsigned> face_id;
face_id.push_back(vid[c->vertex((i+1)%4)]);
face_id.push_back(vid[c->vertex((i+2)%4)]);
face_id.push_back(vid[c->vertex((i+3)%4)]);
// Write this vertex indices of face i.e. connectivity information to file
}
But when I output the whole c3t3 to unstructuredgridVtk by calling output_to_vtu(c3t3) it is nicer (the way Delaunay Refined 3D Mesh should look like) and not like the mesh I obtained from manually outputting the info.
Am I missing something? That is needed to be taken care of?For sake of clarity I am attaching two pictures with this email.
Manual Output:




.<Manual_Output.png>
Output to vtu:
<Output_to_vtu.png>
Reply | Threaded
Open this post in threaded view
|

Re: Facets from 3D Mesh Generation

Mukherjee, Soham
Hi Andreas,
Thank you for your reply. Can you please elaborate more a bit? I am not sure what do you mean by finite facets will give me the triangulation of convex hull of the input?

Thanks,
Soham

On Aug 16, 2019, at 7:53 AM, Andreas fabri <[hidden email]> wrote:

The finite facets are all facets of the triangulation of the convex hull of the input. That is you only do not get facets with a vertex at infinity. 
Andreas

On 16 Aug 2019, at 06:22, Mukherjee, Soham <[hidden email]> wrote:

Hi All,
Is there any way to extract all the facets (not just the boundary facets) that belong to tetrahedra of C3T3::Triangulation? What I am doing is following:
1. Iterate over finite faces of C3T3::Triangulation object obtained from the function call refine_mesh(…..) 
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
C3t3::Triangulation tr = c3t3.triangulation();
for(auto fit=tr.finite_facets_begin();fit!=tr.finite_facets_end();fit++){
C3t3::Triangulation::Cell_handle c = fit->first;
int i = fit->second;
std::vector<unsigned> face_id;
face_id.push_back(vid[c->vertex((i+1)%4)]);
face_id.push_back(vid[c->vertex((i+2)%4)]);
face_id.push_back(vid[c->vertex((i+3)%4)]);
// Write this vertex indices of face i.e. connectivity information to file
}
But when I output the whole c3t3 to unstructuredgridVtk by calling output_to_vtu(c3t3) it is nicer (the way Delaunay Refined 3D Mesh should look like) and not like the mesh I obtained from manually outputting the info.
Am I missing something? That is needed to be taken care of?For sake of clarity I am attaching two pictures with this email.
Manual Output:




.<Manual_Output.png>
Output to vtu:
<Output_to_vtu.png>

Reply | Threaded
Open this post in threaded view
|

Re: Facets from 3D Mesh Generation

Sebastien Loriot (GeometryFactory)
Go back to the user manual of the 3D triangulations package.

A 3D triangulation in CGAL is a triangulation of the whole 3D space.
To do that an extra vertex (the infinite vertex) is added in the
triangulation data structure and is connected to all the faces of
the convex hull of the input point set. Each face on the convex hull
corresponds to a infinite cell with the infinite vertex opposite to
the face.

See:
https://doc.cgal.org/latest/Triangulation_3/classCGAL_1_1Triangulation__3.html#a0dde82d53bcd9f705f3a676329c1df2d

https://doc.cgal.org/latest/Triangulation_3/classCGAL_1_1Triangulation__3.html#ad9890c64030969cd74f35a007cb6b049

Sebastien.

On 8/16/19 5:58 PM, Mukherjee, Soham wrote:

> Hi Andreas,
> Thank you for your reply. Can you please elaborate more a bit? I am not
> sure what do you mean by finite facets will give me the triangulation of
> convex hull of the input?
>
> Thanks,
> Soham
>
>> On Aug 16, 2019, at 7:53 AM, Andreas fabri
>> <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> The finite facets are all facets of the triangulation of the convex
>> hull of the input. That is you only do not get facets with a vertex at
>> infinity.
>> Andreas
>>
>> On 16 Aug 2019, at 06:22, Mukherjee, Soham
>> <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>> Hi All,
>>> Is there any way to extract all the facets (not just the boundary
>>> facets) that belong to tetrahedra of C3T3::Triangulation? What I am
>>> doing is following:
>>> 1. Iterate over finite faces of C3T3::Triangulation object obtained
>>> from the function call refine_mesh(…..)
>>> C3t3 c3t3 =CGAL::make_mesh_3<C3t3>(domain, criteria);
>>> C3t3::Triangulation tr =c3t3.triangulation();
>>> for(auto
>>> fit=tr.finite_facets_begin();fit!=tr.finite_facets_end();fit++){
>>> C3t3::Triangulation::Cell_handle c = fit->first;
>>> int i = fit->second;
>>> std::vector<unsigned> face_id;
>>> face_id.push_back(vid[c->vertex((i+1)%4)]);
>>> face_id.push_back(vid[c->vertex((i+2)%4)]);
>>> face_id.push_back(vid[c->vertex((i+3)%4)]);
>>> // Write this vertex indices of face i.e. connectivity information to
>>> file
>>> }
>>> But when I output the whole c3t3 to unstructuredgridVtk by calling
>>> output_to_vtu(c3t3) it is nicer (the way Delaunay Refined 3D Mesh
>>> should look like) and not like the mesh I obtained from manually
>>> outputting the info.
>>> Am I missing something? That is needed to be taken care of?For sake
>>> of clarity I am attaching two pictures with this email.
>>> Manual Output:
>>>
>>>
>>>
>>>
>>> .<Manual_Output.png>
>>> Output to vtu:
>>> <Output_to_vtu.png>
>

--
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: Facets from 3D Mesh Generation

Frykovsky
In reply to this post by Mukherjee, Soham
I had a somewhat similar problem.

I think you need to iterate using /facets_in_complex_begin()/ and
/facets_in_complex_end()/. At least that is what they do in their output
function:
https://github.com/CGAL/cgal/blob/9c54068936abea2b445e3e2d7adb8eabe14fdca0/Mesh_3/include/CGAL/IO/File_medit.h#L814-L816

That fixed it for me.



--
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