Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
42
Task/Pentagram/ALGOL-68/pentagram.alg
Normal file
42
Task/Pentagram/ALGOL-68/pentagram.alg
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
BEGIN # draw a pentagram, using SVG #
|
||||
|
||||
OP SIND = ( REAL x )REAL: sin( x * pi / 180 );
|
||||
OP COSD = ( REAL x )REAL: cos( x * pi / 180 );
|
||||
PRIO FMT = 9;
|
||||
OP FMT = ( REAL v, INT dp )STRING:
|
||||
BEGIN
|
||||
STRING result = IF ENTIER v = v
|
||||
THEN whole( v, - dp * 16 )
|
||||
ELSE fixed( v, - dp * 16, ABS dp )
|
||||
FI;
|
||||
INT v pos := LWB result;
|
||||
WHILE result[ v pos ] = " " DO v pos +:= 1 OD;
|
||||
result[ v pos : ]
|
||||
END # FMT # ;
|
||||
PROC point = ( REAL x, y )STRING: x FMT 2 + " " + y FMT 2;
|
||||
|
||||
PROC draw gram = ( INT width, height, vertices, REAL side, start x, start y, line width )VOID:
|
||||
BEGIN
|
||||
REAL angle = 360 / vertices;
|
||||
print( ( "<svg xmlns='http://www.w3.org/2000/svg' width='"
|
||||
, whole( width, 0 ), "' height='", whole( height, 0 ), "'>", newline
|
||||
)
|
||||
);
|
||||
REAL x := start x, y := start y;
|
||||
print( ( " <polygon points='", point( x, y ) ) );
|
||||
REAL heading := angle;
|
||||
TO vertices DO
|
||||
x +:= side * COSD heading;
|
||||
y +:= side * SIND heading;
|
||||
print( ( " ", point( x, y ) ) );
|
||||
heading -:= 180 -:= angle / 2
|
||||
OD;
|
||||
print( ( "'", newline ) );
|
||||
print( ( " style='fill:#55cccc;stroke:#5555cc;stroke-width:" ) );
|
||||
print( ( whole( line width, 0 ), "'/>", newline ) );
|
||||
print( ( "</svg>", newline ) )
|
||||
END # draw gram #;
|
||||
|
||||
draw gram( 500, 300, 5, 240, 150, 50, 3 )
|
||||
|
||||
END
|
||||
51
Task/Pentagram/FutureBasic/pentagram.basic
Normal file
51
Task/Pentagram/FutureBasic/pentagram.basic
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
_window = 1
|
||||
|
||||
void local fn DrawInView
|
||||
CFMutableArrayRef points = fn MutableArrayWithCapacity( 0 )
|
||||
CGPoint ptA,ptB,ptC,ptD,ptE
|
||||
float xo,yo, z, x,y, twoPi = 0.0174533
|
||||
|
||||
xo = 225
|
||||
yo = 20
|
||||
z = 340
|
||||
|
||||
ptA = fn CGPointMake( xo,yo)
|
||||
x = xo - z*sin(18*TwoPi)
|
||||
y = yo + z*cos(18*TwoPi)
|
||||
ptB = fn CGPointMake( x,y)
|
||||
ptE = fn CGPointMake( xo + z*sin(18*TwoPi),y)
|
||||
x = ptB.x + z*cos(36*TwoPi)
|
||||
y = ptB.y - z*sin(36*TwoPi)
|
||||
ptC = fn CGPointMake( x,y)
|
||||
x -= z
|
||||
ptD = fn CGPointMake(x,y)
|
||||
|
||||
MutableArrayAddObject( points, fn ValueWithPoint( ptA ) )
|
||||
MutableArrayAddObject( points, fn ValueWithPoint( ptB ) )
|
||||
MutableArrayAddObject( points, fn ValueWithPoint( ptC ) )
|
||||
MutableArrayAddObject( points, fn ValueWithPoint( ptD ) )
|
||||
MutableArrayAddObject( points, fn ValueWithPoint( ptE ) )
|
||||
MutableArrayAddObject( points, fn ValueWithPoint( ptA ) )
|
||||
BezierPathStrokeFillPolygon( points, 2, fn ColorBlack, fn ColorSystemBlue )
|
||||
|
||||
end fn
|
||||
|
||||
void local fn BuildWindow
|
||||
window _window, @"Pentagram", ( 0,0,450,400 )
|
||||
WindowCenter(_window)
|
||||
WindowSubclassContentView(_window)
|
||||
ViewSetFlipped( _windowContentViewTag, YES )
|
||||
ViewSetNeedsDisplay( _windowContentViewTag )
|
||||
end fn
|
||||
|
||||
void local fn DoDialog( ev as long)
|
||||
select ( ev )
|
||||
case _viewDrawRect : fn DrawInView
|
||||
end select
|
||||
end fn
|
||||
|
||||
fn BuildWindow
|
||||
|
||||
on dialog fn DoDialog
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue