[vtkusers] flipping the scene:(Parity Transform)

David Gobbi dgobbi at irus.rri.on.ca
Wed Dec 13 16:42:28 EST 2000


On Wed, 13 Dec 2000, Fletcher, Bob (GEAE) wrote:

> I have a scene with many actors. I need to flip the whole scene around,
> replacing z with -z. (Parity Transform).
> 
> I tried 
> myactor  SetScale 1 1 -1

It is a more-or-less fundamental rule in OpenGL (and probably all other
graphics libraries) that parity transforms are not allowed (they don't
raise any error flags, they just screw things up).
 
> The geometry looks ok, but it's all rendered flat black. Without the
> Setscale it's colored by it's scalar value.  Is this some kind of normal
> vector problem? 

Yes.  When you do a flip, you end up turning your geometry inside-out.
The normals end up pointing inwards.  

> I can setScale -1 -1 1, and the colors are ok, but of course it doesn't
> change my geometry!
> 
> Is there a better approach? This seemed simplest.  Is ther a Left
> handed/righthanded corrdinate system flag hiding someplace?

I'm pretty sure that there isn't.  You will probably have to use
vtkTransformPolyDataFilter to transform your data, then use 
vtkPolyDataNormals to re-generate normals in the correct direction.

It would be possible to add code to VTK so that it automatically 
detects parity transformations and reverses the normals.  This 
would be a fair bit of work, though.

 - David

P.S. Parity transformations are evil.  Avoid them if you can.  Read
     "Alice's Adventures Through the Looking Glass" for further info,
     or perhaps watch a couple episodes of "Sailor Moon."

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario





More information about the vtkusers mailing list