Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Nef_3 #8644

Open
gdamiand opened this issue Dec 5, 2024 · 7 comments
Open

Assertion Nef_3 #8644

gdamiand opened this issue Dec 5, 2024 · 7 comments
Assignees

Comments

@gdamiand
Copy link
Member

gdamiand commented Dec 5, 2024

Please use the following template to help us solving your issue.

Issue Details

The following code raise an assertion.

Source Code

surface_mesh_kernel.txt
data.zip

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Ubuntu 24.04
  • Compiler: g++ 13.2.0
  • Release or debug mode: debug
  • CGAL version: master branch
@afabri
Copy link
Member

afabri commented Dec 5, 2024

I turned this into PR #8646 without fix.

@afabri
Copy link
Member

afabri commented Dec 5, 2024

What assertion do you have? When I run the executable in the PR I get th output below without assertion.

andre@motherwell /cygdrive/c/GitHub/cgal/Nef_3/test/Nef_3
$ ./build/Debug/issue8644
0 0  0 0  0 -1  0 1
0 1  0 0  0 0  0 -3/2
0 0  0 -1  0 0  0 3
0 -1  0 0  0 0  0 3
0 0  0 1  0 0  0 3
0 1  0 0  0 0  0 3
0 0  0 -1  0 0  0 -3/2
0 0  0 0  0 1  0 1
[./data/lshape1_dim3.off]: empty kernel.
0 0  0 0  0 1  0 -1
0 -1  0 0  0 0  0 3/2
0 0  0 1  0 0  0 -3
0 1  0 0  0 0  0 -3
0 0  0 -1  0 0  0 -3
0 -1  0 0  0 0  0 -3
0 0  0 1  0 0  0 3/2
0 0  0 0  0 -1  0 -1
[./data/lshape1_dim3.off]: NON empty kernel.
0 -1  0 0  0 0  0 -3
0 0  0 0  0 -1  0 -1
0 0  0 -1  0 0  0 -3
0 0  0 0  0 1  0 -1
0 0  0 1  0 0  0 3/2
0 -1  0 0  0 0  0 3/2
0 0  0 -1  0 0  0 3/2
0 -1  0 0  0 0  0 -3
0 0  0 1  0 0  0 -3
0 1  0 0  0 0  0 -3
[./data/ushape1_dim3.off]: empty kernel.
0 1  0 0  0 0  0 3
0 0  0 0  0 1  0 1
0 0  0 1  0 0  0 3
0 0  0 0  0 -1  0 1
0 0  0 -1  0 0  0 -3/2
0 1  0 0  0 0  0 -3/2
0 0  0 1  0 0  0 -3/2
0 1  0 0  0 0  0 3
0 0  0 -1  0 0  0 3
0 -1  0 0  0 0  0 3
[./data/ushape1_dim3.off]: empty kernel.

@gdamiand
Copy link
Member Author

gdamiand commented Dec 5, 2024

Result using your branch PR #8646

./issue8644
0 0 0 0 0 -1 0 1
0 1 0 0 0 0 0 -3/2
0 0 0 -1 0 0 0 3
0 -1 0 0 0 0 0 3
0 0 0 1 0 0 0 3
0 1 0 0 0 0 0 3
0 0 0 -1 0 0 0 -3/2
0 0 0 0 0 1 0 1
[./data/lshape1_dim3.off]: empty kernel.
0 0 0 0 0 1 0 -1
0 -1 0 0 0 0 0 3/2
0 0 0 1 0 0 0 -3
0 1 0 0 0 0 0 -3
0 0 0 -1 0 0 0 -3
0 -1 0 0 0 0 0 -3
0 0 0 1 0 0 0 3/2
0 0 0 0 0 -1 0 -1
[./data/lshape1_dim3.off]: NON empty kernel.
0 -1 0 0 0 0 0 -3
0 0 0 0 0 -1 0 -1
0 0 0 -1 0 0 0 -3
0 0 0 0 0 1 0 -1
0 0 0 1 0 0 0 3/2
0 -1 0 0 0 0 0 3/2
0 0 0 -1 0 0 0 3/2
0 -1 0 0 0 0 0 -3
0 0 0 1 0 0 0 -3
0 1 0 0 0 0 0 -3
[./data/ushape1_dim3.off]: empty kernel.
0 1 0 0 0 0 0 3
0 0 0 0 0 1 0 1
0 0 0 1 0 0 0 3
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: normalized(cet->circle()) == normalized(ce->circle().opposite())
File: /home/gdamiand/sources/cgal/Nef_3/include/CGAL/Nef_3/SNC_external_structure.h
Line: 620
Abandon (core dumped)

