[vtk-developers] Tcl wrapping and output array arguments

David Lonie david.lonie at kitware.com
Fri Mar 27 11:35:06 EDT 2015


On Fri, Mar 27, 2015 at 11:21 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> On Fri, Mar 27, 2015 at 8:49 AM, David Lonie <david.lonie at kitware.com>
> wrote:
>
>> 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.
>

Would you have time to do this? It looks like we're going to need to bite
the bullet and train the wrappers one way or another. No worries, If you're
too busy, I can give it a shot, though I may need to bug you a bit while
going through. But I really wouldn't mind taking some time to learn how the
wrapping mechanisms work.


> 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").
>

I was thinking more along the lines of the concrete vtkVector3d, etc
subclasses to avoid the templating issues. Is lifetime management the main
problem with these classes?

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


More information about the vtk-developers mailing list