Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: Matthew Lai <>
  • To:
  • Subject: [cgal-discuss] Valid and closed polyhedron cannot be converted into nef polyhedron
  • Date: Tue, 4 May 2021 22:45:53 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-hdrordr: A9a23:igGHZqFv2SMGjOPEpLqEAceALOonbusQ8zAX/mp2TgFYddHdqtunm+4V2QSxpDEaXnwhnt7oAtjkfVr385lp7Y4NeYqzRQWOghrLEKhOz6vHhxLhHjDz7Ydmv5tIXqBiBLTLbWRSot395GCDfuoI5Pmi3OSWifzFz3FrJDsFV4ha4w10ChmWHyRNLWEsObMDGIOY9o57oVObGEg/VNixBXUOQoH4y+HjqZSOW3E7Li9iwgGIhTaj5J72eiLovSsjbw==
  • Ironport-phdr: A9a23:2R1C0BIj8LC8Cpp2M9mcuMtmWUAX047cDksu8pMizoh2WeGdxfzKAkXT6L1XgUPTWs2DsrQY0ruQ6fu+EjVevN6oizMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9vKBi6txvdu8cXjIdtN6o8yxvEqWZUdupLwm9lOUidlAvm6Meq+55j/SVQu/Y/+MNFTK73Yac2Q6FGATo/K2w669HluhfFTQuU+3sTSX4WnQZSAwjE9x71QJH8uTbnu+Vn2SmaOcr2Ta0oWTmn8qxmRgPkhDsBOjUk9mzcl85+g79BoB+5qBNxw4DaboKIOvRgYqzQZskVSXZbU8tLSyBNHoGxYo0SBOQBJ+ZYqIz9qkMJoxSkGQmsGOPvxSFGh3Tr26M1yeUhGhzB0QwlBd0OrGjUrNXrO6YcVeC61qjIwC7Mb/NR3jf954zIfQ47rf6QWrJwdNPcxE8yHAzKklues5bqPy+J1usTqWib6fJtWOKhhWM5rwx9vyWjyMkyhofGho8YykzI+Tt2zos1K9C1VEB1bMOmHZZSuSyUN4p7T8wtTWxsvCs0xbIIt5G7ciUM1Z8pyRnfa/mdfIiJ5BLuTPqeIThii3JhYr6/gAyy8Uemx+bhVce0yE5HojRZntTIrHwA1Bze5tKZRvdh/UqtwzaC2xzV5+pZO047j7DbJIQkwrMolpocr0DDHijulUXzlqCWd0Ek9vG25Ov6f7nqv5GcOo9ohg3kPaQuncu/Aes8MgcQRWSU5eO81Lj78U34RrVFkOE2n7HHvJzGIckXvK20Dg9P3oo99xqyDC2q3dQEkXUfKVJKYhOHj4znO1HUJ/D4CO+yg1G2nzd32/DGPqPuA5vJLnfZkbfsZrl960lbyAo8ydBQ+YhYBa0GIPL2QkPxrsDXDgclMwyoxObqEMly1owEVmKLG6OWLaLSsUSU6eIyOOmMf5QYuC39Kvgg//7hl2U1mV4bfamz3JsYcmq0Hvp8IxbRXX25idgIFSIGvxE1UffxoFyESz9aIXioDIwm4TRuLYu6EYfOWciJib3JiCKyAoFWa39CA1GkHnDveIGJHfwLbXTBcYdajjUYWO35GMca3ha0uVqio5JXa9HM8yhdjqrNkdh44+q7vRQ79DgxAsjElm/QFyd7mWQHQzJw16d68xQV4mfG6rBxhrljLfIW/+lAOi81MpnTy+E8ANf3CFqpVufMc06vR5CdOR90S9swx9EUZEMVM9qliR/H0myhBLpHztS2

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




Archive powered by MHonArc 2.6.19+.

Top of Page