Artifact during drawing a simple 3D Nef polyhedron

Open
#9,010 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@gdamiand is already working on this.

Since Oct 13, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start with the supplied reproducer and trace CGAL::draw(N1) from CGAL/draw_nef_3.h into the drawing implementation; compare the rendered result with the cube built from the six half-spaces. Done means the supplied example draws only the intended cube, without the extra artifact. The issue also notes intersection-order behavior as a separate report (#9002).

Written by the indexing model from the issue text.

Description

Issue Details

A cube, created as an intersection of six half-spaces, is drawn correctly, but the picture also includes another cube. Where does it come from?

Also, the order of intersections matters, but it's another issue, reported by me earlier (#9002).

Image

Source Code

#include <CGAL/Exact_integer.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/draw_nef_3.h>

using Kernel = CGAL::Extended_homogeneous<CGAL::Exact_integer>;
using Nef = CGAL::Nef_polyhedron_3<Kernel>;
using Plane = Nef::Plane_3;

// ------ create axis-aligned cube with center (X,Y,Z) and side 2*A 
Nef cube(int const X, int const Y, int const Z, int const A)
{
  Nef const pX(Plane(-1,  0,  0,  X - A));
  Nef const pY(Plane( 0, -1,  0,  Y - A));
  Nef const pZ(Plane( 0,  0, -1,  Z - A));
  Nef const qX(Plane( 1,  0,  0, -X - A));
  Nef const qY(Plane( 0,  1,  0, -Y - A));
  Nef const qZ(Plane( 0,  0,  1, -Z - A));
  //return pX * pY * pZ * qX * qY * qZ;         // <--- throws exception
  return qX * pX * qY * pY * qZ * pZ;           // <--- normal return
}

int main()
{
  auto const N1 = cube(1, 1, 1, 1);
  CGAL::draw(N1);
}

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Ubuntu 24.04.2 LTS
  • Compiler: g++ 13.3.0
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version: 6.0.1
  • Boost version: 1.83
  • Other libraries versions if used (Eigen, TBB, etc.):
Dominant language
C++
Stars
6.1k
Forks
1.6k
Avg merge
3d 19h
Merged PRs (30d)
55

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CGAL/cgal

All issues in CGAL/cgal

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.