Shear transformation which doesn't change the order in x-direction

偶尔善良 提交于 2019-12-25 10:26:13

问题


Given a set of points with unequal x-coordinates, I want to calculate the value v > 0 such that the shear transformation (x, y) -> (x + v*y, y) doesn't change the order in the x-direction.


回答1:


This isn't difficult. Order the points by their x-axis. Because of the continuity of the shear transformation, it's enough for you to find a maximum v that two consecutive points (in x-order) do not change order. Let (x,y) and (x',y') be two consecutive points in your ordering. with v>0, the x coordinates change as x -> x + vy and x' -> x' + vy'. Now as x'>x, you want to find maximum v such that x' + vy' >= x + vy. By linearity, it's enough to solve

x' + vy' = x + vy

i.e.

x' - x = vy - vy' = v(y - y')

thus

v = (x' - x)/(y - y')

If the result is negative, then any value of v goes (the points are moving farther away); if the result is positive, that's the maximum value that the pair (x,y), (x',y') can tolerate. Now calculate this maximum for all consecutive pairs and take their minimum.

Note that if y = y', v becomes undefined. In this case the points lie at the same point on y-axis and the shear transformation doesn't change their distance.




回答2:


Convert each point (x, y) into a ray {(x + yv, v) | v ≥ 0} in the xv-halfplane with v ≥ 0. Use a segment intersection algorithm to find the one with minimum v.



来源:https://stackoverflow.com/questions/5615964/shear-transformation-which-doesnt-change-the-order-in-x-direction

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