is there Matrix for Float but not Double?

is there Matrix for Float but not Double?

Hello,

Yes, in C++ you can declare a double matrix (a 2D array). Just do, for example, a:

double myMatrix[10][10];

To have a 10x10 matrix of doubles.

take care,

PC

Hello @gpu

Your question concerns the VTK class vtkMatrix4x4 instead of the general concept of matrices in math/programming, correct?

If so, the answer is no, there isn’t. vtkMatrix4x4 internally uses double* and returns the data either as a double* or const double* as can be seen from the public API - double* vtkMatrix4x4::GetData() and const double* vtkMatrix4x4::GetData().

This requires VTK developers to make an additional copy to float* before uploading to OpenGL via glUniformMatrix* functions. vtkOpenGLUniforms::SetUniformMatrix(const char* name, vtkMatrix4x4* v) does a similar thing.

I believe the reason for using double precision in vtkMatrix4x4 is for better numeric tolerance when applying transformations to skewed meshes where the geometry has very large or very small bounds.

that’s what i want to avoid…seems have to write a custom class. Thanks!
moreover, is there API or common method which is the most effiect to do this copy?