POV-Ray : Newsgroups : povray.general : please assist with function : Re: please assist with function Server Time
31 Jul 2024 06:25:00 EDT (-0400)
  Re: please assist with function  
From: alphaQuad
Date: 2 Oct 2007 02:50:00
Message: <web.4701e8bcfdc645c063d48a7c0@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> This is a built in vector function vaxis_rotate in POV,
> though the parameter order is different.
>
> #declare A = <1,0,0>;
> #declare B = <0,1,0>;
> #declare M = vaxis_rotate(A,B,<0,90,0>);

many thanks Tim!

the exercise was to take the ballroll anim from helpfile and roll it in a
circle
to test my ability to use pov.


#include "colors.inc"
#include "transforms.inc"

#declare A=<1.0,0.0,0.0>;
#declare B=<0.0,1.0,0.0>;
#declare C=<0.0,0.0,1.0>;

#declare rolls = 2.15;
/*
dist to travel / circumference of the sphere
aas-sin(pi/2,deg2rad(30),4.3) = 2.15
((2.15*2*pi) / (sphere_radius*2*pi)) rolls = 2.15 as long as sphere_radius=1
aas-sin {
  ; AAS solve opposing side of angle2 ($2)
  return sin($2) * ($3 / sin($1))
}*/

#declare Vector_Arrow=
 union{
   cylinder{<0,0,0>,2.5*z,.15}
   cone{2.5*z,.3,3*z,0}
 }

#declare objB=object{
  Vector_Arrow
  rotate <-30,0,0>
  rotate 360*clock*y
  pigment{Green}
}
#declare my = vaxis_rotate(vaxis_rotate(y,A,-30),B,360*clock);
#declare mz = vaxis_rotate(vaxis_rotate(z,A,-30),B,360*clock);
#declare mx = vnormalize(vcross(mz,my));
// #debug str(mx) need to check here if mx is positive. HOW? need to echo
this vector somehow
// or print to render window for which example in vect2.pov
#declare A_point = vrotate(vaxis_rotate(z,A,-30),360*clock*y)*4.1;
object{
  objB
}

sphere {
    <0, 0, 0>, 1
    pigment {
      gradient x
      color_map {
        [0.0 Blue  ]
        [0.5 Blue  ]
        [0.5 White ]
        [1.0 White ]
      }
      scale .25
      rotate <0,0,90>
    }
    Shear_Trans(mx,my,mz)
    Axis_Rotate_Trans(mz,-360* rolls *clock)

    translate A_point
}

camera {
    location <0, 3, -20>
    look_at <0, 0, 0>
    rotate <5,0,0>
    angle 25
}
light_source { <20, 20, -20> color White*1.6 }
plane {
    y, 1
    pigment { checker color White color Black }
}


posted to animations:
web.4701e81c27717bd263d48a7c0@news.povray.org


Post a reply to this message

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