POV-Ray : Newsgroups : povray.animations : center of rotation : center of rotation Server Time
26 Apr 2024 22:10:50 EDT (-0400)
  center of rotation  
From: bnrj rudra
Date: 21 Jan 2012 08:45:02
Message: <web.4f1ac14a6363859f9971f8480@news.povray.org>
Dear friends,
I am a complete newbie trying to use povray to show a rotation. My code is :
#version 3.6; // 3.7
global_settings{assumed_gamma 1.0}
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//------------------------------------------
#include "colors.inc"
#include "textures.inc"
//------------------------------------------
// camera ----------------------------------
camera{ location  <0.0 , 1.0 ,-3.0>
        look_at   <0.0 , 1.0 , 0.0>
        right x*image_width/image_height
        angle 75 }
// sun -------------------------------------
light_source{<1500,3000,-2500> color White}
// sky -------------------------------------
plane{ <0,1,0>,1 hollow
       texture{
         pigment{ bozo turbulence 0.92
           color_map{
                 [0.00 rgb<0.05,0.15,0.45>]
                 [0.50 rgb<0.05,0.15,0.45>]
                 [0.70 rgb<1,1,1>        ]
                 [0.85 rgb<0.2,0.2,0.2>  ]
                 [1.00 rgb<0.5,0.5,0.5>  ]
                       } //
           scale<1,1,1.5>*2.5
           translate<0,0,0>
           } // end of pigment
         finish {ambient 1 diffuse 0}
        } // end of texture
       scale 10000}
// fog on the ground -----------------------
fog { fog_type   2
      distance   50
      color      rgb<1,1,1>*0.8
      fog_offset 0.1
      fog_alt    1.5
      turbulence 1.8
    } //

// ground ----------------------------------
plane{ <0,1,0>, 0
       texture{
          pigment{ color rgb<0.22,0.45,0>}
          normal { bumps 0.75 scale 0.015 }
          finish { phong 0.1 }
       } // end of texture
     } // end of plane

//------------------------------------------
// objects in scene ------------------------
sphere{ <-.5,0,0>, 0.5
        texture{
          pigment{ color rgbt<0.9,0.55,0,.8>}
          finish { phong 1  }
        } // end of texture
        translate<0.85,1.1,0>
      } // end of sphere
sphere{ <-1.5,0,0>, 0.5
        texture{
          pigment{ color rgbt<0.9,0.55,0,.5>}
          finish { phong 1 }
        } // end of texture
        translate<0.85,1.1,0>
      } // end of sphere
sphere{ <-2.5,0,0>, 0.5
        texture{
          pigment{ color rgbt<0.9,0.55,0,.8>}
          finish { phong 1 }
        } // end of texture
        translate<0.85,1.1,0>
      } // end of sphere
sphere{ <.5,0,0>, 0.5
        texture{
          pigment{ color rgbt<0.9,0.55,0,.5>}
          finish { phong 1 }
        } // end of texture
        translate<0.85,1.1,0>
      } // end of sphere
#declare Pendula = //-------------------------------------------------------
Pendula

union{ // outer union
cylinder { <0.35,-.50,0>,<0.35,.4,0>,0.04
           texture { pigment { color rgb<0.90,0.05,0.15>}
                    //normal { bumps 0.5 scale <0.005,0.25,0.005>}
                     finish  { phong 0.5}
                   } // end of texture
           scale <1,1,1> rotate<0,0,0> translate<0,-1,0>
         } // end of cylinder
 union{ // inner union   -------------------------------------------------------
  cone { <0.35,0.0,0>,0,<0.35,-0.5,0>,0.105
         texture { pigment{color rgb<0.90,0.05,0.15>}
                   finish { phong 0 }
               } // end of texture
       scale <1,1,1> rotate<0,0,0> translate<0,1.55,0>
     } // end of cone ----------------------------------------------------------
  scale <1,1,1> rotate<0,0,0> translate<0,-2,0>
  }// end of inner union
}  // end of outer union
 //
----------------------------------------------------------------------------------

#declare Amplitude = 40 ;// in degrees  -  in Grad

object { Pendula

         rotate< 0, 0, Amplitude*sin( clock*2*pi) >

         translate<0,2.15,0>
        }
#declare Amplitude = 40 ;// in degrees  -  in Grad

object { Pendula

         rotate< 0, 0, Amplitude*sin( clock*2*pi) >

         translate<1.1,2.15,0>
        }
#declare Amplitude = 40 ;// in degrees  -  in Grad

object { Pendula

         rotate< 0, 0, Amplitude*sin( clock*2*pi) >

         translate<-1.,2.15,0>
        }
#declare Amplitude = 40 ;// in degrees  -  in Grad

object { Pendula

         rotate< 0, 0, Amplitude*sin( clock*2*pi) >

         translate<-2,2.15,0>
        }
//------------------------------------- end

This may not be good code, as I am peeking up pieces from various tutorials.
The problem is the rotation. How I can define the rotation origin? Its behaving
like being fixed at the top point.


Post a reply to this message

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