Explorar o código

Fix white ring in ctkMaterialPropertyPreviewLabel

There was some #inf values in the computation because of sqrt(x<0)
Julien Finet %!s(int64=14) %!d(string=hai) anos
pai
achega
bbca36713a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Libs/Widgets/ctkMaterialPropertyPreviewLabel.cpp

+ 1 - 1
Libs/Widgets/ctkMaterialPropertyPreviewLabel.cpp

@@ -228,7 +228,7 @@ void ctkMaterialPropertyPreviewLabel::draw(QImage& image)
         QVector3D pt;
         pt.setX( (i-size2) / (size2-1) );
         pt.setY( (j-size2) / (size2-1) );
-        pt.setZ( sqrt(1. - pt.x()*pt.x() - pt.y()*pt.y()) );
+        pt.setZ( sqrt(qMax(1. - pt.x()*pt.x() - pt.y()*pt.y(), 0.)) );
         
         QVector3D normal = pt;
         normal.normalize();