Perspective Coords for 2D Hex Grid

时光怂恿深爱的人放手 提交于 2019-12-04 20:34:33

Note that X-coordinate after perspective transformation depends both on X and on Y source coordinates. General expression

XPersp = (A * X + B * Y + C) / (G * X + H * Y + 1)

For your case (perspective sight along central axis) transformation of rectangle with corners (XCenter-W,0)-(XCenter +W, H) to trapezoid centered vertically at XCenter, shifted up by YShift, is:

XPersp = XCenter + (X - XCenter) / (H * Y + 1)
YPersp = (YShift +  E * Y) / (H * Y + 1)

where H, E are some coefficients, adapted for good look.

Vary E (defines trapezoid height) about 0.5-2.0, H (defines trapezoid tilt) about 0.005

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