Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Pentagram/Zkl/pentagram.zkl
Normal file
25
Task/Pentagram/Zkl/pentagram.zkl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
const DIM=200, SIDES=5, A=360/SIDES, R=DIM.toFloat();
|
||||
vs:=[0.0..360-A,A].apply("toRad"); // angles of vertices
|
||||
#<<<
|
||||
0'|<?xml version="1.0" standalone="no" ?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
||||
"http://www.w3.org/TR/2001/PR-SVG-20010719/DTD/svg10.dtd">
|
||||
<svg height="%d" width="%d" style="" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect height="100%" width="100%" style="fill:bisque;" />|
|
||||
#<<<
|
||||
.fmt(DIM*2, DIM*2).println();
|
||||
|
||||
var vertices=vs.pump(List,fcn(a){ R.toRectangular(a) }); //( (x,y), (x,y)...
|
||||
SIDES.pump(String,pline).println(); // the line pairs that draw the pentagram
|
||||
|
||||
fcn pline(n){ a:=(n + 2)%SIDES; // (n,a) are the endpoints of the right leg
|
||||
pts:=String("\"", ("% 0.3f,% 0.3f "*2), "\" "); // two points
|
||||
vs:='wrap(){ T(n,a).pump(List,vertices.get).flatten() }; //(x,y, x,y)
|
||||
String(
|
||||
(0'|<polyline points=| + pts).fmt(vs().xplode()),
|
||||
0'|style="fill:seashell; stroke:blue; stroke-width:3;" |,
|
||||
0'|transform="translate(%d,%d) rotate(-18)"|.fmt(DIM,DIM),
|
||||
" />\n"
|
||||
);
|
||||
}
|
||||
println("</svg>");
|
||||
Loading…
Add table
Add a link
Reference in a new issue