@afabri
Copy link
Member

afabri commented Dec 5, 2024

Did you get that in the code I have put in the pull request? What you have put in surface_mesh_kernel.txt does not even compile, as you probably extracted it from some application.

@afabri
Copy link
Member

afabri commented Dec 5, 2024

Just saw "./issue8644" , so it is in my branch. I do not have the assertion. What is your test platform? Let me flag it ready for testing so that we see it in the testsuite.

@afabri afabri self-assigned this Dec 5, 2024
@afabri
Copy link
Member

afabri commented Dec 11, 2024

Hello @gdamiand
So it fails on some platforms in testsuite 6.1-Ic-38

@gspr
Copy link

gspr commented Jan 13, 2025

I think I'm seeing this assertion failure with a simpler example, too. Consider:

#include <CGAL/Extended_cartesian.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Nef_polyhedron_3.h>

using Kernel = CGAL::Extended_cartesian<CGAL::Gmpq>;
using Nef = CGAL::Nef_polyhedron_3<Kernel>;

int main(int argc, char ** argv)
{
  Nef hspace_1(Nef::Plane_3(1.0, 0.0, 0.0, 0.0), Nef::INCLUDED);
  Nef hspace_2(Nef::Plane_3(1.0, 0.0, 0.0, 1.0), Nef::INCLUDED);
  Nef hspace_3(Nef::Plane_3(0.0, 0.0, 1.0, 1.0), Nef::INCLUDED);

  Nef intersection_1 = hspace_1*hspace_2; // Line 14. Works fine.
  Nef intersection_2 = hspace_2*hspace_3; // Line 15. Assertion failure.
  
  return 0;
}

The computation on line 14 works fine, while the one on line 15 fails at the assertion in question. Here's the backtrace (captured with version 5.5.1, so it might differ from one captured at git HEAD):

#6  0x00007ffff7ca90d8 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x000055555555d592 in CGAL::assertion_fail (expr=0x55555562b7a0 "normalized(cet->circle()) == normalized(ce->circle().opposite())", 
    file=0x55555562b710 "/usr/include/CGAL/Nef_3/SNC_external_structure.h", line=691, msg=0x55555562a09c "")
    at /usr/include/CGAL/assertions_impl.h:173
#8  0x000055555556d158 in CGAL::SNC_external_structure_base<CGAL::SNC_items, CGAL::SNC_structure<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool> >::link_shalfedges_to_facet_cycles (this=0x7fffffffdb90) at /usr/include/CGAL/Nef_3/SNC_external_structure.h:691
#9  0x0000555555566058 in CGAL::SNC_external_structure_base<CGAL::SNC_items, CGAL::SNC_structure<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool> >::build_external_structure (this=0x7fffffffdb90) at /usr/include/CGAL/Nef_3/SNC_external_structure.h:1014
#10 0x0000555555571fb8 in CGAL::SNC_external_structure_base<CGAL::SNC_items, CGAL::SNC_structure<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool> >::build_after_binary_operation<CGAL::ID_support_handler<CGAL::SNC_items, CGAL::SNC_decorator<CGAL::SNC_structure<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool> > > > (this=0x7fffffffdb90) at /usr/include/CGAL/Nef_3/SNC_external_structure.h:1049
#11 0x000055555556758c in CGAL::Binary_operation<CGAL::SNC_structure<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool> >::operator()<CGAL::Nef_polyhedron_3<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool>::AND> (this=0x7fffffffdd70, pl0=0x55555573d6d0, snc1=..., 
    pl1=0x5555556c5e90, snc2=..., pl2=0x5555556f51a0, BOP=...) at /usr/include/CGAL/Nef_3/Binary_operation.h:525
#12 0x0000555555563119 in CGAL::Nef_polyhedron_3<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool>::intersection (
    this=0x7fffffffde40, N1=...) at /usr/include/CGAL/Nef_polyhedron_3.h:1416
#13 0x0000555555561c47 in CGAL::Nef_polyhedron_3<CGAL::Extended_cartesian<CGAL::Gmpq>, CGAL::SNC_items, bool>::operator* (this=0x7fffffffde40, 
    N1=...) at /usr/include/CGAL/Nef_polyhedron_3.h:1488
#14 0x000055555555ae83 in main (argc=1, argv=0x7fffffffe048) at test-2.cpp:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants