Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Valid and closed polyhedron cannot be converted into nef polyhedron

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Valid and closed polyhedron cannot be converted into nef polyhedron


Chronological Thread 
  • From: Sebastien Loriot <>
  • To:
  • Subject: Re: [cgal-discuss] Valid and closed polyhedron cannot be converted into nef polyhedron
  • Date: Wed, 5 May 2021 14:32:12 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-hdrordr: A9a23:Ool7XK5BNFmBHJmrXQPXwADXdLJzesId70hD6mlaTxtJfsuE0/2/hfhz726WtB89UGwt8OrwXZWobmjb8fdOj7U5GZeHcE3YtHCzLIdkhLGD/xTFFzfl/uBQkYdsGpIOauHYNlRxgcbk7ATQKb9Jq7O62ZulnOLPi0pqJDsKV4hb8wx7BgyHe3cbeCB6A/MCeaa0145irzqkdW9/VKuGOkU=
  • Ironport-phdr: A9a23:uAs8cBJN+Q5CD1lL1dmcuLxhWUAX047cDksu8pMizoh2WeGdxfzKAkXT6L1XgUPTWs2DsrQY0ruQ6fu/Ej1Zqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba52IRmsswncuMsbjYRmJ6os1xDEvmZGd+NKyG1yOFmdhQz85sC+/J5i9yRfpfcs/NNeXKv5Yqo1U6VWACwpPG4p6sLrswLDTRaU6XsHTmoWiBtIDBPb4xz8Q5z8rzH1tut52CmdIM32UbU5Uims4qt3VBPljjoMOjgk+2/Vl8NwlrpWrg+/qRxxw4DaY4+bO/RxcazfYdwUSnFMXtpSWiFbHo+wc4UCAugHMO1Fr4f9vVwOrR6mCAexGuzg0SVHhmTq3a07zeshFxzN0gonH9IUsXTUq8n1P7oVXOCuyKnIyi/Db/JR2Tfh8oTIdxQhrOqDXbJ1a8XRyE0vGxnZgVWXrIzoJjW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gxsETp2BF6TI5HlJpyxE4=

Indeed in such cases, you need to stick to Nef.

There has been a try to implement one simple approximate version:
https://github.com/CGAL/cgal/pull/3302

But we were having some expensive runtime issues that I did not have
time to look at and fix it.

Sebastien.

On 5/5/21 11:24 AM, Matthew Lai ( via cgal-discuss Mailing List) wrote:
Thanks!

I am actually only using Nef as input to convex decomposition. I assume it only supports Nef?

Matthew

On Wed, May 5, 2021 at 9:48 AM Sebastien Loriot < <>> wrote:

Note that there is an alternative package to perform Boolean operations
(with some restrictions on the kind of input/output handled) available
in the Polygon mesh processing package:

https://doc.cgal.org/latest/Polygon_mesh_processing/#title13
<https://doc.cgal.org/latest/Polygon_mesh_processing/#title13>

Those restriction enables this package to have better runtimes than
Nef.

Best regards,

Sebastien.

