是否存在可以对 x 和/或 y 轴进行对数缩放的变换矩阵?
我正在使用 .net WPF 几何类来绘制波形图。我一直在使用矩阵变换从屏幕坐标空间转换为波形的坐标空间。一切都很好,跟踪窗口和缩放等非常简单。我什至可以使用逆变换来计算坐标空间中的鼠标位置。我使用内置的缩放和平移类,然后使用自定义矩阵来执行 y 轴翻转(没有用于翻转的预制矩阵)。我希望能够在对数刻度上绘制这些波形(x 轴或 y 轴或两者),但我不确定这是否可以通过矩阵变换来完成。有谁知道这是否可能,如果可能,矩阵是什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
矩阵是线性变换,因此它们可以缩放、旋转等。但它们不能对数拉伸。这是一个非线性变换。
编辑:但是您应该能够自己进行此操作,而不会遇到不必要的麻烦。 (不需要林算法的知识。)我的意思是,如果您希望 x 轴采用对数刻度,取您正在绘制的 x 坐标的对数。棘手的部分是使比例图例在图表的一侧起作用 - 归结为将每个比例值从 x 转换为 10^x (或您使用的任何对数底)。
因此图例将显示为:
而不是
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:
instead of
嗯,显然矩阵是这样的:
但这显然没有用。您不能编写常量矩阵来进行非线性变换。
Well, clearly the matrix would be this:
But that's obviously not useful. You can't write a constant matrix to do a non-linear transformation.