[vtkusers] PolyData Translation Problem

David Gobbi david.gobbi at gmail.com
Thu Oct 27 13:05:32 EDT 2011


The actor might be disappearing because it is no longer between the
front and back clipping planes of the renderer.

Try calling renderer->ResetCameraClippingRange() before window->Render().

 - David


On Thu, Oct 27, 2011 at 10:53 AM, Wenlong Wang <scc.wwl at gmail.com> wrote:
> Hi David,
>
> Thank you for your advice.
>
> In my app, the scale and rotate is not ignored, they works. For translation,
> I don't know, after I applied translation, the actor disappeared from my
> screen. And the transform is not passed to actor but camera. For rendering,
> I totally agree with you, I render the render window first time to show my
> actor, then I apply all the transformation. At last, I render again to show
> the changed actor.
>
> Wenlong
>
>
>
> 2011/10/27 David Gobbi <david.gobbi at gmail.com>
>>
>> The renderer automatically resets the camera on the first render,
>> it resets both the field-of-view and the position.  That is why it
>> "seems" like the position and scale are being ignored.  But they
>> are not being ignored.  It is just that the renderer is automatically
>> resetting the camera, and this causes the camera to move to the
>> new actor location.
>>
>> The easiest way to avoid this is to render once (with the original
>> position), then apply the UserTransform to the actor (or the
>> vtkTransformPolyData), and then render again.  The camera
>> reset will only occur on the first render.
>>
>>  - David
>>
>>
>> On Thu, Oct 27, 2011 at 10:32 AM, Wenlong Wang <scc.wwl at gmail.com> wrote:
>> > Hi, Jothybasu,
>> >
>> > Thank you very much for your reply.
>> >
>> > No, I didn't use it in my app. Does that matter? If so, why the scale
>> > and
>> > rotate functions works without vtkTransformFilter?
>> >
>> > Wenlong
>> >
>> > 2011/10/27 Jothybasu Selvaraj <jothybasu at gmail.com>
>> >>
>> >> Are you using vtkPolyDataTransformFilter along with vtkTransform?
>> >>
>> >> Jothy
>> >>
>> >> On Thu, Oct 27, 2011 at 5:13 PM, Wenlong Wang <scc.wwl at gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi everyone,
>> >>>
>> >>> I'm trying to scale, rotate and translate my polydata. My strategy is
>> >>> using vtkTransform to do these operations one by one. The order is
>> >>> scale,
>> >>> rotate and translate. I calculate the transform parameters and use
>> >>> vtkTransform::Scale, ::RotateZ() and ::Translate() to define the
>> >>> transformation. Then I pass this transformation to my camera by
>> >>> vtkCamera::SetUserTransform(). After that, I do the visualization
>> >>> pipeline
>> >>> again to show the new polydata object. And the visualization pipeline
>> >>> is
>> >>> capsualted as an independent function.
>> >>>
>> >>> So far, the scale and rotate works well and the polydata changes as I
>> >>> expected. However, as I start to translate it, it disappears! It
>> >>> doesn't
>> >>> work even I put simple numbers as the input parameters.
>> >>>
>> >>> I tried to pass the transform to my actor and use
>> >>> vtkActor::SetUserTransform to do it. But again, the scale and rotate
>> >>> works
>> >>> well and translate failed.
>> >>>
>> >>> Can anyone give me some advice? I'll be extremely appreciate it!
>> >>>
>> >>> Thank you very much!
>> >>>
>> >>> Best wishes
>> >>> Long
>
>



More information about the vtkusers mailing list