POV-Ray : Newsgroups : povray.newusers : axis of rotation - confused Server Time
1 Nov 2024 16:23:09 EDT (-0400)
  axis of rotation - confused (Message 1 to 6 of 6)  
From: frankly
Subject: axis of rotation - confused
Date: 23 Dec 2007 18:11:23
Message: <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


Post a reply to this message

From: Chris B
Subject: Re: axis of rotation - confused
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

From: Alain
Subject: Re: axis of rotation - confused
Date: 24 Dec 2007 15:02:20
Message: <4770104c$1@news.povray.org>
frankly nous apporta ses lumieres en ce 2007/12/23 18:11:
> 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
None of the preceding have any effect on what you see.
> ^^^^^^^^^^^^^^^^^^^^^^^
>  object{Disc scale 22 rotate <0,360*clock 0> translate < -21.35, -0.3, 100>}
This rotate around the Y axis.
> // also tried this -
> //object{Disc scale 22 rotate<0,-360*(clock+0.025),0> translate 
> < -21.35, -0.3, 100>)
This does the same, but start/end the rotation a little farther.
> ^^^^^^^^^^^^^^^^^^^^^^^
> 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 
> 
> 
By bet would be that your Disc object is not centered and/or it's normal/axis 
don't start parallel to an axis.
If you use the disk primitive, make sure that it's center is at <0,0,0> and it's 
original orientation is flat on the X-Z plane.
#declare Disc = disc{0, x, Radius texture{Some_texture}}
Make sure that there is no Y component in the vector part.

Can you post the definition of your Disc object? If it's more than 10 lines, 
post it on povray.binaries.scene-files. If it's a big mesh, zip it.


-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you wonder why you ever collected 
those 200 megs worth of paint and image manipulation programs now rusting 
somewhere on your hard drive.
Ken Tyler


Post a reply to this message

From: frankly
Subject: Still confused...
Date: 25 Dec 2007 18:13:03
Message: <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">

^^^^^^^RotaTest.pov file^^^^^^^^^^^^^^^^^
#version 3.6;
#include "golds.inc"
#include "metals.inc"
#include "shapes_old.inc"
#include "shapes_lo.inc"
#include "shapes2.inc"
#include "colors.inc"
global_settings {
  assumed_gamma 1.0
  max_trace_level 5
}

// ---------Image - Lights and Camera-------------------------------
camera {
 location <-10, 0,-5>
 up y*image_height right x*image_width
 look_at < 0, 0, 0>
 angle 45
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <0, 00, -30>}

//-------Object Definition-----------------------------
#declare Ringtxtr=T_Gold_3E;

#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>}

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

//~~~~~~~ the instance of the object ~~~~~~~~
object{Ring
//         translate z*CentrePoint.z
           rotate y*360*clock
}

//~~~~~~~ the instance of the axis indicator line ~~~~~~~~
cylinder{
    <0, CentrePoint.y-4, 0>,     // Center of one end of ring y
    <0, CentrePoint.y+4, 0>,     // Center of other end of ring y
0.030            // Radius
 texture {pigment {color Red} } }

/* ~~~~~  The rotation RotaTest.ini file
Antialias=On
Antialias_Threshold=0.5
Antialias_Depth=5

Input_File_Name=RotaTest

Initial_Frame=1
Final_Frame=20
Initial_Clock=0
Final_Clock=1
Cyclic_Animation=on
Pause_when_Done=off

*/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I apologise if I have posted too much text or if graphics are a no-no.  I 
have no
newsgroup netiquette yet...
Let me know if you can spare the time.

Thanks again - POV-Ray is amazing!


Post a reply to this message


Attachments:
Download 'RotaTest.gif' (24 KB)

Preview of image 'RotaTest.gif'
RotaTest.gif


 

From: Chris B
Subject: Re: Still confused...
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

From: frankly
Subject: Re: Still confused...
Date: 26 Dec 2007 11:47:39
Message: <477285ab$1@news.povray.org>
Thank You So Very Much Chris!
Your explanations have been extremely useful to me.  I had just worked out
the -0.175 translation tonight myself.

It is of enormous benefit to me that you have helped me, both in the
rotation information and guiding me where to post and look for more
information.

Thank You Again.


Post a reply to this message

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