mirror of https://github.com/CGAL/cgal
use iformat for reading doubles
This commit is contained in:
parent
563bc4621e
commit
2916850771
|
|
@ -126,13 +126,13 @@ private:
|
|||
|
||||
is >> n;
|
||||
CGAL_assertion(n == 10);
|
||||
is >> cx;
|
||||
is >> iformat(cx);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 20);
|
||||
is >> cy;
|
||||
is >> iformat(cy);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 40);
|
||||
is >> r;
|
||||
is >> iformat(r);
|
||||
FT rft(r);
|
||||
circ = typename K::Construct_circle_2()(Point_2(cx,cy), rft);
|
||||
}
|
||||
|
|
@ -150,13 +150,13 @@ private:
|
|||
|
||||
is >> n;
|
||||
CGAL_assertion(n == 10);
|
||||
is >> cx;
|
||||
is >> iformat(cx);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 20);
|
||||
is >> cy;
|
||||
is >> iformat(cy);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 40);
|
||||
is >> r;
|
||||
is >> iformat(r);
|
||||
|
||||
center = typename K::Construct_point_2()(cx,cy);
|
||||
rft = FT(r);
|
||||
|
|
@ -187,10 +187,10 @@ read_polygon(std::istream& is, Polygon& poly)
|
|||
CGAL_assertion(n == 0);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 10);
|
||||
is >> x;
|
||||
is >> iformat(x);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 20);
|
||||
is >> y;
|
||||
is >> iformat(y);
|
||||
is >> n;
|
||||
len = 0;
|
||||
if(n == 42){
|
||||
|
|
@ -252,7 +252,6 @@ void
|
|||
read_entities(std::istream& is, Polygons& polys, Centers_and_radii& car)
|
||||
{
|
||||
int n;
|
||||
//double x, y;
|
||||
std::string str;
|
||||
is >> n;
|
||||
CGAL_assertion(n == 0);
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@ private:
|
|||
|
||||
is >> n;
|
||||
CGAL_assertion(n == 10);
|
||||
is >> cx;
|
||||
is >> iformat(cx);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 20);
|
||||
is >> cy;
|
||||
is >> iformat(cy);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 40);
|
||||
is >> r;
|
||||
is >> iformat(r);
|
||||
FT rft(r);
|
||||
|
||||
circ = CGAL::make_array(cx,cy,rft);
|
||||
|
|
@ -166,10 +166,10 @@ read_polygon(std::istream& is, Polygon& poly)
|
|||
CGAL_assertion(n == 0);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 10);
|
||||
is >> x;
|
||||
is >> iformat(x);
|
||||
is >> n;
|
||||
CGAL_assertion(n == 20);
|
||||
is >> y;
|
||||
is >> iformat(y);
|
||||
is >> n;
|
||||
len = 0;
|
||||
if(n == 42){
|
||||
|
|
@ -194,7 +194,6 @@ void
|
|||
read_entities(std::istream& is, Polygons& polys, Circles& circles)
|
||||
{
|
||||
int n;
|
||||
//double x, y;
|
||||
std::string str;
|
||||
is >> n;
|
||||
CGAL_assertion(n == 0);
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ operator>>(std::istream &is, Bbox_2 &b)
|
|||
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> xmin >> ymin >> xmax >> ymax;
|
||||
is >> iformat(xmin) >> iformat(ymin) >> iformat(xmax) >> iformat(ymax);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, xmin);
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ operator>>(std::istream &is, Bbox_3& b)
|
|||
switch(is.iword(IO::mode))
|
||||
{
|
||||
case IO::ASCII :
|
||||
is >> xmin >> ymin >> zmin >> xmax >> ymax >> zmax;
|
||||
is >> iformat(xmin) >> iformat(ymin) >> iformat(zmin)
|
||||
>> iformat(xmax) >> iformat(ymax) >> iformat(zmax);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, xmin);
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ extract(std::istream& is, Circle_2<R>& c)
|
|||
int o;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> center >> squared_radius >> o;
|
||||
is >> center >> iformat(squared_radius) >> o;
|
||||
break;
|
||||
case IO::BINARY :
|
||||
is >> center;
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ extract(std::istream& is, Direction_2<R>& d, const Cartesian_tag&)
|
|||
typename R::FT x, y;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> x >> y;
|
||||
is >> iformat(x) >> iformat(y);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
@ -255,7 +255,7 @@ extract(std::istream& is, Direction_2<R>& d, const Homogeneous_tag&)
|
|||
switch(is.iword(IO::mode))
|
||||
{
|
||||
case IO::ASCII :
|
||||
is >> x >> y;
|
||||
is >> iformat(x) >> iformat(y);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ extract(std::istream& is, Direction_3<R>& d, const Cartesian_tag&)
|
|||
typename R::FT x, y, z;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> x >> y >> z;
|
||||
is >> format(x) >> iformat(y) >> iformat(z);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
@ -213,7 +213,7 @@ extract(std::istream& is, Direction_3<R>& d, const Homogeneous_tag&)
|
|||
switch(is.iword(IO::mode))
|
||||
{
|
||||
case IO::ASCII :
|
||||
is >> x >> y >> z;
|
||||
is >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ extract(std::istream& is, Line_2<R>& l)
|
|||
typename R::RT a, b, c;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> a >> b >> c;
|
||||
is >> iformat(a) >> iformat(b) >> iformat(c);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, a);
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ operator>>(std::istream &is, Plane_3<R> &p)
|
|||
typename R::RT a, b, c, d;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> a >> b >> c >> d;
|
||||
is >> iformat(a) >> iformat(b) >> iformat(c) >> iformat(d);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, a);
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ extract(std::istream& is, Point_2<R>& p, const Cartesian_tag&)
|
|||
typename R::FT x, y;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> x >> y;
|
||||
is >> iformat(x) >> iformat(y);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ extract(std::istream& is, Point_3<R>& p, const Cartesian_tag&)
|
|||
typename R::FT x, y, z;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> x >> y >> z;
|
||||
is >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ extract(std::istream& is, Vector_2<R>& v, const Cartesian_tag&)
|
|||
typename R::FT x, y;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> x >> y;
|
||||
is >> iformat(x) >> iformat(y);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ extract(std::istream& is, Vector_3<R>& v, const Cartesian_tag&)
|
|||
typename R::FT x, y, z;
|
||||
switch(is.iword(IO::mode)) {
|
||||
case IO::ASCII :
|
||||
is >> x >> y >> z;
|
||||
is >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, x);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace CGAL {
|
|||
return alcc.null_handle;
|
||||
}
|
||||
|
||||
ais >> x >> y;
|
||||
ais >> iformat(x) >> iformat(y);
|
||||
initVertices.push_back(alcc.create_vertex_attribute
|
||||
(typename LCC::Point(x, y)));
|
||||
testVertices.push_back(std::list<Dart_handle>());
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ read_triangle_poly_file(CDT& t, std::istream &f,
|
|||
{
|
||||
unsigned int j;
|
||||
double x, y;
|
||||
f >> j >> x >> y;
|
||||
f >> j >> iformat(x) >> iformat(y);
|
||||
Point p(x, y);
|
||||
skip_until_EOL(f); skip_comment_OFF(f);
|
||||
vertices[--j] = t.insert(p);
|
||||
|
|
|
|||
|
|
@ -126,15 +126,15 @@ read_off_points_and_normals(
|
|||
// Reads position + normal...
|
||||
double x,y,z;
|
||||
double nx,ny,nz;
|
||||
if (iss >> x >> y >> z)
|
||||
if (iss >> iformat(x) >> iformat(y) >> iformat(z))
|
||||
{
|
||||
Point point(x,y,z);
|
||||
Vector normal = CGAL::NULL_VECTOR;
|
||||
// ... + normal...
|
||||
if (iss >> nx)
|
||||
if (iss >> iformat(nx))
|
||||
{
|
||||
// In case we could read one number, we expect that there are two more
|
||||
if(iss >> ny >> nz){
|
||||
if(iss >> iformat(ny) >> iformat(nz)){
|
||||
normal = Vector(nx,ny,nz);
|
||||
} else {
|
||||
std::cerr << "Error line " << lineNumber << " of file" << std::endl;
|
||||
|
|
|
|||
|
|
@ -113,15 +113,15 @@ read_xyz_points_and_normals(
|
|||
else {
|
||||
iss.clear();
|
||||
iss.str(line);
|
||||
if (iss >> x >> y >> z)
|
||||
if (iss >> iformat(x) >> iformat(y) >> iformat(z)
|
||||
{
|
||||
Point point(x,y,z);
|
||||
Vector normal = CGAL::NULL_VECTOR;
|
||||
// ... + normal...
|
||||
if (iss >> nx)
|
||||
if (iss >> iformat(nx))
|
||||
{
|
||||
// In case we could read one number, we expect that there are two more
|
||||
if(iss >> ny >> nz){
|
||||
if(iss >> iformat(ny) >> iformat(nz)){
|
||||
normal = Vector(nx,ny,nz);
|
||||
} else {
|
||||
std::cerr << "Error line " << lineNumber << " of file" << std::endl;
|
||||
|
|
|
|||
|
|
@ -58,5 +58,6 @@ include_directories( BEFORE ../../include )
|
|||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
create_single_source_cgal_program( "read_doubles.cpp" )
|
||||
create_single_source_cgal_program( "read_points.cpp" )
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ public:
|
|||
}
|
||||
} else {
|
||||
skip_comment();
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
if ( is_homogeneous()) {
|
||||
float w;
|
||||
m_in >> w;
|
||||
m_in >> iformat(w);
|
||||
x /= w;
|
||||
y /= w;
|
||||
z /= w;
|
||||
|
|
@ -94,10 +94,10 @@ public:
|
|||
}
|
||||
} else {
|
||||
skip_comment();
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
if ( is_homogeneous()) {
|
||||
double w;
|
||||
m_in >> w;
|
||||
m_in >> iformat(w);
|
||||
x /= w;
|
||||
y /= w;
|
||||
z /= w;
|
||||
|
|
@ -125,17 +125,17 @@ public:
|
|||
skip_comment();
|
||||
if ( is_homogeneous()) {
|
||||
double fx, fy, fz, fw;
|
||||
m_in >> fx >> fy >> fz >> fw;
|
||||
m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
|
||||
x = int( fx / fw);
|
||||
y = int( fy / fw);
|
||||
z = int( fz / fw);
|
||||
} else {
|
||||
double d;
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
x = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
y = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
z = int(d);
|
||||
}
|
||||
}
|
||||
|
|
@ -151,9 +151,9 @@ public:
|
|||
I_Binary_read_big_endian_float32( m_in, w);
|
||||
} else {
|
||||
skip_comment();
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
if ( is_homogeneous())
|
||||
m_in >> w;
|
||||
m_in >> iformat(w);
|
||||
}
|
||||
}
|
||||
void scan_vertex( double& x, double& y, double& z, double& w) {
|
||||
|
|
@ -172,11 +172,11 @@ public:
|
|||
}
|
||||
} else {
|
||||
skip_comment();
|
||||
extract(m_in, x);
|
||||
extract(m_in, y);
|
||||
extract(m_in, z);
|
||||
m_in >> iformat(x);
|
||||
m_in >> iformat(y);
|
||||
m_in >> iformat(z);
|
||||
if ( is_homogeneous())
|
||||
extract(m_in, w);
|
||||
m_in >> iformat(w);
|
||||
}
|
||||
}
|
||||
void scan_vertex( int& x, int& y, int& z, int& w) {
|
||||
|
|
@ -196,14 +196,14 @@ public:
|
|||
} else {
|
||||
skip_comment();
|
||||
double d;
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
x = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
y = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
z = int(d);
|
||||
if ( is_homogeneous()) {
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
w = int(d);
|
||||
}
|
||||
}
|
||||
|
|
@ -224,10 +224,10 @@ public:
|
|||
z /= w;
|
||||
}
|
||||
} else {
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
if ( is_homogeneous()) {
|
||||
float w;
|
||||
m_in >> w;
|
||||
m_in >> iformat(w);
|
||||
x /= w;
|
||||
y /= w;
|
||||
z /= w;
|
||||
|
|
@ -257,12 +257,12 @@ public:
|
|||
} else {
|
||||
if ( is_homogeneous()) {
|
||||
float fx, fy, fz, fw;
|
||||
m_in >> fx >> fy >> fz >> fw;
|
||||
m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
|
||||
x = fx / fw;
|
||||
y = fy / fw;
|
||||
z = fz / fw;
|
||||
} else
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -288,17 +288,17 @@ public:
|
|||
} else {
|
||||
if ( is_homogeneous()) {
|
||||
float fx, fy, fz, fw;
|
||||
m_in >> fx >> fy >> fz >> fw;
|
||||
m_in >> iformat(fx) >> iformat(fy) >> iformat(fz) >> iformat(fw);
|
||||
x = int( fx / fw);
|
||||
y = int( fy / fw);
|
||||
z = int( fz / fw);
|
||||
} else {
|
||||
double d;
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
x = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
y = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
z = int(d);
|
||||
}
|
||||
}
|
||||
|
|
@ -316,9 +316,9 @@ public:
|
|||
if ( is_homogeneous())
|
||||
I_Binary_read_big_endian_float32( m_in, w);
|
||||
} else {
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
if ( is_homogeneous())
|
||||
m_in >> w;
|
||||
m_in >> iformat(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -339,9 +339,9 @@ public:
|
|||
w = f;
|
||||
}
|
||||
} else {
|
||||
m_in >> x >> y >> z;
|
||||
m_in >> iformat(x) >> iformat(y) >> iformat(z);
|
||||
if ( is_homogeneous())
|
||||
m_in >> w;
|
||||
m_in >> iformat(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -363,14 +363,14 @@ public:
|
|||
}
|
||||
} else {
|
||||
double d;
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
x = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
y = int(d);
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
z = int(d);
|
||||
if ( is_homogeneous()) {
|
||||
m_in >> d;
|
||||
m_in >> iformat(d);
|
||||
w = int(d);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue