 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Horvath <mik### [at] gmail com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 1/7/2016 6:29 PM, Norbert Kern wrote:
> Mike Horvath <mik### [at] gmail com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |