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

大城市里の小女人 提交于 2020-01-13 10:02:18

问题


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?


回答1:


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



回答2:


Well, clearly the matrix would be this:

( log(x) / x        0      ) ( x )  =  ( log(x) )
(      0        log(y) / y ) ( y )  =  ( log(y) )

But that's obviously not useful. You can't write a constant matrix to do a non-linear transformation.



来源:https://stackoverflow.com/questions/2538844/is-there-a-transformation-matrix-that-can-scale-the-x-and-or-y-axis-logarithmica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!