POV-Ray : Newsgroups : povray.animations : Source Code Help!!!! Server Time
28 Jul 2024 14:18:11 EDT (-0400)
  Source Code Help!!!! (Message 1 to 7 of 7)  
From: SHELLEY
Subject: Source Code Help!!!!
Date: 26 Apr 2000 22:09:11
Message: <3907A02F.2A7AFFE7@prodigy.net>
okay, im trying to create a simple animation where two balls roll into
each other.  My problem is that when the ball rotates 360 degrees it
rotates really weird.  Ive been playing with the code for awhile and I
can't figure it out.  here my source code:


#include "colors.inc"
#include "textures.inc"

camera
{
  location  <0.5 , 0.0 ,-10.0>
  look_at   <0.5 , 0.0 , 0.0>
}

background {SlateBlue }

light_source
{
  0*x
  color rgb 1.0
  area_light
  <8, 0, 0> <0, 0, 8>
  4, 4
  adaptive 0
  jitter
  translate <40, 80, -40>
}

//#declare ground =
box
{
  <-1, -1, -1>
  < 1,  1,  1>
  pigment { Orange }
  scale 10
  translate -15*y
  scale <20,0,20>
  translate 4*y
}

//#declare MainBall =
sphere
{
  <10, 0, 0>
  1
  finish {phong 1 phong_size 90}
  pigment {checker Violet,Yellow rotate y*(clock*360)}
  translate x*(clock*-8)
}

//#declare MainBall2 =
sphere
{
  <-10, 0, 0>
  1
  finish {phong 1 phong_size 90}
  pigment {checker Black,Yellow rotate y*(clock*360)}
  translate x*(clock*10)
}

//#declare hole =
//cylinder
//{
//  0*x,  5*x,  2
//  pigment {Yellow}
//  rotate 90*z
//  translate <3,-5.99,0>
//}

//difference {
//  object{ ground }
//  object{ hole }}

//#declare holelight =
//cone
//{
//  1*y,  0.0,
//  -1*y, 1.0
//  pigment {Yellow}
//  scale .5
//  translate <3,-1,0>
//  rotate 180*z
//  translate <6,-2,0>
//  scale 2
//  translate -3*x
//  translate -3*y
//}

//union {
//    light_source { <2,-2,0> color White }
//    object { holelight } no_shadow translate 1*y
//  }


Post a reply to this message

From: Bob Hughes
Subject: Re: Source Code Help!!!!
Date: 26 Apr 2000 22:33:38
Message: <3907a702@news.povray.org>
Rotation and translation coupled together such as that of a ball rolling
along a floor takes the use of  pi*(BallRadius*2)=Dist  then translate Dist*x
for example.
Just a matter of moving along the same distance as the circumference of the
sphere.  If more than one roll (>360 degrees) then you would just multiply
that amount by Dist.  720 degrees becomes 2*Dist*x

Bob

"SHELLEY" <SHE### [at] prodigynet> wrote in message
news:3907A02F.2A7AFFE7@prodigy.net...
| okay, im trying to create a simple animation where two balls roll into
| each other.  My problem is that when the ball rotates 360 degrees it
| rotates really weird.  Ive been playing with the code for awhile and I
| can't figure it out.  here my source code:
|
|
| #include "colors.inc"
| #include "textures.inc"
|
| camera
| {
|   location  <0.5 , 0.0 ,-10.0>
|   look_at   <0.5 , 0.0 , 0.0>
| }
|
| background {SlateBlue }
|
| light_source
| {
|   0*x
|   color rgb 1.0
|   area_light
|   <8, 0, 0> <0, 0, 8>
|   4, 4
|   adaptive 0
|   jitter
|   translate <40, 80, -40>
| }
|
| file://#declare ground =
| box
| {
|   <-1, -1, -1>
|   < 1,  1,  1>
|   pigment { Orange }
|   scale 10
|   translate -15*y
|   scale <20,0,20>
|   translate 4*y
| }
|
| file://#declare MainBall =
| sphere
| {
|   <10, 0, 0>
|   1
|   finish {phong 1 phong_size 90}
|   pigment {checker Violet,Yellow rotate y*(clock*360)}
|   translate x*(clock*-8)
| }
|
| file://#declare MainBall2 =
| sphere
| {
|   <-10, 0, 0>
|   1
|   finish {phong 1 phong_size 90}
|   pigment {checker Black,Yellow rotate y*(clock*360)}
|   translate x*(clock*10)
| }
|
| file://#declare hole =
| file://cylinder
| file://{
| //  0*x,  5*x,  2
| //  pigment {Yellow}
| //  rotate 90*z
| //  translate <3,-5.99,0>
| file://}
|
| file://difference {
| //  object{ ground }
| //  object{ hole }}
|
| file://#declare holelight =
| file://cone
| file://{
| //  1*y,  0.0,
| //  -1*y, 1.0
| //  pigment {Yellow}
| //  scale .5
| //  translate <3,-1,0>
| //  rotate 180*z
| //  translate <6,-2,0>
| //  scale 2
| //  translate -3*x
| //  translate -3*y
| file://}
|
| file://union {
| //    light_source { <2,-2,0> color White }
| //    object { holelight } no_shadow translate 1*y
| //  }
|


Post a reply to this message

