POV-Ray : Newsgroups : povray.general : Emergency help: Can someone teach me how to make spirals? Server Time
6 Jan 2025 18:16:47 EST (-0500)
  Emergency help: Can someone teach me how to make spirals? (Message 1 to 7 of 7)  
From: DD123
Subject: Emergency help: Can someone teach me how to make spirals?
Date: 3 Jan 2025 21:50:00
Message: <web.6778a14c75c33f99c838269347e8d5e0@news.povray.org>
Hello everyone,

The task asked me to create an image just like the one in Figure 1. There are 5
revolutions in it. So far my code can only create 1  revolution.


#include "colors.inc"
#include "shapes.inc"

camera {
location <6, 9, -13>
look_at <0, 0, 0>
angle 45}
light_source {
<-5, 10, -20>
color 2*White
shadowless}
global_settings {ambient_light 3*White}



sphere_sweep {
linear_spline 11,

#declare N = 0;
#while(N < 11)
#declare RAD = 2*pi*30*N/360;
<2*cos(RAD), 0, 2*sin(RAD)>, 0.1
#declare N = N + 1;
#end
pigment {color Yellow}
}

The outcome can only create 1 revolution of the spiral. I have an external file
that can define the x,y,z axis. Can someone teach me how to create spirals
exactly like figure 1?

Cheers!


Post a reply to this message


Attachments:
Download '1.png' (32 KB)

Preview of image '1.png'
1.png


 

From: yesbird
Subject: Re: Emergency help: Can someone teach me how to make spirals?
Date: 3 Jan 2025 23:24:23
Message: <6778b7f7@news.povray.org>
On 04/01/2025 05:49, DD123 wrote:
> Hello everyone,
> ...
> Can someone teach me how to create spirals exactly like figure 1?

This way, maybe:

//----------------------------------------------------
#include "colors.inc"
#include "shapes.inc"

global_settings {ambient_light 2*White}

camera {
location <6, 9, -13> / 2.5
look_at <0, 0.8, 0>
angle 45}

background { color rgb <0.2, 0.22, 0.2> }

light_source{< -300, 300, -300> color White}
light_source { <-5, 10, -20> color White shadowless}

#declare Ball =
  sphere{ <0,0,0>,0.15 scale <1,1,1> rotate<0,0,0> translate<0,0,0>
	 texture{ pigment{ color rgb<1,0.7,0>}
                  finish { phong 1}}}

union{
  #local Nr = 0;            // start
  #local N_per_Rev = 500;   // Number of Elements per revolutions
  #local N_of_Rev  = 4.00;  // Total number of revolutions
  #while (Nr< N_per_Rev*N_of_Rev)
    object{Ball translate<1,Nr*0.45/N_per_Rev,0>
                rotate<0,Nr * 360/N_per_Rev,0>}

  #local Nr = Nr + 1;    // next Nr
  #end // ---------------  end of loop
rotate<0,0,0>
translate<0,0,0>
}
//----------------------------------------------------

This one of loop example, see more in POV-Ray UI:
Menu / Insert / Loop ...
--
YB


Post a reply to this message


Attachments:
Download 'spiral.png' (84 KB)

Preview of image 'spiral.png'
spiral.png


 

From: Kenneth
Subject: Re: Emergency help: Can someone teach me how to make spirals?
Date: 4 Jan 2025 06:30:00
Message: <web.67791af43c0a8cfae83955656e066e29@news.povray.org>
"DD123" <286### [at] qqcom> wrote:
> Hello everyone,
> Can someone teach me how to create spirals
> exactly like figure 1?
>

Here is a slightly re-worked version of your code (and uses many more spline
points to get smoother curves.) Note the '150' in three places.

sphere_sweep {
linear_spline 150,
#declare N = 0;
#while(N < 150)
#declare RAD = N*9*pi/150; // 9*pi produces 4 1/2 'coils'
<2*cos(RAD), .028*N, 2*sin(RAD)>, .1
#declare N = N + 1;
#end
pigment {color Yellow}
}

