POV-Ray : Newsgroups : povray.general : an extraordinary rotation question : Re: an extraordinary rotation question Server Time
30 Jul 2024 08:23:29 EDT (-0400)
  Re: an extraordinary rotation question  
From: Larry Hudson
Date: 19 Jun 2009 23:42:23
Message: <4a3c5a9f$1@news.povray.org>
mysdn wrote:
> Hello everybody,
>  I'm new at this forum and very interested in ray tracing. Currently, I'm using
> Povray for ray tracing. But I have a huge problem understanding its rotation
...
> Any type of help will be greatly appreciated.
> ibrahim dogan
> Turkey

You have already received far more detailed explanations, so I don't 
know if this is helpful or not.  This is a VERY simple demo of rotations 
and scaling.  And being simple, it might help you visualize how POV-Ray 
handles these things.  The key to remember, ALL rotations and scalings 
are done with respect to the coordinate axes.

This image uses a simple 2-unit box created centered around the origin, 
then rotated/scaled/translated in various ways.

Rotated around z then translated along x (blue)
Translated along x then rotated around z (cyan)
Scaled then translated along y (red)
Translated then scaled along y (magenta)

Then to show the order of the rotations is important...
Rotated around x then around y (yellow)
Rotated around y then around x (orange)

****************************************
#include "colors.inc"

camera {
     location <-2, 2.5, -15>
     look_at 0
}

light_source { <-5, 20, -30> White * 1.2 }

background { SkyBlue }

#declare Cube = box { -1, 1 }

#declare Axes = union {
     cylinder { <-100, 0, 0>, <100, 0, 0>, .05 }
     cylinder { <0, -100, 0>, <0, 100, 0>, .05 }
     cylinder { <0, 0, -100>, <0, 0, 100>, .05 }
     pigment { Gray70 }
     no_shadow
}

object {    //  Rotate followed by translate
     Cube pigment { Blue }
     rotate z * 45
     translate x * 5
}

object {    //  Translate followed by rotate
     Cube pigment { Cyan }
     translate x * 5
     rotate z * 45
}

object {    //  Scale followed by translate
     Cube pigment { Red }
     scale .5
     translate y * 5
}

object {    //  Translate followed by scale
     Cube pigment { Magenta }
     translate y * 5
     scale .5
}

object {    //  Rotate x followed by rotate y
     Cube pigment { Yellow }
     rotate <45, 45, 0>
     translate -x * 6
}

object {    //  Rotate y followed by rotate x
     Cube pigment { Orange }
     rotate y * 45 rotate x * 45
     translate -x * 2
}

plane { y, -5 pigment { Green } }

//  Comment this out for no axes displayed
object { Axes }
*****************************************

Hope this helps.

      -=- Larry -=-


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.