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: Matthew Lai <>
  • To:
  • Subject: Re: [cgal-discuss] Valid and closed polyhedron cannot be converted into nef polyhedron
  • Date: Wed, 5 May 2021 10:24:45 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-hdrordr: A9a23:qRMd5qD20ekv0C7lHemk55DYdL4zR+YMi2QD+khtRXVuHvCwuNupmJ0guCPcrDoKQnkvlZShNcC7L0/0zpJ+7YkPMbrKZmCP01eAFp1o7ofp3lTbdBHWy+g1781dT5Q=
  • Ironport-phdr: A9a23:fDSCOBZUArki+4+ckW5tOeL/LTHJ14qcDmYuwqpisKpHd+GZx7+nAna3zctkgFKBZ4jH8fUM07OQ7/mxHzZbvt3Q6TgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrqQjdrNcajIVgJ6o+zhbFv2ZDdvhLy29vOV+dhQv36N2q/J5k/SRQuvYh+NBFXK7nYak2TqFWASo/PWwt68LlqRfMTQ2U5nsBSWoWiQZHAxLE7B7hQJj8tDbxu/dn1ymbOc32Sq00WSin4qx2RhLklDsLOjgk+2zRl8d+jr9UoAi5qhNwzY7bYoGbOvR9cK3AY90VWXFMUdxNWyFbGI6wc5cDAugHMO1Fr4f9vVwOrR6mCAerHuzv1iNIhn/o0qw0zu8vFxvJ3A09FN8JtXTbtsn1NLsSUe+rwqjIyS/Mb/JN1Dfy74jIdR8hofWSUr5qbcXRzkwvGhrDg16NpoPrIymb2f4Rs2iH8eVgT+SvhnYopQ9xvjWhxtsgh4rJiI8Uy13I6CR0zok6K9C5VkN2fNCqHZ9fuiyGKYZ6X8AvTW5ptSg0yrMItp+2cSwWxZknwRPUdvKJc4+N4h35VeaRJy91i25qeL2lgxa+60+gyvfzVsWs0VZKqDBFktjWuXwX2RzT8M6KQeZ+8Ee5wTuDyRzf5+VeLU03lafXMYAtzqMzm5YJvknOESn7k1jsgqCMbEUr4O2o5vznYrr4op+cMJd5igTkPaQvnsyzGPo3MgoTU2SC9+Sx27Lu8Vf2QLVNif02na3Zv47AKcsHoa65BhdZ0ocl6xmhEzeryMoUkWUDIV5fex+Kj5LlN0/TLP37F/uyjFuhnC9ux//cP73hBpvNLmLEkLfkZbt97lRTyBYvzdBf+Z1VBLUBL+jyWkLqu9zYCRg5MwOww+n5EtlyyoQeWWeXDq+DLKzSqUOI5v4oI+SUeIAVtyzyK/w86/HzjH85gkMSfbSy3ZsMc324BfRnI0CBYXX2mNsBEGEKvhA/TOPwklGCXyRTND6PWbkh7GQ7FJ6+FtWEAZu8haSImia9BJxfIG5cTUudFG/hMISCVfBLYy2bJoptkycPSKO6GLInzgyklBP/z+9nMvbM4X9f8ony0cB8oezVjxA7szJuSN+M1nmECGBykGRPTDA/2OVzoFd210yYgpV+mOFSKdFD+6ZJThsiLsybiPdrDsj7HAPHZNaADli8Bc63BCk4CdM3zdhJaEl0H5CujwvIwjGxUIMSwreEDZhx/qPH1GXqPO58zWzH3e8vlQoIWMxKYEivmrJ/+hebI4fI2xGcnrq2dakD2CfM3GiEymWKsQdTVwsmAvaNZmwWekaD9Yex3UjFVbL7UdwPAk560ceHb5ByRJjpgFFBLN/mMdXaJm+zwiK+WUrOybSLY47nPW4a2XeFYGA01jsL9HPDDjAQQyKoombQFjtrfXrgZETj9eQ4o3S+HBZc5zHPVFVo0v+OwjBQneaVI9sc2bULvCpnoDJxTg7V4g==

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

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 <
> <mailto:>> 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>,
>     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>,
>     I have tried on my machine and it works.
>
>     Le mar. 4 mai 2021 à 23:46, Matthew Lai <
>     <mailto:>> 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>
>         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>
>
>
>     --
>     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
>

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