Commit 180ebd0b authored by Ken Martin's avatar Ken Martin

Fix floating point issue with chart test

TestChartXYZ test fails on various platforms.  It turns out it is
failing due to floating point issues. Basically

1)	By default the plot data points define the bounds of the axes
    for the chart
2)	the axes define the plot area (clip stuff outside that)
3)	which defines the clipping plane equations
4)	which can in turn clip the original data points subject to
    floating point precision

This is what is happening (FYI, the point that disappears in the middle
is actual on the boundary in the depth axis). This patch
“fixes” the test by defining axes that are slightly bigger than the
data and replacing the valid image.

Change-Id: I25e7f05736f274ffc16633d8110767b9a5a5907b
parent 26af2896
......@@ -13,6 +13,7 @@
=========================================================================*/
#include "vtkAxis.h"
#include "vtkChartXYZ.h"
#include "vtkContextView.h"
#include "vtkContextScene.h"
......@@ -82,7 +83,6 @@ int TestChartXYZ(int , char * [])
int numPoints = 69;
float inc = 7.5 / (numPoints-1);
table->SetNumberOfRows(numPoints);
table->SetNumberOfRows(numPoints);
for (int i = 0; i < numPoints; ++i)
{
table->SetValue(i, 0, i * inc);
......@@ -97,6 +97,10 @@ int TestChartXYZ(int , char * [])
chart->AddPlot(plot.GetPointer());
const vtkColor4ub axisColor(20, 200, 30);
chart->SetAxisColor(axisColor);
chart->GetAxis(0)->SetUnscaledRange(-0.1,7.6);
chart->GetAxis(1)->SetUnscaledRange(-1.1,1.1);
chart->GetAxis(2)->SetUnscaledRange(-1.1,1.1);
chart->RecalculateTransform();
// We want a duplicate, that does not move.
vtkNew<vtkPlotPoints3D> plot2;
......
73a9d7fd3940b7cbe9d4b345bf8dd297
5f0cf41c427eec0b0d6be0467760a9e6
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