From: Warp
Subject: Re: Source Code Help!!!!
Date: 27 Apr 2000 08:29:23
Message: <390832a3@news.povray.org>
SHELLEY <SHE### [at] prodigynet> wrote:
: sphere
: {
:   <10, 0, 0>
     ==

:   pigment {checker Violet,Yellow rotate y*(clock*360)}
                                   =========

  Can we see the problem here?

  (Hint: Rotation is always made around the axes)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Mike Weber
Subject: Re: Source Code Help!!!!
Date: 27 Apr 2000 10:16:30
Message: <39084bbe@news.povray.org>
But that rotation is done before the translation - shouldn't be a problem...
Perhaps Shelley can post the animation - for me, a picture will tell me more
than the code...

--
Mike

wk: mik### [at] pyxiscom  www.pyxis.com
hm: mwe### [at] sciticom  www.geocities.com/mikepweber


"Warp" <war### [at] tagpovrayorg> wrote in message
news:390832a3@news.povray.org...
> SHELLEY <SHE### [at] prodigynet> wrote:
> : sphere
> : {
> :   <10, 0, 0>
>      ==
>
> :   pigment {checker Violet,Yellow rotate y*(clock*360)}
>                                    =========
>
>   Can we see the problem here?
>
>   (Hint: Rotation is always made around the axes)
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Bob Hughes
Subject: Re: Source Code Help!!!! and the answer?
Date: 27 Apr 2000 13:51:13
Message: <39087e11@news.povray.org>
There were a few things wrong, but to simplify it might be easier to compare
this with the other.  Far as the math goes on this I'm no mathematician so this is
all I came up with.  I'm not sure of the intent for this animation because one of
these balls rolls over a hole and doesn't fall in  :-)  Up to you I guess.

#include "colors.inc"
#include "textures.inc"

camera
{
  location  <0.5 , 0.0 ,-10.0>
  look_at   <0.5 , 0.0 , 0.0>
}

background {SlateBlue }

light_source
{
  0*x
  color rgb 1.0
  area_light
  <8, 0, 0> <0, 0, 8>
  4, 4
  adaptive 0
  jitter
  translate <40, 80, -40>
}

#declare ground =
box
{
  <-1, -1, -1>
  < 1,  1,  1>
  pigment { Orange }
  scale 10
  translate -15*y
  scale <20,1,20> // can't scale by 0, y changed to 1
  translate 4*y
}

/* Amount of movement needs to be calculated first.
   In this case it's -8*x and 10*x, or Dist*x
   meaning the Rolls need to make abs(Dist)/(Rolls*(Radii*2*pi))
   equivalent to 1.
   Example: abs(-8)/(1.2725*(1*2*pi)) = 1
*/

#declare Rolls1=1.2725; // number of rolls
#declare Rolls2=1.59; // number of rolls
#declare Radii1=1; // ball radius
#declare Radii2=1; // ball radius

#declare MainBall =
sphere // +z rotation on y plane, -x direction
{
  0, // don't translate first or texture will be offset
  Radii1
  finish {phong 1 phong_size 90}
  pigment {checker color Violet, color Yellow}
  // typically the object is rotated, not just the texture
   rotate +z*(clock*Rolls1*360)
  translate <10,0,0>-x*(clock*(Rolls1*((Radii1*2)*pi)))
}

MainBall // here's 1st object

#declare MainBall2 =
sphere // -z rotation on y plane, +x direction
{
  0, // don't translate first or texture will be offset
  Radii2
  finish {phong 1 phong_size 90}
  pigment {checker color Black, color Yellow}
  // typically the object is rotated, not just the texture
   rotate -z*(clock*Rolls2*360)
  translate <-10,0,0>+x*(clock*(Rolls2*((Radii2*2)*pi)))
}

MainBall2 // here's 2nd object

#declare hole =
cylinder
{
  0*x,  5*x,  2
  pigment {Yellow}
  rotate 90*z
  translate <3,-5.99,0>
}

difference {
  object{ ground }
  object{ hole }}

#declare holelight =
cone
{
  1*y,  0.0,
  -1*y, 1.0
  pigment {Yellow}
  scale .5
  translate <3,-1,0>
  rotate 180*z
  translate <6,-2,0>
  scale 2
  translate -3*x
  translate -3*y
}

union {
    light_source { <2,-2,0> color White }
    object { holelight } no_shadow translate 1*y
  }


Post a reply to this message

From: Peter Popov
Subject: Re: Source Code Help!!!!
Date: 27 Apr 2000 16:51:03
Message: <5f9hgsgedmq2t9ea84oir84an1iqqips6q@4ax.com>
On Thu, 27 Apr 2000 07:16:31 -0700, "Mike Weber"
<mik### [at] pyxiscom> wrote:

>But that rotation is done before the translation - shouldn't be a problem...

The sphere is already translated -- it's center is at <10,0,0>.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Mike Weber
Subject: Re: Source Code Help!!!!
Date: 27 Apr 2000 17:07:15
Message: <3908ac03$1@news.povray.org>
hmmm... I don't have the code anymore... I must have missed that.  I sure
would like to see the animation....

--
Mike

wk: mik### [at] pyxiscom  www.pyxis.com
hm: mwe### [at] sciticom  www.geocities.com/mikepweber


"Peter Popov" <pet### [at] usanet> wrote in message
news:5f9hgsgedmq2t9ea84oir84an1iqqips6q@4ax.com...
> On Thu, 27 Apr 2000 07:16:31 -0700, "Mike Weber"
> <mik### [at] pyxiscom> wrote:
>
> >But that rotation is done before the translation - shouldn't be a
problem...
>
> The sphere is already translated -- it's center is at <10,0,0>.
>
>
> Peter Popov ICQ : 15002700
> Personal e-mail : pet### [at] usanet
> TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

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