[vtkusers] 2DAxisActor

Louis Desjardins lost_bits1110 at hotmail.com
Wed May 19 15:08:13 EDT 2004


Thanks for your response

Okay so I now have an x-axis if i use something like:
        XAxisActor->SetPosition(0.0, 0.25);             // where 
'XAxisActor' is an AxisActor2D
	XAxisActor->SetPosition2(0.75, 0.25);

I also have image data which is really just a graph (manually created by 
inserting numbers into a FloatArray which is then used by my imagedata by 
calling SetVoidArray ) where I do:

ImageData->SetOrigin( -240, -90, 0 );
ImageData->SetSpacing(1, 1, 1);

and this image data is in a viewport which I set as:

MyGraph.Ren1->SetViewport(0, 0, 1, 0.3);
(so it only takes the bottom third of the whole window)

and then I also set the camera some distance away from my imagedata/graph
        Cam->SetPosition(0, 0, 270);
	Cam->SetFocalPoint(0, 0, 0);

My imagedata has X rows and Y columns  (so I have used subscript math in my 
1D float array to represent a 2D float array which is then input into 
vtkFloatArray which is used by my ImageData by calling SetVoidArray ) so if 
my Y axis has 20 elements then my Y=0 position would be at Y=10

So knowing this, and after all the translations (i.e. setting origin of my 
image data etc), my imagedata/graph is placed on my screen - but now how do 
I align
my X-axis so that it crosses at (0,0) the way any normal graph should..!? Do 
I have to resort to matrix algebra etc... if so can someone just lead me the 
way on this? Thank you again..

>From: Sander Niemeijer <niemeijer at science-and-technology.nl>
>To: "Louis Desjardins" <lost_bits1110 at hotmail.com>
>CC: vtkusers at vtk.org
>Subject: Re: [vtkusers] 2DAxisActor
>Date: Wed, 19 May 2004 19:06:40 +0200
>
>
>On woensdag, mei 19, 2004, at 16:08 Europe/Amsterdam, Louis Desjardins 
>wrote:
>
>>Thanks Cedric for your response,
>>
>>Does this mean that people do not use vtkAxisActor2D?
>>
>>Then how do I get ticks and labels on my axes?
>>
>>Thanks again,
>>
>>Louis
>>
>>>Hi vtkusers
>>>i just want to display an xy axis on my screen so i have an object of
>>>vtk2DAxisActor :
>>>
>>>         XYAxisActor->SetPoint1(10, 100);
>>>              XYAxisActor->SetPoint2(10, 100);
>>>              XYAxisActor->SetRange(5, 40);
>>>              XYAxisActor->AxisVisibilityOn();
>>>              XYAxisActor->TickVisibilityOn();
>>>              XYAxisActor->LabelVisibilityOn();
>>>              XYAxisActor->RenderOverlay( Ren1 );
>>>
>>>and then I add this actor to my Renderer but nothign appears?
>>>Do you see anything wrong with the above code?
>>>Thanks
>
>Try using different coordinates for Point2 and Point1. You are now creating 
>an Axis of zero length.
>According to the latest VTK documentation you should also be using the 
>SetPosition and SetPosition2 functions from vtkActor2D as the 
>vtk2DAxisActor::SetPoint functions seem to be only there for backward 
>compatibility.
>
>Best regards,
>Sander
>

_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN 
Premium! http://join.msn.click-url.com/go/onm00200439ave/direct/01/




More information about the vtkusers mailing list