[vtk-developers] Tcl wrapping and output array arguments

David Gobbi david.gobbi at gmail.com
Fri Mar 27 11:21:31 EDT 2015

On Fri, Mar 27, 2015 at 8:49 AM, David Lonie <david.lonie at kitware.com>

> On Fri, Mar 27, 2015 at 10:38 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>> No, neither the Tcl wrappers or the the Java wrappers can wrap
>> vtkBoundingBox as an "object".  But they could convert it into an
>> array of six floats.  For example, if a method takes an argument
>> of type "vtkBoundingBox" in C++, it could be wrapped as a Tcl
>> method that takes six floats.  If a method returns a vtkBoundingBox
>> in C++, it could be wrapped as a Tcl method that returns six floats.
> That'd be ok from a usability standpoint. Effort-wise, would this be a lot
> of work?

Same estimate that I gave before: it would take more than an afternoon.

I'm not introducing any API that takes vtkBoundingBox as input, so we'd
> just have to wrap the case where they're returned, if that makes it easier.
> As an aside, would it be difficult to have these handled as objects? If we
> could handle vtkBoundingBox, we could probably start using the wonderful
> vtkVector implementations, too.

It would be lots of work (I'm guessing two weeks minimum, probably much
more).  It would be very nice for Java, not sure if it would be worthwhile
for Tcl.

Wrapping vtkVector in python was especially tricky, because it was a
templated class, and interpreted languages don't really support the concept
of "templates".  So the python wrappers automatically wrap a dozen or so
instantiations of the vtkVector template and store them in a mapping so
that you can do this:

  v = vtkVector[float,2]()
  print v
    [0.0, 0.0]

So, in the python wrappers, vtkVector[float, 2] is equivalent to
vtkVector<double, 2> in C++ (because python "float" is C++ "double").

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150327/867cde90/attachment.html>

More information about the vtk-developers mailing list