POV-Ray : Newsgroups : povray.binaries.images : The five rings : Re: The five rings Server Time
15 Aug 2024 22:22:01 EDT (-0400)
  Re: The five rings  
From: Shay
Date: 20 Apr 2002 13:15:11
Message: <3cc1a21f$1@news.povray.org>
"Sam Van Oort" <sam### [at] yahoocom> wrote in message
news:3cc0f7d5@news.povray.org...
> I worship you!
> #include "Bow_Down.inc"
> #include "Chant_Gibberish.inc"
> #include "Virgin_Sacrifice.inc"
> OOPS! How did that last one slip in? :)
>

Wow! Thanks!

> Now, the question is, HOW THE HECK did you do that with sweeps?
> Are you using Rhino and exporting as a mesh?  Is this an obscure math
> function?

I *might* mess with Rhino if I ever master Pov-Ray.

The function is anything but obscure. I don't have the code anymore, and
even if I did it would be at work, but I will show you how I created the
function. I just used trig operators and made a separate function for each
direction <x,y,z>.

In case anyone reading this is not familiar with trig, I will show you the
pattern of the operators used.
R = a value in radians given to the functions.

sin (R=0) 0 --> (R=1/2*pi) 1 --> (R=pi) 0 --> (R=3/2*pi) -1 --> (R=2*pi) 0
cos (R=0) 1 --> (R=1/2*pi) 0 --> (R=pi) -1 --> (R=3/2*pi) 0 --> (R=2*pi) 1

basically, if the angle were drawn on the x-y plane, sin would be equal to
the value of y at the end of the angle vector and cos would be equal to x.

First make a circle on the x,z plane
x = {cos(R)}
y = 0
z = {sin(R)}

Now I want to make the ring dip up and down on the y-axis. I want this to
happen twice, so I multipy the sin by 2 to get my y-value
x = {cos(R)}
y = {sin(2*R)}
z = {sin(R)}

I now have a circle on the x-z plane with a radius of one which dips up and
down on the y plane from y=1 to y=-1 all I have to do is add the weave
pattern so the sweep will dip under and over each other. I do this by taking
the values which give the edge of the ring (x and z) and multiplying them by
a number just over or just under one. Sin cycles from 0 to 1 to 0 to -1 to
0, so for each time the sweep goes over and then under, I need sin to go
through a cycle. The sweep does this twice each time it goes up the y-axis
and twice each time it goes down the y-axis. The sweep goes up twice and
down twice, so I will need sin to cycle a total of 8 times as it goes around
my radius one circle. Since sin can be as high as one and as low as negative
one and my ring only has a radius of 1, I need to shrink the value that sin
returns so it only effects the radius of the ring a little bit.
x = {cos(R) * sin(R*8)/10}
y = {sin(2*R)}
z = {sin(R) * sin(R*8)/10}

This should be it (untested). Now you can feed values in from 0 to 2*pi and
get a weaving and dipping loop. The Sheap_Sweep macro I posted in p.b.s-f
recently will take those values and draw a sweep out of them.

Let me know if anything here is not clear.

 -Shay


Post a reply to this message

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