POV-Ray : Newsgroups : povray.general : elongated torus? Server Time
30 Jul 2024 02:19:21 EDT (-0400)
  elongated torus? (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: elongated torus?
Date: 14 Jun 2010 13:01:51
Message: <4c16607f@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:
> A torus is a 4th order polynomial, so it should be possible to get an
> elongated torus (as revolution of a circle along an ellipse) with a 4th
> order polynomial, but it might not be as simple for the equation.

  Note that it's not enough to simply use an ellipse as the major radius
because that probably won't keep the minor radius constant throughout
(in the same way as simply scaling the torus unevenly doesn't).

-- 
                                                          - Warp


Post a reply to this message

From: Jaap Frank
Subject: Re: elongated torus?
Date: 20 Jun 2010 18:07:15
Message: <4c1e9113@news.povray.org>
"Shay" <n@n.n> schreef in bericht news:4c13b889$1@news.povray.org...
> Possible with an isosurface function?

Shay,

Years ago I needed a formula for the same shape you now request and, beleive 
me, it took me several month to figure it out.

You start with:

x = (A + a.cos(alpha)).cos(phy)
y = b.sin(alpha)
z = (B + a.cos(alpha)).sin(phy)

A and B are the different main radii in x and z direction,
and a and b are the different radii in de pipe of the torus.
So the major radius R is now changed in A and B
and the minor radius r is now changed in a and b.
When you rotate alpha and phy over 360 degrees, you get the torus you want.
If you want to translate this to the f(x,y,z) = .... you need much patience 
and time and
at the end (couple of days at least) you get your variables you can put in 
the
poly shape.
In this range t = a/b so this is the ratio of the minor radii.
If you want a circular pipe, then t = 1.
Constant: 
powers:
+t^4 
x^4y^4
+2t^2(B^2-a^2) 
x^4y^2
+(B^2-a^2) ^2 
x^4
+2t^6 
x^2y^6
+2t^4 
x^2y^4z^2
-2t^4{(A^2+B^2)-3(B^2-a^2)}                                           x^2y^4
-2t^2{(A^2-a^2)+(B^2-a^2)-4(AB-a^2)}                           x^2y^2z^2
+2t^2{(B^2-a^2)^2-2(B^2-a^2)(A^2+a^2)}                       x^2y^2
+2{(A^2-a^2)(B^2-a^2)+2(A-B)^2a^2                               x^2z^2
-2(B^2-a^2)^2(A^2+a^2) 
x^2
+t^8 
y^8
+2t^6 
y^6z^2
+2t^6{(A^2-a^2)+(B^2-a^2)}                                             y^6
+t^4 
y^4z^4
-2t^4{(A^2+B^2)-3(A^2-a^2)}                                           y^4z^2
+t^4{(A^2-a^2)^2+(B^2-a^2)^2+4(A^2-a^2)(B^2-a^2)}  y^4
+2t^2(A^2-a^2) 
y^2z^4
+2t^2{(A^2-a^2)^2+2(A^2-a^2)(B^2+a^2)}                      y^2z^2
+2t^2{(A^2-a^2)^2(B^2-a^2)+(A^2-a^2)(B^2-a^2)^2}    y^2
+(A^2-a^2) ^2 
z^4
-2(A^2-a^2)^2(B^2+a^2) 
z^2
(B^2-a^2)^2(A^2-a^2)^2 
constant

This equation works fine if the poly shape power 8 is possible, but for some 
reason today this is limited to power 7. There was a short period of time 
that power 15 was alowed, but alas, not in this times. For me it would be 
fine if this limitation is raised again.
In the short period that power 8 was alowed, it traces fine and not too 
slow. The slowing down happened with textures. Then it slowed down 
considerable. But I think that with our modern fast computers this is no 
problem anymore.

You can still use this with the parametric Object, but then the shape is 
made out of triangles and is not the pure mathematic form.

Maybe this mail causes that the max power is raised to 8 so this shape can 
be used in his pure mathematical form again.

Jaap Frank


Post a reply to this message

From: Shay
Subject: Re: elongated torus?
Date: 23 Jun 2010 21:41:46
Message: <4c22b7da@news.povray.org>
Thank you!

The formatting of your message is a bit skewed on my end, but I will 
attempt to retrace your steps myself and check my work against yours.

  -Shay

Jaap Frank wrote:
> "Shay" <n@n.n> schreef in bericht news:4c13b889$1@news.povray.org...
>> Possible with an isosurface function?
> 
> Shay,
> 
> Years ago I needed a formula for the same shape you now request and, beleive 
> me, it took me several month to figure it out.
> 
> You start with:
> 
> x = (A + a.cos(alpha)).cos(phy)
> y = b.sin(alpha)
> z = (B + a.cos(alpha)).sin(phy)
> 
> A and B are the different main radii in x and z direction,
> and a and b are the different radii in de pipe of the torus.
> So the major radius R is now changed in A and B
> and the minor radius r is now changed in a and b.
> When you rotate alpha and phy over 360 degrees, you get the torus you want.
> If you want to translate this to the f(x,y,z) = .... you need much patience 
> and time and
> at the end (couple of days at least) you get your variables you can put in 
> the
> poly shape.
> In this range t = a/b so this is the ratio of the minor radii.
> If you want a circular pipe, then t = 1.
> Constant: 
> powers:
> +t^4 
> x^4y^4
> +2t^2(B^2-a^2) 
> x^4y^2
> +(B^2-a^2) ^2 
> x^4
> +2t^6 
> x^2y^6
> +2t^4 
> x^2y^4z^2
> -2t^4{(A^2+B^2)-3(B^2-a^2)}                                           x^2y^4
> -2t^2{(A^2-a^2)+(B^2-a^2)-4(AB-a^2)}                           x^2y^2z^2
> +2t^2{(B^2-a^2)^2-2(B^2-a^2)(A^2+a^2)}                       x^2y^2
> +2{(A^2-a^2)(B^2-a^2)+2(A-B)^2a^2                               x^2z^2
> -2(B^2-a^2)^2(A^2+a^2) 
> x^2
> +t^8 
> y^8
> +2t^6 
> y^6z^2
> +2t^6{(A^2-a^2)+(B^2-a^2)}                                             y^6
> +t^4 
> y^4z^4
> -2t^4{(A^2+B^2)-3(A^2-a^2)}                                           y^4z^2
> +t^4{(A^2-a^2)^2+(B^2-a^2)^2+4(A^2-a^2)(B^2-a^2)}  y^4
> +2t^2(A^2-a^2) 
> y^2z^4
> +2t^2{(A^2-a^2)^2+2(A^2-a^2)(B^2+a^2)}                      y^2z^2
> +2t^2{(A^2-a^2)^2(B^2-a^2)+(A^2-a^2)(B^2-a^2)^2}    y^2
> +(A^2-a^2) ^2 
> z^4
> -2(A^2-a^2)^2(B^2+a^2) 
> z^2
> (B^2-a^2)^2(A^2-a^2)^2 
> constant
> 
> This equation works fine if the poly shape power 8 is possible, but for some 
> reason today this is limited to power 7. There was a short period of time 
> that power 15 was alowed, but alas, not in this times. For me it would be 
> fine if this limitation is raised again.
> In the short period that power 8 was alowed, it traces fine and not too 
> slow. The slowing down happened with textures. Then it slowed down 
> considerable. But I think that with our modern fast computers this is no 
> problem anymore.
> 
> You can still use this with the parametric Object, but then the shape is 
> made out of triangles and is not the pure mathematic form.
> 
> Maybe this mail causes that the max power is raised to 8 so this shape can 
> be used in his pure mathematical form again.
> 
> Jaap Frank 
> 
>


Post a reply to this message

From: Jaap Frank
Subject: Re: elongated torus?
Date: 24 Jun 2010 15:05:47
Message: <4c23ac8b$1@news.povray.org>
Hello Shay,

"Shay" <n@n.n> schreef in bericht news:4c22b7da@news.povray.org...
> Thank you!
Your welcom.

>
> The formatting of your message is a bit skewed on my end,

I noticed when I read it back from the news side.
If you want I can do it in a word document, so there is no misunderstanding.

> but I will attempt to retrace your steps myself and check my work against 
> yours.
>
>  -Shay

If you are interested in the whole mathematical derivation,
then I can scan it for you, because I don't have it electronically.
It's hand written in a blank book with some other mathematical things
I did need. I didn't exaggerate that it takes some days. It's a colossal
derivation because you have to square a rather big equation twice
and then sort everything on A, B, a and b.
If you like to do it yourself, first try the normal torus, so you know
how to do that. The oval_oval_torus starts the same way, but half way
I subtracted two equations, otherwise you end up with a power 16 result.


I will reorganise the variables and powers for you so you can read it 
better:

Constants for their powers:
+t^4                       x^4y^4
+2t^2(B^2-a^2)     x^4y^2
+(B^2-a^2) ^2       x^4
+2t^6                     x^2y^6
+2t^4                     x^2y^4z^2
-2t^4{(A^2+B^2)+
           -3(B^2-a^2)}        x^2y^4
-2t^2{(A^2-a^2)+
           +(B^2-a^2)+
           -4(AB-a^2)}     x^2y^2z^2
+2t^2{(B^2-a^2)^2+
           -2(B^2-a^2)(A^2+a^2)}   x^2y^2
+2{(A^2-a^2)(B^2-a^2)+
        +2(A-B)^2a^2         x^2z^2
-2(B^2-a^2)^2(A^2+a^2)    x^2
+t^8  y^8
+2t^6  y^6z^2
+2t^6{(A^2-a^2)+(B^2-a^2)}  y^6
+t^4   y^4z^4
-2t^4{(A^2+B^2)-3(A^2-a^2)}  y^4z^2
+t^4{(A^2-a^2)^2+(B^2-a^2)^2+
          +4(A^2-a^2)(B^2-a^2)}  y^4
+2t^2(A^2-a^2)   y^2z^4
+2t^2{(A^2-a^2)^2+
            +2(A^2-a^2)(B^2+a^2)}  y^2z^2
+2t^2{(A^2-a^2)^2(B^2-a^2)+
            +(A^2-a^2)(B^2-a^2)^2}    y^2
+(A^2-a^2) ^2  z^4
-2(A^2-a^2)^2(B^2+a^2)   z^2
(B^2-a^2)^2(A^2-a^2)^2
The last one is the constant  or for power x^0y^0z^0 if you wish.

>> This equation works fine if the poly shape power 8 is possible, but for 
>> some reason today this is limited to power 7. There was a short period of 
>> time that power 15 was alowed, but alas, not in this times. For me it 
>> would be fine if this limitation is raised again.
>> In the short period that power 8 was alowed, it traces fine and not too 
>> slow. The slowing down happened with textures. Then it slowed down 
>> considerable. But I think that with our modern fast computers this is no 
>> problem anymore.
>>
>> You can still use this with the parametric Object, but then the shape is 
>> made out of triangles and is not the pure mathematic form.
>>
>> Maybe this mail causes that the max power is raised to 8 so this shape 
>> can be used in his pure mathematical form again.
>>
>> Jaap Frank

Because of this a request to Christof Lipka or Thorsten Froehlich;
Is it possible to raise the poly shape to power eight?
Power seven is just one power to low. If you mesh around with
these equations, then it always ends up with power four, eight or even 
sixteen.

Greetings,

Jaap Frank


Post a reply to this message

From: Shay
Subject: Re: elongated torus?
Date: 24 Jun 2010 22:54:54
Message: <4c241a7e@news.povray.org>
I would very much like to see that scan. I would teach me a lot, I'm 
sure. My email address is myn### [at] hotmailcom.

Thank you.

Jaap Frank wrote:
> Hello Shay,
> 
> "Shay" <n@n.n> schreef in bericht news:4c22b7da@news.povray.org...
>> Thank you!
> Your welcom.
> 
>> The formatting of your message is a bit skewed on my end,
> 
> I noticed when I read it back from the news side.
> If you want I can do it in a word document, so there is no misunderstanding.
> 
>> but I will attempt to retrace your steps myself and check my work against 
>> yours.
>>
>>  -Shay
> 
> If you are interested in the whole mathematical derivation,
> then I can scan it for you, because I don't have it electronically.
> It's hand written in a blank book with some other mathematical things
> I did need. I didn't exaggerate that it takes some days. It's a colossal
> derivation because you have to square a rather big equation twice
> and then sort everything on A, B, a and b.
> If you like to do it yourself, first try the normal torus, so you know
> how to do that. The oval_oval_torus starts the same way, but half way
> I subtracted two equations, otherwise you end up with a power 16 result.
> 
> 
> I will reorganise the variables and powers for you so you can read it 
> better:
> 
> Constants for their powers:
> +t^4                       x^4y^4
> +2t^2(B^2-a^2)     x^4y^2
> +(B^2-a^2) ^2       x^4
> +2t^6                     x^2y^6
> +2t^4                     x^2y^4z^2
> -2t^4{(A^2+B^2)+
>            -3(B^2-a^2)}        x^2y^4
> -2t^2{(A^2-a^2)+
>            +(B^2-a^2)+
>            -4(AB-a^2)}     x^2y^2z^2
> +2t^2{(B^2-a^2)^2+
>            -2(B^2-a^2)(A^2+a^2)}   x^2y^2
> +2{(A^2-a^2)(B^2-a^2)+
>         +2(A-B)^2a^2         x^2z^2
> -2(B^2-a^2)^2(A^2+a^2)    x^2
> +t^8  y^8
> +2t^6  y^6z^2
> +2t^6{(A^2-a^2)+(B^2-a^2)}  y^6
> +t^4   y^4z^4
> -2t^4{(A^2+B^2)-3(A^2-a^2)}  y^4z^2
> +t^4{(A^2-a^2)^2+(B^2-a^2)^2+
>           +4(A^2-a^2)(B^2-a^2)}  y^4
> +2t^2(A^2-a^2)   y^2z^4
> +2t^2{(A^2-a^2)^2+
>             +2(A^2-a^2)(B^2+a^2)}  y^2z^2
> +2t^2{(A^2-a^2)^2(B^2-a^2)+
>             +(A^2-a^2)(B^2-a^2)^2}    y^2
> +(A^2-a^2) ^2  z^4
> -2(A^2-a^2)^2(B^2+a^2)   z^2
> (B^2-a^2)^2(A^2-a^2)^2
> The last one is the constant  or for power x^0y^0z^0 if you wish.
> 
>>> This equation works fine if the poly shape power 8 is possible, but for 
>>> some reason today this is limited to power 7. There was a short period of 
>>> time that power 15 was alowed, but alas, not in this times. For me it 
>>> would be fine if this limitation is raised again.
>>> In the short period that power 8 was alowed, it traces fine and not too 
>>> slow. The slowing down happened with textures. Then it slowed down 
>>> considerable. But I think that with our modern fast computers this is no 
>>> problem anymore.
>>>
>>> You can still use this with the parametric Object, but then the shape is 
>>> made out of triangles and is not the pure mathematic form.
>>>
>>> Maybe this mail causes that the max power is raised to 8 so this shape 
>>> can be used in his pure mathematical form again.
>>>
>>> Jaap Frank
> 
> Because of this a request to Christof Lipka or Thorsten Froehlich;
> Is it possible to raise the poly shape to power eight?
> Power seven is just one power to low. If you mesh around with
> these equations, then it always ends up with power four, eight or even 
> sixteen.
> 
> Greetings,
> 
> Jaap Frank 
> 
>


Post a reply to this message

From: Jaap Frank
Subject: Re: elongated torus?
Date: 27 Jun 2010 13:04:55
Message: <4c2784b7@news.povray.org>
Hello Shay,

"Shay" <n@n.n> schreef in bericht news:4c241a7e@news.povray.org...
>I would very much like to see that scan. I would teach me a lot, I'm sure. 
>My email address is myn### [at] hotmailcom.
>
I'm not sure what you mean with the "myname public" part.

Can you send me an email to the next address, using the first characters of
the following names:
Jack Jeniver Frederick Raymond Anton Nicolas Kevin at
Casimir Antonia Sonia Edward Mary Agatha point Nigel Larry

I will answer your mail with the scans and a translation of the dutch 
sentences.
Is your email box big enough to receive about 6 MB of attachments?

Waiting for your email,

Jaap Frank


Post a reply to this message

From: waggy
Subject: Re: elongated torus?
Date: 27 Jun 2010 14:30:00
Message: <web.4c27982b751c630af99d05c80@news.povray.org>
Jaap Frank wrote:
>[snip]
> Because of this a request to Christof Lipka or Thorsten Froehlich;
> Is it possible to raise the poly shape to power eight?
> Power seven is just one power to low. If you mesh around with
> these equations, then it always ends up with power four, eight or even
> sixteen.
>
A power 8 poly works fine in 3.7beta35.  (I don't have 3.6 installed in a
convenient computer right now.)

Beautiful work!

~waggy

#local a=1;
#local b=1;
#local A=4; // Major radius of the swept elipse
#local B=2; // Minor radius of the swept elipse
#local tratio=a/b;

#local c21=   pow(tratio,4);//ok
#local c20= 2*pow(tratio,2)*(B*B-a*a);//ok
#local c19=   pow(B*B-a*a,2);//ok
#local c18= 2*pow(tratio,6) ;//ok
#local c17= 2*pow(tratio,4);//ok
#local c16=-2*pow(tratio,4)*( A*A+B*B -3*(B*B-a*a) );//ok
#local c15=-2*pow(tratio,2)*( A*A-a*a +B*B-a*a -4*(A*B-a*a) );//ok
#local c14= 2*pow(tratio,2)*( pow(B*B-a*a,2) -2*(B*B-a*a)*(A*A+a*a) );//ok
#local c13= 2*(  (A*A-a*a) * (B*B-a*a) +2*pow(A-B,2)*a*a  )  ;//ok? unclear
where closing paren goes
#local c12=-2*pow(B*B-a*a,2)*(A*A+a*a);//ok
#local c11=   pow(tratio,8);//ok
#local c10= 2*pow(tratio,6);//ok
#local c9 = 2*pow(tratio,6)*((A*A-a*a)+(B*B-a*a));//ok
#local c8 =   pow(tratio,4) ;//ok
#local c7 =-2*pow(tratio,4)*( (A*A+B*B)-3*(A*A-a*a) );//ok
#local c6 =   pow(tratio,4)*( pow((A*A-a*a),2) +pow((B*B-a*a),2)
+4*(A*A-a*a)*(B*B-a*a) );//ok
#local c5 = 2*pow(tratio,2)*(A*A-a*a);//ok
#local c4 = 2*pow(tratio,2)*( pow(A*A-a*a,2) +2*(A*A-a*a)*(B*B+a*a) );//ok
#local c3 = 2*pow(tratio,2)*( pow(A*A-a*a,2)*(B*B-a*a) +
(A*A-a*a)*pow(B*B-a*a,2) );//ok
#local c2 =   pow(A*A-a*a ,2);//ok
#local c1 =-2*pow(A*A-a*a,2)*(B*B+a*a);//ok
#local c0 =   pow(B*B-a*a,2)*pow(A*A-a*a,2) ;//ok

//powers check out ok.
#declare oval_oval_torus = function(x,y,z) {
   c21* pow(x,4)*pow(y,4)
  +c20* pow(x,4)*pow(y,2)
  +c19* pow(x,4)
  +c18* pow(x,2)*pow(y,6)
  +c17* pow(x,2)*pow(y,4)*pow(z,2)
  +c16* pow(x,2)*pow(y,4)
  +c15* pow(x,2)*pow(y,2)*pow(z,2)
  +c14* pow(x,2)*pow(y,2)
  +c13* pow(x,2)*pow(z,2)
  +c12* pow(x,2)
  +c11* pow(y,8)
  +c10* pow(y,6)*pow(z,2)
  +c9 * pow(y,6)
  +c8 * pow(y,4)*pow(z,4)
  +c7 * pow(y,4)*pow(z,2)
  +c6 * pow(y,4)
  +c5 * pow(y,2)*pow(z,4)
  +c4 * pow(y,2)*pow(z,2)
  +c3 * pow(y,2)
  +c2 * pow(z,4)
  +c1 * pow(z,2)
  +c0
  }
poly {8,
 <0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  c21,0, 0, 0, 0, c20,  0, 0, 0,
  0, 0, 0, 0, 0, c19,  0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0,   0, 0,   0, 0, 0, 0, c18, 0,
  0, c17, 0, c16, 0, 0, 0, 0, 0, 0,
  c15,0, c14, 0,   0, 0,   0, 0, 0, 0,
  0, 0, 0, c13,   0, c12, 0, 0, 0, 0,
  0, 0, 0, 0, 0,  0, 0,   0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0,
  0, 0, 0,  0, 0,  0, 0,  0, 0, 0, c11,
  0, 0, c10, 0, c9, 0, 0, 0, 0, c8, 0,
  c7, 0, c6, 0, 0,  0, 0, 0, 0, 0, 0,
  c5, 0, c4, 0, c3, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, c2, 0, c1, 0, c0>
  sturm // Using strum isn't that much slower, and seems nicer.
  texture {
    pigment {
      color rgb <0.8,0.8,1.0>
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection { 0.8 metallic }
      conserve_energy
    }
  }
  //rotate 90*x
  //translate y*((A+B+a+b)/2 +0.5)
  }


Post a reply to this message

From: Jaap Frank
Subject: Re: elongated torus?
Date: 27 Jun 2010 16:31:21
Message: <4c27b519$1@news.povray.org>
"waggy" <hon### [at] handbasketorg> schreef in bericht 
news:web.4c27982b751c630af99d05c80@news.povray.org...
> Jaap Frank wrote:
>>[snip]
>> Because of this a request to Christof Lipka or Thorsten Froehlich;
>> Is it possible to raise the poly shape to power eight?
>> Power seven is just one power to low. If you mesh around with
>> these equations, then it always ends up with power four, eight or even
>> sixteen.
>>
> A power 8 poly works fine in 3.7beta35.  (I don't have 3.6 installed in a
> convenient computer right now.)
>
> Beautiful work!
>
> ~waggy
>
> #local a=1;
> #local b=1;
> #local A=4; // Major radius of the swept elipse
> #local B=2; // Minor radius of the swept elipse
> #local tratio=a/b;
>
> #local c21=   pow(tratio,4);//ok
> #local c20= 2*pow(tratio,2)*(B*B-a*a);//ok
> #local c19=   pow(B*B-a*a,2);//ok
> #local c18= 2*pow(tratio,6) ;//ok
> #local c17= 2*pow(tratio,4);//ok
> #local c16=-2*pow(tratio,4)*( A*A+B*B -3*(B*B-a*a) );//ok
> #local c15=-2*pow(tratio,2)*( A*A-a*a +B*B-a*a -4*(A*B-a*a) );//ok
> #local c14= 2*pow(tratio,2)*( pow(B*B-a*a,2) -2*(B*B-a*a)*(A*A+a*a) );//ok
> #local c13= 2*(  (A*A-a*a) * (B*B-a*a) +2*pow(A-B,2)*a*a  )  ;//ok? 
> unclear
> where closing paren goes
> #local c12=-2*pow(B*B-a*a,2)*(A*A+a*a);//ok
> #local c11=   pow(tratio,8);//ok
> #local c10= 2*pow(tratio,6);//ok
> #local c9 = 2*pow(tratio,6)*((A*A-a*a)+(B*B-a*a));//ok
> #local c8 =   pow(tratio,4) ;//ok
> #local c7 =-2*pow(tratio,4)*( (A*A+B*B)-3*(A*A-a*a) );//ok
> #local c6 =   pow(tratio,4)*( pow((A*A-a*a),2) +pow((B*B-a*a),2)
> +4*(A*A-a*a)*(B*B-a*a) );//ok
> #local c5 = 2*pow(tratio,2)*(A*A-a*a);//ok
> #local c4 = 2*pow(tratio,2)*( pow(A*A-a*a,2) +2*(A*A-a*a)*(B*B+a*a) );//ok
> #local c3 = 2*pow(tratio,2)*( pow(A*A-a*a,2)*(B*B-a*a) +
> (A*A-a*a)*pow(B*B-a*a,2) );//ok
> #local c2 =   pow(A*A-a*a ,2);//ok
> #local c1 =-2*pow(A*A-a*a,2)*(B*B+a*a);//ok
> #local c0 =   pow(B*B-a*a,2)*pow(A*A-a*a,2) ;//ok
>
> //powers check out ok.
> #declare oval_oval_torus = function(x,y,z) {
>   c21* pow(x,4)*pow(y,4)
>  +c20* pow(x,4)*pow(y,2)
>  +c19* pow(x,4)
>  +c18* pow(x,2)*pow(y,6)
>  +c17* pow(x,2)*pow(y,4)*pow(z,2)
>  +c16* pow(x,2)*pow(y,4)
>  +c15* pow(x,2)*pow(y,2)*pow(z,2)
>  +c14* pow(x,2)*pow(y,2)
>  +c13* pow(x,2)*pow(z,2)
>  +c12* pow(x,2)
>  +c11* pow(y,8)
>  +c10* pow(y,6)*pow(z,2)
>  +c9 * pow(y,6)
>  +c8 * pow(y,4)*pow(z,4)
>  +c7 * pow(y,4)*pow(z,2)
>  +c6 * pow(y,4)
>  +c5 * pow(y,2)*pow(z,4)
>  +c4 * pow(y,2)*pow(z,2)
>  +c3 * pow(y,2)
>  +c2 * pow(z,4)
>  +c1 * pow(z,2)
>  +c0
>  }
> poly {8,
> <0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>  c21,0, 0, 0, 0, c20,  0, 0, 0,
>  0, 0, 0, 0, 0, c19,  0, 0, 0,
>  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>  0, 0,   0, 0,   0, 0, 0, 0, c18, 0,
>  0, c17, 0, c16, 0, 0, 0, 0, 0, 0,
>  c15,0, c14, 0,   0, 0,   0, 0, 0, 0,
>  0, 0, 0, c13,   0, c12, 0, 0, 0, 0,
>  0, 0, 0, 0, 0,  0, 0,   0, 0, 0, 0,
>  0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0,
>  0, 0, 0,  0, 0,  0, 0,  0, 0, 0, c11,
>  0, 0, c10, 0, c9, 0, 0, 0, 0, c8, 0,
>  c7, 0, c6, 0, 0,  0, 0, 0, 0, 0, 0,
>  c5, 0, c4, 0, c3, 0, 0, 0, 0, 0, 0,
>  0, 0, 0, 0, 0, 0, c2, 0, c1, 0, c0>
>  sturm // Using strum isn't that much slower, and seems nicer.
>  texture {
>    pigment {
>      color rgb <0.8,0.8,1.0>
>    }
>    finish{
>      diffuse 0.3
>      ambient 0.0
>      specular 0.6
>      reflection { 0.8 metallic }
>      conserve_energy
>    }
>  }
>  //rotate 90*x
>  //translate y*((A+B+a+b)/2 +0.5)
>  }
>
>
Wow, I didn.t try it in the beta's. That is excellent!
Now I can go further with things from the nineties!

