POV-Ray : Newsgroups : povray.advanced-users : elliptical cone? Server Time
26 Nov 2024 22:46:00 EST (-0500)
  elliptical cone? (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Larry Fontaine
Subject: elliptical cone?
Date: 28 Jul 1999 13:40:02
Message: <379F3F96.48A201E8@isd.net>
I want to make a "cone" of sorts that smoothly connects two ellipses (on
parallel planes) which aren't similar. I tried using a macro that stacks
up thin cylindrical shapes, but that resulted in nasty moire that
nothing got rid of. (I'm thinking of something similar to POV-Ray's cone
object, but with elliptical ends instead of circular. Also a cone scaled
in one direction won't work because the ellipses aren't similar.) I'm
thinking a quadric will do the trick, but I need help making one.


Post a reply to this message

From: ingo
Subject: Re: elliptical cone?
Date: 28 Jul 1999 14:57:01
Message: <379f527d@news.povray.org>
Larry Fontaine heeft geschreven in bericht <379F3F96.48A201E8@isd.net>...
>I want to make a "cone" of sorts that smoothly connects two ellipses (on
>parallel planes) which aren't similar. ........

Though not probably not the most elegant, is this what you're looking for?

#declare A=2;
#declare B=1;

#declare NrPoints=10;
#declare Step=360/NrPoints;
#declare Phi=-Step;

prism {
   quadratic_spline
   conic_sweep
   0,1
   NrPoints+2
   #while (Phi<360+Step)
       <A*cos(radians(Phi)), B*sin(radians(Phi))>
       #declare Phi=Phi+Step;
   #end
   sturm
   pigment {rgb <1,0,0>}
}

ingo
--
Met dank aan de muze met het glazen oog.


Post a reply to this message

From: Nieminen Mika
Subject: Re: elliptical cone?
Date: 29 Jul 1999 06:39:34
Message: <37a02f66@news.povray.org>
Larry Fontaine <lfo### [at] isdnet> wrote:
: I'm
: thinking a quadric will do the trick, but I need help making one.

  You need a quartic for that. Here you are:

//------------------------------------------------------------------------
#macro SuperCone(a,b,c,d)
  intersection
  { quartic
    { <0, 0,  0,  0, 0,   0,   0,  b*b-2*b*d+d*d, 2*(b*d-b*b), b*b,
       0,  0,   0,  0,   0,  0, 0,  0,  0, 0,
       0, 0,  0, a*a-2*a*c+c*c, 2*(a*c-a*a), a*a, 0,  0,  0, 0,
       -(a*a-2*a*c+c*c)*(b*b-2*b*d+d*d),
       -(2*((b*d-b*b)*(a*a-2*a*c+c*c)+(a*c-a*a)*(b*b-2*b*d+d*d))),
       -(b*b*(a*a-2*a*c+c*c)+4*(a*c-a*a)*(b*d-b*b)+a*a*(b*b-2*b*d+d*d)),
       -(2*(b*b*(a*c-a*a)+a*a*(b*d-b*b))), -a*a*b*b>
      sturm
    }
    cylinder { 0, z, max(max(a,b),max(c,d)) }
    bounded_by { cone { 0, max(a,b), z, max(c,d) } }
  }
#end
//------------------------------------------------------------------------


  It creates a cone from <0,0,0> to <0,0,1> with the ends being ellipses,
one with radiuses 'a' and 'b' and the other with radiuses 'c' and 'd'.
  Example:

camera { location -z*10 look_at 0 angle 35 }
light_source { -z*1000,1 }
light_source { y*1000,1 }

object
{ SuperCone(1, .5, 1, 2)
  pigment { rgb x } finish { specular .5 }
  translate -z*.5 scale <1,1,2>
  rotate z*90 rotate -x*45
}

  If someone is interested in the mathematics behind those quartic parameters,
I can explain (although I think nobody will ask... :) ).

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: TonyB
Subject: Re: elliptical cone?
Date: 29 Jul 1999 07:20:05
Message: <37A02A80.FC2CCB77@panama.phoenix.net>
Perhaps you could give the explanation anyway. I may not understand, but I like to
read and try. =) One thing I've noticed is that these 'quartics' can do some of
the stuff that an isosurface can do. Am I correct in assuming this?

--
Anthony L. Bennett
http://welcome.to/TonyB

Non nova, sed nove.


Post a reply to this message

From: Chris Huff
Subject: Re: elliptical cone?
Date: 29 Jul 1999 07:31:49
Message: <37A03BB4.16480155@compuserve.com>
Could you please explain the parameters? I had given up on quartic,
poly, etc and decided to use isosurfaces, because I couldn't figure out
what the parameters meant.


Post a reply to this message

From: Nieminen Mika
Subject: Re: elliptical cone?
Date: 29 Jul 1999 08:28:02
Message: <37a048d2@news.povray.org>
The formula of an elliptical cylinder along the z-axis is the following:

x^2/r1^2 + y^2/r2^2 = 1

where 'r1' and 'r2' are the radiuses of the ellipse.
  What we want is this kind of cylinder which changes linearly from z=0 to
z=1 so that in z=0 the ellipse has radiuses 'a' and 'b' and in z=1 radiuses
'c' and 'd'.
  This means that when z=0, r1=a and r2=b. Then r1 and r2 should linearly
change so that when z=1, r1=c and r2=d.
  This can be expressed this way:

r1 = a*(1-z)+c*z
r2 = b*(1-z)+d*z

  Substituting in the above formula we get:

x^2/(a*(1-z)+c*z)^2 + y^2/(b*(1-z)+d*z)^2 = 1

  That's it. Now we have to reduce that to polynomial form so that we can
