+ fixes #0002075: Analysis of FreeCAD by PVS-Studio static analyzer

This commit is contained in:
wmayer
2015-05-01 16:56:31 +02:00
parent d8f63bcfd1
commit dd2b39ddd6
21 changed files with 59 additions and 91 deletions

View File

@@ -1053,11 +1053,11 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion & vp,
float scaleX = (float)sizeX/(float)size[0];
float scaleY = (float)sizeY/(float)size[1];
float scale = std::max<float>(scaleX, scaleY);
if (cam && cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) {
if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) {
float height = static_cast<SoOrthographicCamera*>(cam)->height.getValue() * scale;
static_cast<SoOrthographicCamera*>(cam)->height = height;
}
else if (cam && cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) {
else if (cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) {
float height = static_cast<SoPerspectiveCamera*>(cam)->heightAngle.getValue() / 2.0f;
height = 2.0f * atan(tan(height) * scale);
static_cast<SoPerspectiveCamera*>(cam)->heightAngle = height;