|
|
Here is a mini scene that demonstrates my Box_connect macro.
#include "colors.inc"
#include "finish.inc"
light_source{ <-3,4,-5>*100 rgb 2}
camera{translate -4*z}
#macro Box_connect(Point1,Point2,Width,Height,Up,Gap)
#local V1 = (Point2-Point1);
#local Length = vlength(V1);
#local X1 = vnormalize(z);
#local Z1 = vnormalize(vcross(X1,y));
#local Y1 = vcross(Z1,X1);
#local X2 = vnormalize(V1);
#local Z2 = vnormalize(vcross(X2,Up));
#local Y2 = vcross(Z2,X2);
box{<-Width/2,-Height/2,-Gap>,<Width/2,Height/2,Length+Gap>
transform {
matrix <X1.x,Y1.x,Z1.x,X1.y,Y1.y,Z1.y,X1.z,Y1.z,Z1.z,0,0,0>
matrix <vdot(X2,X1),vdot(X2,Y1),vdot(X2,Z1),vdot(Y2,X1),
vdot(Y2,Y1),vdot(Y2,Z1),vdot(Z2,X1),vdot(Z2,Y1),vdot(Z2,Z1),0,0,0>
matrix <X1.x,X1.y,X1.z,Y1.x,Y1.y,Y1.z,Z1.x,Z1.y,Z1.z,0,0,0>
translate Point1}
}
#end
union{
object{Box_connect(x,y,.2,.1,y,0)}
object{Box_connect(-x,y,.2,.1,y,0)}
object{Box_connect(z,y,.2,.1,y,0)}
object{Box_connect(-z,y,.2,.1,y,0)}
object{Box_connect(x,-y,.2,.1,y,0)}
object{Box_connect(-x,-y,.2,.1,y,0)}
object{Box_connect(z,-y,.2,.1,y,0)}
object{Box_connect(-z,-y,.2,.1,y,0)}
object{Box_connect(z,-x,.1,.2,y,0)}
object{Box_connect(-z,-x,.1,.2,y,0)}
object{Box_connect(z,x,.1,.2,y,0)}
object{Box_connect(-z,x,.1,.2,y,0)}
pigment{Cyan}finish{Dull}}
union{
object{Box_connect(<1,1,1>,<1,-1,-1>,.2,.1,y,0)}
object{Box_connect(<1,1,1>,<-1,-1,1>,.2,.1,y,0)}
object{Box_connect(<1,1,1>,<-1,1,-1>,.1,.2,y,0)}
object{Box_connect(<-1,-1,1>,<1,-1,-1>,.1,.2,y,0)}
object{Box_connect(<-1,-1,1>,<-1,1,-1>,.2,.1,y,0)}
object{Box_connect(<-1,1,-1>,<1,-1,-1>,.2,.1,y,0)} // <--- try changing
the
pigment{Blue}finish{Dull}} // last
parameter here
// to learn what
Gap does
union{
object{Box_connect(<1,1,1>,<-1,1,1>,.1,.1,y,0)}
object{Box_connect(<1,-1,1>,<-1,-1,1>,.1,.1,y,0)}
object{Box_connect(<1,1,-1>,<-1,1,-1>,.1,.1,y,0)}
object{Box_connect(<1,-1,-1>,<-1,-1,-1>,.1,.1,y,0)}
object{Box_connect(<1,1,1>,<1,1,-1>,.1,.1,y,0)}
object{Box_connect(<-1,1,1>,<-1,1,-1>,.1,.1,y,0)}
object{Box_connect(<1,-1,1>,<1,-1,-1>,.1,.1,y,0)}
object{Box_connect(<-1,-1,1>,<-1,-1,-1>,.1,.1,y,0)}
object{Box_connect(<1,1,1>,<1,-1,1>,.1,.1,x,0)}
object{Box_connect(<-1,1,1>,<-1,-1,1>,.1,.1,x,0)}
object{Box_connect(<1,1,-1>,<1,-1,-1>,.1,.1,x,0)}
object{Box_connect(<-1,1,-1>,<-1,-1,-1>,.1,.1,x,0)}
pigment{Magenta}finish{Dull}}
--
Dan Johnson
http://www.geocities.com/zapob
Post a reply to this message
|
|