POV-Ray : Newsgroups : povray.newusers : axis of rotation - confused : Re: Still confused... Server Time
28 Jul 2024 18:22:08 EDT (-0400)
  Re: Still confused...  
From: Chris B
Date: 25 Dec 2007 21:07:10
Message: <4771b74e$1@news.povray.org>
"frankly" <sim### [at] gmailcom> wrote in message 
news:47718e7f@news.povray.org...
> Despite your kind efforts Chris and Alain, I am still pretty confused.
>
> These is a cut down versions of the Disc/Ring source files and a small
> example of the animated gif it produces.
> I have included a red pole to show the axis of rotation.  I want the axis 
> to
> be central to the object rather than at one edge.
> I have made use of Friedrich A. Lohmueller's geometric objects and shape
> include files.
> http://www.f-lohmueller.de/pov_tut/pov__eng.htm
>
> the test image
> <img src="http://i202.photobucket.com/albums/aa79/simunch/RotaTest.gif">
>
> ... snip ...
>
> #declare Ring =
> object{ Segment_of_CylinderRing ( 1.30, 1.55, 0.35, 0)
>        texture {Ringtxtr} // end of texture
>                 rotate x* 90              // 45 90 135 180 225 270 315 360
>                 rotate z* 00
>                 rotate y* 00
>                 translate< 0.0, 0.0, -0.35>}

Hi Simon,
This defines a ring that's 0.35 units thick, initially lying on the XZ 
plane, then rotates it so that it's lying on the XY plane and translates it 
by -0.35 in z placing it's centre at <0,0,-0.175>.
I suspect that you intended to translate by -z*0.175, so that you end up 
with it centred at the origin, in which case you could proceed to rotate it 
based upon the clock in your animation without doing anything further to 
centre it.

>
> #declare CentrePoint = (min_extent(Ring)+max_extent(Ring));
>

To centre it no-matter where it is you can calculate the centre point, but, 
the calculation in your scene needs to be divided by two to give the correct 
centre point of the object. ie.:
  #declare CentrePoint = (min_extent(Ring)+max_extent(Ring))/2;

> //~~~~~~~ the instance of the object ~~~~~~~~
> object{Ring
> //         translate z*CentrePoint.z

If you want to auto-centre the object you need to uncomment this translation 
and multiply it by -1 to bring the centre point of the object to the origin. 
ie.:
  translate -z*CentrePoint.z
This centres in using just the z component, which should be fine as your 
object should already be centred in x and y, but, you could also use the 
more generic form if you wanted to. ie.:
   translate -CentrePoint

Then you can rotate the object and it should rotate around the object's 
centre.

>           rotate y*360*clock
> }
>

If you want to define it away from the origin and rotate it around it's own 
centre you can use:
  translate -CentrePoint
  rotate y*360*clock

  translate CentrePoint
which moves it to the origin, rotates it, then moves it back to wherever it 
was.

> ... snip ... I apologise if I have posted too much text or if graphics are 
> a no-no.  I have no
> newsgroup netiquette yet...

Animation is usually discussed on povray.animations (although I'd argue that 
this one is ok here on povray.newusers and may tend to get you a more 
detailed response). Animated graphics should go on 
povray.binaries.animations, (or you can link to images on the Internet). 
Non-animated images go on povray.binaries.images.

Complete scene files would go on povray.binaries.scene-files, but I believe 
that code snippets are ok here. Useful reference information about what to 
post where is contained on the  frequently-asked-questions newsgroup.

Happy Christmas,
Chris B.


Post a reply to this message

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