POV-Ray : Newsgroups : povray.newusers : axis of rotation - confused : Re: axis of rotation - confused Server Time
28 Jul 2024 18:23:22 EDT (-0400)
  Re: axis of rotation - confused  
From: Chris B
Date: 23 Dec 2007 19:40:31
Message: <476effff@news.povray.org>
"frankly" <the### [at] hotmailcom> wrote in message 
news:476eeb1b@news.povray.org...
> Hi, I have an object which is basically a 3D disc.
> I can rotate it 360 degrees with the disc starting face on and
> the axis of rotation being the vertical one and central at the front of 
> the disc depth (z direction)
>
> This causes the disc not to spin correctly (it oscillates) and I would 
> like to set it so that the axis is through the vertical but also the 
> centre of the disc z-wise
>
> I am using an ini file to build the frames of the animation (given below)
> ^^^^^^^^^^^^^^^^^^^^^^^
> Antialias=On
> Antialias_Threshold=0.5
> Antialias_Depth=5
> Input_File_Name=Discus
> Initial_Frame=1
> Final_Frame=20
> Initial_Clock=0
> Final_Clock=1
> Cyclic_Animation=on
> Pause_when_Done=off
> ^^^^^^^^^^^^^^^^^^^^^^^
> in the main Discus pov file includes the line
> ^^^^^^^^^^^^^^^^^^^^^^^
> object{Disc scale 22 rotate <0,360*clock 0> translate < -21.35, -0.3, 
> 100>}
> // also tried this -
> //object{Disc scale 22 rotate<0,-360*(clock+0.025),0> translate 
> < -21.35, -0.3, 100>)
> ^^^^^^^^^^^^^^^^^^^^^^^
> I cannot for the life of me understand how I can change the y axis z 
> value?
>
> Could any of you kind and clever people please help me ?
>
> Kind Regards,
>
> Simon

Hi Simon,
Your explanation is not totally clear to me and I don't see what you mean 
when you say "it oscillates", so I'm guessing a bit here.

I'm assuming that the 'disc' is an object that you've converted from another 
format rather than the POV-Ray disc object. I'm therefore assuming that your 
disc is more like a thin cylindrical shape made up of a mesh or mesh2 object 
that has a non-zero thickness in the +z direction.

To rotate it around it's centre in the z direction you would first need to 
translate it so that it is centred on z=0 before rotating, then you can 
translate it back again once you've rotated it.
If you don't know its thickness you can use the min_extent and max_extent 
macros. Something like:

#declare CentrePoint = (min_extent(Disc)+max_extent(Disc))/2;
object{Disc
  translate -z*CentrePoint.z
  scale 22
  rotate y*360*clock
  translate < -21.35, -0.3, 100> + z*CentrePoint.z
}

(I didn't test this code snippet, so watch out for potential typos)

Regards,
Chris B


Post a reply to this message

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