Sloped objects - how to transform a set of points
-
I'm roughly up to speed on how to perform things like reflection and rotation, and even simple shear. However, I want to produce a perspective effect on a 2D shape. If we take the case of a rectangle, the left edge would appear nearer the viewer than the right edge. These edges should still be vertical. However, instead of the top and bottom being parallel, they should taper, moving closer together as the X value increases. Is there a 'magic' transformation I can apply, or do I have to iteratively update the points from left to right? For simple shapes (like the rectangle), this wouldn't be too onerous, but I am also looking at generating the same effect for text, where there would be a larger number of points, and the order of the points is not so easy to predict.
Steve S Developer for hire
-
I'm roughly up to speed on how to perform things like reflection and rotation, and even simple shear. However, I want to produce a perspective effect on a 2D shape. If we take the case of a rectangle, the left edge would appear nearer the viewer than the right edge. These edges should still be vertical. However, instead of the top and bottom being parallel, they should taper, moving closer together as the X value increases. Is there a 'magic' transformation I can apply, or do I have to iteratively update the points from left to right? For simple shapes (like the rectangle), this wouldn't be too onerous, but I am also looking at generating the same effect for text, where there would be a larger number of points, and the order of the points is not so easy to predict.
Steve S Developer for hire
Steve S wrote:
However, I want to produce a perspective effect on a 2D shape.
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/3d_perspective/[^]
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
Steve S wrote:
However, I want to produce a perspective effect on a 2D shape.
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/3d_perspective/[^]
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
TVM. That sort of helps, except I'm not using OpenGL, but it gives me a few ideas.
Steve S Developer for hire
thanks: https://movied.org
-
Steve S wrote:
However, I want to produce a perspective effect on a 2D shape.
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/3d_perspective/[^]
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
thanks: https://movied.org
-
I'm roughly up to speed on how to perform things like reflection and rotation, and even simple shear. However, I want to produce a perspective effect on a 2D shape. If we take the case of a rectangle, the left edge would appear nearer the viewer than the right edge. These edges should still be vertical. However, instead of the top and bottom being parallel, they should taper, moving closer together as the X value increases. Is there a 'magic' transformation I can apply, or do I have to iteratively update the points from left to right? For simple shapes (like the rectangle), this wouldn't be too onerous, but I am also looking at generating the same effect for text, where there would be a larger number of points, and the order of the points is not so easy to predict.
Steve S Developer for hire
thanks: https://movied.org