PolyData actor is invisible after applying scale(1,1,-1)

classic Classic list List threaded Threaded
7 messages Options
zlf
Reply | Threaded
Open this post in threaded view
|

PolyData actor is invisible after applying scale(1,1,-1)

zlf
Hi all,

I place a cube polydata actor in renderer and reset camera. It is visible.
But after applying scale (1,1,-1) to actor and reset camera, the actor is invisible.

            vtkTransform transform = new vtkTransform();
            transform.SetMatrix(viewMatrix);
            transform.Scale(1, 1, -1);
            cubeActor2.SetUserTransform(transform);

How to make it visible?

Regards,

zlf
Reply | Threaded
Open this post in threaded view
|

Re: PolyData actor is invisible after applying scale(1, 1, -1)

neollie
Hi, 
try scaling with 1,1,1 whether your scene is correctly rendered, than with other positive factors for example 2,2,2 , finally with some negative factors. Perhaps negative factor could be problem, scaling by negative factor logically does not make much sense for me, regardless that it could pass..

j.

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: PolyData actor is invisible after applying scale(1, 1, -1)

David E DeMarle
Try vtkProperty:BackFaceCullingOff()

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Mon, Sep 3, 2012 at 5:07 AM, Jana Sefcikova <[hidden email]> wrote:

> Hi,
> try scaling with 1,1,1 whether your scene is correctly rendered, than with
> other positive factors for example 2,2,2 , finally with some negative
> factors. Perhaps negative factor could be problem, scaling by negative
> factor logically does not make much sense for me, regardless that it could
> pass..
>
> j.
>
> _______________________________________________
> 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
>
_______________________________________________
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
zlf
Reply | Threaded
Open this post in threaded view
|

Re: PolyData actor is invisible after applying scale(1, 1, -1)

zlf
Dear David,

Thank you for your response. But I still cannot see anything. My code is

vtkCubeSource cubeSource = vtkCubeSource->New();
cubeSource->SetCenter(5,5,5);
cubeSource->SetXLength(10);
cubeSource->SetYLength(10);
cubeSource->SetZLength(10);

vtkPolyDataMapper mapper = vtkPolyDataMapper::New();
mapper->SetInput(cubeSource->GetOutput());

vtkActor cubeActor = vtkActor::New();
cubeActor->SetMapper(mapper);

render->AddActor(cubeActor);

vtkTransform transform = vtkTransform::New();
transform->Scale(1,1,-1);
cubeActor->GetProertry()->BackfaceCullingOff();
cubeAcotr->SetUserTransform(transform);

renderer->ResetCameraClippingRange();
renderer->ResetCamera();
renwin->Render();

Regards,

zlf
Reply | Threaded
Open this post in threaded view
|

Re: PolyData actor is invisible after applying scale(1, 1, -1)

David Doria-2-3
On Mon, Sep 3, 2012 at 10:17 AM, zlf <[hidden email]> wrote:

> Dear David,
>
> Thank you for your response. But I still cannot see anything. My code is
>
> vtkCubeSource cubeSource = vtkCubeSource->New();
> cubeSource->SetCenter(5,5,5);
> cubeSource->SetXLength(10);
> cubeSource->SetYLength(10);
> cubeSource->SetZLength(10);
>
> vtkPolyDataMapper mapper = vtkPolyDataMapper::New();
> mapper->SetInput(cubeSource->GetOutput());
>
> vtkActor cubeActor = vtkActor::New();
> cubeActor->SetMapper(mapper);
>
> render->AddActor(cubeActor);
>
> vtkTransform transform = vtkTransform::New();
> transform->Scale(1,1,-1);
> cubeActor->GetProertry()->BackfaceCullingOff();
> cubeAcotr->SetUserTransform(transform);
>
> renderer->ResetCameraClippingRange();
> renderer->ResetCamera();
> renwin->Render();
>
> Regards,
>
> zlf


zlf,

