[vtkusers] Bug in vtkXYPlotActor ?
REGAT-BARREL Aurélien
arbvtk at yahoo.fr
Thu May 27 08:38:14 EDT 2004
Hi,
I think there is a bug in vtkXYPlotActor.
The following curve is clipped on the Y axis if offset < 0.1 :
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkXYPlotActor.h>
#include <vtkFloatArray.h>
#include <vtkFieldData.h>
#include <vtkDataObject.h>
#ifdef _MSC_VER
#pragma comment( lib, "vtkCommon.lib" )
#pragma comment( lib, "vtkRendering.lib" )
#pragma comment( lib, "vtkHybrid.lib" )
#endif
int main()
{
// rendering stuff
vtkRenderWindow * renWin = vtkRenderWindow::New();
vtkRenderWindowInteractor * Iter = vtkRenderWindowInteractor::New();
renWin->SetInteractor( Iter );
vtkRenderer * ren = vtkRenderer::New();
renWin->AddRenderer( ren );
// plot actor
vtkXYPlotActor * xyplot = vtkXYPlotActor::New();
xyplot->SetWidth( 1 );
xyplot->SetHeight( 1 );
xyplot->SetPosition( 0, 0 );
ren->AddActor2D( xyplot );
// add buggy curve ([0, 0.09], [1, 1.59])
vtkFloatArray * xarray = vtkFloatArray::New();
vtkFloatArray * yarray = vtkFloatArray::New();
double offset = 0.09;
xarray->InsertNextValue( 0 );
yarray->InsertNextValue( offset );
xarray->InsertNextValue( 1 );
yarray->InsertNextValue( 1.50 + offset );
vtkFieldData * values = vtkFieldData::New();
values->AllocateArrays( 2 );
values->AddArray( xarray );
values->AddArray( yarray );
vtkDataObject * data = vtkDataObject::New();
data->SetFieldData( values );
xyplot->AddDataObjectInput( data );
xyplot->SetDataObjectYComponent( 0, 1 );
// render
renWin->SetSize( 500, 500 );
renWin->Render();
Iter->Initialize();
Iter->Start();
}
If offset >= 0.1 there is no problem.
I use vtk 4.4. with vtkXYPlotActor.cxx revision 1.52.
Aurélien REGAT-BARREL
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail
Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040527/3e71ec94/attachment.htm>
More information about the vtkusers
mailing list