POV-Ray : Newsgroups : povray.text.scene-files : BoxBlob source : BoxBlob source Server Time
28 Jul 2024 18:26:15 EDT (-0400)
  BoxBlob source  
From: TonyB
Date: 5 Oct 1999 20:54:54
Message: <37fa9dde@news.povray.org>
Well, here it is. I don't see any need for this. It seems simple, at least
it did to me after Samuel's explanation. I'll break it down for you,
nonetheless.

/*

          05-10-1999
  "BoxBlob" by Anthony Bennett
 Feel free to use it, all I want
  is credit and/or notification

 Notes:

 *         blob
 |         union
 &         intersection
 %         difference
 min(a,b)  union
 max(a,b)  intersection

*/

//lights!
light_source {< 1,1,-1>*10 rgb <1.00,1.00,0>*2/3}
light_source {< 0,1,-1>*10 rgb <1.00,0.75,0>*2/3}
light_source {<-1,1,-1>*10 rgb <1.00,0.50,0>*2/3}

//camera!
camera {location <1,2,-3>*2.8 look_at 0}

//action!

//Following are the definitions for
//the boxes used in the function of
//the isosurface.

#declare c1 = < 1,4, 1>;
#declare c2 = <-1,2,-1>;
#declare x1 = c1.x;
#declare y1 = c1.y;
#declare z1 = c1.z;
#declare x2 = c2.x;
#declare y2 = c2.y;
#declare z2 = c2.z;

#declare d1 = <1,-2,1>;
#declare d2 =-<1, 4,1>;
#declare u1 = d1.x;
#declare v1 = d1.y;
#declare w1 = d1.z;
#declare u2 = d2.x;
#declare v2 = d2.y;
#declare w2 = d2.z;

#declare e1 = <2, 1, 1>;
#declare e2 = <4,-1,-1>;
#declare i1 = e1.x;
#declare j1 = e1.y;
#declare k1 = e1.z;
#declare i2 = e2.x;
#declare j2 = e2.y;
#declare k2 = e2.z;

#declare f1 = <-2, 1, 1>;
#declare f2 = <-4,-1,-1>;
#declare l1 = f1.x;
#declare m1 = f1.y;
#declare n1 = f1.z;
#declare l2 = f2.x;
#declare m2 = f2.y;
#declare n2 = f2.z;

#declare r0 = 3;
#declare r1 = 1;

isosurface
{
 function
 //torus, modified and shortened formula from quartic in pov-docs
 (x^2*(x^2+2*z^2+2*y^2) + y^2*(y^2+2*z^2-2*(r0^2+r1^2)) + z^4 +
(r0^2-r^2)*(2*z^2-2*x^2+(r0^2-r^2)))
 *
 //top box
 ((x-x1)*(x-x2) & (z-z1)*(z-z2) & (y-y1)*(y-y2))// +
(sqrt(x^2+(y-3)^2+z^2)-1))
 *
 //bottom box
 ((x-u1)*(x-u2) & (z-w1)*(z-w2) & (y-v1)*(y-v2))// +
(sqrt(x^2+(y+3)^2+z^2)-1))
 *
 //side box 1 (sorry, i forget which side...)
 ((x-i1)*(x-i2) & (z-k1)*(z-k2) & (y-j1)*(y-j2))// +
(sqrt((x-3)^2+y^2+z^2)-1))
 *
 //side box 2 (sorry, i forget which side...)
 ((x-l1)*(x-l2) & (z-n1)*(z-n2) & (y-m1)*(y-m2))// +
(sqrt((x+3)^2+y^2+z^2)-1))
 //perhaps threshold is a bit high, it doesn't seem to affect the boxblob
much
 threshold 100 sign 1 bounded_by {sphere {0,4.5}}
 //simplicity
 pigment {rgb 1} finish {phong 1}
}


Post a reply to this message

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