Merge pull request #1574 from afabri/Filtered_kernel_init_double_to_avoid_warning-GF

Kernel_23: Initialize numbers in operator>>(istream&, Point/Vector/..)
This commit is contained in:
Laurent Rineau 2016-10-24 11:46:54 +02:00
commit 26c803b6af
13 changed files with 18 additions and 17 deletions

View File

@ -126,16 +126,15 @@ void MdelaunayIpelet::protected_run(int fn)
Point_2 pt0_ori1=it->first->vertex(Delaunay::cw(it->second))->info().back(); Point_2 pt0_ori1=it->first->vertex(Delaunay::cw(it->second))->info().back();
Point_2 pt1_ori0=it->first->vertex(Delaunay::ccw(it->second))->info().front(); Point_2 pt1_ori0=it->first->vertex(Delaunay::ccw(it->second))->info().front();
Point_2 pt1_ori1=it->first->vertex(Delaunay::ccw(it->second))->info().back(); Point_2 pt1_ori1=it->first->vertex(Delaunay::ccw(it->second))->info().back();
Point_2 pt3 = Point_2();
if(CGAL::compare_xy(pt0_ori0,pt1_ori0)==CGAL::EQUAL || CGAL::compare_xy(pt0_ori1,pt1_ori0)==CGAL::EQUAL) if(CGAL::compare_xy(pt0_ori0,pt1_ori0)==CGAL::EQUAL || CGAL::compare_xy(pt0_ori1,pt1_ori0)==CGAL::EQUAL)
pt3 = pt1_ori1; rt.insert(Weighted_point_2(CGAL::centroid(pt0_ori0,pt0_ori1,pt1_ori1),-CGAL::to_double(CGAL::squared_distance(pt0_ori0,pt0_ori1)+
CGAL::squared_distance(pt0_ori0,pt1_ori1)+CGAL::squared_distance(pt1_ori1,pt0_ori1))/9.));
else else
if(CGAL::compare_xy(pt0_ori0,pt1_ori1)==CGAL::EQUAL || CGAL::compare_xy(pt0_ori1,pt1_ori1)==CGAL::EQUAL) if(CGAL::compare_xy(pt0_ori0,pt1_ori1)==CGAL::EQUAL || CGAL::compare_xy(pt0_ori1,pt1_ori1)==CGAL::EQUAL)
pt3 = pt1_ori0; rt.insert(Weighted_point_2(CGAL::centroid(pt0_ori0,pt0_ori1,pt1_ori0),-CGAL::to_double(CGAL::squared_distance(pt0_ori0,pt0_ori1)+
CGAL::squared_distance(pt0_ori0,pt1_ori0)+CGAL::squared_distance(pt1_ori0,pt0_ori1))/9.));
if(pt3!=Point_2()) //if adjacent wpoints comed from a delaunay triangle
rt.insert(Weighted_point_2(CGAL::centroid(pt0_ori0,pt0_ori1,pt3),-CGAL::to_double(CGAL::squared_distance(pt0_ori0,pt0_ori1)+
CGAL::squared_distance(pt0_ori0,pt3)+CGAL::squared_distance(pt3,pt0_ori1))/9.));
} }
if(fn==2){//Draw 3th Delauney if(fn==2){//Draw 3th Delauney
draw_in_ipe(rt); draw_in_ipe(rt);

View File

@ -39,6 +39,7 @@ template < typename K_base >
class Equal_2 class Equal_2
: public K_base::Equal_2 : public K_base::Equal_2
{ {
typedef typename K_base::FT FT;
typedef typename K_base::Point_2 Point_2; typedef typename K_base::Point_2 Point_2;
typedef typename K_base::Vector_2 Vector_2; typedef typename K_base::Vector_2 Vector_2;
typedef typename K_base::Equal_2 Base; typedef typename K_base::Equal_2 Base;
@ -68,6 +69,7 @@ public:
Get_approx<Point_2> get_approx; // Identity functor for all points Get_approx<Point_2> get_approx; // Identity functor for all points
// but lazy points // but lazy points
double px, py, qx, qy; double px, py, qx, qy;
init_double(px, py,qx, qy, (FT*)(0));
if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) && if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) ) fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) )

View File

