-
Notifications
You must be signed in to change notification settings - Fork 1
/
pmm.rb
executable file
·53 lines (47 loc) · 4.77 KB
/
pmm.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env ruby
require 'nokogiri'
require 'pry'
html = Nokogiri::XML::Builder.new do
html do
head do
title "pmm"
end
body do
svg :width => "100%", :height => "100%" do
defs do
g :id => "quarter" do
g :fill => "rgb(204,163,74)" do
path :d => "M 59.599,29.077654 C -38.426535,25.906022 59.393483,51.712045 50.507627,69.483756 44.548841,81.401328 19.221736,84.693719 29.294424,104.8391 43.962908,134.17606 73.741136,56.46382 73.741136,83.625892 c 0,32.968908 -26.419686,68.107438 -23.233509,69.700528 10.207105,5.10355 31.941319,0.38356 38.385797,-6.06092 8.029225,-8.02922 -4.009028,-29.81529 -3.030458,-30.30457 13.649423,-6.82472 61.619304,45.07481 61.619304,8.08122 0,-24.85936 -46.76839,-12.42321 -56.568541,-22.22336 -22.373996,-22.373996 54.936981,-5.828249 55.558391,-7.071068 8.04605,-16.0921 -19.1929,-4.646535 -19.1929,-21.213203 0,-37.45575 48.73465,64.402431 60.60915,52.527931 11.61339,-11.61339 -16.96342,-17.38176 -10.10152,-24.24366 19.36362,-19.363619 29.40798,43.20945 49.49747,3.03046 7.12999,-14.259979 -40.129,-18.63871 -43.43656,-25.253816 C 168.87091,50.641723 222.4852,58.623715 194.95944,31.097959 169.17288,5.3113938 159.3056,42.508143 148.49242,53.321315 141.4957,60.318036 149.91954,4.6255109 123.23861,17.965976 102.98411,28.093228 122.37469,46.104018 113.13709,55.34162 109.54812,58.930583 94.487032,61.478073 91.923882,56.351773 88.297323,49.098656 102.05342,32.108112 93.944187,32.108112 80.746866,32.108112 59.599,69.738333 59.599,29.077654 z"
end
g :fill => "rgb(200,101,58)" do
path :d => "m 159.35156,137.92159 c -7.67347,7.84128 -22.83111,7.32361 -34.09264,7.32361 -2.34499,0 -1.61456,-7.40022 -5.30331,-5.55584 -2.74852,1.37426 -3.41298,11.48676 -8.33375,6.56599 -2.72052,-2.72052 1.66312,-8.69094 -0.50508,-10.85914 -5.75642,-5.75642 -13.449021,8.5218 -8.33376,13.63706 6.56279,6.56278 15.16968,2.01595 20.20305,0.75761 6.51698,-1.62924 5.33617,8.56986 10.85914,5.80838 5.79658,-2.89829 22.48488,-6.31345 28.53681,-6.31345 10.79303,0 14.71627,7.79415 26.76904,1.76776 8.87797,-4.43898 -13.72707,-7.04106 -1.51522,-11.11167 6.60623,-2.20208 22.51869,13.84679 29.54696,6.81852 6.3091,-6.3091 -10.52699,-4.6253 0,-15.15228 9.96203,-9.96204 2.4592,22.50898 14.14213,16.66751 5.8085,-2.90424 -5.43704,-18.91066 -9.59645,-19.95051 -15.5575,-3.88938 -17.91373,8.5863 -31.8198,8.5863 -12.75943,0 -10.09077,-5.04 -13.8896,-8.83884 -4.60404,-4.60404 -5.45217,10.30887 -8.33376,4.54569 -1.17847,-2.35694 -3.51399,-19.70874 -7.57614,-17.67767 -5.39978,2.69989 4.76147,11.6535 1.76777,14.64721 -2.41346,2.41346 -7.42908,-2.16737 -10.35407,0.75762 -3.09175,3.09175 9.79247,2.86305 7.82868,7.57614 z"
end
g :fill => "rgb(110,85,147)" do
path :d => "m 63.63961,11.652521 c -2.008941,4.372653 0.593251,7.279519 4.545687,5.303301 C 72.907906,14.594518 65.675253,6.8389593 67.427682,5.0865301 68.532243,3.9819692 73.189464,3.5480034 74.751288,4.3289157 85.389454,9.6479984 71.064547,16.905945 72.478445,19.733742 c 2.096046,4.192092 11.908932,-3.243356 13.637059,-1.515229 3.272371,3.272371 -6.719423,4.139716 -4.293148,6.565992 2.598838,2.598838 10.199258,-1.205619 11.111678,-3.030458 3.101694,-6.203388 -11.00674,-2.482719 -7.828682,-8.838835 4.251643,-8.5032868 8.132602,6.51461 12.12183,2.525381 4.545038,-4.545042 -10.992041,-11.3642154 2.777918,-11.3642154 9.87594,0 -3.058544,16.6394284 -2.272841,17.4251314 2.441521,2.441519 18.380851,-3.327624 11.111681,7.576144 -0.37111,0.556656 2.24147,3.819446 1.76776,4.293148 -10.32831,10.328308 -3.42853,-6.313453 -14.142132,-6.313453 -6.807732,0 -12.730632,6.060915 -18.182746,6.060915 -0.998032,0 -4.471543,-8.482044 -5.303301,-6.81853 -0.633284,1.266568 -2.795368,12.88817 -3.282995,13.131983 C 59.504961,44.529499 69.368568,23.694933 68.185297,22.511661 63.019412,17.345776 55.11088,26.001394 49.497475,22.259123 42.527,17.61214 60.738528,15.63155 51.265242,10.894907 31.862529,1.1935511 42.611402,34.565949 25.253813,17.20836 15.040817,6.9953641 55.684347,0.28786054 63.63961,11.652521 z"
end
end
g :id => "half" do
use :"xlink:href" => "#quarter"
use :"xlink:href" => "#quarter", :transform => "matrix(-1,0,0,1,0,0)"
end
g :id => "tile" do
use :"xlink:href" => "#half"
use :"xlink:href" => "#half", :transform => "matrix(1,0,0,-1,0,0)"
end
end
x1, y1 = 480,0
x2, y2 = 0, 320
((0)..10).each do |m|
((0)..15).each do |n|
x_delta = m*x1 + n*x2
y_delta = m*y1 + n*y2
use :"xlink:href" => "#tile",:transform => "translate(#{x_delta},#{y_delta})"
end
end
end
end
end
end
out = File.new('output.html','w')
out.puts html.doc.to_html
out.close