POV-Ray : Newsgroups : povray.general : Spiral tube? Server Time
23 Dec 2024 11:54:52 EST (-0500)
  Spiral tube? (Message 1 to 10 of 20)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: Spiral tube?
Date: 6 Jan 2016 00:48:09
Message: <568caa99$1@news.povray.org>
How do I create a spiral tube, like a spring? Like this:

http://www.f-lohmueller.de/pov_tut/animate/anim16e.htm

but a single object, not a union of spheres?

Thanks!


Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: Spiral tube?
Date: 6 Jan 2016 03:11:21
Message: <568ccc29$1@news.povray.org>
On 6-1-2016 6:48, Mike Horvath wrote:
> How do I create a spiral tube, like a spring? Like this:
>
> http://www.f-lohmueller.de/pov_tut/animate/anim16e.htm
>
> but a single object, not a union of spheres?
>
> Thanks!
>
In a modeller, this is pretty easy, for instance building a spiral line 
segment (aka a spline) and an appropriate surface to follow it. However, 
that may not be what you want.

-- 
Thomas


Post a reply to this message

From: Le Forgeron
Subject: Re: Spiral tube?
Date: 6 Jan 2016 03:55:58
Message: <568cd69e$1@news.povray.org>
Le 06/01/2016 09:11, Thomas de Groot a écrit :
> On 6-1-2016 6:48, Mike Horvath wrote:
>> How do I create a spiral tube, like a spring? Like this:
>>
>> http://www.f-lohmueller.de/pov_tut/animate/anim16e.htm
>>
>> but a single object, not a union of spheres?
>>
>> Thanks!
>>
> In a modeller, this is pretty easy, for instance building a spiral line
> segment (aka a spline) and an appropriate surface to follow it. However,
> that may not be what you want.
>

generating a spline along an helix is rather easy. Then if sphere_sweep 
is acceptable, the problem is solved.

Now, do you considere sphere_sweep a single object ?


Post a reply to this message

From: Stephen
Subject: Re: Spiral tube?
Date: 6 Jan 2016 05:17:47
Message: <568ce9cb@news.povray.org>
On 1/6/2016 5:48 AM, Mike Horvath wrote:
> How do I create a spiral tube, like a spring? Like this:
>
> http://www.f-lohmueller.de/pov_tut/animate/anim16e.htm
>
> but a single object, not a union of spheres?
>
> Thanks!
>

Many years ago I asked a similar question and was given a macro to 
create spiral tubes consisting of torus-segments. It is not a single 
object but it is contiguous. The annotations are mostly by Frank 
(Sputnik) and it is just pulled out of an old scene of mine. It is a 
long spring with the helix tightening at the ends.


#declare Y_Adjust = 0 ;                                // <- Mine
// Spring_with_Ends
// Spring_Sputnik
// Spiral  by Sputnik

#declare RotSpeed =  -9720*(frame_number/599 );        // <- Mine

#declare HeightOffset = 6.5 ; //11.750;
#declare SpringHeight =  13  ;
#declare SpringMajorRadius = .4;          //2;
#declare SpringMinorRadius = .060;
#declare SpringRevolutions = 24;
#declare SpringSegments = 5*SpringRevolutions ; // 5*SpringRevolutions is
                               // enough for #macro Spiral

#declare SpringHeight2 = 0.5;
#declare SpringRevolutions2 = 2;
#declare SpringSegments2 = 5*SpringRevolutions2; // 5*SpringRevolutions is
                               // enough for #macro Spiral
#declare SpringHeight3  = 0.5;
#declare SpringRevolutions3 = 2;
#declare SpringSegments3 = 5*SpringRevolutions3; // 5*SpringRevolutions is
                               // enough for #macro Spiral

// SPIRAL 
///////////////////////////////////////////////////////////////////

