|
![](/i/fill.gif) |
"Amir_ni" <nomail@nomail> wrote:
> Hi friends, I wanna make a solid tetrahedron using 4 triangles. I am using the
> following code, but the object's inside is empty (I noticed it, when I used
This generic pyramid is solid (CSG):
// pyramid 1 unit high, 1 unit radius
#macro Pyramid_N ( NSides )
#local Height = 1;
#local Radius = 1/2;
#local SW2 = Radius * cos( 2 * pi / NSides / 2 );
#local SW = 2 * SW2;
#local Alpha_rad = atan( SW / Height );
#local Alpha_deg = Alpha_rad * 180 / pi;
#local H2 = 1.01 * Height / cos ( Alpha_rad );
#local Side = 0;
intersection {
#while (Side < NSides)
box { < -2, 0, -2 >, < 0, 2, 2 >
rotate z * Alpha_deg translate SW2 * x rotate y * ( Side * 360 /
NSides )
}
#local Side = Side + 1;
#end
cylinder { 0 < 0, Height + 1.01, 0 > Radius }
rotate y * 360 / NSides / 2
}
#end
object {
Pyramid_N (4)
pigment { color Red }
}
Post a reply to this message
|
![](/i/fill.gif) |