[vtk-developers] Tcl wrapping and output array arguments
David Lonie
david.lonie at kitware.com
Tue Mar 24 09:26:55 EDT 2015
On Mon, Mar 23, 2015 at 5:51 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi David,
>
> It's apparent to me that part of the difficulty surrounding this change is
> due to the name of the method. Why not use a new name?
>
> bool ComputeBoundsForViewport(vtkViewport *, double bounds[6]);
>
> I confess that I have an ulterior motive. I like all Get() or Set()
> methods
> to get/set a property that depends only on the the object itself. Here,
> the Bounds depend on both the object and on a second object. So I
> don't consider this method to be a "getter" in the strict sense, hence
> "ComputeBounds" rather than "GetBounds".
>
> Basically, I like it when Get methods are associated with properties/traits
> of the object. Eventually, VTK's wrappers might associate Set/Get
> methods with Python properties. In fact, this idea can already be seen
> in action in tvtk, Enthought's Traited VTK.
>
Hmm, and this also wouldn't require the 'using' wrapper support right
away...I like it! The distinction between Get/Compute makes sense.
The name is a bit long, and "ForViewport" is implied by the arguments. I'd
like ComputeBounds, but that's already a virtual on many of these classes.
Now I'm leaning towards
vtkBoundingBox ComputeBoundingBox(vtkViewport *)
That would also:
- eliminate the output-array-arg issues with the Tcl wrappers (Yay!)
- encourage use of the vtkBoundingBox class, which is a really nice API for
working with a bounding box that leads to much, much more consistent and
readable usage (there are a few approaches used for, e.g. invalid bounds,
that aren't always consistent).
It needs a couple hints to be wrapped properly, but that's not nearly as
much trouble :)
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150324/5930b15e/attachment.html>
More information about the vtk-developers
mailing list