Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Problem with Polyhedron IO

Subject: CGAL users discussion list

List archive

[cgal-discuss] Problem with Polyhedron IO


Chronological Thread 
  • From: "Christopher O'Donnell" <>
  • To:
  • Subject: [cgal-discuss] Problem with Polyhedron IO
  • Date: Thu, 22 Jul 2010 12:14:24 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=YfzEK9gBJGC9SMvwWCg/kVXSqCubNM/ep3FmjueZxMgokuEjqOShiYv8fOoX/bmBZ/ a8EJ92eRXOBAluq3e18nnYDBrDRGQMuHUm7ZKedpQyGr+3ludjnehJaHGHKtOlBN29W8 9OJ561mjGwr/uDaN+sLqepFe4hB/KUO/r+NrY=

I'm trying to input a Polyhedron_3 using the built-in .off input stream. All of the points seem to be input correctly, but all of the Plane_3 objects are read as (0.5, 0.5, 0.5, 0.5). Also, I get lots of strange errors when I try to manipulate them (inf > sup assertion failure and seg faults).

Here is the code I'm using, and it fails on the corner.off from examples/Polyhedron:

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>

#include <CGAL/IO/Polyhedron_iostream.h>
#include <iostream>
#include <fstream>

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_3> Polyhedron;
typedef Polyhedron::Point_iterator Point_iterator;
typedef Polyhedron::Plane_iterator Plane_iterator;

int main(int argc, char** argv)
{
    Polyhedron P;
    std::ifstream input(argv[1]);
    input >> P;

    for (Point_iterator i = P.points_begin(); i != P.points_end(); ++i)
        std::cout << *i << std::endl;
    for (Plane_iterator i = P.planes_begin(); i != P.planes_end(); ++i)
        std::cout << *i << std::endl;
    fflush(stdout);
    return 0;
}

This is the output I get from corner.off:

0 0 0
1 0 0
2 0 0
0 0 1
1 0 1
2 0 1
0 0 2
1 0 2
0 1 0
1 1 0
2 1 0
0 1 1
1 1 1
2 1 1
0 1 2
1 1 2
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5

Any help would be appreciated.

Chris



Archive powered by MHonArc 2.6.16.

Top of Page