[vtkusers] Problem with vtkActor->SetOrigin()

Anant Vemuri ajar108 at gmail.com
Wed May 26 03:11:58 EDT 2010


Hi,

I had posted a problem a few days back that I am still having with using
vtkActor->SetOrigin(). The documentation of vtkProp3D says that
SetOrigin(pos) function sets the point of rotation to the point specified by
pos. However, when I apply SetOrigin(pos), my actor moves in the scene such
that his point is at the world origin. For example, if I do SetOrigin(100,
100, 100), the actor moves such that the previous (100,100,100) is now at
(0,0,0) initially before I apply any other transform to it. The effect is
similar to when I do

m_transform->Translate( -100,-100,-100 );
m_actor->SetUserTransform( m_transform );


Is this what is expected? Becase from the documentation, I understood that
it should do translate(-newOrigin) [rotations, scaling etc]
translate(newOrigin). Should I expect that when I do
vtkActor->SetOrigin(newOrigin), the newOrigin moves to the world (0,0,0).
Can someone explain this to me?

Thank you.
Anant.


On Mon, May 24, 2010 at 11:27 PM, Anant Vemuri <ajar108 at gmail.com> wrote:

> Thanks... But doesn't SetUserTransform() do that already... the vtk
> documentation says as below...
>
> I think I understand the problem, but not sure how to correct it... I
> am attaching a transform as the base transform which means that all
> the other operations such as SetOrigin(), SetScale() get overridden.
>
>
> On 5/24/10, 王君臣 <wangjunchen at gmail.com> wrote:
> > what you need is a multiplication (PostMultiply) of m_defaultTrf to the
> > current actor transform not a replacement.
> >
> >
> > 2010/5/24 Anant Vemuri <ajar108 at gmail.com>
> >
> >> Hi,
> >>
> >> I am trying to use myVtkActor->SetOrigin(origin) to set the origin so
> that
> >> any rotations I apply is done about this point. This is what I do to
> build
> >> the pipeline
> >>
> >>
> >> void buildPipeline( )
> >> {
> >>     m_actor->SetMapper( m_mapper );
> >>     m_actor->SetOrigin( 100, 100, 100 );
> >>     m_defaultTrf->Scale(m_scale, m_scale, m_scale);
> >>     m_defaultTrf->PostMultiply();
> >>     m_defaultTrf->Concatenate( this->getTransform() );
> >>     /// I add some more things to the m_defaultTrf
> >>     .
> >>     .
> >>     .
> >>     m_actor->SetUserTransform( m_defaultTrf );
> >>     }
> >>     std::cout << "\n\n\nOrigin = [" << m_actor->GetOrigin()[0] << ", "
> <<
> >> m_actor->GetOrigin()[1] << ", " << m_actor->GetOrigin()[2] << "]\n\n\n";
> >> }
> >>
> >> But when I apply the transform in the scene, it is not being about some
> >> other point entirely. I noticed that this is the same point when I
> remove
> >> the SetOrigin() line. But in the last line it gives me the origin as the
> >> one
> >> that I set a few line earlier. I am not able to figure out what is the
> >> mistake. Can anyone help me?
> >>
> >> Thank you.
> >> Anant.
> >>
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >>
> >
> >
> > --
> >
>
>
> --
> -----------
> Anant S. Vemuri
> email: ajar108 at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100526/ebeb4345/attachment.htm>


More information about the vtkusers mailing list