@ -611,7 +611,7 @@ MainWindow::loadEdgConstraints(QString fileName)
int n; int n;
ifs >> n; ifs >> n;
K::Point_2 p,q, qold; K::Point_2 p,q, qold(0,0); // initialize to avoid maybe-uninitialized warning from GCC6
CDT::Vertex_handle vp, vq, vqold; CDT::Vertex_handle vp, vq, vqold;
while(ifs >> p) { while(ifs >> p) {

View File

@ -271,7 +271,7 @@ std::istream&
extract(std::istream& is, Circle_2<R>& c) extract(std::istream& is, Circle_2<R>& c)
{ {
typename R::Point_2 center; typename R::Point_2 center;
typename R::FT squared_radius; typename R::FT squared_radius(0);
int o; int o;
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :

View File

@ -231,7 +231,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Direction_2<R>& d, const Cartesian_tag&) extract(std::istream& is, Direction_2<R>& d, const Cartesian_tag&)
{ {
typename R::FT x, y; typename R::FT x(0), y(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(x) >> iformat(y); is >> iformat(x) >> iformat(y);

View File

@ -188,7 +188,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Direction_3<R>& d, const Cartesian_tag&) extract(std::istream& is, Direction_3<R>& d, const Cartesian_tag&)
{ {
typename R::FT x, y, z; typename R::FT x(0), y(0), z(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(x) >> iformat(y) >> iformat(z); is >> iformat(x) >> iformat(y) >> iformat(z);

View File

@ -260,7 +260,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Line_2<R>& l) extract(std::istream& is, Line_2<R>& l)
{ {
typename R::RT a, b, c; typename R::RT a(0), b(0), c(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(a) >> iformat(b) >> iformat(c); is >> iformat(a) >> iformat(b) >> iformat(c);

View File

@ -257,7 +257,7 @@ template < class R >
std::istream & std::istream &
operator>>(std::istream &is, Plane_3<R> &p) operator>>(std::istream &is, Plane_3<R> &p)
{ {
typename R::RT a, b, c, d; typename R::RT a(0), b(0), c(0), d(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(a) >> iformat(b) >> iformat(c) >> iformat(d); is >> iformat(a) >> iformat(b) >> iformat(c) >> iformat(d);

View File

@ -229,7 +229,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Point_2<R>& p, const Cartesian_tag&) extract(std::istream& is, Point_2<R>& p, const Cartesian_tag&)
{ {
typename R::FT x, y; typename R::FT x(0), y(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(x) >> iformat(y); is >> iformat(x) >> iformat(y);

View File

@ -257,7 +257,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Point_3<R>& p, const Cartesian_tag&) extract(std::istream& is, Point_3<R>& p, const Cartesian_tag&)
{ {
typename R::FT x, y, z; typename R::FT x(0), y(0), z(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(x) >> iformat(y) >> iformat(z); is >> iformat(x) >> iformat(y) >> iformat(z);

View File

@ -289,7 +289,7 @@ std::istream&
extract(std::istream& is, Sphere_3<R>& c, const Cartesian_tag&) extract(std::istream& is, Sphere_3<R>& c, const Cartesian_tag&)
{ {
typename R::Point_3 center; typename R::Point_3 center;
typename R::FT squared_radius; typename R::FT squared_radius(0);
int o=0; int o=0;
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :

View File

@ -335,7 +335,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Vector_2<R>& v, const Cartesian_tag&) extract(std::istream& is, Vector_2<R>& v, const Cartesian_tag&)
{ {
typename R::FT x, y; typename R::FT x(0), y(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(x) >> iformat(y); is >> iformat(x) >> iformat(y);

View File

@ -315,7 +315,7 @@ template <class R >
std::istream& std::istream&
extract(std::istream& is, Vector_3<R>& v, const Cartesian_tag&) extract(std::istream& is, Vector_3<R>& v, const Cartesian_tag&)
{ {
typename R::FT x, y, z; typename R::FT x(0), y(0), z(0);
switch(get_mode(is)) { switch(get_mode(is)) {
case IO::ASCII : case IO::ASCII :
is >> iformat(x) >> iformat(y) >> iformat(z); is >> iformat(x) >> iformat(y) >> iformat(z);