use geometry.frink // Return a polygon object representing the specified equilateral triangle. // THINK ABOUT: Would this be better as a GeneralPath of 4 disconnected // polygons? makeEquilateralTriangle[cx, cy, sideLength, rotation] := { p = new polygon halfL = 1/2 sideLength h = halfL sqrt[3] halfH = 1/2 h x1 = cx y1 = cy - halfH [x2, y2] = rotateAroundPoint[x1,y1,cx,cy,rotation] p.addPoint[x2, y2] x1 = cx - halfL y1 = cy + halfH [x2, y2] = rotateAroundPoint[x1,y1,cx,cy,rotation] p.addPoint[x2, y2] x1 = cx + halfL [x2, y2] = rotateAroundPoint[x1,y1,cx,cy,rotation] p.addPoint[x2, y2] return p } // Draw the specified tetrahedron into the graphics object. makeTetrahedron[g is graphics, cx, cy, sideLength] := { hl = sideLength / 2 ho = hl sqrt[3] g.add[makeEquilateralTriangle[cx, cy, sideLength, 0 deg]] g.add[makeEquilateralTriangle[cx, cy + ho, sideLength, 180 deg]] g.add[makeEquilateralTriangle[cx + hl, cy + ho, sideLength, 0 deg]] g.add[makeEquilateralTriangle[cx - hl, cy + ho, sideLength, 0 deg]] } g = new graphics makeTetrahedron[g, 0, 0, 1] g.show[]