|
Edit
| Attach
| Backlinks: Web All webs
| Printable
| History: r3 < r2 < r1
More
{
/* Folding Box
}
PROCEDURE GenerateBox;
CONST
GlueFactor = 0.1;
VAR
Height:REAL;
Radius:REAL;
Edge:REAL;
Angel: REAL;
CutColor:INTEGER;
FoldColor:INTEGER;
Corners:INTEGER;
RunVar:INTEGER;
BEGIN
{assign Parameters}
Height := PHEIGHT;
Radius := PRADIUS;
Corners := PCORNERS;
CutColor:=PCUTCOLOR;
FoldColor:=PFOLDCOLOR;
{get Edgelegth & Angel}
Edge := 2 * Radius * sin(Pi/Corners);
Angel := Pi/Corners;
PenFore(FoldColor);
MoveTo(0,0);
LineTo(Edge*Corners,0);
MoveTo(0, Height);
LineTo(Edge*Corners, Height);
PenFore(CutColor);
MoveTo(Edge*Corners,0);
LineTo(Edge*Corners, Height);
MoveTo(0,0);
LineTo(-GlueFactor*Radius, GlueFactor*Radius);
LineTo(-GlueFactor*Radius, Height-GlueFactor*Radius);
LineTo(0, Height);
LineTo(-GlueFactor*Radius, Height+GlueFactor*Radius);
LineTo(-GlueFactor*Radius, Height+cos(Angel)*Radius-GlueFactor*Radius);
LineTo(0, Height+cos(Angel)*Radius);
MoveTo(Edge*Corners,Height);
LineTo(Edge*Corners,Height+cos(Angel)*Radius);
FOR RunVar := 1 TO Corners DO BEGIN
PenFore(FoldColor);
MoveTo(Edge*(RunVar-1),0);
LineTo(Edge*(RunVar-1),Height);
MoveTo(Edge*(RunVar-1),Height);
LineTo(Edge*(RunVar-1),Height+cos(Angel)*Radius);
MoveTo(Edge*RunVar,Height+cos(Angel)*Radius);
PenFore(CutColor);
LineTo(Edge*RunVar-sin(Angel)*Radius,Height+cos(Angel)*Radius);
PenFore(FoldColor);
LineTo(Edge*RunVar, Height);
PenFore(CutColor);
ArcByCenter(Edge*(RunVar-0.75), Height+cos(Angel)*Radius,Edge/4, 0, 180);
MoveTo(Edge*(RunVar-1),0);
LineTo(Edge*(RunVar-1)+GlueFactor*Radius,-GlueFactor*Radius);
LineTo(Edge*(RunVar)-GlueFactor*Radius,-GlueFactor*Radius);
LineTo(Edge*RunVar,0);
MoveTo(Radius+Radius*cos(2*Angel*(RunVar-1)),-Radius*(1+2*GlueFactor)+Radius*sin(2*Angel*(RunVar-1)));
LineTo(Radius+Radius*cos(2*Angel*RunVar),-Radius*(1+2*GlueFactor)+Radius*sin(2*Angel*RunVar));
END;
END;
RUN(GenerateBox);
* 1.jpg:
Edit
| Attach
| Backlinks: Web All webs
| Printable
| History: r3 < r2 < r1
More
|