Have fun!


Post a reply to this message


Attachments:
Download 'spiral_test_from_newsgroups.png' (52 KB)

Preview of image 'spiral_test_from_newsgroups.png'
spiral_test_from_newsgroups.png


 

From: DD123
Subject: Re: Emergency help: Can someone teach me how to make spirals?
Date: 4 Jan 2025 07:00:00
Message: <web.677922bd3c0a8cfac838269347e8d5e0@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "DD123" <286### [at] qqcom> wrote:
> > Hello everyone,
> > Can someone teach me how to create spirals
> > exactly like figure 1?
> >
>
> Here is a slightly re-worked version of your code (and uses many more spline
> points to get smoother curves.) Note the '150' in three places.
>
> sphere_sweep {
> linear_spline 150,
> #declare N = 0;
> #while(N < 150)
> #declare RAD = N*9*pi/150; // 9*pi produces 4 1/2 'coils'
> <2*cos(RAD), .028*N, 2*sin(RAD)>, .1
> #declare N = N + 1;
> #end
> pigment {color Yellow}
> }
>
> Have fun!

Hello, mate. Your code is really helpful. Now I can create the one that is
really close to the final outcome. However, I met some problems with the
coordinates this spring. The picture is the outcome given by your code. I would
appreciate it if you could help me with it (by how to shift the spring to the
left and down a bit).


Post a reply to this message


Attachments:
Download '4.png' (28 KB)

Preview of image '4.png'
4.png


 

From: jr
Subject: Re: Emergency help: Can someone teach me how to make spirals?
Date: 4 Jan 2025 07:20:00
Message: <web.677926c13c0a8cfab2e841a6cde94f1@news.povray.org>
hi,

"DD123" <286### [at] qqcom> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
> > "DD123" <286### [at] qqcom> wrote:
> > > Hello everyone,
> > > Can someone teach me how to create spirals
> > > exactly like figure 1?
> > >
> >
> > Here is a slightly re-worked version of your code (and uses many more spline
> > points to get smoother curves.) Note the '150' in three places.
> >
> > sphere_sweep {
> > linear_spline 150,
> > #declare N = 0;
> > #while(N < 150)
> > #declare RAD = N*9*pi/150; // 9*pi produces 4 1/2 'coils'
> > <2*cos(RAD), .028*N, 2*sin(RAD)>, .1
> > #declare N = N + 1;
> > #end
> > pigment {color Yellow}
> > }
> >
> > Have fun!
> ...
> appreciate it if you could help me with it (by how to shift the spring to the
> left and down a bit).

<https://wiki.povray.org/content/Reference:Transformations#Translate>


regards, jr.


Post a reply to this message

From: jr
Subject: Re: Emergency help: Can someone teach me how to make spirals?
Date: 4 Jan 2025 07:30:00
Message: <web.677929843c0a8cfab2e841a6cde94f1@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> ...
> > ...
> > appreciate it if you could help me with it (by how to shift the spring to the
> > left and down a bit).
>
> <https://wiki.povray.org/content/Reference:Transformations#Translate>

sorry, forgot.  the wiki is the "always up-to-date" documentation.  hth.


regards, jr.


Post a reply to this message

From: DD123
Subject: Re: Emergency help: Can someone teach me how to make spirals?
Date: 4 Jan 2025 07:35:00
Message: <web.67792a9d3c0a8cfac838269347e8d5e0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > ...
> > > ...
> > > appreciate it if you could help me with it (by how to shift the spring to the
> > > left and down a bit).
> >
> > <https://wiki.povray.org/content/Reference:Transformations#Translate>
>
> sorry, forgot.  the wiki is the "always up-to-date" documentation.  hth.
>
>
> regards, jr.

Cheers mate!


Post a reply to this message

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