Jaap Frank


Post a reply to this message

From: Jaap Frank
Subject: Re: elongated torus?
Date: 27 Jun 2010 16:42:41
Message: <4c27b7c1$1@news.povray.org>
"waggy" <hon### [at] handbasketorg> schreef in bericht 
news:web.4c27982b751c630af99d05c80@news.povray.org...
> Jaap Frank wrote:
>>[snip]
> #local a=1;
> #local b=1;
> #local A=4; // Major radius of the swept elipse
> #local B=2; // Minor radius of the swept elipse
> #local tratio=a/b;
>
> #local c21=   pow(tratio,4);//ok
> #local c20= 2*pow(tratio,2)*(B*B-a*a);//ok
> #local c19=   pow(B*B-a*a,2);//ok
> #local c18= 2*pow(tratio,6) ;//ok
> #local c17= 2*pow(tratio,4);//ok
> #local c16=-2*pow(tratio,4)*( A*A+B*B -3*(B*B-a*a) );//ok
> #local c15=-2*pow(tratio,2)*( A*A-a*a +B*B-a*a -4*(A*B-a*a) );//ok
> #local c14= 2*pow(tratio,2)*( pow(B*B-a*a,2) -2*(B*B-a*a)*(A*A+a*a) );//ok
> #local c13= 2*(  (A*A-a*a) * (B*B-a*a) +2*pow(A-B,2)*a*a  )  ;//ok? 
> unclear
> where closing paren goes

At the end, so this is correct.

Will try this tomorrow evening myself.

I will publish more about these equations later on.

Jaap Frank


Post a reply to this message

From: Benix
Subject: Re: elongated torus?
Date: 14 Nov 2017 07:40:00
Message: <web.5a0ae3c4751c630accb9e8800@news.povray.org>
Hi everyone,

I just came across this thread and the very nice solutions presented here.

I had a similar issue with an elongated torus. However, I had the feeling that
the functions presented here require some calculation of the ray tracer. There
is a rather simple (quick and dirty) workaround, which might save some
computational effort:

When shapes overlap sufficiently, the ray tracer is rather quick. So I got my
elongated torus with a small trick using a for loop:

    #for (n, 1,99, 1)
        torus { 1,0.1
            translate<0,0.1*n,0>
          } // end of torus  -------------------------------
    #end

This makes you an elongated torus along the y-axis, from 0 to 10, with a major
radius of 1, and a radius of 0.1 for round corners.


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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