Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a transformation matrix that can scale the x and/or y axis logarithmically?

I'm using .net WPF geometry classes to graph waveforms. I've been using the matrix transformations to convert from the screen coordinate space to my coordinate space for the waveform. Everything works great and it's really simple to keep track of my window and scaling, etc. I can even use the inverse transform to calculate the mouse position in terms of the coordinate space. I use the built in Scaling and Translation classes and then a custom matrix to do the y-axis flipping (there's not a prefab matrix for flipping). I want to be able to graph these waveforms on a log scale as well (either x axis or y axis or both), but I'm not sure if this is even possible to do with a matrix transformation. Does anyone know if this is possible, and if it is, what is the matrix?

like image 799
Dave M Avatar asked Nov 06 '22 14:11

Dave M


1 Answers

Matrices are linear transformations, so they can scale, rotate, etc. But they can't stretch logarithmically. That's a nonlinear transformation.

EDIT: But you should be able to roll this yourself, without undue trouble. (Doesn't require a knowledge of lin alg.) I mean, if you want the x axis to be on a logarithmic scale, take the log of the x coordinates that you're graphing. The tricky part is making the scale legend work on the side of the graph -- that boils down to transforming each scale value from x to 10^x (or whatever logarithm base you're using.)

So the legend would read:

1     10    100   1000

instead of

1      2      3      4
like image 124
Rob Lachlan Avatar answered Nov 15 '22 05:11

Rob Lachlan