POV-Ray : Newsgroups : povray.newusers : povray and 3D graphs : Re: povray and 3D graphs Server Time
28 Jul 2024 16:32:47 EDT (-0400)
  Re: povray and 3D graphs  
From: Daniel C  Bastos
Date: 20 Apr 2008 00:00:18
Message: <slrng0lft6.oa2.dbast0s@yahoo.com.br>
In article <48071e5a@news.povray.org>,
Tim Attwood wrote:

>> What I would like to do on your code is to keep the plane where it is
>> --- that would be my xy-plane --- and make the helix start from the
>> plane and spiral up, because that's how this helix should be as x varies
>> according to cos(t) and y to sin(t) and z = t. That is, while x and y
>> circle around, z keeps on going up (or down.)
>
> You can rotate unions like any other object, there's a good tutorial in
> the manual too.

That's true. I have already read that, when they talk about that green
cube. This seems better to write than swaping coordinates which might
seem a bit misleading.

>> So what I think it's happening here is that while I keep on thinking on
>> the xyz-axis as I do, the povray puts the z axis as going from outside
>> my screen into it. So if I swap y and z I should get what I'd like, and
>> apparently I do.
>
> POV uses a left handed coordinate system, like if you point with
> your left hand, thumb up is y, pointer finger in is z, and middle
> finger right is x. Rotations are the same way, if you trace from your
> left palm looping around your fingers that is the direction of rotation
> used for each axis.

Got it.

>> I also took your code and plotted it from -25pi to 25pi and it spirals
>> just right. Cool. I'm impressed. This is what I'm looking for. Thanks
>> for the introduction.
>
> Yeah, Warp knows his stuff =)
> I fiddled with his scene a bit...

Looks good. I took 

                    #declare Z = function(T) { T };

and made it 

                   #declare Z = function(T) { T/3 };

so that we can see it looking more like a spring. Looks pretty
good. This is the kind of function graph I'd like to have. :-) Cool
stuff.

>
> #include "colors.inc"
>
> camera {
>    location <0,2.5,-7>
>    right    x*image_width/image_height
>    look_at  <0,2,0>
> }
>
> light_source {
>    <-20, 30, 0>
>    White
> }
> light_source {
>    <0,2.5,-8>
>    White
> }
>
> sky_sphere {
>    pigment {
>       gradient y
>       color_map {
>          [0 Black]
>          [0.5 Gray75]
>          [1 Black]
>       }
>    }
> }
>
> #declare X = function(T) { sin(T) };
> #declare Y = function(T) { cos(T) };
> #declare Z = function(T) { T };
>
> #declare CylRadius = 0.1;
> #declare MinT = 0;
> #declare MaxT = 2*pi;
> #declare Steps = 100;
>
> union {
>
>    #declare Ind = 0;
>    #while(Ind < Steps)
>       #declare T1 = MinT + (MaxT-MinT)*Ind/Steps;
>       #declare T2 = MinT + (MaxT-MinT)*(Ind+1)/Steps;
>       #declare P1 = <X(T1), Y(T1), Z(T1)>;
>       #declare P2 = <X(T2), Y(T2), Z(T2)>;
>       sphere { P1, CylRadius }
>       cylinder { P1, P2, CylRadius }
>       #declare Ind = Ind+1;
>    #end
>
>    texture {
>       pigment {Orange}
>       normal {bumps scale 0.02}
>       finish {
>          specular 0.3
>          roughness 0.005
>       }
>    }
>
>    rotate <-90,0,0>
>    translate <0,-1,2.5>
> }
>
> plane { y, -1
>    pigment {
>       cells
>       color_map {
>          [0 Blue]
>          [1 ForestGreen]
>       }
>    }
> }
>
>


Post a reply to this message

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