How to draw a Perspective-Correct Grid in 2D

后端 未结 9 1223
滥情空心
滥情空心 2020-12-25 08:43

I have an application that defines a real world rectangle on top of an image/photograph, of course in 2D it may not be a rectangle because you are looking at it from an angl

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-25 09:26

    What you need to do is represent it in 3D (world) and then project it down to 2D (screen).

    This will require you to use a 4D transformation matrix which does the projection on a 4D homogeneous down to a 3D homogeneous vector, which you can then convert down to a 2D screen space vector.

    I couldn't find it in Google either, but a good computer graphics books will have the details.

    Keywords are projection matrix, projection transformation, affine transformation, homogeneous vector, world space, screen space, perspective transformation, 3D transformation

    And by the way, this usually takes a few lectures to explain all of that. So good luck.

提交回复
热议问题