z_media_rotate3d (zotonic_core v1.0.0-rc.17)
Calculate the ImageMagick distortion parameters for a 3D rotation.
Summary
Functions
Calculate the transformation matrix for the perspective. Translate the corner points of the image to the arguments for the ImageMagick distort function. This code has been derived from http://www.fmwconcepts.com/imagemagick/3Drotate/index.php
Types
-type matrix() :: [[number()]].
Functions
-spec rotate3d(Width :: non_neg_integer(), Height :: non_neg_integer(), Roll :: number(), Tilt :: number(), Pan :: number()) -> {ok, string()} | {error, term()}.
Calculate the transformation matrix for the perspective. Translate the corner points of the image to the arguments for the ImageMagick distort function. This code has been derived from http://www.fmwconcepts.com/imagemagick/3Drotate/index.php
Here we don't scale the image, the image is rotated from the center of the image, and we use a fixed viewing point that is compatible with the viewing point used in the mod_image_edit css3 transformations.