[vtkusers] rescaling glyphs..??
Rakesh Patil
rakeshthp at in.com
Tue Feb 9 06:40:04 EST 2010
Well, I guess, its working fine.. But the scaling isn't working properly...As told by you, i hooked an observer in the renderer's start event. But by doing so, the performance of the application became very slow. So, i hooked an observer to the vtkRenderWindowInteractor's EndInteractionEvent.And then in my command callback, i call the following two functions,ComputeScale();DisplayVectors();DisplayVectors contains the code to display vector arrays. asglyphs>SetScaleFactor(scale);glyphMapper = vtkPolyDataMapper::New();glyphMapper>SetInputConnection(glyphs>GetOutputPort());glyphActor = vtkActor::New();glyphActor>SetMapper(glyphMapper);pRenderer>AddActor(glyphActor);The above code is executed again and again.. And thats why the performance of the applicationgoes down.. So, what i want to know is whether what i did is correct or not?? Secondly, is there any faster method to display the scaled output??Thanks Original message From:"Rakesh Patil"< rakeshthp at in.com >Date: 09 Feb 10 1
2:50:37Subject:Re: [vtkusers] rescaling glyphs..??To: "David Gobbi"Hello sir,Well, I dont know what you exactly mean by "at the same depth" inregards to collection of glyph?Actually, each nodes are at different depths (say range from 0 to 3000 for example). And I displayglyphs at these nodes. So, does it mean that my glyphs are not at same depth..??Thanks Original message From:David Gobbi< david.gobbi at gmail.com >Date: 08 Feb 10 19:06:27Subject:Re: [vtkusers] rescaling glyphs..??To: Rakesh Patil Hi Rakesh,The "ViewPort" is not what you think.It has nothing to do with theproblem you are working on.The "position" in that code means world coordinates of whatever objectobject you want to scale.When the camera is doing a perspectiveprojection (this is the default), then the scale of an object dependson its depth within the scene.The position is used to compute thedepth.If you have a collection of glyphs that are all at approximately thesame depth, you can compute the centroid and
use that as the position. Setting a different scale for each glyph is possible, too, but ismore complicated. DavidOn Sun, Feb 7, 2010 at 10:58 PM, Rakesh Patilwrote:> Hello,>> I have to scale my vector arrows (glyphs) in such a way that when it is> zoomed in, the arrow size must become small and as I zoom out, it should> grow up.. As my senior instructed me here,>> http://www.vtk.org/pipermail/vtkusers/2010January/105915.html>> I tried my best and did this..>> class vtkMyCallback : public vtkCommand> {> public:> static vtkMyCallback *New(){> return new vtkMyCallback;> }>> virtual void Execute(vtkObject *callee, unsigned long, void *)> {> vtkRenderer *renderer = reinterpretcast(callee);> computeSomething(renderer>GetActiveCamera()>GetPosition(), renderer);> }> };>> Here is a code for computeSomething()>> computeSomething( const double position[3], vtkRenderer *renderer)> {> double vp[4];> renderer>GetViewPort(vp);> cout > vtkMyCallback * mo = vtkMyCallback::New();> pRenderer>
AddObserver(vtkCommand::StartEvent, mo);>>> When i run this code, I get the viewport as>> 0011>> It remains same throughout. Even after zooming in and out...>> after that I tried the code which was suggested to me by one of the senior> developer here>> The scale which it returns is 0. as the position i'm passing in> computeSomething is same as the camera position in else part. Actually, now> i need to find the scale. So in order to do that, what position do i need to> pass as a parameter for this function.? what is difference between, position> and camera position??>> Thanks in advance> Rakesh Patil>> Dear vtkusers ! Get Yourself a cool, short @in.com Email ID now!> > Powered by www.kitware.com>> Visit other Kitware opensource projects at> http://www.kitware.com/opensource/opensource.html>> Please keep messages ontopic and check the VTK FAQ at:> http://www.vtk.org/Wiki/VTKFAQ>> Follow this link to subscribe/unsubscribe:> http://www.vtk.org/mailman/listinfo/vtkusers>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100209/cad88b2c/attachment.htm>
More information about the vtkusers
mailing list