[vtk-developers] 2D Clipping planes again (problem)

David Gobbi dgobbi at irus.rri.on.ca
Thu Apr 12 17:54:38 EDT 2001


On Thu, 12 Apr 2001, John Biddiscombe wrote:

> >vtkPlanes SetFrustumPlanes aspect [vtkCamera GetFrustumPlanes aspect]
>
> I like this one, but it'd mean storing an extra
> float stuff[24]
> in each instance of vtkCamera because its not stored usually (computed on
> the fly from transformation matrix).

Yes, I see your point.  The only way to 'fix' this problem is to have VTK
use special 'array' classes instead of using standard C arrays, then
arrays that are returned by methods could be created on-the-fly.  This
is a fairly common trick in C++, but I don't know if it's a good
idea to add fancy C++ tricks like this to VTK.

> >There is the option of not implementing the
> >    SetClippingPlanes(vtkPlanes)
> >method in vtkAbstractMapper at all.
>
> Yes, but one script uses it, so someone must have wanted it once. (or maybe
> you mean, just leave this one function in AbstractMapper3D)

Yes, that's what I meant.  There isn't any real need for vtkPlanes
in vtkAbstractMapper since vtkPlaneCollection can be used to set up the
mapper clipping planes.  Also, leaving vtkPlanes in graphics ensures
that no code will break.

The best thing might be to add new methods to vtkPlaneCollection (or
maybe to vtkAbstractMapper) to make setting up clipping planes a little
easier, and to further reduce the need for vtkPlanes:
 AddPlaneFromPointAndNormal(const double point[3], const double normal[3])
 SetPlanesFromPointsAndNormals(vtkPoints *points, vtkNormals *normals)
Then you can change the scripts to use these methods, instead of using
vtkPlanes, and hence maybe change people's habits.

> If a change is for a good cause, but breaks some old code, how does one
> decide if it should be permitted. (cf thread about discussion and laissez
> faire attitude to changes).

Right now, you ask on the list, and if no-one responds you can commit
anyway and take the risk that some people might get mad at you.  This
is not an ideal system, but it has been working up until now and will
continue to work as long as everyone applies common sense when making
changes and uses common courtesy when complaining about breakages.

> b) break tcl code by implementing it and remove offending script,
> replacing it with a cxx version

> How about this strategy.
> I'm going to change the code as mentioned previously (b), and some stuff
> will break, Almost nobody will ever notice, but please say so now if it
> matters. I'll post a similar message to the user list and make sure people
> are notified.

My recommendation would be to leave vtkPlanes where it is, and leave it
out of vtkAbstractMapper.  But keep it in vtkAbstractMapper3D for
backwards compatibility.

> Can someone please remind me of the change log FAQ thingy that needs
> entries when stuff changes.

I'll leave this for someone else to answer.  I haven't made a large commit
in a long time, so I've forgotten the details.

 - David





More information about the vtk-developers mailing list