POV-Ray : Newsgroups : povray.newusers : Rotations not working as expected : Re: Rotations not working as expected Server Time
30 Jul 2024 10:21:53 EDT (-0400)
  Re: Rotations not working as expected  
From: Alex Bame
Date: 19 May 2004 22:50:00
Message: <web.40ac1bc7225a08e5b4980b800@news.povray.org>
Severi Salminen <sev### [at] NOT_THISsibafi> wrote:
> Alex Bame wrote:
> > I think I'm missing something in how the rotation mechanism is supposed to
> > work.
> [snip...]
>
> You have a WAY too long example. Try to make it _as short as possible_.
> Remove all the unnecessary stuff like textures and try to give only one
> single object showing the problem.
>
> The syntax of rotate is given in section 6.3.1.3 in the manual. In summary:
>
> - rotation is done relative to each axis
> - totation is done in degrees
> - rotation is done using left-handed rotation system
> - the order of rotations in one rotate statement is x,y,z
>
> That should probably solve your problems?
>
> Severi

I've read the section in the manual on rotations and I believe that I am
using the rotate command correctly.  It seems to be working fine for the
cylinders it's just the isosurface that is behaving oddly.  Of course the
isosurface also has a much more complicated placing so it's probably the
case that I'm simply misunderstanding something and making a mistake
somewhere.  I've trimmed as much as I'm able from the scene file,
unfortunatly the problem is one of relative rotations and so I need objects
against which to refrence.  Also, I'm still very new at this (I've only
been using POV-Ray for a week) so I'm not very clear on what is and is not
needed with these objects.  I tried removing the textures as you suggested
but then I couldn't see the objects when I rendered the scene.

The problem is that the spring (isosurface) should be rotated around the Z
axis as much as the cylinders are so that they line up, yet it clearly is
not.  I have aligned the camera so that this is easy to see.

Thank you for your time and suggestions, here is my shortened example scene.

--SNIP--
#include "colors.inc"
#include "metals.inc"
#include "functions.inc"

#declare cyl_radius=0.07;
#declare spr_maj_radius=0.05;
#declare spr_min_radius=0.01;

#declare phi=pi/4;
#declare theta=pi/4;

camera {
   location <0, 1, -3>
   look_at <0, 1, 0>
}

// The rods

cylinder {
   <0, 0, 0>,     // Center of one end
   <0, 2, 0>,     // Center of other end
   cyl_radius     // Radius
   texture {
      T_Chrome_3A // Pre-defined texture
      scale 4     // Scale by the same ammount in all directions
   }
   rotate <0, 0, theta*180/pi>
   rotate <0, phi*180/pi, 0>
}

cylinder {
   <0, 0, 0>,     // Center of one end
   <0, 2, 0>,     // Center of other end
   cyl_radius     // Radius
   texture {
      T_Chrome_3A // Pre-defined texture
      scale 4     // Scale by the same ammount in all directions
   }
   rotate <0, 0, theta*180/pi>
   rotate <0, (phi+3*pi/2)*180/pi, 0>
}

// The springs

isosurface {
   function {
      f_helix1(x, y, z, 1, 20*pi,
         spr_min_radius, spr_maj_radius,
         1, 1, 0)
   }
   max_gradient 3
   contained_by{ box {-1/2,1/2} }   // One unit long, this gives us a
constant
   texture {                        // number of twists in the spring
      T_Brass_3A
      scale 4
   }
   scale <1, sqrt(2)*sin(theta), 1> // Scale the spring to the proper length
   rotate <0, 0, 90>
   rotate <0, 90, 0>
   translate <0, 1, 0>
   rotate <0, 0, theta*180/pi>
}

light_source { <2, 4, -3> color White }
light_source { <-2, -4, -3> color White }
--SNIP--


Post a reply to this message

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