POV-Ray : Newsgroups : povray.binaries.images : Elliptical torus Server Time
14 May 2024 02:32:06 EDT (-0400)
  Elliptical torus (Message 8 to 17 of 39)  
<<< Previous 7 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Bald Eagle
Subject: Re: Elliptical torus
Date: 3 May 2020 22:20:00
Message: <web.5eaf7b6da032ea3dfb0b41570@news.povray.org>
First diagram shows plan and elevation of a torus.

The goal is to next adapt everything in Step 2 to an ellipse instead of a
circle.

I think I have it worked out, but I get no visible isosurface, so the math and
logic need to be checked, then I can go isosurface idiosyncrasy hunting.


Post a reply to this message


Attachments:
Download 'implicitellipticaltorus.png' (124 KB)

Preview of image 'implicitellipticaltorus.png'
implicitellipticaltorus.png


 

From: William F Pokorny
Subject: Re: Elliptical torus
Date: 4 May 2020 03:56:00
Message: <5eafca90$1@news.povray.org>
On 5/3/20 4:30 PM, Bald Eagle wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
> 
>> :-) Thanks for pushing here. Does this all work only when the major axis
>> is 1.0 or something?
> 
> Unfortunately, I thought, nay - believed (at 1am) that I had gotten it
> sufficiently worked out so that I could just get it prettied up and all would be
> fine, but of course it has proven to be a bit more challenging than that.
> I have been trying to get it re-worked out myself, but how exactly the
> z-parameter gets adjusted to compensate for the x and y stretching in the
> implicit form is unclear.
> 
> I too have been trying to get it to be consistent with POV-Ray's torus in the
> xz-plane - I just need to hit upon the proper form.
> 
> On the plus side, after a few dozen experiments, I have at least one function
> that's sufficiently interesting to pursue at some other point.
> 
> It's maddening to be this tantalizingly close and still not _have_ it.
> 

FYI. I've not recently looked at it, but back in 2006 Bruno Cabasson 
worked up some code for elliptical tori implemented with sphere_sweeps 
and blobs. Perhaps useful to review that work as we look for an 
f_elliptical_torus() or complete parametric solution.

Given we can use blobs as potential patterns in functions/isosurfaces in 
v38, perhaps this a path to something practical for Cousin Ricky?

The sphere_sweep as a general solution is not very attractive in v37 and 
prior due bugs. Situations is better in v38 - and still better in povr 
but the sphere_sweep probably not the fastest.

With both approaches expect tolerances to any math ideal, but perhaps we 
are stuck with a fuzzy result in any case?

I captured his code in my sphere_sweep test cases, let me see if small 
enough to just attach it - yep. Warning! Some chance I hacked on the 
scene file a little from what was originally posted - I didn't check.

Bill P.


Post a reply to this message


Attachments:
Download 'utf-8' (6 KB)

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 4 May 2020 07:10:00
Message: <web.5eaff7d5a032ea3dfb0b41570@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
Perhaps useful to review that work as we look for an
> f_elliptical_torus() or complete parametric solution.

I'll go back to my initial post and see what else I need for the parametric.
I had a key insight last night that I need to pursue when I get back later.


With regard to a workaround, if needed:

http://www.econym.demon.co.uk/isotut/splines.htm

Which I should have thought of much much earlier.


Post a reply to this message

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 4 May 2020 15:15:01
Message: <web.5eb06994a032ea3dfb0b41570@news.povray.org>
So, just to provide a diagram for the elliptical torus, we can see that the same
sort of situation exists, and the same calculations are used once we establish a
length from the origin to point P.

And I think that's where things get interesting (complicated).


https://courses.lumenlearning.com/ivytech-collegealgebra/chapter/deriving-the-equation-of-an-ellipse-centered-at-the-or
igin/

describes how the definition of a torus (constant distance from two foci) gets
algebraically converted down to pow(x,2)/pow(a,2) + pow(y,2)/pow(b,2) = 1.

But really what we want is a distance function for the points on an ellipse.

I found this excellent answer for how to do that

https://math.stackexchange.com/q/1760296

so since the distance is sqrt(pow(x,2)+pow(y,2)), I use the equations from that
post to substitute in for x and y in the distance function to get:

#declare DistE = function (x, y, z, a, b){
 sqrt (
 (pow(a,2)*pow(b,2)*pow(x,2))/((pow(b,2)*pow(x,2))+(pow(a,2)*pow(y,2))) +
 (pow(a,2)*pow(b,2)*pow(y,2))/((pow(b,2)*pow(x,2))+(pow(a,2)*pow(y,2)))
 )
}

