소스 검색

Fix white ring in ctkMaterialPropertyPreviewLabel

There was some #inf values in the computation because of sqrt(x<0)
Julien Finet 14 년 전
부모
커밋
bbca36713a
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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();