write the quartic. This is a quite laborious job. I will not type the
polynom here because it's so long, but it begins this way:

b^2*x^2 + 2*(b*d-b^2)*x^2*z + (b^2-2*b*d+d^2)*x^2*z^2 + ... and so on

  Now, to write the polynomial, we look at the table in the page 212 of the
povray manual (the "Poly, Cubic and Quartic"-section). We place all the
terms of the polynomial in the right places in the vector. The result is:

quartic
{ <0, 0,  0,  0, 0,   0,   0,  b*b-2*b*d+d*d, 2*(b*d-b*b), b*b,
   0,  0,   0,  0,   0,  0, 0,  0,  0, 0,
   0, 0,  0, a*a-2*a*c+c*c, 2*(a*c-a*a), a*a, 0,  0,  0, 0,
   -(a*a-2*a*c+c*c)*(b*b-2*b*d+d*d),
   -(2*((b*d-b*b)*(a*a-2*a*c+c*c)+(a*c-a*a)*(b*b-2*b*d+d*d))),
   -(b*b*(a*a-2*a*c+c*c)+4*(a*c-a*a)*(b*d-b*b)+a*a*(b*b-2*b*d+d*d)),
   -(2*(b*b*(a*c-a*a)+a*a*(b*d-b*b))), -a*a*b*b>
}

  Now we only have to cut the unwanted parts out (ie. everything that is
at z<0 and z>1) and bound with a proper object for speedup.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: elliptical cone?
Date: 29 Jul 1999 11:40:16
Message: <37A075EF.1DE877CD@compuserve.com>
Hmm, I think I will just stick to the isosurfaces. :-)


Post a reply to this message

From: Ken
Subject: Re: elliptical cone?
Date: 29 Jul 1999 12:00:29
Message: <37A078B1.E8D53C7C@pacbell.net>
Chris Huff wrote:
> 
> Hmm, I think I will just stick to the isosurfaces. :-)

Must be a way to fake it with a csg if you ask me ;^ }

-- 
Ken Tyler
  
mailto://tylereng@pacbell.net
http://home.pacbell.net/tylereng/links.htm


Post a reply to this message

From: Bob Hughes
Subject: Re: elliptical cone?
Date: 29 Jul 1999 14:56:16
Message: <37a0a3d0@news.povray.org>
It's nice to know someone actually understands it enough to work with
the math. All I've ever done is put some numbers in to these sort of
primitives. Got a hat shape I wanted that way though ;) pure luck and
then a little tweaking.


Nieminen Mika wrote:
> 
>   The formula of an elliptical cylinder along the z-axis is the following:
> 
> x^2/r1^2 + y^2/r2^2 = 1
> 
> where 'r1' and 'r2' are the radiuses of the ellipse.
>   What we want is this kind of cylinder which changes linearly from z=0 to
> z=1 so that in z=0 the ellipse has radiuses 'a' and 'b' and in z=1 radiuses
> 'c' and 'd'.
>   This means that when z=0, r1=a and r2=b. Then r1 and r2 should linearly
> change so that when z=1, r1=c and r2=d.
>   This can be expressed this way:
> 
> r1 = a*(1-z)+c*z
> r2 = b*(1-z)+d*z
> 
>   Substituting in the above formula we get:
> 
> x^2/(a*(1-z)+c*z)^2 + y^2/(b*(1-z)+d*z)^2 = 1
> 
>   That's it. Now we have to reduce that to polynomial form so that we can
> write the quartic. This is a quite laborious job. I will not type the
> polynom here because it's so long, but it begins this way:
> 
> b^2*x^2 + 2*(b*d-b^2)*x^2*z + (b^2-2*b*d+d^2)*x^2*z^2 + ... and so on
> 
>   Now, to write the polynomial, we look at the table in the page 212 of the
> povray manual (the "Poly, Cubic and Quartic"-section). We place all the
> terms of the polynomial in the right places in the vector. The result is:
> 
> quartic
> { <0, 0,  0,  0, 0,   0,   0,  b*b-2*b*d+d*d, 2*(b*d-b*b), b*b,
>    0,  0,   0,  0,   0,  0, 0,  0,  0, 0,
>    0, 0,  0, a*a-2*a*c+c*c, 2*(a*c-a*a), a*a, 0,  0,  0, 0,
>    -(a*a-2*a*c+c*c)*(b*b-2*b*d+d*d),
>    -(2*((b*d-b*b)*(a*a-2*a*c+c*c)+(a*c-a*a)*(b*b-2*b*d+d*d))),
>    -(b*b*(a*a-2*a*c+c*c)+4*(a*c-a*a)*(b*d-b*b)+a*a*(b*b-2*b*d+d*d)),
>    -(2*(b*b*(a*c-a*a)+a*a*(b*d-b*b))), -a*a*b*b>
> }
> 
>   Now we only have to cut the unwanted parts out (ie. everything that is
> at z<0 and z>1) and bound with a proper object for speedup.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Mark Wagner
Subject: Re: elliptical cone?
Date: 30 Jul 1999 01:10:41
Message: <37a133d1@news.povray.org>
Ken wrote in message <37A078B1.E8D53C7C@pacbell.net>...
>
>
>Chris Huff wrote:
>>
>> Hmm, I think I will just stick to the isosurfaces. :-)
>
>Must be a way to fake it with a csg if you ask me ;^ }


Yes, by using the integral method -- use an infinite number of
infinitesmally thin elliptical cylinders with infinitesmal differences
between adjoining cylinders.

Mark


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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