POV-Ray : Newsgroups : povray.newusers : Making A Heart : Re: Making A Heart Server Time
28 Jul 2024 22:26:28 EDT (-0400)
  Re: Making A Heart  
From: Mike Williams
Date: 24 Jun 2007 23:11:56
Message: <EU7iqDAuFzfGFwK$@econym.demon.co.uk>
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

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