#macro Spiral ( Radius1, Radius0, Rise, Turns, Segments )

   // Radius1 : major radius
   // Radius1 : minor radius
   // Rise    : height of a single turn
   // Turns   : number of turns (may be non-integer)
   // Segments: number of tori in spiral
   //           (>= 2*Turns; usually 5*Turns ... 10*Turns is enough)

   // some calculations ...
   #local Ang= Turns*360/Segments;
   #local Ri = Rise/2 * Turns/Segments;
   #local Sin= sin(radians(Ang/2));
   #local A  = Radius1*Sin;
   #local B  = sqrt(Radius1*Radius1-A*A);
   #local C  = A*A/B;
   #local DD = Ri*Ri+A*A;
   #local E  = DD/C;
   #local W  = degrees(atan2(C,sqrt(DD)));
   #local R  = sqrt(E*(E+C));

   // single torus-segment
   #declare T =
     intersection {
       torus { R, Radius0 }
       plane { -x, 0 rotate  W*y }
       plane {  x, 0 rotate -W*y }
       bounded_by { box {
         1.001*<-(R+Radius0)*Sin, -Radius0, -(R+Radius0)>,
         1.001*< (R+Radius0)*Sin,  Radius0, -(R-Radius0)*(1-Sin*Sin)>
         } }
       rotate -degrees(atan2(Ri,A))*z
       translate <0, Ri, E-B>
       rotate Ang/2*y
       }
   // stack the segments
   union {
     #local N = 0;
     #while (N<Segments)
       object { T rotate N*Ang*y translate N*2*Ri*y }
       #local N = N+1;
       #end//while
     // no "}" to allow modifiers
   #end//macro Spiral

/////////////////////////////////////////////////////////////////////////////

   // spring consisting of torus-segments
   #declare Spring =
     Spiral (
       SpringMajorRadius,
       SpringMinorRadius,
       SpringHeight/SpringRevolutions,
       SpringRevolutions,
       SpringSegments // 5*SpringRevolutions usually is enough
       ) /* { */ rotate -90*y /* same orientation as Warp's spring */ }


   #declare Spring2 =
     Spiral (
       SpringMajorRadius,
       SpringMinorRadius,
       SpringHeight2/SpringRevolutions2,
       SpringRevolutions2,
       SpringSegments2 // 5*SpringRevolutions usually is enough
       ) /* { */ rotate -90*y /* same orientation as Warp's spring */ }


   #declare Spring3 =
     Spiral (
       SpringMajorRadius ,
       SpringMinorRadius,
       SpringHeight3 /SpringRevolutions3,
       SpringRevolutions3,
       SpringSegments3 // 5*SpringRevolutions usually is enough
       ) /* { */ rotate -90*y /* same orientation as Warp's spring */ }


#declare Springs = union {

                         object { Spring}
                         object { Spring2
                         translate SpringHeight *y
                                 }
                         object { Spring3
                         translate -SpringHeight3 *y
                                 }
                         }

                 object { Springs

	rotate 90*x
//                scale 0.02
//scale -1*z

scale <1,1,-1>

	translate  HeightOffset *z


rotate x*90
translate y* Y_Adjust                                                // 
<- Mine
rotate y*RotSpeed
                                                                      // 
<- Mine
                          pigment
                                 { color rgb <1.0, 1.0, 1.0>  }
                          finish
                                  {
                                     ambient 0.194233
                                     diffuse 0.424433
                                     brilliance 16.992
                                     phong 0.482
                                     phong_size 66.886667
                                     specular 0.129467
                                     roughness 0.1203
                                     reflection
                                     {
                                        0.13 , 0.34
                                        fresnel  off
                                        falloff  1.0
                                        exponent 1.0
                                        metallic 0.5
                                     }
                                  }

                 }




-- 

Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Spiral tube?
Date: 6 Jan 2016 15:46:29
Message: <568d7d25$1@news.povray.org>
Le 16-01-06 00:48, Mike Horvath a écrit :
> How do I create a spiral tube, like a spring? Like this:
>
> http://www.f-lohmueller.de/pov_tut/animate/anim16e.htm
>
> but a single object, not a union of spheres?
>
> Thanks!
>
>
> Mike

It can be done as an isosurface. In fact, there are two builtin 
functions that does just that.

In function.inc, those are: f_helix1() and f_helix2()

The various parameters controll the shape of the spiral, it's spacing 
and some other aspects. Those are some of the functions using the 
largest number of parameters.
The extent of the shapes generated are dependent on the contained_by 
object. Use a box just whide enough to contain the spiral and as long as 
needed.
Take some time to experiment.

If you want to use that shape in an animation similar to the linked one, 
you need to adjust the length of the box at the same time that you 
adjust the pitch of the helix.

If the amplitude of the sooilationsis relatively small, and the spring 
far/small enough, it may be possible to use some scalling, but the 
profile of the "whire" will also change.




Alain


Post a reply to this message

From: Mike Horvath
Subject: Re: Spiral tube?
Date: 7 Jan 2016 17:22:20
Message: <568ee51c$1@news.povray.org>
On 1/6/2016 3:46 PM, Alain wrote:
> It can be done as an isosurface. In fact, there are two builtin
> functions that does just that.
>
> In function.inc, those are: f_helix1() and f_helix2()
>
> The various parameters controll the shape of the spiral, it's spacing
> and some other aspects. Those are some of the functions using the
> largest number of parameters.
> The extent of the shapes generated are dependent on the contained_by
> object. Use a box just whide enough to contain the spiral and as long as
> needed.
> Take some time to experiment.
>
> If you want to use that shape in an animation similar to the linked one,
> you need to adjust the length of the box at the same time that you
> adjust the pitch of the helix.
>
> If the amplitude of the sooilationsis relatively small, and the spring
> far/small enough, it may be possible to use some scalling, but the
> profile of the "whire" will also change.
>
>
>
>
> Alain


