[vtkusers] Generic vtkMatrix

Jeff Baumes jeff.baumes at kitware.com
Wed Dec 2 11:42:16 EST 2009


> You mentioned we may be able to add some of these simple things to vtkMath.
> These may be a few functions to kick things off:
>
> void MultiplyScalar(double a[3], const double s)
>    {
>   for(unsigned int i = 0; i < 3; i++)
>      {
>      a[i] *= s;
>      }
>    }
>
> void Add(double a[3], double b[3], double c[3])
>    {
>    //c = a+b
>   for(unsigned int i = 0; i < 3; i++)
>      {
>      c[i] = a[i] + b[i];
>      }
>    }
>
> void Subtract(double a[3], double b[3], double c[3])
>    {
>    //c = a-b
>   for(unsigned int i = 0; i < 3; i++)
>      {
>      c[i] = a[i] - b[i];
>      }
>    }
>

I've added these methods (float and double versions) to CVS.

/cvsroot/VTK/VTK/Common/Testing/Cxx/TestMath.cxx,v  <--
Common/Testing/Cxx/TestMath.cxx
new revision: 1.15; previous revision: 1.14
/cvsroot/VTK/VTK/Common/vtkMath.h,v  <--  Common/vtkMath.h
new revision: 1.136; previous revision: 1.135

That said, if someone wants to create a nicely polished vtkPoint
object with operators, I think it should be considered for inclusion
in VTK. I think it should be stack-based for efficiency (i.e. not a
vtkObject subclass). It would have issues with wrapping in other
languages, but could be nice for C++ developers. Major issues I see:

 - Will it need to support double and float?
 - How would it be integrated with the existing VTK API (vtkPoints, etc.)?

Jeff



More information about the vtkusers mailing list