POV-Ray : Newsgroups : povray.general : Spiral tube? Server Time
19 May 2024 18:24:02 EDT (-0400)
  Spiral tube? (Message 11 to 20 of 20)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mike Horvath
Subject: Re: Spiral tube?
Date: 8 Jan 2016 13:24:31
Message: <568ffedf$1@news.povray.org>
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


Post a reply to this message

From: Alain
Subject: Re: Spiral tube?
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

From: Mike Horvath
Subject: Re: Spiral tube?
Date: 8 Jan 2016 15:11:53
Message: <56901809$1@news.povray.org>
On 1/8/2016 2:51 PM, Alain wrote:
> 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


The problem is that the isosurface is clipped within a box. This means 
the edges of the cut are not perpendicular to the curve. It looks bad.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Spiral tube?
Date: 8 Jan 2016 16:02:14
Message: <569023d6$1@news.povray.org>
On 1/8/2016 1:24 PM, Mike Horvath wrote:
> 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


The docs say that parametric objects are hollow. Can they have interiors?


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Spiral tube?
Date: 8 Jan 2016 16:06:18
Message: <569024ca$1@news.povray.org>
On 1/6/2016 3:55 AM, Le_Forgeron wrote:
> 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 ?
>
>


Can a spline accurately mimic a helix?


Mike


Post a reply to this message

From: clipka
Subject: Re: Spiral tube?
Date: 8 Jan 2016 16:07:59
Message: <5690252f$1@news.povray.org>
Am 08.01.2016 um 21:12 schrieb Mike Horvath:

> The problem is that the isosurface is clipped within a box. This means
> the edges of the cut are not perpendicular to the curve. It looks bad.

Make the isosurface container a bit larger, and use difference to cut
away the ends.


Post a reply to this message

From: Mike Horvath
Subject: Re: Spiral tube?
Date: 8 Jan 2016 16:10:57
Message: <569025e1$1@news.povray.org>
On 1/8/2016 4:07 PM, clipka wrote:
> Am 08.01.2016 um 21:12 schrieb Mike Horvath:
>
>> The problem is that the isosurface is clipped within a box. This means
>> the edges of the cut are not perpendicular to the curve. It looks bad.
>
> Make the isosurface container a bit larger, and use difference to cut
> away the ends.
>

I will still need to calculate the tangent of the curve at the cutoff 
points. This may be more trouble than it's worth.


Mike


Post a reply to this message

From: clipka
Subject: Re: Spiral tube?
Date: 8 Jan 2016 17:48:55
Message: <56903cd7$1@news.povray.org>
Am 08.01.2016 um 22:06 schrieb Mike Horvath:
> On 1/6/2016 3:55 AM, Le_Forgeron wrote:
>> 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 ?
>>
>>
> 
> 
> Can a spline accurately mimic a helix?

A natural, bezier or other cubic spline -- nope, not precisely.

I read somewhere that a non-uniform rational B-spline /could/ do the
trick (not sure if that's true), but POV-Ray does not support those.


Post a reply to this message

From: clipka
Subject: Re: Spiral tube?
Date: 8 Jan 2016 17:50:43
Message: <56903d43$1@news.povray.org>
Am 08.01.2016 um 22:11 schrieb Mike Horvath:
> On 1/8/2016 4:07 PM, clipka wrote:
>> Am 08.01.2016 um 21:12 schrieb Mike Horvath:
>>
>>> The problem is that the isosurface is clipped within a box. This means
>>> the edges of the cut are not perpendicular to the curve. It looks bad.
>>
>> Make the isosurface container a bit larger, and use difference to cut
>> away the ends.
>>
> 
> I will still need to calculate the tangent of the curve at the cutoff
> points. This may be more trouble than it's worth.

If it's a simple helix, the corresponding formula should be easy to come
up with.


Post a reply to this message

From: Alain
Subject: Re: Spiral tube?
Date: 9 Jan 2016 12:13:51
Message: <56913fcf$1@news.povray.org>
Le 16-01-08 17:48, clipka a écrit :
> Am 08.01.2016 um 22:06 schrieb Mike Horvath:
>> On 1/6/2016 3:55 AM, Le_Forgeron wrote:
>>> 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 ?
>>>
>>>
>>
>>
>> Can a spline accurately mimic a helix?
>
> A natural, bezier or other cubic spline -- nope, not precisely.
>

But, if you are willing to throw in enough points, the error can be kept 
low enough that it's not visible.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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