POV-Ray : Newsgroups : povray.general : Problem shaping a CSG object : Re: Problem shaping a CSG object Server Time
30 Jul 2024 06:20:32 EDT (-0400)
  Re: Problem shaping a CSG object  
From: Chris B
Date: 29 Jul 2009 06:50:32
Message: <4a702978@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote in message 
news:4a70161e@news.povray.org...
> Hi all,
>
> I need a CSG object that basically has the shape of a cone, but with the 
> apex as a straight edge parallel to the base, with a length equal to the 
> diameter of the base. I tried all kinds of combinations but am unable to 
> get this right.
>
> Any help will be much appreciated. Thanks a lot.
>
> -- 
> All the best,
>
> Thomas
>
> "Sic vive, tanquam cras moriturus, sic stude, quasi semper victurus." 
> Desiderius Erasmus

An Isosurface is the easiest and quickest and is technically CSGable.
Otherwise you can get the same shape by taking slices of a squashed sphere.
Both are illustrated below. Turning up the interval for the slicing gives 
smoother results, but less interesting render times.

Regards,
Chris B.



camera {location <-2, 2.5, -1.5> look_at <1,0.25,0>}
light_source {<2,20,-15> color rgb 1}


isosurface {
  function { (x*x*(y*y)+z*z-y*y)}
    accuracy 0.001
    max_gradient 4
    contained_by{box{<-1,-1,-1>,<1,0,1>}}
    pigment {rgb <1,1,0>}
    finish {phong 0.5 phong_size 10}
    translate y
    translate x*3
}

#local Interval = 0.05;
merge {
  #local I = 0;
  #while (I<1)
     intersection {
       sphere {0,1}
       box {<-1,0,-1><1,Interval,1>}
       scale z*(1-I)
       translate I*y
     }
     #local I = I+Interval;
  #end
  pigment {rgb 1}
}


Post a reply to this message

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