Sfoglia il codice sorgente

Fix white ring in ctkMaterialPropertyPreviewLabel

There was some #inf values in the computation because of sqrt(x<0)
Julien Finet 14 anni fa
parent
commit
bbca36713a
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  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();