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: Maxime Gimeno <>
  • To:
  • Subject: Re: [cgal-discuss] Valid and closed polyhedron cannot be converted into nef polyhedron
  • Date: Wed, 5 May 2021 09:02:19 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-hdrordr: A9a23:7O5ZAauC8ppytoGQm5InEuIe7skCKIMji2hD6mlwRA09T+WzkceykPMHkSLlkTp5YgBYpfmsGomlBUnd+5l8/JULMd6ZNjXOlWO0IOhZnO7f6hL6HSmWzJ8+6Y5BdOxEBMT0HRxGi6/BkWqFOvIB5PXCz6yyn+fZyB5WLD1CT6179Q92BkK6PyRNNW17LKE0Hpad+cZLzgDIER8qR/+2CXUfU+/Iq8ejrvLbSCQbDB0q4hTmt0LO1JfGFXGjr3EjegIK77Nn1WTeiQT26uGYrvmnxnbnu1P73tB5nt3uz9cGKe6trowuKjvqghu1f4gJYdC/lQFwjueo5lMn1OPJvg5lBcJu8HncF1vbnTLdnzLt2jov9HPuoGX3vUfe
  • Ironport-phdr: A9a23:9diY5h0GpvMp+SgLsmDOUgMyDhhPgJ3EezUN459isYplN5qZl7zcNUDSrc9gkEXOFd2Cra4d2qyM6P+rCDVIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLd/IA+ooQjftMQajo9vJrsswRbVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPXw7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RDqv47t3RBLulSwKMSMy/mPKhcxqlK9UrxyhqB5/zYDaY4+bKeR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amf0oF+eQA6Sz9ukY4/jemFb1yLYWhBsuzBWxm6PME0FPgnko2/aC1RGEFvuZwby8rA7pirkFgk7yAaFa0An3L2wqEZ9rczZcOsa2/c/gAlkrjx1GFin2Ne+I9WFrgtlOq5bZIFkiGo=

Hi,

I think the problem is your kernel. If you look at the documentation, 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, 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
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




Archive powered by MHonArc 2.6.19+.

Top of Page