Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Reading and writing Point_3 values to file

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Reading and writing Point_3 values to file


Chronological Thread 
  • From: "naresh" <>
  • To: <>
  • Subject: Re: [cgal-discuss] Reading and writing Point_3 values to file
  • Date: Thu, 26 Mar 2009 19:02:01 +0530

Hi
 
You can easily read or write points. You can user  Point_3 from kernel and using ofstream and ifstream you can read and write.
 
 
Here is example :
 
typedef kernel::Point_3 Point_3;
 
Reading :
 
int pointsize;
Point p;

std::ifstream outfile;

outfile.open ("test.pts");

outfile >> pointsize;
 
for(int i=0; i<pointsize; ++i)
{
    outfile >> p;
    // now you have point p that you can do what you want
}
 
Writing :
 

std::ofstream outfile;

outfile.open ("test.pts");

outfile << Points.size() << "\n";

for (int i=0; i< Points.size(); ++i)

{

outfile << Points[i] << "\n";

}

 
All this is only sample psuecode. You have to implement your self
 
 
----- Original Message -----
From:
To:
Sent: Thursday, March 26, 2009 3:04 PM
Subject: [cgal-discuss] Reading and writing Point_3 values to file

Hello,

 

Is there a convenient way to write Point_3 values to a file stream (using a cout operator), and then reading them, using a cin in the same order? I am using a gmpq kernel.

 

Amir.




Archive powered by MHonArc 2.6.16.

Top of Page