POV-Ray : Newsgroups : povray.general : Constructing a solid tetrahedron by 4 triangles : Re: Constructing a solid tetrahedron by 4 triangles Server Time
30 Jul 2024 12:26:33 EDT (-0400)
  Re: Constructing a solid tetrahedron by 4 triangles  
From: stevenvh
Date: 5 Feb 2009 11:30:03
Message: <web.498b133ff5dfc3fc0721a1d0@news.povray.org>
"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

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