How would I create a density function to fill the shape with gas?


Mike


Post a reply to this message

From: Norbert Kern
Subject: Re: Spiral tube?
Date: 7 Jan 2016 18:30:00
Message: <web.568ef4e1bcf3aeb42b16ebf70@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:

> How would I create a density function to fill the shape with gas?
>
>
> Mike


Hmm, look for an idea at
http://news.povray.org/povray.text.scene-files/message/%3C3e3c2c14%40news.povray.org%3E/#%3C3e3c2c14%40news.povray.org%
3E
..

Norbert


Post a reply to this message

From: Mike Horvath
Subject: Re: Spiral tube?
Date: 7 Jan 2016 18:48:39
Message: <568ef957$1@news.povray.org>
On 1/7/2016 6:29 PM, Norbert Kern wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>
>> How would I create a density function to fill the shape with gas?
>>
>>
>> Mike
>
>
> Hmm, look for an idea at
>
http://news.povray.org/povray.text.scene-files/message/%3C3e3c2c14%40news.povray.org%3E/#%3C3e3c2c14%40news.povray.org%
> 3E
> ..
>
> Norbert
>
>
>
>


Unfortunately, that message never got a reply.


Mike


Post a reply to this message

From: Alain
Subject: Re: Spiral tube?
Date: 7 Jan 2016 21:17:25
Message: <568f1c35$1@news.povray.org>
Le 16-01-07 17:22, Mike Horvath a écrit :
> On 1/6/2016 3:46 PM, Alain wrote:
>> It can be done as an isosurface. In fact, there are two builtin
>> functions that does just that.
>>
>> In function.inc, those are: f_helix1() and f_helix2()
>>
>> The various parameters controll the shape of the spiral, it's spacing
>> and some other aspects. Those are some of the functions using the
>> largest number of parameters.
>> The extent of the shapes generated are dependent on the contained_by
>> object. Use a box just whide enough to contain the spiral and as long as
>> needed.
>> Take some time to experiment.
>>
>> If you want to use that shape in an animation similar to the linked one,
>> you need to adjust the length of the box at the same time that you
>> adjust the pitch of the helix.
>>
>> If the amplitude of the sooilationsis relatively small, and the spring
>> far/small enough, it may be possible to use some scalling, but the
>> profile of the "whire" will also change.
>>
>>
>>
>>
>> Alain
>
>
> How would I create a density function to fill the shape with gas?
>
>
> Mike

You could use the same function to controll the media's density. It's 
just that, for the isosurface, the value need to be low inside and 
higher outside, while, for the media, you probably want it to be at is't 
maximum in the center and drop to zero at the surface.

My take would be to use a threshold of zero and negate the function.
In this case, the function evaluate to a negative value inside the 
isosurface and positive outside.
If the threshold is larger, you substract the threshold value, then 
negate the function.

Next, you can multiply the function by whatever value you want,
or
use a colour_map with values as large as you want them to controll the 
pattern of your media.


Alain


Post a reply to this message

From: William F Pokorny
Subject: Re: Spiral tube?
Date: 8 Jan 2016 00:03:06
Message: <568f430a$1@news.povray.org>
On 01/07/2016 09:17 PM, Alain wrote:
>
> You could use the same function to controll the media's density. It's
> just that, for the isosurface, the value need to be low inside and
> higher outside, while, for the media, you probably want it to be at is't
> maximum in the center and drop to zero at the surface.
>
> My take would be to use a threshold of zero and negate the function.
> In this case, the function evaluate to a negative value inside the
> isosurface and positive outside.
> If the threshold is larger, you substract the threshold value, then
> negate the function.
>
> Next, you can multiply the function by whatever value you want,
> or
> use a colour_map with values as large as you want them to controll the
> pattern of your media.
>
>
> Alain

For example code which does pretty much what Alain outlined above see 
povray.text.scene-files post "Example constraining media inside an 
isosurface shape."

http://news.povray.org/povray.text.scene-files/message/%3C568f4074%241%40news.povray.org%3E/#%3C568f4074%241%40news.povray.org%3E

The tricky part when using the built in functions is not easily being 
sure of the range of values returned. In this example I ended up with a 
pretty large negative multiplier on the helix1 function for use with the 
color map & it likely isn't the optimal multiplier.

Bill P.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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