POV-Ray : Newsgroups : povray.general : Spiral tube? : Re: Spiral tube? Server Time
5 Jul 2024 09:55:45 EDT (-0400)
  Re: Spiral tube?  
From: Alain
Date: 8 Jan 2016 14:51:07
Message: <5690132b$1@news.povray.org>
Le 16-01-08 13:24, Mike Horvath a écrit :
> On 1/6/2016 12: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!
>>
>>
>> Mike
>
> I found this parametric function online:
>
> http://math.stackexchange.com/questions/461547/whats-the-equation-of-helix-surface
>
>
> 1. How do I turn this into POV-Ray code?
> 2. Can I fill this shape with a gas that is denser in the middle of the
> tube and less dense at the tube's surface?
>
>
> Mike

You don't need to convert that parametric function.

You can get that exact shape using f_helix1 or f_helix2 whitch are 
builtin function. Builtin functions are inheritently faster than user 
defined functions as they use compiled code.

P0 is set to 1 to get only a single helix. Non integer may cause 
unexpected results. (not used if f_helix2)
P1, P2 and P3 are renamed to reflect their functions.
P4 elongate the section along the Y axis. Set to 1 to leave the shape 
unchanged. (not used if f_helix2)
P5 is set to 1 whitch correspond to a circular section.
0 = square section.
1 = circular section
2 = losange section (I don't get it that a square rotated 45° could be 
called "diamond")
 >2 = concave losange section, may become degenarate if larger than 3.
For a circular section, P6 have no effect. It rotate the section shape 
when it's not circular.

Start with the following:

f_helix1(x,y,z, 1, Period_per_unit, Minor_radius, major_radius, 1, 1, 0)
or
f_helix2(x,y,z, 0, Period_per_unit, Minor_radius, major_radius, 0, 1, 0)

Both are designed for a threshold of zero. Evaluate as <0 inside, 0 at 
the surface and >0 outside.
Negate the function used to use it to controll your media.

Sample from i_internal.pov that you can find in the sample scenes (frame 
26, frame 27 for f_helix2):

#declare LCorner = <-1.5, -2.9, -1.5>;
#declare RCorner = <1.5, 2.9,  1.5>;
isosurface {
	function { f_helix1(x,y,z, 1, 8, 0.3, 0.9, 0.6, 0.2, 0) }
		//P0= number of helixes
		//P1= frequency
		//P2= minor radius
		//P3= major radius
		//P4= Y scale cross section
		//P5= cross section
		//P6= cross section rotation (¡)
	contained_by { box { LCorner, RCorner } }
	max_gradient 1.5
	texture { IsoTexture }
	no_shadow
	scale 1.9  rotate z*-54
}






Alain


Post a reply to this message

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