





 
 




 
 


Hi
I was wondering if there is a simple way
to draw a helix on a sinus. Instead of having a straigh helix
we should have a helix that would follow a sine function. It seems
hard but may be I am not optimising the code. so far it is not working
regards
Post a reply to this message


 
 




 
 


"sahraoui" <sch### [at] uiucedu> wrote:
> Hi
>
> I was wondering if there is a simple way
> to draw a helix on a sinus. Instead of having a straigh helix
> we should have a helix that would follow a sine function. It seems
> hard but may be I am not optimising the code. so far it is not working
>
> regards
I would turn to parametric objects, with them you can get pretty much
anything that strikes your fancy, provided you know your way around them.
I'm not too familiar with them myself, but I do know you can find pointers
at Mike Williams page:
http://www.econym.demon.co.uk/isotut/parametric.htm
The helix isn't mentioned over there, at least I haven't found it with only
a quick sweep, but its parametric equation is:
#declare Fx = function {sin(5*v)}
#declare Fy = function {v}
#declare Fz = function {cos(5*v)}
parametric {
function {Fx(u,v,0)}
function {Fy(u,v,0)}
function {Fz(u,v,0)}
<2*pi,pi>,<4*pi,2.1*pi>
contained_by{box{2,2}}
precompute 18, x,y,z
pigment {rgb x}
}
If you render the above you'll only see a series of dots in a helix pattern,
that is because the above formula implies 0 thickness. I do not know how to
change it so that it becomes a sphere sweep of a given radius along the
helix.
Anyway, to address your question, simply modify Fy (the helix's axis) to
accomodate for a sin(v) or whatnot.
Parametric objects render exceedingly slowly, so you may want to use Ingo
Janssen's param.inc. You can find more details at Mike Williams page.
Post a reply to this message


 
 




 
 


Actually
I use a while loop to make my spiral and I can make
as many as possible and it is rather simple
it is a translation and a rotation.
BUT with this method it is not easy to make the helix
follow a sine curve.
sigh!
"Grassblade" <nomail@nomail> wrote:
> "sahraoui" <sch### [at] uiucedu> wrote:
> > Hi
> >
> > I was wondering if there is a simple way
> > to draw a helix on a sinus. Instead of having a straigh helix
> > we should have a helix that would follow a sine function. It seems
> > hard but may be I am not optimising the code. so far it is not working
> >
> > regards
>
> I would turn to parametric objects, with them you can get pretty much
> anything that strikes your fancy, provided you know your way around them.
> I'm not too familiar with them myself, but I do know you can find pointers
> at Mike Williams page:
> http://www.econym.demon.co.uk/isotut/parametric.htm
>
> The helix isn't mentioned over there, at least I haven't found it with only
> a quick sweep, but its parametric equation is:
>
> #declare Fx = function {sin(5*v)}
> #declare Fy = function {v}
> #declare Fz = function {cos(5*v)}
>
> parametric {
> function {Fx(u,v,0)}
> function {Fy(u,v,0)}
> function {Fz(u,v,0)}
> <2*pi,pi>,<4*pi,2.1*pi>
> contained_by{box{2,2}}
> precompute 18, x,y,z
> pigment {rgb x}
> }
>
> If you render the above you'll only see a series of dots in a helix pattern,
> that is because the above formula implies 0 thickness. I do not know how to
> change it so that it becomes a sphere sweep of a given radius along the
> helix.
> Anyway, to address your question, simply modify Fy (the helix's axis) to
> accomodate for a sin(v) or whatnot.
>
> Parametric objects render exceedingly slowly, so you may want to use Ingo
> Janssen's param.inc. You can find more details at Mike Williams page.
Post a reply to this message


 
 




 
 


Wasn't it sahraoui who wrote:
>Actually
>I use a while loop to make my spiral and I can make
>as many as possible and it is rather simple
>it is a translation and a rotation.
>BUT with this method it is not easy to make the helix
>follow a sine curve.
If you're using a sphere_sweep, like this
#declare R1=1.5;
#declare F1=1.2;
#declare R2=0.15;
#declare N=100;
#declare H=10;
sphere_sweep {
b_spline
100,
#declare Y=0;
#while (Y<N)
<R1*sin(F1*Y),Y*H/NH/2,R1*cos(F1*Y)>,R2
#declare Y=Y+1;
#end
pigment {rgb 1}
}
Then you can just add an extra sinusoidal factor to the x value of the
points, like this
#declare R1=1.5;
#declare F1=1.2;
#declare R2=0.15;
#declare N=100;
#declare H=10;
#declare F2=0.2;
#declare A=0.25;
sphere_sweep {
b_spline
100,
#declare Y=0;
#while (Y<N)
<R1*sin(F1*Y)+A*sin(F2*Y),Y*H/NH/2,R1*cos(F1*Y)>,R2
#declare Y=Y+1;
#end
pigment {rgb 1}
}

Mike Williams
Gentleman of Leisure
Post a reply to this message


 
 




 
 


Hi Mike
Thanks a lot for the file.
Actually i was trying that same loop
but got entangled inside and got the code
to run forever until I saw your message. thanks again.
The parametric stuff did not work for some reason.
Now here is the thing. What you sent me make the spiral follow
the sinus line indeed but BUT every "circle" of the spiral
is NOT perpendicular to the line of the sinus but it
is always perpendicular to the horizontal.
In other words your code produce a helix who axis is
always parallel to the horizontal
but what would be perfect is a helix whose axis
is parallel to the sinus fonction that follows, andn that I beleive
is not a piece of cake...but may be not for you Oh gentleman of Leisure
embedding that into a larger sheet of beads would be quite a challenge too.
Regards and have a great week end
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it sahraoui who wrote:
> >Actually
> >I use a while loop to make my spiral and I can make
> >as many as possible and it is rather simple
> >it is a translation and a rotation.
> >BUT with this method it is not easy to make the helix
> >follow a sine curve.
>
> If you're using a sphere_sweep, like this
>
> #declare R1=1.5;
> #declare F1=1.2;
> #declare R2=0.15;
> #declare N=100;
> #declare H=10;
>
> sphere_sweep {
> b_spline
> 100,
> #declare Y=0;
> #while (Y<N)
> <R1*sin(F1*Y),Y*H/NH/2,R1*cos(F1*Y)>,R2
> #declare Y=Y+1;
> #end
> pigment {rgb 1}
> }
>
> Then you can just add an extra sinusoidal factor to the x value of the
> points, like this
>
> #declare R1=1.5;
> #declare F1=1.2;
> #declare R2=0.15;
> #declare N=100;
> #declare H=10;
>
> #declare F2=0.2;
> #declare A=0.25;
>
> sphere_sweep {
> b_spline
> 100,
>
> #declare Y=0;
> #while (Y<N)
> <R1*sin(F1*Y)+A*sin(F2*Y),Y*H/NH/2,R1*cos(F1*Y)>,R2
> #declare Y=Y+1;
> #end
> pigment {rgb 1}
> }
>
>
> 
> Mike Williams
> Gentleman of Leisure
Post a reply to this message


 
 




 
 


Thanks for the message.
Actually I like the power of parametric objects.
I am not sure however how to make these dotes spheres howeve
Also in param.inc there was a line
#include makemesh.inc
but I am not sure where is that include file.
thanks
"Grassblade" <nomail@nomail> wrote:
> "sahraoui" <sch### [at] uiucedu> wrote:
> > Hi
> >
> > I was wondering if there is a simple way
> > to draw a helix on a sinus. Instead of having a straigh helix
> > we should have a helix that would follow a sine function. It seems
> > hard but may be I am not optimising the code. so far it is not working
> >
> > regards
>
> I would turn to parametric objects, with them you can get pretty much
> anything that strikes your fancy, provided you know your way around them.
> I'm not too familiar with them myself, but I do know you can find pointers
> at Mike Williams page:
> http://www.econym.demon.co.uk/isotut/parametric.htm
>
> The helix isn't mentioned over there, at least I haven't found it with only
> a quick sweep, but its parametric equation is:
>
> #declare Fx = function {sin(5*v)}
> #declare Fy = function {v}
> #declare Fz = function {cos(5*v)}
>
> parametric {
> function {Fx(u,v,0)}
> function {Fy(u,v,0)}
> function {Fz(u,v,0)}
> <2*pi,pi>,<4*pi,2.1*pi>
> contained_by{box{2,2}}
> precompute 18, x,y,z
> pigment {rgb x}
> }
>
> If you render the above you'll only see a series of dots in a helix pattern,
> that is because the above formula implies 0 thickness. I do not know how to
> change it so that it becomes a sphere sweep of a given radius along the
> helix.
> Anyway, to address your question, simply modify Fy (the helix's axis) to
> accomodate for a sin(v) or whatnot.
>
> Parametric objects render exceedingly slowly, so you may want to use Ingo
> Janssen's param.inc. You can find more details at Mike Williams page.
Post a reply to this message


 
 




 
 


Wasn't it sahraoui who wrote:
>Hi Mike
>
>Thanks a lot for the file.
>Actually i was trying that same loop
>but got entangled inside and got the code
>to run forever until I saw your message. thanks again.
>The parametric stuff did not work for some reason.
>
>Now here is the thing. What you sent me make the spiral follow
>the sinus line indeed but BUT every "circle" of the spiral
>is NOT perpendicular to the line of the sinus but it
>is always perpendicular to the horizontal.
>In other words your code produce a helix who axis is
>always parallel to the horizontal
>but what would be perfect is a helix whose axis
>is parallel to the sinus fonction that follows, andn that I beleive
>is not a piece of cake...but may be not for you Oh gentleman of Leisure
The basic strategy would be to tilt each "circle" by an amount that
varied with the cosine. The tricky bit would be to calculate the correct
value for the amount of tilt ("B" in the following code) from the other
values.
#declare R1=1.5;
#declare F1=1.2;
#declare R2=0.15;
#declare N=100;
#declare H=10;
#declare F2=0.2;
#declare A=0.5;
#declare B=0.2;
sphere_sweep {
b_spline
100,
#declare Y=0;
#while (Y<N)
#declare X=R1*sin(F1*Y)+A*sin(F2*Y);
<X, Y*H/NH/2 + B*X*cos(F2*Y) , R1*cos(F1*Y)>,R2
#declare Y=Y+1;
#end
pigment {rgb 1}
}
>embedding that into a larger sheet of beads would be quite a challenge too.
In what way?

Mike Williams
Gentleman of Leisure
Post a reply to this message


 
 




 
 


"sahraoui" <sch### [at] uiucedu> wrote:
> Thanks for the message.
> Actually I like the power of parametric objects.
> I am not sure however how to make these dotes spheres howeve
> Also in param.inc there was a line
> #include makemesh.inc
> but I am not sure where is that include file.
>
> thanks
I just posted the parametric equation for the "straight" tubular helix on
your other thread. Makemesh.inc should be in Ingo's zip. To run param.inc
you need to tell POVray where to look for makemesh.inc, you can either
drop all the inc's in POVray/ include directory, or edit povray.ini in the
renderer directory to point to whatever directory you unzipped the param
tool in. This is in the Windows version, I do not know if or how the Mac
version differs.
Post a reply to this message


 
 




 
 


Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it sahraoui who wrote:
> >Hi Mike
> >
> >Thanks a lot for the file.
> >Actually i was trying that same loop
> >but got entangled inside and got the code
> >to run forever until I saw your message. thanks again.
> >The parametric stuff did not work for some reason.
> >
> >Now here is the thing. What you sent me make the spiral follow
> >the sinus line indeed but BUT every "circle" of the spiral
> >is NOT perpendicular to the line of the sinus but it
> >is always perpendicular to the horizontal.
> >In other words your code produce a helix who axis is
> >always parallel to the horizontal
> >but what would be perfect is a helix whose axis
> >is parallel to the sinus fonction that follows, andn that I beleive
> >is not a piece of cake...but may be not for you Oh gentleman of Leisure
>
> The basic strategy would be to tilt each "circle" by an amount that
> varied with the cosine. The tricky bit would be to calculate the correct
> value for the amount of tilt ("B" in the following code) from the other
> values.
>
> #declare R1=1.5;
> #declare F1=1.2;
> #declare R2=0.15;
> #declare N=100;
> #declare H=10;
>
> #declare F2=0.2;
> #declare A=0.5;
> #declare B=0.2;
>
> sphere_sweep {
> b_spline
> 100,
> #declare Y=0;
> #while (Y<N)
> #declare X=R1*sin(F1*Y)+A*sin(F2*Y);
> <X, Y*H/NH/2 + B*X*cos(F2*Y) , R1*cos(F1*Y)>,R2
> #declare Y=Y+1;
> #end
> pigment {rgb 1}
> }
>
> >embedding that into a larger sheet of beads would be quite a challenge too.
>
> In what way?
>
Here what I am trying to do;
What follow are not very optimized. Some parameters
were there but they are superfluous now...
#declare Ball =
sphere{<0,0,0>,0.15
texture{
pigment{color rgb<1,0.65,0.0>}
finish {diffuse 0.9 phong 1}
}// end of texture
// texture component
// defines an object's surface bumpiness
}// end of sphere
#declare rods =
cylinder{<0,0,0>,<0,2,0>,0.1
//cylinder {
// 0.01*x, 0.02*x, 1
open
texture{
pigment{color rgb<1,0,0>}
normal { bumps 0.5 scale <0.005,0.25,0.005>}
finish {diffuse 0.9 phong 1}
}
}
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.2;// step value
// loop start Z:
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
// loop start X:
#while ( X < EndX + Step)
object{ Ball
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
object{ rods
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
#declare Ball =
sphere{<0,2,0>,0.15
texture{
pigment{color rgb<1,0.65,0.0>}
finish {diffuse 0.9 phong 1}
}// end of texture
}// end of sphere
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.2;// step value
// loop start Z:
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
// loop start X:
#while ( X < EndX + Step)
object{ Ball
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
//THis is the water sheet in blue made of cylinders
#declare rods =
cylinder{<0,2.05,0>,<0,2.5,0>,0.11
//cylinder {
// 0.01*x, 0.02*x, 1
//open
texture{
pigment{color rgb<0,0.3,1>}
normal { bumps 0.5 scale <0.005,0.25,0.005>}
finish {diffuse 0.9 phong 1}
}
// texture component
// defines an object's surface bumpiness
}
//this loop will make the water sheet
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.2;// step value
// loop start Z:
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
// loop start X:
#while ( X < EndX + Step)
object{ rods
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
//This is the next monolayer
#declare Ball =
sphere{<0,2.55,0>,0.15
texture{
pigment{color rgb<1,0.65,0.0>}
finish {diffuse 0.9 phong 1}
}// end of texture
}// end of sphere
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.2;// step value
// loop start Z:
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
// loop start X:
#while ( X < EndX + Step)
object{ Ball
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
//this will make the aliphatic layers
#declare rods =
cylinder{<0,2.7,0>,<0,4.7,0>,0.11
//cylinder {
// 0.01*x, 0.02*x, 1
//open
texture{
pigment{color rgb<1,0,0>}
normal { bumps 0.5 scale <0.005,0.025,0.005>}
finish {diffuse 0.99 phong 1}
}
// texture component
// defines an object's surface bumpiness
}
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.2;// step value
// loop start Z:
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
// loop start X:
#while ( X < EndX + Step)
object{ rods
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
//This is the next monolayer with links between some spheres
//THis IS THE SPIRALs
//spiral
#declare Amplitude = 0.160 ;
#declare Minimal_Length = 0.80 ;
#declare Middle_Length = Amplitude + Minimal_Length ; //superfluous
parameter
#declare Sp_Length = Middle_Length+Amplitude*sin((clock+Time_test)*2*pi);
#declare Spiral = // the spiral
union{
#local N_per_Rev = 125; // Number of Elements per revolutions
#local N_of_Rev = 8.00; // Total number of revolutions
#local H_per_Ref = Middle_Length / N_of_Rev;
#local Nr = 0; // start loop
#while (Nr< N_per_Rev*N_of_Rev)
sphere{ <0,4.8,0>,0.025
translate<0.05, 0, Nr*H_per_Ref/N_per_Rev>
//rotate<0,0, Nr * 360/N_per_Rev>
rotate<0,0,Nr*360/N_per_Rev>
texture{ Chrome_Metal
finish {ambient 0.15 diffuse 0.85 phong 1}}
}
#local Nr = Nr + 1; // next Nr
#end //  end of loop
} // end of union  end of spiral
// end
#declare Ball =
sphere{<0,4.8,0>,0.15
texture{
pigment{color rgb<1,0.65,0.0>}
finish {diffuse 0.9 phong 1}
}// end of texture
}// end of sphere
#declare links =
cylinder{<0,4.8,0>,<0.,4.8,0.2>,0.05
texture{
pigment{color rgb<1,1,0>}
normal { bumps 0.5 scale <0.005,0.25,0.005>}
finish {diffuse 0.9 phong 1}
}
// texture component
// defines an object's surface bumpiness
}
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.2;// step value
// loop start Z:
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
// loop start X:
#while ( X < EndX + Step)
object{ Ball
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
object{Spiral
translate<X,0.1*X*sin(2*Z)
+0.1*Z*cos(2*X),Z>}
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
//This is the network of spring
//first we construct a helix
#declare E = 5;
#declare Z = E; // start value Z
#declare EndZ = E; // end value Z
#declare Step = 0.5;// step value
#while ( Z < EndZ + Step)
#declare X = E; // start value X
#declare EndX = E; // end value X
#while ( X < EndX + Step)
#declare X = X+Step;//next X value
#end //  loop end X
#declare Z = Z+Step;//next Z value
#end //  loop end Z
and the last sheet should have random spring attached to the beads.
Meaning that if you span the sheet you find five consecutive spring
connecting
the beads and sometimes you find less or more..like this:
#declare Rnd_1 = seed (1153);
#declare Ball =
sphere{<0,0,0>,0.25
texture{
pigment{color rgb<1,0.8,0>}
finish {diffuse 0.9 phong 1}
}// end of texture
}// end of sphere
//
//
#declare links =
cylinder{<0,0,0>,<0.59,0,0.0>,0.051
texture{
pigment{color rgb<1,1,0>}
//normal { bumps 0.5 scale <0.005,0.25,0.005>}
finish {diffuse 0.19 phong 1}
}
}
//end of rods
//spiral
#declare Amplitude = 0.160 ;
#declare Minimal_Length = 0.80 ;
#declare Middle_Length = Amplitude + Minimal_Length ;
#declare Sp_Length = Middle_Length+Amplitude*sin((clock+Time_test)*2*pi);
#declare Spiral = // the spiral
union{
#local N_per_Rev = 125; // Number of Elements per revolutions
#local N_of_Rev = 8.00; // Total number of revolutions
#local H_per_Ref = Middle_Length / N_of_Rev;
#local Nr = 0; // start loop
#while (Nr< N_per_Rev*N_of_Rev)
sphere{ <0,0,0>,0.025
translate<0.05, 0, Nr*H_per_Ref/N_per_Rev>//
rotate<0,0,Nr*360/N_per_Rev>
texture{ Chrome_Metal
finish {ambient 0.15 diffuse 0.85 phong 1}}
}
#local Nr = Nr + 1; // next Nr
#end //  end of loop
} // end of union  end of spiral
// end
#declare X=5;
#declare EndX = 5; // end value X
#declare Step = 0.85;// step value
#while ( X < EndX + Step)//loop start
object{ Ball translate <X,0,0>}
#declare X = X + Step; // next X
#end //  loop end
#declare Z = 5; // start value Z
#declare EndZ = 5; // end value Z
#declare Step = 0.85;// step value
#while ( Z < EndZ*2 + Step)
#declare X = 5; // start value X
#declare EndX = 5;// end value X
#while ( X < EndX*2 + Step)
object{ Ball translate <X,0,Z>}
object{Spiral translate<X,0,Z*5*rand(Rnd_1)>}
#declare X = X + Step;//next X
#end //  loop end X
#declare Z = Z + Step; //next Z
#end //  loop end Z
> 
> Mike Williams
> Gentleman of Leisure
Post a reply to this message


 
 




 
 


which thread. I did not see your posting.
Are you talking about the f_helix?
Again neither param.inc nor f_helix let you
play with the origin of the helix.
Like I said to mike williams,
you cannot put thesee helices on a lattice.
I can send you the image of the helices on
a square lattice but did not put the sinus
in effect.
thanks
"Grassblade" <nomail@nomail> wrote:
> "sahraoui" <sch### [at] uiucedu> wrote:
> > Thanks for the message.
> > Actually I like the power of parametric objects.
> > I am not sure however how to make these dotes spheres howeve
> > Also in param.inc there was a line
> > #include makemesh.inc
> > but I am not sure where is that include file.
> >
> > thanks
> I just posted the parametric equation for the "straight" tubular helix on
> your other thread. Makemesh.inc should be in Ingo's zip. To run param.inc
> you need to tell POVray where to look for makemesh.inc, you can either
> drop all the inc's in POVray/ include directory, or edit povray.ini in the
> renderer directory to point to whatever directory you unzipped the param
> tool in. This is in the Windows version, I do not know if or how the Mac
> version differs.
Post a reply to this message


 
 




 

