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

".nefdbg" extension to dump debug info on CGALNefPolyhedron3+SphereMaps #1466

Merged
merged 2 commits into from
Nov 18, 2015

Conversation

donbright
Copy link
Sponsor Member

This is a small patch to allow an easier dump of already existing debug code for CGAL Nef Polyhedrons. It also adds some code to dump Sphere Map information as well.

It allows the ".nefdbg" file extension that will trigger a dump of an SVG file containing detailed information about the Nef Polyhedron and it's associated Vertex Sphere Maps. This will make it a bit easier to debug Nef Polyhedron issues in the future. The feature is left as an "undocumented" feature so that users will not rely on the format and it can change as needed.

The SVG file has dual use - it contains very detail information as 'comments' within the text file, while the file itself can be opened in a web browser to view a graphic picture of the Nef Polyhedron faces.

Here is an example of the svg text for a vertex sphere map

<!-- vertex sphere map begin. vertex counter is 1
     vertex coordinates: -32.5,16.9177,-23.3125-->
  vertex sphere map info
  number of svertices: 3
  number of shalfedges: 6
  number of shalfloops: 0
  number of sfaces: 2
  number of sface cycles: 2
  connected_components: 1
  integrity check...(asserts if not OK)
 the sface cycles of sface 0 start with an
  shalfedge from 0,0,47.744 to 0,-37.652,0
 the sface cycles of sface 1 start with an
  shalfedge from 0,-37.652,0 to 0,0,47.744

  vertex sphere map end -->

Here is a snippet showing a HalfFacet visit (part of a Volume visit)

<!-- Halffacet visit. Mark: 1 -->
   <!-- Halffacet cycle begin: -->
    <!-- Body contour:--> 
     <!-- -32.5,16.9177,-23.3125 -->
     <line x1="130.71" y1="307.358" x2="43.8203" y2="394.248"  stroke="gold" />
     <!-- -30,16.9177,-23.3125 -->
     <line x1="142.12" y1="307.358" x2="130.71" y2="307.358"  stroke="gold" />
     <!-- -30,-20.7343,-23.3125 -->
     <line x1="55.2304" y1="394.248" x2="142.12" y2="307.358"  stroke="gold" />
     <!-- -32.5,-20.7343,-23.3125 -->
     <line x1="43.8203" y1="394.248" x2="55.2304" y2="394.248"  stroke="gold" />
   <!-- Halffacet cycle end -->
  <!-- Halffacet visit end -->

The SVG file can also be loaded in a web browser, where it currently looks like this:

d

@kintel
Copy link
Member

kintel commented Oct 27, 2015

Would it make sense to also add a ".nef3" output as well, for easier stand-alone testing with CGAL demos/examples?

@donbright
Copy link
Sponsor Member Author

Hmmm... Is ".nef3" the Official CGAL format for Nef Polyhedrons ?

@donbright
Copy link
Sponsor Member Author

Im looking at http://doc.cgal.org/latest/Nef_3/index.html#Nef_3File .... ?? I think I can add that without too much trouble . . . . You just want to add another extension that is basically '.nef3' ?

@kintel
Copy link
Member

kintel commented Oct 27, 2015

Looks like CGAL is using ".nef3": https://github.com/CGAL/cgal/tree/master/Nef_3/test/Nef_3/data

I've also implemented .nef3 support for some test apps: https://github.com/openscad/openscad/blob/master/cgal/decompose.cpp

@donbright
Copy link
Sponsor Member Author

ok i added .nef3 as an output filename, and tested with "decompose" (with a patch or two for linux/g++)

it was uhm.... interesting.... looks like 1970s wallpaper...

delme

@TakeItAndRun
Copy link

Nice, real nice.

(the picture)

2015-10-27 3:11 GMT+01:00 don bright notifications@github.com:

ok i added .nef3 as an output filename, and tested with "decompose" (with
a patch or two for linux/g++)

it was uhm.... interesting.... looks like 1970s wallpaper...

[image: delme]
https://cloud.githubusercontent.com/assets/896858/10747668/f24d4038-7c25-11e5-86fd-cc3ad9163e4c.png


Reply to this email directly or view it on GitHub
#1466 (comment).

@kintel
Copy link
Member

kintel commented Nov 18, 2015

@donbright Btw., in case you didn't know; it's possible to openscad cube.scad --render=cgal -o out.nef3 - makes it possible to easier test CGAL corner cases without having to add csg ops just to force a round-trip through CGAL.

kintel added a commit that referenced this pull request Nov 18, 2015
".nefdbg" extension to dump debug info on CGALNefPolyhedron3+SphereMaps
@kintel kintel merged commit da79f97 into master Nov 18, 2015
@kintel kintel deleted the smapdebug branch November 18, 2015 05:25
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

Successfully merging this pull request may close these issues.

3 participants