subclassing vtkCamera

Hank Childs childs at forum.llnl.gov
Thu Jun 1 11:39:44 EDT 2000


Hello gurus,

I agree with those who have already voiced there opinion about subclassing
vtkCamera.  It doesn't seem like a good idea.  The problem (that I only
understand because I've been down this path) is that the camera is
subclassed in many graphics-lib specific ways.  Making a new subclass
means redoing all of the graphics-lib stuff, which you don't want to do.

I think the correct answer is what they call a `bridge' in OO-speak.
Identify what functionality in the camera you want to change.  For
example, say it is the projection method.  (Yes, I understand that the
projection method is already part of vtkCamera, I am trying to give a
concrete example).  Make an abstract type for ProjectionMethod and have
derived types OrthographicProjection and PerspectiveProjection.  The
vtkCamera module then has a reference to only a ProjectionMethod and
doesn't care if it is orthographic or perspective.  This way you can
subclass the module you have made without having to change any of the
graphics-lib code.

Anyways, this probably won't help at all, but it was what I identified as
the correct solution when I thought about the same thing.

Good luck,
Hank Childs

____________________________________________________________________________

Hank Childs
MeshTV
Lawrence Livermore National Laboratory


On Thu, 1 Jun 2000, David Gobbi wrote:

> Hi Matt,
> 
> I don't think there is any correct way to do this.  If the
> existing vtkCamera class is not flexible enough for what
> you are trying to do, then perhaps the vtkCamera class
> needs to be changed.  If the changes are generally useful,
> then they could be added to VTK.
> 
>  - David
> 
> --
>   David Gobbi, MSc                    dgobbi at irus.rri.on.ca
>   Advanced Imaging Research Group
>   Robarts Research Institute, University of Western Ontario
> 
> On Thu, 1 Jun 2000, Matt Clarkson wrote:
> 
> > Hi there,
> > 	how am I meant to create sub classes of vtkCamera.
> > I want to add some functionality to it, but I have just
> > been looking through the source code, and I see
> > how vtkCamera is created with vtkGraphicsFactory,
> > and it actually creates an instance of vtkOpenGLCamera etc.
> > 
> > Whats the `correct' way to do it.
> > 
> > Thanks in advance
> > 
> > Matt
> > 
> 
> --------------------------------------------------------------------
> This is the private VTK discussion list. Please keep messages on-topic.
> Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
> <majordomo at public.kitware.com>. For help, send message body containing
> "info vtkusers" to the same address.
> --------------------------------------------------------------------
> 


--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------




More information about the vtkusers mailing list