Please post a minimal example
(http://www.vtk.org/Wiki/VTK/MinimalExample). This way David could
just copy/paste/compile/run and see your error for himself.

David
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: PolyData actor is invisible after applying scale(1, 1, -1)

Jothy
In reply to this post by zlf
Few points here

 You are setting a -ve scaling (1,1,-1). I am not sure whether scaling in -ve has any meaning. To shrink it will be <1 and >1 to expand. (I am not familiar with matrix operations, excuse if its wrong)


With few typographical error corrections they appear in the color I set (yellow)

//...................
    vtkCubeSource *cubeSource = vtkCubeSource::New();
    cubeSource->SetCenter(5,5,5);
    cubeSource->SetXLength(10);
    cubeSource->SetYLength(10);
    cubeSource->SetZLength(10);

    vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
    mapper->SetInput(cubeSource->GetOutput());
    mapper->ScalarVisibilityOff();

    vtkActor* cubeActor = vtkActor::New();
    cubeActor->SetMapper(mapper);
    cubeActor->GetProperty()->SetColor(1,1,0);

    this->modelRenderer->AddActor(cubeActor);
    vtkTransform *transform = vtkTransform::New();
    transform->Scale(1,1,0.5);

//    cubeActor->GetProperty()->BackfaceCullingOff();

    cubeActor->SetUserTransform(transform);


Regards
Jothy




On Mon, Sep 3, 2012 at 3:17 PM, zlf <[hidden email]> wrote:
>
> Dear David,
>
> Thank you for your response. But I still cannot see anything. My code is
>
> vtkCubeSource cubeSource = vtkCubeSource->New();
> cubeSource->SetCenter(5,5,5);
> cubeSource->SetXLength(10);
> cubeSource->SetYLength(10);
> cubeSource->SetZLength(10);
>
> vtkPolyDataMapper mapper = vtkPolyDataMapper::New();
> mapper->SetInput(cubeSource->GetOutput());
>
> vtkActor cubeActor = vtkActor::New();
> cubeActor->SetMapper(mapper);
>
> render->AddActor(cubeActor);
>
> vtkTransform transform = vtkTransform::New();
> transform->Scale(1,1,-1);
> cubeActor->GetProertry()->BackfaceCullingOff();
> cubeAcotr->SetUserTransform(transform);
>

> renderer->ResetCameraClippingRange();
> renderer->ResetCamera();
> renwin->Render();
>
> Regards,
>
> zlf
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/PolyData-actor-is-invisible-after-applying-scale-1-1-1-tp5715785p5715801.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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




--
Jothybasu Selvaraj
PhD Student
University of Liverpool
UK

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: PolyData actor is invisible after applying scale(1, 1, -1)

Bill Lorensen
What are you trying to achieve?

On Mon, Sep 3, 2012 at 10:49 AM, Jothybasu Selvaraj <[hidden email]> wrote:
Few points here

 You are setting a -ve scaling (1,1,-1). I am not sure whether scaling in -ve has any meaning. To shrink it will be <1 and >1 to expand. (I am not familiar with matrix operations, excuse if its wrong)


With few typographical error corrections they appear in the color I set (yellow)

//...................
    vtkCubeSource *cubeSource = vtkCubeSource::New();

    cubeSource->SetCenter(5,5,5);
    cubeSource->SetXLength(10);
    cubeSource->SetYLength(10);
    cubeSource->SetZLength(10);

    vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
    mapper->SetInput(cubeSource->GetOutput());
    mapper->ScalarVisibilityOff();

    vtkActor* cubeActor = vtkActor::New();
    cubeActor->SetMapper(mapper);
    cubeActor->GetProperty()->SetColor(1,1,0);

    this->modelRenderer->AddActor(cubeActor);
    vtkTransform *transform = vtkTransform::New();
    transform->Scale(1,1,0.5);

//    cubeActor->GetProperty()->BackfaceCullingOff();

    cubeActor->SetUserTransform(transform);


Regards
Jothy





On Mon, Sep 3, 2012 at 3:17 PM, zlf <[hidden email]> wrote:
>
> Dear David,
>
> Thank you for your response. But I still cannot see anything. My code is
>
> vtkCubeSource cubeSource = vtkCubeSource->New();
> cubeSource->SetCenter(5,5,5);
> cubeSource->SetXLength(10);
> cubeSource->SetYLength(10);
> cubeSource->SetZLength(10);
>
> vtkPolyDataMapper mapper = vtkPolyDataMapper::New();
> mapper->SetInput(cubeSource->GetOutput());
>
> vtkActor cubeActor = vtkActor::New();
> cubeActor->SetMapper(mapper);
>
> render->AddActor(cubeActor);
>
> vtkTransform transform = vtkTransform::New();
> transform->Scale(1,1,-1);
> cubeActor->GetProertry()->BackfaceCullingOff();
> cubeAcotr->SetUserTransform(transform);
>

> renderer->ResetCameraClippingRange();
> renderer->ResetCamera();
> renwin->Render();
>
> Regards,
>
> zlf
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/PolyData-actor-is-invisible-after-applying-scale-1-1-1-tp5715785p5715801.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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




--
Jothybasu Selvaraj
PhD Student
University of Liverpool
UK

_______________________________________________
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




--
Unpaid intern in BillsBasement at noware dot com


_______________________________________________
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