| 
|  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | I've been trying to model a heart-shaped box in POV-Ray, but even though I
have the vague idea that using splines would be a good idea, I have no idea
how. Could anyone give me any tips on that?
 Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Wasn't it Caligula who wrote:
>I've been trying to model a heart-shaped box in POV-Ray, but even though I
>have the vague idea that using splines would be a good idea, I have no idea
>how. Could anyone give me any tips on that?
You might consider isosurfaces. This isosurface happens to be reasonably
fast. Here's one with a rounded top.
#include "functions.inc"
camera { location  <1, 2, -3> look_at <0, 0.2, 0> angle 30}
light_source {<100,200,-100> colour rgb 1}
light_source {<-100,100,-100> colour rgb 0.5}
// heart shaped isosurface function
#declare Bend = 0.5;
#declare Sharpness = 0.8;
#declare heart = function { f_sphere(y-pow(abs(x),Sharpness)*Bend,z*2,x,
0.6) }
#declare boxheight = 0.25;
#declare toproundedness = 0.3;
// sides
isosurface {
  function { heart(x,z,0) }
        max_gradient 2.0
        contained_by{box{<-1,0,-1><1,boxheight,1>}}
        pigment {rgb x}
        finish {phong 1.5 phong_size 50}
}
// rounded top
isosurface {
  function { heart(x,z,y) }
        max_gradient 2.0
        contained_by{sphere {0,1}}
        pigment {rgb x}
        finish {phong 1.5 phong_size 50}
  scale <1,toproundedness,1> 
  translate boxheight*y
}
-- 
Mike Williams
Gentleman of Leisure
Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Caligula wrote:
> I've been trying to model a heart-shaped box in POV-Ray, but even though I
> have the vague idea that using splines would be a good idea, I have no idea
> how. Could anyone give me any tips on that?
> 
> 
I'd use a prism:
I have a Prism editor at my web site:
  http://leroywhetstone.s5.com/
Here's a not very good example:
#declare Heart=prism{
bezier_spline
-0.1,0.1,24
<0,-1.08>
<0.266667,-0.773333> //___control___
<0.733333,-0.466667> //___control___
<1,0.48>
<1,0.48>
<1.17333,0.893333> //___control___
<0.866667,1.10667> //___control___
<0.493333,1.02667>
<0.493333,1.02667>
<0.186667,0.933333> //___control___
<0.133333,0.72> //___control___
<0,0.546666>
<0,0.546666>
<-0.0666667,0.693333> //___control___
<-0.226667,0.96> //___control___
<-0.56,1.05333>
<-0.56,1.05333>
<-0.853333,1.08> //___control___
<-1.16,0.96> //___control___
<-0.986667,0.52>
<-0.986667,0.52>
<-0.64,-0.493333> //___control___
<-0.28,-0.773333> //___control___
<0,-1.08>
}
Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Leroy nous apporta ses lumieres en ce 2007/06/25 23:33:
> 
> Caligula wrote:
>> I've been trying to model a heart-shaped box in POV-Ray, but even 
>> though I
>> have the vague idea that using splines would be a good idea, I have no 
>> idea
>> how. Could anyone give me any tips on that?
>>
>>
> 
> I'd use a prism:
> I have a Prism editor at my web site:
>  http://leroywhetstone.s5.com/
> 
> Here's a not very good example:
> 
> #declare Heart=prism{
> bezier_spline
> -0.1,0.1,24
> <0,-1.08>
> <0.266667,-0.773333> //___control___
> <0.733333,-0.466667> //___control___
> <1,0.48>
> <1,0.48>
> <1.17333,0.893333> //___control___
> <0.866667,1.10667> //___control___
> <0.493333,1.02667>
> <0.493333,1.02667>
> <0.186667,0.933333> //___control___
> <0.133333,0.72> //___control___
> <0,0.546666>
> <0,0.546666>
> <-0.0666667,0.693333> //___control___
> <-0.226667,0.96> //___control___
> <-0.56,1.05333>
> <-0.56,1.05333>
> <-0.853333,1.08> //___control___
> <-1.16,0.96> //___control___
> <-0.986667,0.52>
> <-0.986667,0.52>
> <-0.64,-0.493333> //___control___
> <-0.28,-0.773333> //___control___
> <0,-1.08>
> }
> 
The drawback is that you can only have a flat top. BUT, it does render somewhat 
faster. The isosurface solution by Mike offer you a rounded top, with the 
ability of adjusting the roundness to your liking.
-- 
Alain
-------------------------------------------------
BE ALERT!!!!  (The world needs more lerts ...)
Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |