POV-Ray : Newsgroups : povray.general : Elliptical toroids--another take Server Time
30 Jul 2024 18:13:04 EDT (-0400)
  Elliptical toroids--another take (Message 1 to 6 of 6)  
From: Cousin Ricky
Subject: Elliptical toroids--another take
Date: 21 Oct 2008 01:40:00
Message: <web.48fd69e8e0492fdd85de7b680@news.povray.org>
The two of you who have downloaded my RoundEdge module from the Object
Collection may have noticed a gap in the sample images.  This gap was for an
oblong toroid.  However, to fit the theme of the module, the toroid would have
to be able to serve as a rounded edge or join for scaled cylinders.  To do
this, the central curve, the extreme inner curve, and the extreme outer curve
of the toroid must all be ellipses.  A sphere sweep does not satisfy this
condition (except for the boundary case of the circular torus).

So towards the end of August, I drew a diagram of an elliptical torus, and
stared at it.  A pattern emerged almost immediately, but it just sat there
looking pretty.  Hrummph.  I continued to stare at the diagram.

Finally, a couple of weeks ago, the pattern whispered to me from the graph
paper:

   "t^4 - 2*z*t^3 + (x^2+z^2-d^2)*t^2 + 2*d^2*z*t - d^2*z^2 = 0
   Solve for t."

:-O

No, no, no, it can't be!  Let me recheck my derivation.  It checked out.  But
I'm prone to mixing up signs, dropping coefficients, and getting exponents
wrong, so let me plug this into a spreadsheet just to make sure.  The
spreadsheet responded, "Your numbers are perfect.  Good luck with that formula.
 Bwa ha ha ha!"

So here I am, having to (re?)learn how to solve a quartic equation, and a
messier one than you'll find on any algebra exam.  I entered the "depressed
quartic" stage into the spreadsheet, and it checks out.  But after that, I'm
flying blind until I drag a "solution" out kicking and screaming.  I look
forward to rendering the result.  I *hope* it will be an elliptical torus.


Post a reply to this message

From: Nicolas George
Subject: Re: Elliptical toroids--another take
Date: 21 Oct 2008 04:35:43
Message: <48fd945f@news.povray.org>
"Cousin Ricky"  wrote in message
<web.48fd69e8e0492fdd85de7b680@news.povray.org>:
> So towards the end of August, I drew a diagram of an elliptical torus, and
> stared at it.  A pattern emerged almost immediately, but it just sat there
> looking pretty.  Hrummph.  I continued to stare at the diagram.
> 
> Finally, a couple of weeks ago, the pattern whispered to me from the graph
> paper:
> 
>    "t^4 - 2*z*t^3 + (x^2+z^2-d^2)*t^2 + 2*d^2*z*t - d^2*z^2 = 0
>    Solve for t."

What are the meanings of the variuous variables?


Post a reply to this message

From: Cousin Ricky
Subject: Re: Elliptical toroids--another take
Date: 21 Oct 2008 12:25:00
Message: <web.48fdffd33cf15dac85de7b680@news.povray.org>
Nicolas George <nicolas$george@salle-s.org> wrote:
> "Cousin Ricky"  wrote in message
> <web.48fd69e8e0492fdd85de7b680@news.povray.org>:
> >    "t^4 - 2*z*t^3 + (x^2+z^2-d^2)*t^2 + 2*d^2*z*t - d^2*z^2 = 0
> >    Solve for t."
>
> What are the meanings of the variuous variables?

x and z are your standard coordinates in 3-space.

d is the difference between the semimajor and semiminor axes, with the semimajor
assumed, for the time being, to be in the z-direction.

t is the difference between the z-coordinates of corresponding points on the
oblong torus and a circular torus, such that the major radius of the circular
torus equals the semiminor axis of the central ellipse of the oblong torus.

Interestingly enough, the minor radius doesn't show up in the figures!  One less
variable to worry about.  :-p


Post a reply to this message

From: Nicolas George
Subject: Re: Elliptical toroids--another take
Date: 21 Oct 2008 13:17:50
Message: <48fe0ebe$1@news.povray.org>
"Cousin Ricky"  wrote in message
<web.48fdffd33cf15dac85de7b680@news.povray.org>:
> x and z are your standard coordinates in 3-space.
> 
> d is the difference between the semimajor and semiminor axes, with the semimajor
> assumed, for the time being, to be in the z-direction.
> 
> t is the difference between the z-coordinates of corresponding points on the
> oblong torus and a circular torus, such that the major radius of the circular
> torus equals the semiminor axis of the central ellipse of the oblong torus.

That seems to be overly complicated.

I tried the following, much simper approach:

Let M be a point in space.
Let P be the projection of M on the (x,y) plane.
Let Q be the intersection of segment [OP] with the ellipsis.

Then M is on the torus if and only of MQ = r, where r is the minor radius of
the torus (which is not the minor radius of the core ellipsis).

MQ can be computed in the triangle QPM:
PM = z
QP = OP - OQ



where a and b are the radius of the core ellipsis.

Fiddling around with the equations to get rid of the square root, I get:



The following macro implements it, and looks pretty much like an elliptic
torus:

#macro Ellipsis_torus(a, b, r)
  isosurface {
    function { pow((b*b*x*x + a*a*y*y) * (x*x + y*y + z*z - r*r) +
      a*a*b*b * (x*x + y*y), 2) -
      4 * pow(a * b * (x*x + y*y), 2) * (b*b*x*x + a*a*y*y) }
    contained_by { box { <-a - r, -b - r, -r>, <a + r, b + r, r> } }
    max_gradient 100000000000
  }
#end

The max_gradient was adjusted according to the warnings, in the particular
case Ellipsis_torus(8, 5, 1).

This equation looks pretty much like a eighth order polynomial. If you have
enough courage, you can expand it and find the 165 parameters needed for the
poly primitive, this would probably be faster than isosurface, and there
would be no need for the max_gradient.


Post a reply to this message

From: Warp
Subject: Re: Elliptical toroids--another take
Date: 21 Oct 2008 13:38:49
Message: <48fe13a8@news.povray.org>
Nicolas George <nicolas$george@salle-s.org> wrote:
> This equation looks pretty much like a eighth order polynomial. If you have
> enough courage, you can expand it and find the 165 parameters needed for the
> poly primitive, this would probably be faster than isosurface, and there
> would be no need for the max_gradient.

  If I remember correctly, the poly primitive supports up to 7th order
polynomials, so it would not be possible, unfortunately.

-- 
                                                          - Warp


Post a reply to this message

From: Nicolas George
Subject: Re: Elliptical toroids--another take
Date: 21 Oct 2008 13:50:08
Message: <48fe1650@news.povray.org>
Warp  wrote in message <48fe13a8@news.povray.org>:
>   If I remember correctly, the poly primitive supports up to 7th order
> polynomials, so it would not be possible, unfortunately.

The documentation says "where Order is an integer number from 2 to 15
inclusively". There is something about 7th order though: the documentation
gives the complete list of terms up to the 7th order and not beyond.


Post a reply to this message

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