diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 4ecdf29d68c..f36da573a76 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -497,12 +497,13 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t mat.rotate(angle, axis); //Head + const float Rf = static_cast(R); for(int d = 0; d<360; d+= 360/prec) { - double D = d*M_PI/180.0; - double a =std::atan(R/0.33); - QVector4D p(0,1.0,0, 1.0); - QVector4D n(R*2.0*sin(D), sin(a), R*2.0*cos(D), 1.0); + float D = (float) (d * M_PI / 180.); + float a = (float) std::atan(Rf / 0.33); + QVector4D p(0., 1., 0, 1.); + QVector4D n(Rf*2.*sin(D), sin(a), Rf*2.*cos(D), 1.); QVector4D pR = mat*p; QVector4D nR = mat*n; @@ -518,8 +519,8 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t data.colors->push_back((float)color.z); //point B1 - p = QVector4D(R*2.0* sin(D),0.66,R *2.0* cos(D), 1.0); - n = QVector4D(sin(D), sin(a), cos(D), 1.0); + p = QVector4D(Rf*2.*sin(D), 0.66f, Rf*2.* cos(D), 1.f); + n = QVector4D(sin(D), sin(a), cos(D), 1.); pR = mat*p; nR = mat*n; data.vertices->push_back(pR.x()); @@ -533,7 +534,7 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t data.colors->push_back((float)color.z); //point C1 D = (d+360/prec)*M_PI/180.0; - p = QVector4D(R*2.0* sin(D),0.66,R *2.0* cos(D), 1.0); + p = QVector4D(Rf*2.* sin(D), 0.66f, Rf *2.* cos(D), 1.f); n = QVector4D(sin(D), sin(a), cos(D), 1.0); pR = mat*p; nR = mat*n; @@ -556,8 +557,8 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t { //point A1 double D = d*M_PI/180.0; - QVector4D p(R*sin(D),0.66,R*cos(D), 1.0); - QVector4D n(sin(D), 0, cos(D), 1.0); + QVector4D p(Rf*sin(D), 0.66f, Rf*cos(D), 1.f); + QVector4D n(sin(D), 0.f, cos(D), 1.f); QVector4D pR = mat*p; QVector4D nR = mat*n; @@ -571,7 +572,7 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t data.colors->push_back(color.y); data.colors->push_back(color.z); //point B1 - p = QVector4D(R * sin(D),0,R*cos(D), 1.0); + p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0); n = QVector4D(sin(D), 0, cos(D), 1.0); pR = mat*p; nR = mat*n; @@ -588,7 +589,7 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t data.colors->push_back(color.z); //point C1 D = (d+360/prec)*M_PI/180.0; - p = QVector4D(R * sin(D),0,R*cos(D), 1.0); + p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0); n = QVector4D(sin(D), 0, cos(D), 1.0); pR = mat*p; nR = mat*n; @@ -604,7 +605,7 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t //point A2 D = (d+360/prec)*M_PI/180.0; - p = QVector4D(R * sin(D),0,R*cos(D), 1.0); + p = QVector4D(Rf * sin(D),0,Rf*cos(D), 1.0); n = QVector4D(sin(D), 0, cos(D), 1.0); pR = mat*p; nR = mat*n; @@ -618,7 +619,7 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t data.colors->push_back((float)color.y); data.colors->push_back((float)color.z); //point B2 - p = QVector4D(R * sin(D),0.66,R*cos(D), 1.0); + p = QVector4D(Rf * sin(D), 0.66f, Rf*cos(D), 1.f); n = QVector4D(sin(D), 0, cos(D), 1.0); pR = mat*p; nR = mat*n; @@ -633,8 +634,8 @@ void Viewer::makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec t data.colors->push_back((float)color.z); //point C2 D = d*M_PI/180.0; - p = QVector4D(R * sin(D),0.66,R*cos(D), 1.0); - n = QVector4D(sin(D), 0, cos(D), 1.0); + p = QVector4D(Rf * sin(D), 0.66f, Rf*cos(D), 1.f); + n = QVector4D(sin(D), 0.f, cos(D), 1.f); pR = mat*p; nR = mat*n; data.vertices->push_back(pR.x());