Commit 6a57e2d0 authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Introduced a variable zero-threshold for labels

Change-Id: Ibad4770d861527e17548c464f244e4df575e3f9a
parent 5fe98d0b
......@@ -88,8 +88,8 @@ int TestPolarAxes( int argc, char * argv [] )
polaxes->SetRadialLabelFormat( "%6.1f" );
polaxes->GetRadialAxesProperty()->SetColor( .0, .0, .9 );
polaxes->SetScreenSize( 12.0 );
polaxes->GetPolarAxisTitleTextProperty()->SetColor( .8, 0., 0. );
polaxes->GetPolarAxisLabelTextProperty()->SetColor( .8, 0., 0. );
polaxes->GetPolarAxisTitleTextProperty()->SetColor( .9, 0., 0. );
polaxes->GetPolarAxisLabelTextProperty()->SetColor( .9, 0., 0. );
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples( 0 );
......
......@@ -520,8 +520,8 @@ void vtkPolarAxesActor::BuildAxes( vtkViewport *viewport )
// Build polar axis tick, with respect to specified x-origin
this->BuildPolarAxisTicks( o[0] );
// Build polar axis labels
this->BuildPolarAxisLabels( o[0] );
// Build polar axis labels with 0.01 zero-threshold for labels
this->BuildPolarAxisLabels( .01 );
// Scale appropriately.
this->AutoScale( viewport );
......@@ -664,7 +664,7 @@ void vtkPolarAxesActor::BuildPolarAxisTicks( double origin )
}
// ****************************************************************
void vtkPolarAxesActor::BuildPolarAxisLabels( double origin )
void vtkPolarAxesActor::BuildPolarAxisLabels( double zeroThreshold )
{
// Calculate number of labels needed and create array for them
vtkAxisActor* axis = this->RadialAxes[0];
......@@ -688,7 +688,7 @@ void vtkPolarAxesActor::BuildPolarAxisLabels( double origin )
char label[64];
for ( int i = 0; i < nLabels; ++ i )
{
if ( fabs( val ) < .01 && this->MaximumRadius > 1 )
if ( fabs( val ) < zeroThreshold && this->MaximumRadius > 1 )
{
// We just happened to fall at something near zero and the range is
// large, so set it to zero to avoid ugliness.
......@@ -696,7 +696,7 @@ void vtkPolarAxesActor::BuildPolarAxisLabels( double origin )
}
sprintf( label, format, val );
if ( fabs( val ) < 0.01 )
if ( fabs( val ) < zeroThreshold )
{
//
// Ensure that -0.0 is never a label
......
Supports Markdown
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