Re: CGAL warning: check violation! in CGAL::Polygon_mesh_processing::remove_self_intersections

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

Re: CGAL warning: check violation! in CGAL::Polygon_mesh_processing::remove_self_intersections

Sebastien Loriot (GeometryFactory)
This is a debug warning that indicates that filling a hole
failed, it means that it will be tried again with a larger
region. This warning will be gone in release mode.
Using the polyhedron demo, it only took a few seconds to fix
the model so I guess you are in debug mode.

Sebastien.

On 06/27/2018 11:05 AM, sergio wrote:

> Hello,
> I have the following code to repair the candy_bowl.obj file:
>
> typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
>
> bool repairOBJFile(const char* filename)
> {
> std::cerr << "repairOBJFile " << std::endl;
> std::ifstream input(filename);
> if (!input)
> {
> std::cerr << "Cannot open file " << std::endl;
> return false;
> }
>
> std::vector<Kernel::Point_3> points;
> std::vector< std::vector<std::size_t> > polygons;
> if (!CGAL::read_OBJ(input, points, polygons))
> {
> std::cerr << "Error parsing the OFF file " << std::endl;
> return false;
> }
> //Mesh mesh;
> Polyhedron mesh;
> CGAL::Polygon_mesh_processing::orient_polygon_soup(points, polygons);
> CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,
> polygons, mesh);
>
> bool solved = solved =
> CGAL::Polygon_mesh_processing::remove_self_intersections(mesh);
>
> if (!solved)
> {
> std::cout << "Some self-intersection could not be fixed" << std::endl;
> //return false;
> }
>
> std::ofstream ofs(filename);
> CGAL::print_polyhedron_wavefront(ofs, mesh);
>
> return true;
> }
>
> during this process the program generate the following warnings:
>
> CGAL warning: check violation!
> Expression : !"Returning no output. Filling hole with extra triangles is not
> successful!"
> File       :
> C:\dev\CGAL-4.12\include\CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h
> Line       : 1103
> Explanation:
> Refer to the bug-reporting instructions at
> https://www.cgal.org/bug_report.html
>
> The model is repaired after 971 seconds.
>
> from:
>
> Number self-intersections:..........290 (0.0618804 % of faces)
> Number non manifold edge:...........0 (0 % of edges)
> Number non manifold vertex:.........63 (0.026893 % of vertices)
> IsCoherentlyOriented:...............False
> IsOrientable:.......................False
>  
> to
>
> Number self-intersections:..........4 (0.000857012 % of faces)
> Number non manifold edge:...........0 (0 % of edges)
> Number non manifold vertex:.........0 (0 % of vertices)
> IsCoherentlyOriented:...............True
> IsOrientable:.......................True
>
> Questions:
> 1. Is it possible to fix the problem related with the warnings?
> 2. How we can reduce the time of repairing?
>
>
> the file candy_bowl.obj is included in:
> https://drive.google.com/file/d/1UCsstxwBQF--uFMXxcKR4JrQDGdHbB94/view?usp=sharing
>
> Thanks in advance!
> Sergio
>
>
>
>
>
>
>
>
>
> --
> 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: CGAL warning: check violation! in CGAL::Polygon_mesh_processing::remove_self_intersections

sergio
This post was updated on .
Ok now I build my application in Release so why the results are different? I
found that it repair it better if it is build in Debug. In release build it
changes the mesh that causing additional defects in the model result and the
intersections is not repaired as in debug mode does.
Check the results:
*--------------------------------------------------------------------------------------
                            RESULTS BUILD RELEASE (DOES NOT WORKS WELL)
--------------------------------------------------------------------------------------*

...........................................................
.                        Repairing                       .
...........................................................

Repairing time:..................176.924 seconds. = 2.94873min


...........................................................
.                        Checking errors                  .
...........................................................


...........................................................
.                        Model Data                       .
...........................................................
Number of faces:....................463782
Number of edges:....................695673
Number of vertex:...................232520


-----------------------------------------------------------
                     Principal Diagnostics
-----------------------------------------------------------
Number self-intersections:..........166 (0.0357927 % of faces)
Number non manifold edge:...........0 (0 % of edges)
Number non manifold vertex:.........1 (0.000430071 % of vertices)
IsCoherentlyOriented:...............False
IsOrientable:.......................False


-----------------------------------------------------------
                     Others Diagnostics
-----------------------------------------------------------
Number holes:......................0
Boundary edges:....................0 (0 % of edges)
Number duplicate edge:............0 (0 % of edges)
Number duplicate Face:............0 (0 % of faces)
Number duplicate vertex:..........37 (0.0159126 % of vertices)
Number degenerate faces...........0 (0 % of faces)
Number degenerate vertex..........0 (0 % of vertices)


-----------------------------------------------------------
                     Diagnostics Data
-----------------------------------------------------------
Diagnostics time:..................7.791 seconds. = 0.12985min
Average error:.......................0.00579282 %


*------------------------------------------------------------------------------------------
                            RESULTS DEBUG  BUILD  (WORKS WELL)
------------------------------------------------------------------------------------------*

