[vtkusers] Generic vtkMatrix

David Doria daviddoria+vtk at gmail.com
Wed Nov 25 09:10:31 EST 2009


On Tue, Nov 24, 2009 at 11:44 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:

> Hi,
>
> I have extensively  used GMTL library. Similar to Eigen its headers only
> and LGPL license
>
> http://ggt.sourceforge.net/
>
> It worked reasonably well with VTK and some other SceneGraph libraries for
> some of the projects me and my colleagues worked on earlier. May be some of
> concepts can be ported to VTK if not used directly?
>
> ~Regards,
> Aashish
>
>
> On Tue, Nov 24, 2009 at 11:02 PM, Marcus D. Hanwell <
> marcus.hanwell at kitware.com> wrote:
>
>> On Tue, Nov 24, 2009 at 10:05 PM, David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
>> > wrote:
>>
>>> I really think it would be nice to have something in VTK to allow users
>>> to do simple matrix/vector multiplication/addition/transpose/etc without
>>> much effort and fighting ** type variables.  It will also greatly improve
>>> the interface to many of the vtkMath functions.
>>>
>>> I have started working on vtkMatrix here:
>>> http://www.rpi.edu/~doriad/VTK_List/vtkMatrix/<http://www.rpi.edu/%7Edoriad/VTK_List/vtkMatrix/>
>>>
>>> Take a look at Example.cxx to see the syntax. Can I get some initial
>>> comments? Is it something that users actually want/actually has a chance of
>>> making it to VTK? Is this the right structure/way to go about writing such a
>>> thing? Is there any way we could include some things from VNL in VTK as ITK
>>> does to avoid reinventing the wheel?
>>>
>>> What about using a general purpose library such as Eigen when more
>> features are needed?
>>
>> http://eigen.tuxfamily.org/
>>
>> It has a liberal license (LGPL with template instantiation exceptions), is
>> header only, provides a well developed and general purpose C++ template
>> library with a great syntax. You can also get at the underlying pointers to
>> the data, this could be assigned to the vtkMatrix4x4 for example. I have
>> used it in previous projects.
>>
>> I have not had much time to experiment with how easily it can be mixed
>> with VTK code, but it should be reasonably simple. It would of course add an
>> extra dependency to your project, and could not be used in VTK code.
>>
>> Marcus
>> --
>> Marcus D. Hanwell, Ph.D.
>> R&D Engineer, Kitware Inc.
>> (518) 881-4937
>>
> --
> Aashish Chaudhary
>
>
These are good suggestions for general purpose things. However, I was more
interested in improving the interface to the vtkMath functions, as well as
providing developers in VTK source an easy way to do these things. I realize
vtkMatrix3x3 and vtkMatrix4x4 cover many cases of matrix manipulations - but
even doing something as simple as subtracting/adding vectors the user has to
write their own little subtraction loop:

double a[3];
double b[3];
//...fill a and b ...
double c[3];

// Should be easy as c = a-b
//instead, we have to do:
for(unsigned int i = 0; i < 3; i++)
{
c[i] = a[i] - b[i];
}

That just seems like something that is done quite often and is
representative of the kind of thing that should have a little more
"wrapping" (i.e. a vtkPoint or vtkVector class).

Do you not agree that VTK needs some built-ins like this?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091125/e4472184/attachment.htm>


More information about the vtkusers mailing list