and then plug that into the main isosurface equation for an elliptical torus
with a constant circular cross-section.

#declare IET =
function (x,y,z,a,b,r) {
 pow(DistE(x,y,z,a,b) - sqrt(pow(x,2)+pow(y,2)) ,2) + pow(z,2) - pow(r,2)
}

But I still get no visible surface.


Post a reply to this message

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 4 May 2020 16:15:01
Message: <web.5eb07701a032ea3dfb0b41570@news.povray.org>
Helps to provide the diagram...


Post a reply to this message


Attachments:
Download 'implicitellipticaltorus.png' (130 KB)

Preview of image 'implicitellipticaltorus.png'
implicitellipticaltorus.png


 

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 4 May 2020 16:50:06
Message: <web.5eb07f87a032ea3dfb0b41570@news.povray.org>
So, I looped over x, y, and z and sent the evaluated function result to the
debug stream.   Massive delay from sending 8000 points to the text stream
later...
 and I get values in the hundreds, less, less, less, and maybe a min of 0 or so.

I then plotted points with a value of 10 or less with spheres.

There's definitely an elliptical shape in there somewhere....


Post a reply to this message


Attachments:
Download 'implicitellipticaltorus.png' (119 KB)

Preview of image 'implicitellipticaltorus.png'
implicitellipticaltorus.png


 

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 4 May 2020 17:25:06
Message: <web.5eb08780a032ea3dfb0b41570@news.povray.org>
Oh look:
If I clean up my sloppy code and cease engaging in flagrant dumbassery.....


Post a reply to this message


Attachments:
Download 'implicitellipticaltorus.png' (148 KB)

Preview of image 'implicitellipticaltorus.png'
implicitellipticaltorus.png


 

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 4 May 2020 20:10:00
Message: <web.5eb0ae7ca032ea3dfb0b41570@news.povray.org>
And wow - wouldn't you know - when you actually do the math correctly, it comes
out dead-on.

:)

f_elliptical_torus in the proper x-z plane


Post a reply to this message


Attachments:
Download 'implicitellipticaltorus.png' (93 KB)

Preview of image 'implicitellipticaltorus.png'
implicitellipticaltorus.png


 

From: William F Pokorny
Subject: Re: Elliptical torus
Date: 5 May 2020 07:23:39
Message: <5eb14cbb$1@news.povray.org>
On 5/4/20 8:08 PM, Bald Eagle wrote:
> And wow - wouldn't you know - when you actually do the math correctly, it comes
> out dead-on.
> 
> :)
> 
> f_elliptical_torus in the proper x-z plane
> 

Cool! :-)

I'm going make another attempt at an inbuilt function for this. If 
you've tweaked something in the code from the previous few posts, please 
let me know.

More ReL (Real Life) than RaL (Ray Life) today - so likely later this 
week before I get to it.

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: Elliptical torus
Date: 5 May 2020 13:35:01
Message: <web.5eb1a390a032ea3dfb0b41570@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:

> I'm going make another attempt at an inbuilt function for this. If
> you've tweaked something in the code from the previous few posts, please
> let me know.

Nope - Just been playing around with it a bit to make sure the outer and inner
shapes are truly elliptical (they are).

I know we have a vlength() - but it can't be used in functions (vector
argument).
Maybe if there was a way to just do a Vlength (x,y,z) to get around that...


I was also thinking that non-circular cross sections would be something nice to
have - something like the form factors for the helix functions.  I have one
function that I'll try to work out for that, but other functions similar to the
superellipsoid, "squircle", and rounded box seem like they would have utility
for povvers as well.

Conversely, It would be great to have a "torus" that was spherical or
ellipsoidal - but could follow the shape of some other function or spline.


With regard to dot notations and vectors - what is the "native form" for a
pigment pattern?  Is it an "rgb" vector where each component simply has the same
value unless modified by a color_map?

And is it therefore slower to use .gray or .hf?


> More ReL (Real Life) than RaL (Ray Life) today - so likely later this
> week before I get to it.

So much ReL.  Juggling Arduino, work, home, and COVID ridiculousness.
No worries - take your time.  :)


Post a reply to this message

<<< Previous 7 Messages Goto Latest 10 Messages Next 10 Messages >>>

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