Repairing time:..................767.837 seconds. = 12.7973min


...........................................................
.                        Checking errors                  .
...........................................................


...........................................................
.                        Model Data                       .
...........................................................
Number of faces:....................467360
Number of edges:....................701040
Number of vertex:...................233682


-----------------------------------------------------------
                     Principal Diagnostics
-----------------------------------------------------------
Number self-intersections:..........4 (0.000855871 % of faces)
Number non manifold edge:...........0 (0 % of edges)
Number non manifold vertex:.........0 (0 % of vertices)
IsCoherentlyOriented:...............True
IsOrientable:.......................True


-----------------------------------------------------------
                     Others Diagnostics
-----------------------------------------------------------
Number holes:......................0
Boundary edges:....................0 (0 % of edges)
Number duplicate edge:............0 (0 % of edges)
Number duplicate Face:............0 (0 % of faces)
Number duplicate vertex:..........0 (0 % of vertices)
Number degenerate faces...........0 (0 % of faces)
Number degenerate vertex..........0 (0 % of vertices)


-----------------------------------------------------------
                     Diagnostics Data
-----------------------------------------------------------
Diagnostics time:..................112.755 seconds. = 1.87925min
Average error:.......................9.50968e-05 %



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

How do I get the primitive out of a tree after an intersection?

Rash
Dear Readers,

I fail horribly at retrieving the primitive which causes the
intersection. I calculate a hit:

                 boost::optional<Primitive_id> hit =
tree.first_intersected_primitive(rays[this->transformCoordinates(y,x)]);

Then check if a hit happened:

if(hit)

And then the chaos starts. There is simply no "getIntersectedPrimitive"
member function of primitive id. What I am doing wrong? How can I do it
right?

Currently I am getting an iterrator for faces (at least this is what I
think what I am doing). Then I get the first face. This seems to be a
pretty strange approach. How can I get the the normal of
I_Polyhedron_facet and how do I get the intersection point?

 
CGAL::internal::In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>,
CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>,
std::allocator<int> >, CGAL::Boolean_tag<true>,
CGAL::Plane_3<CGAL::Simple_cartesian<double> > > > >,
std::allocator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>,
CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>,
std::allocator<int> >, CGAL::Boolean_tag<true>,
CGAL::Plane_3<CGAL::Simple_cartesian<double> > > > > > > it = *hit;

 
CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>,
CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>,
std::allocator<int> >, CGAL::Boolean_tag<true>,
CGAL::Plane_3<CGAL::Simple_cartesian<double> > >
 >::Halfedge_around_facet_circulator ipfacet = it->facet_begin();

Kind regards
Rashid

--
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: How do I get the primitive out of a tree after an intersection?

Rash
Here is the solution

https://stackoverflow.com/questions/51148826/get-primitive-from-aabb-tree-intersection/51162811#51162811

Cgal has some nice features, but could realy use more documentation.

Am 03.07.2018 um 19:14 schrieb Rash:

> Dear Readers,
>
> I fail horribly at retrieving the primitive which causes the
> intersection. I calculate a hit:
>
>                  boost::optional<Primitive_id> hit =
> tree.first_intersected_primitive(rays[this->transformCoordinates(y,x)]);
>
> Then check if a hit happened:
>
> if(hit)
>
> And then the chaos starts. There is simply no "getIntersectedPrimitive"
> member function of primitive id. What I am doing wrong? How can I do it
> right?
>
> Currently I am getting an iterrator for faces (at least this is what I
> think what I am doing). Then I get the first face. This seems to be a
> pretty strange approach. How can I get the the normal of
> I_Polyhedron_facet and how do I get the intersection point?
>
>
> CGAL::internal::In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>,
> CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>,
> std::allocator<int> >, CGAL::Boolean_tag<true>,
> CGAL::Plane_3<CGAL::Simple_cartesian<double> > > > >,
> std::allocator<CGAL::HalfedgeDS_in_place_list_face<CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>,
> CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>,
> std::allocator<int> >, CGAL::Boolean_tag<true>,
> CGAL::Plane_3<CGAL::Simple_cartesian<double> > > > > > > it = *hit;
>
>
> CGAL::I_Polyhedron_facet<CGAL::HalfedgeDS_face_base<CGAL::HalfedgeDS_list_types<CGAL::Simple_cartesian<double>,
> CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>,
> std::allocator<int> >, CGAL::Boolean_tag<true>,
> CGAL::Plane_3<CGAL::Simple_cartesian<double> > >
>  >::Halfedge_around_facet_circulator ipfacet = it->facet_begin();
>
> Kind regards
> Rashid
>

--
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: CGAL warning: check violation! in CGAL::Polygon_mesh_processing::remove_self_intersections

sergio
In reply to this post by Sebastien Loriot (GeometryFactory)
You right. Let me add another discussion related to build my application in
release:

http://cgal-discuss.949826.n4.nabble.com/remove-self-intersections-changes-the-mesh-and-the-reparation-is-less-than-when-i-build-my-applicatig-tc4663643.html

Thanks  you.
Sergio



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