[vtkusers] matrix output VERY hard to read

Yang, Jinzhong jinzhong76 at gmail.com
Fri Oct 16 17:24:10 EDT 2009


The same problem is with the ascii *.vtk data file. It looks in a mess for
those point coordinate outputs. When output data to streams, fix the width
for each output element and specify the output precision should solve the
problem easily.

 

-Jinzhong

 

From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of David Doria
Sent: Thursday, October 15, 2009 6:55 AM
To: Jeff Baumes
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] matrix output VERY hard to read

 

On Tue, Oct 13, 2009 at 9:34 AM, Jeff Baumes <jeff.baumes at kitware.com>
wrote:

I agree that this would likely be a good change. Could you add a
little more clarity to this? What class(es)/method(s) are you
proposing to change?

Jeff


Jeff,

I think just vtkMatrix4x4::PrintSelf would need to be changed? Maybe
something more like this:
http://www.rpi.edu/~doriad/VTK_List/MatrixOutput/

It's tough to get the formatting VERY nice because of variable width
character fonts, but there is still quite an improvement (in my opinion).
Here are two examples:

Existing method, hard matrix:
    1 -4.12726e-10 3.91703e-10 5.2556e-12 
    4.12726e-10 1 7.75407e-10 -7.62694e-10 
    -3.91703e-10 -7.75407e-10 1 7.57439e-10 
    0 0 0 1 

Proposed method, hard matrix:
   1.000  -0.000   0.000   0.000
   0.000   1.000   0.000  -0.000
  -0.000  -0.000   1.000   0.000
   0.000   0.000   0.000   1.000


Existing method, easy matrix:
    1 2 3 4 
    5 6 7 8 
    9 10 11 12 
    13 14 15 16 

Proposed method, easy matrix:
   1.000   2.000   3.000   4.000
   5.000   6.000   7.000   8.000
   9.000  10.000  11.000  12.000
  13.000  14.000  15.000  16.000

As you can see there is a HUGE difference in the hard case, while the easy
case remains ok. The precision of the decimal outputs is clearly a user
preference sort of thing - maybe we could even make some options for the
formatting? That may be hard to do in the PrintSelf sort of framework
though..

Thoughts?

Thanks,

David 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091016/548eb0ba/attachment.htm>


More information about the vtkusers mailing list