POV-Ray : Newsgroups : povray.advanced-users : elliptical cone? : Re: elliptical cone? Server Time
30 Jul 2024 12:28:10 EDT (-0400)
  Re: elliptical cone?  
From: Nieminen Mika
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

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