POV-Ray : Newsgroups : povray.newusers : Elliptical Torus Server Time
29 Jul 2024 14:14:48 EDT (-0400)
  Elliptical Torus (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: helge h
Subject: Re: Elliptical Torus
Date: 1 Mar 2006 19:45:00
Message: <web.44063f9261f3c5391c6902970@news.povray.org>
"tgl" <aub### [at] sympaticoca> wrote:
> Hello All
> Is it possible to create an elliptical torus with a varying major diameter
> and a constant minor diameter?
>   Thanx,
>   tgl

or approximate it by connecting spheres and cylinders. May render faster?

H


Post a reply to this message

From: tgl
Subject: Re: Elliptical Torus
Date: 1 Mar 2006 20:40:01
Message: <web.44064c4c61f3c539a88bea740@news.povray.org>
"tgl" <aub### [at] sympaticoca> wrote:
> Hello All
> Is it possible to create an elliptical torus with a varying major diameter
> and a constant minor diameter?
>   Thanx,
>   tgl

 I was looking to use the torus object statement and incorperate a
mathematical formula to create an oval shape of what ever dimensions and
keep the torus cylinder itself a constant diameter. Scaling a torus doesn't
work.
 Anyone know a formula that may work?
 Again thank you,
 tgl


Post a reply to this message

From: Mike Williams
Subject: Re: Elliptical Torus
Date: 2 Mar 2006 03:16:54
Message: <mdb6oHAXmqBEFwHS@econym.demon.co.uk>
Wasn't it Roman Reiner who wrote:
>"tgl" <aub### [at] sympaticoca> wrote:
>> Hello All
>> Is it possible to create an elliptical torus with a varying major diameter
>> and a constant minor diameter?
>>   Thanx,
>>   tgl
>
>it should be possible with isosurfaces. see e.g.
>http://www.econym.demon.co.uk/isotut/variable.htm
>Another possibility would be to approximate the surface with a spheresweep,
>see 2.4.1.10 Sphere Sweep
>http://www.povray.org/documentation/view/3.6.1/284/

I've tried to achieve the effect by modifying the "surface of
revolution" isosurface technique, but everything that changes the major
diameter seems to have a side effect that changes the shape of the minor
cross section.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Roman Reiner
Subject: Re: Elliptical Torus
Date: 2 Mar 2006 05:00:00
Message: <web.4406c1fa61f3c539f37ab23e0@news.povray.org>
does this work for you?

camera {
  location <-5,15,-10>
  look_at 0
  angle 45
}
light_source {
  <-5,15,-10>
  rgb 1
}

#local a = 5; //semimajor axis
#local b = 3; //semiminor axis
#local r = .5; //minor radius

#local n = 20;//number of spheres/accuracy of object

sphere_sweep {
  cubic_spline
  n+3,
  #local i=0;
  #while(i<=2*pi*(1+2/n))
    <a*sin(i),0,b*cos(i)>, r
    #local i=i+(2*pi/n);
  #end
  pigment { rgb y }
  finish { phong 1 }
}

Regards Roman


Post a reply to this message

From: tgl
Subject: Re: Elliptical Torus
Date: 2 Mar 2006 17:50:00
Message: <web.4407760b61f3c5399fea01560@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> does this work for you?
>
> camera {
>   location <-5,15,-10>
>   look_at 0
>   angle 45
> }
> light_source {
>   <-5,15,-10>
>   rgb 1
> }
>
> #local a = 5; //semimajor axis
> #local b = 3; //semiminor axis
> #local r = .5; //minor radius
>
> #local n = 20;//number of spheres/accuracy of object
>
> sphere_sweep {
>   cubic_spline
>   n+3,
>   #local i=0;
>   #while(i<=2*pi*(1+2/n))
>     <a*sin(i),0,b*cos(i)>, r
>     #local i=i+(2*pi/n);
>   #end
>   pigment { rgb y }
>   finish { phong 1 }
> }
>
> Regards Roman

Tried the above and as is, it looks good but then I tried the following
variation...

camera {
  location <0,0,-10>
  look_at 0

}
light_source {
  <-5,15,-10>
  rgb 1
}

#local a = 5; //semimajor axis
#local b = 3; //semiminor axis
#local r = .5; //minor radius

#local n = 20;//number of spheres/accuracy of object

sphere_sweep {
  cubic_spline
  n+3,
  #local i=0;
  #while(i<=2*pi*(1+2/n))
    <a*sin(i),0,b*cos(i)>, r
    #local i=i+(2*pi/n);
  #end
  pigment { rgb y }
  finish { phong 1 }
  rotate <-90,0,0>
}

 Is there some kind of distortion happening here or am I seeing things. I
really need an accurate and consistant shape.
 tgl


Post a reply to this message

From: Bruno Cabasson
Subject: Re: Elliptical Torus
Date: 2 Mar 2006 19:05:00
Message: <web.440786bb61f3c5392bb58dc50@news.povray.org>
Hi!

I worked on the problem and I posted in p.b.i + p.b.s-f a solution with
sphere_sweep, and also with a blob (fast render) with a constant behaviour
(I think ..). Your problem might come from the use of the parametric form
of an ellipse, which gives non-constant spacing between samples on the
perimeter from regular parametric values, or/and perhaps from the use of too
few control points in the spline.

The blob macro I posted uses also the parametric equation, but travels along
the perimeter by oversampling, an drops a blob element every constant
spacing, giving quite good results. I hope thi will help, and I am sure
that what I did can be very much improved.

    Bruno


Post a reply to this message

From: Mike Williams
Subject: Re: Elliptical Torus
Date: 3 Mar 2006 01:36:43
Message: <MZzwpFA2M+BEFwDD@econym.demon.co.uk>
Wasn't it tgl who wrote:
> Is there some kind of distortion happening here or am I seeing things. I
>really need an accurate and consistant shape.

It's an optical illusion caused by the fact that you see more shadow on
the horizontal parts, and the shadow is the same colour as the
background.

If you run that test with a white background the illusion goes away and
you can see that the real shape is consistent.
background {rgb 1}
        
You can easily check the accuracy by adding some spheres with a slightly
larger radius along the ellipse, and observing that they all fit
properly.

camera {
  location <0,0,-10>
  look_at 0

}
light_source {
  <-5,15,-10>
  rgb 1
}

#local a = 5; //semimajor axis
#local b = 3; //semiminor axis
#local r = .5; //minor radius

#local n = 20;//number of spheres/accuracy of object


sphere_sweep {
  cubic_spline
  n+3,
  #local i=0;
  #while(i<=2*pi*(1+2/n))
    <a*sin(i),0,b*cos(i)>, r
    #local i=i+(2*pi/n);
  #end
  pigment { rgb y }
  finish { phong 1 }
  rotate <-90,0,0>
}

background {rgb 1}

#local i=0;
#while(i<=2*pi*(1+2/n))
  sphere{<a*sin(i),b*cos(i),0>, r+0.001 pigment {rgb <2,2,0>}}
  #local i=i+(2*pi/n);
#end


Post a reply to this message

From: tgl
Subject: Re: Elliptical Torus
Date: 3 Mar 2006 03:45:00
Message: <web.4408015b61f3c539ad16512d0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> It's an optical illusion caused by the fact that you see more shadow on
> the horizontal parts, and the shadow is the same colour as the
> background.
>
> If you run that test with a white background the illusion goes away and
> you can see that the real shape is consistent.
> background {rgb 1}
>
 Dear Friends
These old eyes just ain't what they used to be!
I would like to take this opportunity to thank Mr. Williams and everyone
else who have taken time enlightening me!
 Take care,
  tgl


Post a reply to this message

From: Sebastian H 
Subject: Re: Elliptical Torus
Date: 4 Mar 2006 12:23:54
Message: <4409cd2a@news.povray.org>
tgl wrote:
> "tgl" <aub### [at] sympaticoca> wrote:
> 
>>Hello All
>>Is it possible to create an elliptical torus with a varying major diameter
>>and a constant minor diameter?
>>  Thanx,
>>  tgl
> 

I found an isosurface sullution but it's
ugly and slow and I'm not sure whether it
is mathematical "correct" description of
the surface you're looking for. Anyhow it
looks quite like an elliptical torus.

Starting with the two focal point implicit
definition of an ellipse one can simply
alter the ellipse radii with y. The max gradient
explodes but it must be somewhere above the surface
since there are no black spots with a max gradient around
18.

Here's the code snippet.

/*
  * Isosurface ellipsoid torus
  */
#declare Torus_RmajX = 8.0;
#declare Torus_RmajZ = 3.0;
#declare Torus_Rmin = 1.0;

#declare bbox_min = <-(Torus_RmajX + Torus_Rmin), -Torus_Rmin, 
-(Torus_RmajZ + Torus_Rmin)>;
#declare bbox_max = < (Torus_RmajX + Torus_Rmin),  Torus_Rmin, 
(Torus_RmajZ + Torus_Rmin)>;

// Function for focal length with given major and minor radius
// Major radius is along x-axis, minor along z-axis
// This function is abused in f_iso_ellipsoid_torus where
// the same term is required
#declare f_fl = function(rx, rz) { sqrt(max(rx*rx - rz*rz, 0)) }
// The max function above is neccessary to avoid negative square
// roots

// Function for an ellipse in the xz plane
#declare f_iso_ellipsoid =
   function(x,y,z,rx,rz) {
     f_r(x+f_fl(rx,rz),0,z) + f_r(x-f_fl(rx,rz),0,z) - 2*rx
   }

// Use of ellipse function to create inner and outer torus
// halfes which are merged with max()
#declare f_iso_ellipsoid_torus =
   function(x,y,z) {
     max (
 
f_iso_ellipsoid(x,y,z,Torus_RmajX+f_fl(Torus_Rmin,y),Torus_RmajZ+f_fl(Torus_Rmin,y)),
 
-f_iso_ellipsoid(x,y,z,Torus_RmajX-f_fl(Torus_Rmin,y),Torus_RmajZ-f_fl(Torus_Rmin,y))
     )
   }

// The actual object
#declare Iso_Ellipsoid_Torus =
   isosurface {
     function { f_iso_ellipsoid_torus(x,y,z) }
     contained_by { box { bbox_min, bbox_max } }  // container shape
     max_gradient 18                      // maximum gradient the 
function can have [1.1]
   }

End of code snippet.

I looked around in the internet for a function
that returns the distance to an ellipse which
seems to be an unsolvable problem. At least
this is what some papers claimed.
Somwhere the problem was reduced to a
quartic which can be solved somehow iirc
so the above statement would be wrong.
I did not follow it any further but it
is an interesting problem. Maybe I'll
give it another try some day...

Regards,
Sebastian


Post a reply to this message

From: Sebastian H 
Subject: Re: Elliptical Torus
Date: 4 Mar 2006 12:26:24
Message: <4409cdc0$1@news.povray.org>
Sebastian H. wrote:
> 
> I found an isosurface sullution but it's

Well, rereading the own post is a good habit...


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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