On 5/5/21 10:36 AM, Matthew Lai (
<> via cgal-discuss
Mailing List) wrote:
> Thanks Maxime.
>
> I had missed that part of the documentation, and indeed switching to
> EPECK fixed it.
>
> Thanks for your help!
>
> On Wed, May 5, 2021 at 8:03 AM Maxime Gimeno
< <>
> < <>>> wrote:
>
>     Hi,
>
>     I think the problem is your kernel. If you look at the
documentation
>  <https://doc.cgal.org/latest/Nef_3/classCGAL_1_1Nef__polyhedron__3.html <https://doc.cgal.org/latest/Nef_3/classCGAL_1_1Nef__polyhedron__3.html>>,
>     you can see that the kernel used for a Nef_polyhedron_3 must be
>     exact, and the one you are using has inexact constructions.
You can
>     try to replace Epick by Epeck
>  <https://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Exact__predicates__exact__constructions__kernel.html <https://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Exact__predicates__exact__constructions__kernel.html>>,
>     I have tried on my machine and it works.
>
>     Le mar. 4 mai 2021 à 23:46, Matthew Lai
< <>
>     <
<>>> a écrit :
>
>         Hello!
>
>         I am running into an assertion fail trying to convert a
>         polyhedron into a Nef polyhedron, despite the polyhedron
being
>         apparently closed and valid. Can someone help?
>
>         I have simplified it down to this minimal test case including
>         the model file:
>         =============================================
>         #include <iostream>
>         #include <sstream>
>
>         #include
"CGAL/Exact_predicates_inexact_constructions_kernel.h"
>         #include "CGAL/Nef_polyhedron_3.h"
>         #include "CGAL/Polyhedron_3.h"
>
>         namespace {
>
>         constexpr char kModel[] = R"""(
>         OFF
>         24 52 0
>         296.9305 -36.80449 0
>         296.9305 -280 0
>         296.9305 -36.80449 50
>         296.9305 -280 50
>         30.94792 -36.80449 0
>         30.94792 -36.80449 50
>         30.94792 -280 0
>         30.94792 -280 50
>         296.9305 -322.1497 0
>         296.9305 -529.0251 0
>         296.9305 -322.1497 50
>         296.9305 -529.0251 50
>         30.94792 -322.1497 0
>         30.94792 -322.1497 50
>         30.94792 -529.0251 0
>         30.94792 -529.0251 50
>         0 0 0
>         0 -560 0
>         0 0 50
>         0 -560 50
>         330 -3.944305e-30 0
>         330 0 50
>         330 -560 0
>         330 -560 50
>         3 0 1 2
>         3 2 1 3
>         3 4 0 5
>         3 5 0 2
>         3 6 4 7
>         3 7 4 5
>         3 1 6 3
>         3 3 6 7
>         3 8 9 10
>         3 10 9 11
>         3 12 8 13
>         3 13 8 10
>         3 14 12 15
>         3 15 12 13
>         3 9 14 11
>         3 11 14 15
>         3 16 17 18
>         3 18 17 19
>         3 20 16 21
>         3 21 16 18
>         3 22 20 23
>         3 23 20 21
>         3 17 22 19
>         3 19 22 23
>         3 15 19 11
>         3 11 19 23
>         3 11 23 10
>         3 10 23 3
>         3 10 3 7
>         3 15 13 19
>         3 19 13 7
>         3 19 7 18
>         3 18 7 5
>         3 18 5 2
>         3 13 10 7
>         3 18 2 21
>         3 21 2 3
>         3 21 3 23
>         3 12 14 17
>         3 17 14 9
>         3 17 9 22
>         3 22 9 8
>         3 22 8 1
>         3 1 8 12
>         3 1 12 6
>         3 6 12 17
>         3 6 17 16
>         3 22 1 20
>         3 20 1 0
>         3 20 0 16
>         3 16 0 4
>         3 16 4 6
>         )""";
>
>         using Kernel =
CGAL::Exact_predicates_inexact_constructions_kernel;
>         using Polyhedron_3 = CGAL::Polyhedron_3<Kernel>;
>         using Nef_polyhedron_3 = CGAL::Nef_polyhedron_3<Kernel>;
>
>         }  // namespace
>
>         int main(int argc, char** argv) {
>            Polyhedron_3 poly;
>            std::stringstream ss(kModel);
>            ss >> poly;
>            poly.normalize_border();
>            std::cout << "is_closed(): " << poly.is_closed() <<
std::endl;
>            std::cout << "is_valid(): " << poly.is_valid(false, 1) <<
>         std::endl;
>            std::cout << "is_pure_triangle(): " <<
>         poly.is_pure_triangle() << std::endl;
>            std::cout << "# faces: " << poly.size_of_facets() <<
std::endl;
>            std::cout << "# vertices: " << poly.size_of_vertices() <<
>         std::endl;
>            std::cout << "# border halfedges: " <<
>         poly.size_of_border_halfedges() << std::endl;
>
>            Nef_polyhedron_3 nef_poly(poly);
>            std::cout << "volumes: " <<
nef_poly.number_of_volumes() <<
>         std::endl;
>            std::cout << "nef(poly) is_valid: " <<
>         nef_poly.is_valid(false, 3) << std::endl;
>            std::cout << "is_simple: " << nef_poly.is_simple() <<
std::endl;
>         }
>         =============================================
>
>         And this is the output:
>         =============================================
>         is_closed(): 1
>         is_valid(): 1
>         is_pure_triangle(): 1
>         # faces: 52
>         # vertices: 24
>         # border halfedges: 0
>         CGAL error: assertion violation!
>         Expression : ss_circle.has_on(sv_prev->point())
>         File       : CGAL/Nef_3/polygon_mesh_to_nef_3.h
>         Line       : 256
>         Explanation:
>         Refer to the bug-reporting instructions at
> https://www.cgal.org/bug_report.html
<https://www.cgal.org/bug_report.html>
>         <https://www.cgal.org/bug_report.html
<https://www.cgal.org/bug_report.html>>
>         Unhandled exception:
>              @     0x55c31fb34732  GoogleTerminateHandler()
>              @     0x55c31fc5a768  std::__terminate()
>              @     0x55c31fc59dfb  __cxxabiv1::failed_throw()
>              @     0x55c31fc59d75  __cxa_throw
>              @     0x55c31fab767c  CGAL::assertion_fail()
>              @     0x55c31faecdcd  CGAL::polygon_mesh_to_nef_3<>()
>              @     0x55c31fac2ec2  CGAL::polyhedron_3_to_nef_3<>()
>              @     0x55c31fab6ea6
>           CGAL::Nef_polyhedron_3<>::Nef_polyhedron_3<>()
>              @     0x55c31fab5bbb  main
>              @     0x7f1dff68abbd  __libc_start_main
>              @     0x55c31fab5569  _start
>         libc++abi: terminating with uncaught exception of type
>         CGAL::Assertion_exception: CGAL ERROR: assertion violation!
>         Expr: ss_circle.has_on(sv_prev->point())
>         File: CGAL/Nef_3/polygon_mesh_to_nef_3.h
>         Line: 256
>         *** SIGABRT received by PID 3953462 (TID 3953462) on cpu
10 from
>         PID 3953462; ***
>         E0504 22:31:27.565500 3953462 process_state.cc:770] RAW:
Raising
>         signal 6 with default behavior
>         Aborted
>         =============================================
>
>         Thanks for your help!
>         Matthew
>
>
>         --
>         You are currently subscribed to cgal-discuss.
>         To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>
>         <https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>>
>
>
>     --
>     You are currently subscribed to cgal-discuss.
>     To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>
>     <https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>>
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>
>

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



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




Archive powered by MHonArc 2.6.19+.

Top of Page