Commit dd72b672 authored by Sean McBride's avatar Sean McBride

Refactor & simplify to avoid cppcheck false positive

cppcheck warned that ‘mynormal’ was not initialized

Change-Id: I840badbfdd46abe706070eb9effe3d74ae51ee17
parent 13ee5b90
......@@ -64,20 +64,22 @@ vtkGlobeSource::vtkGlobeSource()
void vtkGlobeSource::ComputeGlobePoint(
double theta, double phi, double radius, double* x, double* normal)
{
double mynormal[3];
// Lets keep this conversion code in a single place.
double tmp = cos( vtkMath::RadiansFromDegrees( phi ) );
double n0 = -tmp * sin( vtkMath::RadiansFromDegrees( theta ) );
double n1 = tmp * cos( vtkMath::RadiansFromDegrees( theta ) );
double n2 = sin( vtkMath::RadiansFromDegrees( phi ) );
double* n = normal ? normal : mynormal;
x[0] = n0 * radius;
x[1] = n1 * radius;
x[2] = n2 * radius;
// Lets keep this conversion code in a single place.
double tmp;
tmp = cos( vtkMath::RadiansFromDegrees( phi ) );
n[0] = - tmp * sin( vtkMath::RadiansFromDegrees( theta ) );
n[1] = tmp * cos( vtkMath::RadiansFromDegrees( theta ) );
n[2] = sin( vtkMath::RadiansFromDegrees( phi ) );
x[0] = n[0] * radius;
x[1] = n[1] * radius;
x[2] = n[2] * radius;
if (normal)
{
normal[0] = n0;
normal[1] = n1;
normal[2] = n2;
}
}
//----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment