CurveScattering

JavaScript performance comparison

Revision 2 of this test case created by Timo

Info

Test for adaptive cubic curve flattening to line segments. Comparing the performance if the curve is first splitted into parts on local extremes (peak points). Splitting ensures that sharp turns are taken into account despite of the angle tolerance.

Preparation code

<script>
    function rnd(intfloat, Amin, Amax) {
    var num;
    if (intfloat == "float") num = Number((Amin + (Amax - Amin) * Math.random()).toFixed(2));
    else if (intfloat == "int") num = Math.floor(Amin + (1 + Amax - Amin) * Math.random());
    return num;
}
var randomdata=[], randomitem=[];
for(var i = 0;i<20;i++)
{
  var randomitem=[];
 for(var j=0;j<8;j++)
 {
   if (j%2) randomitem.push(rnd("float", 0, 300));
   else randomitem.push(rnd("float", 0, 500));
 }
  randomdata.push(randomitem);
}
</script>
<script>
Benchmark.prototype.setup = function() {
    var data1 = "[[442.5, 471.058, 941.5, 473.058, 439.5, 382.058, 938.5, 387.058], [462.465, 218.772, 709.4649999999999, 221.772, 207.46499999999997, 130.772, 706.4649999999999, 135.772], [225.962, 203.705, 472.962, 206.705, -20.03800000000001, 217.705, 469.962, 120.70500000000001], [550.723, 231.138, 797.723, 162.138, 304.72299999999996, 245.138, 794.723, 148.138], [181.5, 92.42, 454.5, 47.42, -38.5, 130.42000000000002, 380.5, 55.42], [370.463, 156.546, 585.463, 252.546, 150.46300000000002, 194.546, 569.463, 119.54599999999999], [43, 54.789, 447, 200.789, 12, 142.789, 431, 67.789], [47.024, 99.077, 133.024, 249.077, 16.024, 187.077, 435.024, 112.077], [47.024, 314.795, 308.024, 463.795, 16.024, 402.795, 435.024, 327.795], [35.524, 287.078, 417.524, 428.078, 4.524000000000001, 375.078, 423.524, 300.078], [490.46, 594.825, 895.461, 669.825, 482.46, 616.825, 901.461, 541.825], [31.5, 418.753, 480.5, 414.753, 23.5, 440.753, 442.5, 365.753], [164.963, 545.474, 613.963, 541.474, 164.963, 545.474, 575.963, 492.47400000000005], [53.428, 250.78, 502.428, 246.78, 53.428, 250.78, 274.428, 242.78], [43, 278, 572, 252, 43, 278, 210, 272], [370.5, 105.862, 722.5, 25.861999999999995, 370.5, 105.862, 537.5, 99.862], [971.224, 324.661, 442.22400000000005, 331.661, 448.22400000000005, 182.661, 959.224, 285.661], [427.432, 631.102, -123.56799999999998, 615.102, -95.56799999999998, 489.102, 426.432, 491.102], [925.238, 346.82, 383.23800000000006, 378.82, 402.23800000000006, 204.82, 924.238, 206.82], [670.44, 701.422, 290.4390000000001, 553.422, 147.43900000000008, 559.422, 669.44, 561.422], [387, 16, 8, 8, -135, 14, 387, 16], [971.225, 84.38, 454.225, 93.38, 449.225, 82.38, 971.225, 84.38], [934.433, 61.266, 469.433, 60.266, 412.433, 59.266, 934.433, 61.266], [596.926, 36.044, 1101.926, 19.043999999999997, 579.926, 18.043999999999997, 1101.926, 20.043999999999997], [43.001, 43.413, 564.001, 43.413, 42.001, 42.413, 564.001, 44.413], [176.562, 441.572, 621.562, 441.572, 99.56200000000001, 440.572, 621.562, 442.572], [473.461, 518.474, 845.461, 519.474, 396.461, 517.474, 918.461, 519.474], [120, 218.565, 492, 219.565, 43, 217.565, 43, 217.565], [540.374, 361.514, 737.373, 452.514, 463.374, 360.514, 463.374, 360.514], [295.096, 787.451, -255.904, 771.451, 220.63400000000001, 808.451, 294.096, 647.451], [575.963, 738.356, 24.962999999999965, 733.578, 501.5, 744.627, 574.963, 696.545], [984.133, 816.737, -1011.9099999999999, 814.358, 714.386, 819.858, 980.5110000000001, 795.9259999999999], [72.339, 997.32, 14.350000000000001, 532.965, 74.588, 1312.153, 71.339, 857.32], [134.01, 1080.529, 85.448, 635.0799999999999, 134.01, 1080.529, 134.01, 834.113], [209.03, 1080.529, 217.801, 677.5, 209.03, 1080.529, 209.03, 834.113], [253.381, 929.973, 511.852, 801.944, 127.381, 861.971, 469.381, 873.973], [228.475, 1031.471, 460.746, 901.328, 333.746, 864.395, 351.706, 1030.992], [380.937, 1013.3, 594.5, 881.5, 486.208, 846.2239999999999, 504.169, 1012.8209999999999], [527.277, 1018.205, 696.763, 889.674, 632.547, 851.129, 650.508, 1017.726], [65.748, 1131.666, 2202.867, 907.671, -276.252, 1119.664, 65.748, 1131.666], [65.748, 1152.166, 2202.867, 1088.051, -276.252, 1148.73, 65.748, 1152.166], [77.365, 1180.648, 2214.483, 1144.843, -264.635, 1178.729, 77.365, 1180.648], [25.539, 1245.147, 2162.657, 1209.341, 107.539, 1286.147, 15.403000000000002, 1204.442], [32.761, 1398.949, 322.954, 1416.346, 31.836, 1076.346, 32.761, 1398.949], [189.198, 1379.448, 1876.433, 1373.595, 163.256, 1138.817, 189.198, 1379.448], [59.681, 1442.1, 991.914, 1409.892, 1489.914, 1318.871, 59.681, 1442.1]]";
    var data2 = "[[10, 15, 10, 15, 10, 15, 10, 15], [10, 20, 10, 20, 10, 20, 110, 20], [10, 25, 10, 25, 10, 25, 210, 25], [10, 30, 10, 30, 10, 30, 310, 30], [10, 35, 10, 35, 110, 35, 10, 35], [10, 40, 10, 40, 110, 40, 110, 40], [10, 45, 10, 45, 110, 45, 210, 45], [10, 50, 10, 50, 110, 50, 310, 50], [10, 55, 10, 55, 210, 55, 10, 55], [10, 60, 10, 60, 210, 60, 110, 60], [10, 65, 10, 65, 210, 65, 210, 65], [10, 70, 10, 70, 210, 70, 310, 70], [10, 75, 10, 75, 310, 75, 10, 75], [10, 80, 10, 80, 310, 80, 110, 80], [10, 85, 10, 85, 310, 85, 210, 85], [10, 90, 10, 90, 310, 90, 310, 90], [10, 95, 110, 95, 10, 95, 10, 95], [10, 100, 110, 100, 10, 100, 110, 100], [10, 105, 110, 105, 10, 105, 210, 105], [10, 110, 110, 110, 10, 110, 310, 110], [10, 115, 110, 115, 110, 115, 10, 115], [10, 120, 110, 120, 110, 120, 110, 120], [10, 125, 110, 125, 110, 125, 210, 125], [10, 130, 110, 130, 110, 130, 310, 130], [10, 135, 110, 135, 210, 135, 10, 135], [10, 140, 110, 140, 210, 140, 110, 140], [10, 145, 110, 145, 210, 145, 210, 145], [10, 150, 110, 150, 210, 150, 310, 150], [10, 155, 110, 155, 310, 155, 10, 155], [10, 160, 110, 160, 310, 160, 110, 160], [10, 165, 110, 165, 310, 165, 210, 165], [10, 170, 110, 170, 310, 170, 310, 170], [10, 175, 210, 175, 10, 175, 10, 175], [10, 180, 210, 180, 10, 180, 110, 180], [10, 185, 210, 185, 10, 185, 210, 185], [10, 190, 210, 190, 10, 190, 310, 190], [10, 195, 210, 195, 110, 195, 10, 195], [10, 200, 210, 200, 110, 200, 110, 200], [10, 205, 210, 205, 110, 205, 210, 205], [10, 210, 210, 210, 110, 210, 310, 210], [10, 215, 210, 215, 210, 215, 10, 215], [10, 220, 210, 220, 210, 220, 110, 220], [10, 225, 210, 225, 210, 225, 210, 225], [10, 230, 210, 230, 210, 230, 310, 230], [10, 235, 210, 235, 310, 235, 10, 235], [10, 240, 210, 240, 310, 240, 110, 240], [10, 245, 210, 245, 310, 245, 210, 245], [10, 250, 210, 250, 310, 250, 310, 250], [10, 255, 310, 255, 10, 255, 10, 255], [10, 260, 310, 260, 10, 260, 110, 260], [10, 265, 310, 265, 10, 265, 210, 265], [10, 270, 310, 270, 10, 270, 310, 270], [10, 275, 310, 275, 110, 275, 10, 275], [10, 280, 310, 280, 110, 280, 110, 280], [10, 285, 310, 285, 110, 285, 210, 285], [10, 290, 310, 290, 110, 290, 310, 290], [10, 295, 310, 295, 210, 295, 10, 295], [10, 300, 310, 300, 210, 300, 110, 300], [10, 305, 310, 305, 210, 305, 210, 305], [10, 310, 310, 310, 210, 310, 310, 310], [10, 315, 310, 315, 310, 315, 10, 315], [10, 320, 310, 320, 310, 320, 110, 320], [10, 325, 310, 325, 310, 325, 210, 325], [10, 330, 310, 330, 310, 330, 310, 330], [110, 335, 10, 335, 10, 335, 10, 335], [110, 340, 10, 340, 10, 340, 110, 340], [110, 345, 10, 345, 10, 345, 210, 345], [110, 350, 10, 350, 10, 350, 310, 350], [110, 355, 10, 355, 110, 355, 10, 355], [110, 360, 10, 360, 110, 360, 110, 360], [110, 365, 10, 365, 110, 365, 210, 365], [110, 370, 10, 370, 110, 370, 310, 370], [110, 375, 10, 375, 210, 375, 10, 375], [110, 380, 10, 380, 210, 380, 110, 380], [110, 385, 10, 385, 210, 385, 210, 385], [110, 390, 10, 390, 210, 390, 310, 390], [110, 395, 10, 395, 310, 395, 10, 395], [110, 400, 10, 400, 310, 400, 110, 400], [110, 405, 10, 405, 310, 405, 210, 405], [110, 410, 10, 410, 310, 410, 310, 410], [110, 415, 110, 415, 10, 415, 10, 415], [110, 420, 110, 420, 10, 420, 110, 420], [110, 425, 110, 425, 10, 425, 210, 425], [110, 430, 110, 430, 10, 430, 310, 430], [110, 435, 110, 435, 110, 435, 10, 435], [110, 440, 110, 440, 110, 440, 110, 440], [110, 445, 110, 445, 110, 445, 210, 445], [110, 450, 110, 450, 110, 450, 310, 450], [110, 455, 110, 455, 210, 455, 10, 455], [110, 460, 110, 460, 210, 460, 110, 460], [110, 465, 110, 465, 210, 465, 210, 465], [110, 470, 110, 470, 210, 470, 310, 470], [110, 475, 110, 475, 310, 475, 10, 475], [110, 480, 110, 480, 310, 480, 110, 480], [110, 485, 110, 485, 310, 485, 210, 485], [110, 490, 110, 490, 310, 490, 310, 490], [110, 495, 210, 495, 10, 495, 10, 495], [110, 500, 210, 500, 10, 500, 110, 500], [110, 505, 210, 505, 10, 505, 210, 505], [110, 510, 210, 510, 10, 510, 310, 510], [110, 515, 210, 515, 110, 515, 10, 515], [110, 520, 210, 520, 110, 520, 110, 520], [110, 525, 210, 525, 110, 525, 210, 525], [110, 530, 210, 530, 110, 530, 310, 530], [110, 535, 210, 535, 210, 535, 10, 535], [110, 540, 210, 540, 210, 540, 110, 540], [110, 545, 210, 545, 210, 545, 210, 545], [110, 550, 210, 550, 210, 550, 310, 550], [110, 555, 210, 555, 310, 555, 10, 555], [110, 560, 210, 560, 310, 560, 110, 560], [110, 565, 210, 565, 310, 565, 210, 565], [110, 570, 210, 570, 310, 570, 310, 570], [110, 575, 310, 575, 10, 575, 10, 575], [110, 580, 310, 580, 10, 580, 110, 580], [110, 585, 310, 585, 10, 585, 210, 585], [110, 590, 310, 590, 10, 590, 310, 590], [110, 595, 310, 595, 110, 595, 10, 595], [110, 600, 310, 600, 110, 600, 110, 600], [110, 605, 310, 605, 110, 605, 210, 605], [110, 610, 310, 610, 110, 610, 310, 610], [110, 615, 310, 615, 210, 615, 10, 615], [110, 620, 310, 620, 210, 620, 110, 620], [110, 625, 310, 625, 210, 625, 210, 625], [110, 630, 310, 630, 210, 630, 310, 630], [110, 635, 310, 635, 310, 635, 10, 635], [110, 640, 310, 640, 310, 640, 110, 640], [110, 645, 310, 645, 310, 645, 210, 645], [110, 650, 310, 650, 310, 650, 310, 650], [210, 655, 10, 655, 10, 655, 10, 655], [210, 660, 10, 660, 10, 660, 110, 660], [210, 665, 10, 665, 10, 665, 210, 665], [210, 670, 10, 670, 10, 670, 310, 670], [210, 675, 10, 675, 110, 675, 10, 675], [210, 680, 10, 680, 110, 680, 110, 680], [210, 685, 10, 685, 110, 685, 210, 685], [210, 690, 10, 690, 110, 690, 310, 690], [210, 695, 10, 695, 210, 695, 10, 695], [210, 700, 10, 700, 210, 700, 110, 700], [210, 705, 10, 705, 210, 705, 210, 705], [210, 710, 10, 710, 210, 710, 310, 710], [210, 715, 10, 715, 310, 715, 10, 715], [210, 720, 10, 720, 310, 720, 110, 720], [210, 725, 10, 725, 310, 725, 210, 725], [210, 730, 10, 730, 310, 730, 310, 730], [210, 735, 110, 735, 10, 735, 10, 735], [210, 740, 110, 740, 10, 740, 110, 740], [210, 745, 110, 745, 10, 745, 210, 745], [210, 750, 110, 750, 10, 750, 310, 750], [210, 755, 110, 755, 110, 755, 10, 755], [210, 760, 110, 760, 110, 760, 110, 760], [210, 765, 110, 765, 110, 765, 210, 765], [210, 770, 110, 770, 110, 770, 310, 770], [210, 775, 110, 775, 210, 775, 10, 775], [210, 780, 110, 780, 210, 780, 110, 780], [210, 785, 110, 785, 210, 785, 210, 785], [210, 790, 110, 790, 210, 790, 310, 790], [210, 795, 110, 795, 310, 795, 10, 795], [210, 800, 110, 800, 310, 800, 110, 800], [210, 805, 110, 805, 310, 805, 210, 805], [210, 810, 110, 810, 310, 810, 310, 810], [210, 815, 210, 815, 10, 815, 10, 815], [210, 820, 210, 820, 10, 820, 110, 820], [210, 825, 210, 825, 10, 825, 210, 825], [210, 830, 210, 830, 10, 830, 310, 830], [210, 835, 210, 835, 110, 835, 10, 835], [210, 840, 210, 840, 110, 840, 110, 840], [210, 845, 210, 845, 110, 845, 210, 845], [210, 850, 210, 850, 110, 850, 310, 850], [210, 855, 210, 855, 210, 855, 10, 855], [210, 860, 210, 860, 210, 860, 110, 860], [210, 865, 210, 865, 210, 865, 210, 865], [210, 870, 210, 870, 210, 870, 310, 870], [210, 875, 210, 875, 310, 875, 10, 875], [210, 880, 210, 880, 310, 880, 110, 880], [210, 885, 210, 885, 310, 885, 210, 885], [210, 890, 210, 890, 310, 890, 310, 890], [210, 895, 310, 895, 10, 895, 10, 895], [210, 900, 310, 900, 10, 900, 110, 900], [210, 905, 310, 905, 10, 905, 210, 905], [210, 910, 310, 910, 10, 910, 310, 910], [210, 915, 310, 915, 110, 915, 10, 915], [210, 920, 310, 920, 110, 920, 110, 920], [210, 925, 310, 925, 110, 925, 210, 925], [210, 930, 310, 930, 110, 930, 310, 930], [210, 935, 310, 935, 210, 935, 10, 935], [210, 940, 310, 940, 210, 940, 110, 940], [210, 945, 310, 945, 210, 945, 210, 945], [210, 950, 310, 950, 210, 950, 310, 950], [210, 955, 310, 955, 310, 955, 10, 955], [210, 960, 310, 960, 310, 960, 110, 960], [210, 965, 310, 965, 310, 965, 210, 965], [210, 970, 310, 970, 310, 970, 310, 970], [310, 975, 10, 975, 10, 975, 10, 975], [310, 980, 10, 980, 10, 980, 110, 980], [310, 985, 10, 985, 10, 985, 210, 985], [310, 990, 10, 990, 10, 990, 310, 990], [310, 995, 10, 995, 110, 995, 10, 995], [310, 1000, 10, 1000, 110, 1000, 110, 1000], [310, 1005, 10, 1005, 110, 1005, 210, 1005], [310, 1010, 10, 1010, 110, 1010, 310, 1010], [310, 1015, 10, 1015, 210, 1015, 10, 1015], [310, 1020, 10, 1020, 210, 1020, 110, 1020], [310, 1025, 10, 1025, 210, 1025, 210, 1025], [310, 1030, 10, 1030, 210, 1030, 310, 1030], [310, 1035, 10, 1035, 310, 1035, 10, 1035], [310, 1040, 10, 1040, 310, 1040, 110, 1040], [310, 1045, 10, 1045, 310, 1045, 210, 1045], [310, 1050, 10, 1050, 310, 1050, 310, 1050], [310, 1055, 110, 1055, 10, 1055, 10, 1055], [310, 1060, 110, 1060, 10, 1060, 110, 1060], [310, 1065, 110, 1065, 10, 1065, 210, 1065], [310, 1070, 110, 1070, 10, 1070, 310, 1070], [310, 1075, 110, 1075, 110, 1075, 10, 1075], [310, 1080, 110, 1080, 110, 1080, 110, 1080], [310, 1085, 110, 1085, 110, 1085, 210, 1085], [310, 1090, 110, 1090, 110, 1090, 310, 1090], [310, 1095, 110, 1095, 210, 1095, 10, 1095], [310, 1100, 110, 1100, 210, 1100, 110, 1100], [310, 1105, 110, 1105, 210, 1105, 210, 1105], [310, 1110, 110, 1110, 210, 1110, 310, 1110], [310, 1115, 110, 1115, 310, 1115, 10, 1115], [310, 1120, 110, 1120, 310, 1120, 110, 1120], [310, 1125, 110, 1125, 310, 1125, 210, 1125], [310, 1130, 110, 1130, 310, 1130, 310, 1130], [310, 1135, 210, 1135, 10, 1135, 10, 1135], [310, 1140, 210, 1140, 10, 1140, 110, 1140], [310, 1145, 210, 1145, 10, 1145, 210, 1145], [310, 1150, 210, 1150, 10, 1150, 310, 1150], [310, 1155, 210, 1155, 110, 1155, 10, 1155], [310, 1160, 210, 1160, 110, 1160, 110, 1160], [310, 1165, 210, 1165, 110, 1165, 210, 1165], [310, 1170, 210, 1170, 110, 1170, 310, 1170], [310, 1175, 210, 1175, 210, 1175, 10, 1175], [310, 1180, 210, 1180, 210, 1180, 110, 1180], [310, 1185, 210, 1185, 210, 1185, 210, 1185], [310, 1190, 210, 1190, 210, 1190, 310, 1190], [310, 1195, 210, 1195, 310, 1195, 10, 1195], [310, 1200, 210, 1200, 310, 1200, 110, 1200], [310, 1205, 210, 1205, 310, 1205, 210, 1205], [310, 1210, 210, 1210, 310, 1210, 310, 1210], [310, 1215, 310, 1215, 10, 1215, 10, 1215], [310, 1220, 310, 1220, 10, 1220, 110, 1220], [310, 1225, 310, 1225, 10, 1225, 210, 1225], [310, 1230, 310, 1230, 10, 1230, 310, 1230], [310, 1235, 310, 1235, 110, 1235, 10, 1235], [310, 1240, 310, 1240, 110, 1240, 110, 1240], [310, 1245, 310, 1245, 110, 1245, 210, 1245], [310, 1250, 310, 1250, 110, 1250, 310, 1250], [310, 1255, 310, 1255, 210, 1255, 10, 1255], [310, 1260, 310, 1260, 210, 1260, 110, 1260], [310, 1265, 310, 1265, 210, 1265, 210, 1265], [310, 1270, 310, 1270, 210, 1270, 310, 1270], [310, 1275, 310, 1275, 310, 1275, 10, 1275], [310, 1280, 310, 1280, 310, 1280, 110, 1280], [310, 1285, 310, 1285, 310, 1285, 210, 1285], [310, 1290, 310, 1290, 310, 1290, 310, 1290]]";
    var data3 = "[[495.415283203125, 81.71070098877, 495.415283203125, 81.71070098877, 495.415283203125, 81.71070098877, 495.415283203125, 81.71070098877], [494.547302246094, 86.634696960449, 494.547302246094, 86.634696960449, 494.547302246094, 86.634696960449, 593.027282714844, 103.994697570801], [493.679290771484, 91.558700561523, 493.679290771484, 91.558700561523, 493.679290771484, 91.558700561523, 690.639282226563, 126.278701782227], [492.811309814453, 96.482696533203, 492.811309814453, 96.482696533203, 492.811309814453, 96.482696533203, 788.251281738281, 148.562698364258], [491.943298339844, 101.406700134277, 491.943298339844, 101.406700134277, 590.423278808594, 118.766700744629, 491.943298339844, 101.406700134277], [491.075286865234, 106.330696105957, 491.075286865234, 106.330696105957, 589.555297851563, 123.690704345703, 589.555297851563, 123.690704345703], [490.207305908203, 111.254699707031, 490.207305908203, 111.254699707031, 588.687316894531, 128.614700317383, 687.167297363281, 145.974700927734], [489.339294433594, 116.178703308105, 489.339294433594, 116.178703308105, 587.819274902344, 133.538696289063, 784.779296875, 168.258712768555], [488.471282958984, 121.102699279785, 488.471282958984, 121.102699279785, 685.431274414063, 155.822708129883, 488.471282958984, 121.102699279785], [487.603302001953, 126.026702880859, 487.603302001953, 126.026702880859, 684.563293457031, 160.746704101563, 586.083312988281, 143.386703491211], [486.735290527344, 130.950698852539, 486.735290527344, 130.950698852539, 683.6953125, 165.670700073242, 683.6953125, 165.670700073242], [485.867309570313, 135.874694824219, 485.867309570313, 135.874694824219, 682.827331542969, 170.594711303711, 781.307312011719, 187.954711914063], [484.999298095703, 140.798706054688, 484.999298095703, 140.798706054688, 780.439331054688, 192.878707885742, 484.999298095703, 140.798706054688], [484.131286621094, 145.722702026367, 484.131286621094, 145.722702026367, 779.5712890625, 197.802703857422, 582.611328125, 163.082702636719], [483.263305664063, 150.646697998047, 483.263305664063, 150.646697998047, 778.703308105469, 202.726699829102, 680.223327636719, 185.36669921875], [482.395294189453, 155.570709228516, 482.395294189453, 155.570709228516, 777.835327148438, 207.65071105957, 777.835327148438, 207.65071105957], [481.527282714844, 160.494705200195, 580.00732421875, 177.854705810547, 481.527282714844, 160.494705200195, 481.527282714844, 160.494705200195], [480.659301757813, 165.418701171875, 579.139282226563, 182.778701782227, 480.659301757813, 165.418701171875, 579.139282226563, 182.778701782227], [479.791290283203, 170.342697143555, 578.271301269531, 187.702697753906, 479.791290283203, 170.342697143555, 676.751281738281, 205.062698364258], [478.923278808594, 175.266708374023, 577.4033203125, 192.626708984375, 478.923278808594, 175.266708374023, 774.36328125, 227.346710205078], [478.055297851563, 180.190704345703, 576.535278320313, 197.550704956055, 576.535278320313, 197.550704956055, 478.055297851563, 180.190704345703], [477.187286376953, 185.114700317383, 575.667297363281, 202.474700927734, 575.667297363281, 202.474700927734, 575.667297363281, 202.474700927734], [476.319305419922, 190.038696289063, 574.79931640625, 207.398712158203, 574.79931640625, 207.398712158203, 673.279296875, 224.758712768555], [475.451293945313, 194.962707519531, 573.931274414063, 212.322708129883, 573.931274414063, 212.322708129883, 770.891296386719, 247.042709350586], [474.583282470703, 199.886703491211, 573.063293457031, 217.246704101563, 671.543273925781, 234.606704711914, 474.583282470703, 199.886703491211], [473.715301513672, 204.810699462891, 572.1953125, 222.170700073242, 670.67529296875, 239.530700683594, 572.1953125, 222.170700073242], [472.847290039063, 209.734710693359, 571.327270507813, 227.094711303711, 669.807312011719, 244.454711914063, 669.807312011719, 244.454711914063], [471.979278564453, 214.658706665039, 570.459289550781, 232.018707275391, 668.939331054688, 249.378707885742, 767.419311523438, 266.738708496094], [471.111297607422, 219.582702636719, 569.59130859375, 236.94270324707, 766.551330566406, 271.662719726563, 471.111297607422, 219.582702636719], [470.243286132813, 224.506698608398, 568.723266601563, 241.86669921875, 765.683288574219, 276.586700439453, 568.723266601563, 241.86669921875], [469.375305175781, 229.430709838867, 567.855285644531, 246.790710449219, 764.815307617188, 281.510711669922, 666.335327148438, 264.150695800781], [468.507293701172, 234.354705810547, 566.9873046875, 251.714706420898, 763.947326660156, 286.434722900391, 763.947326660156, 286.434722900391], [467.639282226563, 239.278701782227, 664.599304199219, 273.998718261719, 467.639282226563, 239.278701782227, 467.639282226563, 239.278701782227], [466.771301269531, 244.202697753906, 663.731323242188, 278.922698974609, 466.771301269531, 244.202697753906, 565.251281738281, 261.562713623047], [465.903289794922, 249.126708984375, 662.86328125, 283.846710205078, 465.903289794922, 249.126708984375, 662.86328125, 283.846710205078], [465.035278320313, 254.050704956055, 661.995300292969, 288.770721435547, 465.035278320313, 254.050704956055, 760.475280761719, 306.130706787109], [464.167297363281, 258.974700927734, 661.127319335938, 293.694702148438, 562.647277832031, 276.334716796875, 464.167297363281, 258.974700927734], [463.299285888672, 263.898712158203, 660.25927734375, 298.618713378906, 561.779296875, 281.258697509766, 561.779296875, 281.258697509766], [462.431304931641, 268.822692871094, 659.391296386719, 303.542724609375, 560.911315917969, 286.182708740234, 659.391296386719, 303.542724609375], [461.563293457031, 273.746704101563, 658.523315429688, 308.466705322266, 560.043273925781, 291.106719970703, 757.003295898438, 325.826721191406], [460.695281982422, 278.670715332031, 657.6552734375, 313.390716552734, 657.6552734375, 313.390716552734, 460.695281982422, 278.670715332031], [459.827301025391, 283.594696044922, 656.787292480469, 318.314697265625, 656.787292480469, 318.314697265625, 558.307312011719, 300.954711914063], [458.959289550781, 288.518707275391, 655.919311523438, 323.238708496094, 655.919311523438, 323.238708496094, 655.919311523438, 323.238708496094], [458.091278076172, 293.442718505859, 655.05126953125, 328.162719726563, 655.05126953125, 328.162719726563, 753.531311035156, 345.522705078125], [457.223297119141, 298.36669921875, 654.183288574219, 333.086700439453, 752.663330078125, 350.446716308594, 457.223297119141, 298.36669921875], [456.355285644531, 303.290710449219, 653.315307617188, 338.010711669922, 751.795288085938, 355.370727539063, 554.835266113281, 320.650695800781], [455.4873046875, 308.214721679688, 652.447326660156, 342.934722900391, 750.927307128906, 360.294708251953, 652.447326660156, 342.934722900391], [454.619293212891, 313.138702392578, 651.579284667969, 347.858703613281, 750.059326171875, 365.218719482422, 750.059326171875, 365.218719482422], [453.751281738281, 318.062713623047, 749.191284179688, 370.142700195313, 453.751281738281, 318.062713623047, 453.751281738281, 318.062713623047], [452.88330078125, 322.986694335938, 748.323303222656, 375.066711425781, 452.88330078125, 322.986694335938, 551.36328125, 340.346710205078], [452.015289306641, 327.910705566406, 747.455322265625, 379.99072265625, 452.015289306641, 327.910705566406, 648.975280761719, 362.630706787109], [451.147277832031, 332.834716796875, 746.587280273438, 384.914703369141, 451.147277832031, 332.834716796875, 746.587280273438, 384.914703369141], [450.279296875, 337.758697509766, 745.719299316406, 389.838714599609, 548.75927734375, 355.118713378906, 450.279296875, 337.758697509766], [449.411285400391, 342.682708740234, 744.851318359375, 394.762725830078, 547.891296386719, 360.042724609375, 547.891296386719, 360.042724609375], [448.543304443359, 347.606719970703, 743.983276367188, 399.686706542969, 547.023315429688, 364.966705322266, 645.503295898438, 382.326721191406], [447.67529296875, 352.530700683594, 743.115295410156, 404.610717773438, 546.1552734375, 369.890716552734, 743.115295410156, 404.610717773438], [446.807281494141, 357.454711914063, 742.247314453125, 409.534729003906, 643.767272949219, 392.174713134766, 446.807281494141, 357.454711914063], [445.939300537109, 362.378723144531, 741.379272460938, 414.458709716797, 642.899291992188, 397.098724365234, 544.419311523438, 379.738708496094], [445.0712890625, 367.302703857422, 740.511291503906, 419.382720947266, 642.031311035156, 402.022705078125, 642.031311035156, 402.022705078125], [444.203277587891, 372.226715087891, 739.643310546875, 424.306701660156, 641.163269042969, 406.946716308594, 739.643310546875, 424.306701660156], [443.335296630859, 377.150695800781, 738.775329589844, 429.230712890625, 738.775329589844, 429.230712890625, 443.335296630859, 377.150695800781], [442.46728515625, 382.07470703125, 737.907287597656, 434.154724121094, 737.907287597656, 434.154724121094, 540.947265625, 399.434722900391], [441.599304199219, 386.998718261719, 737.039306640625, 439.078704833984, 737.039306640625, 439.078704833984, 638.559326171875, 421.718719482422], [440.731292724609, 391.922698974609, 736.171325683594, 444.002716064453, 736.171325683594, 444.002716064453, 736.171325683594, 444.002716064453], [538.343322753906, 414.206726074219, 439.86328125, 396.846710205078, 439.86328125, 396.846710205078, 439.86328125, 396.846710205078], [537.475280761719, 419.130706787109, 438.995300292969, 401.770721435547, 438.995300292969, 401.770721435547, 537.475280761719, 419.130706787109], [536.607299804688, 424.054718017578, 438.127288818359, 406.694702148438, 438.127288818359, 406.694702148438, 635.087280273438, 441.414703369141], [535.739318847656, 428.978698730469, 437.25927734375, 411.618713378906, 437.25927734375, 411.618713378906, 732.699279785156, 463.69873046875], [534.871276855469, 433.902709960938, 436.391296386719, 416.542724609375, 534.871276855469, 433.902709960938, 436.391296386719, 416.542724609375], [534.003295898438, 438.826721191406, 435.523284912109, 421.466705322266, 534.003295898438, 438.826721191406, 534.003295898438, 438.826721191406], [533.135314941406, 443.750701904297, 434.655303955078, 426.390716552734, 533.135314941406, 443.750701904297, 631.615295410156, 461.110717773438], [532.267272949219, 448.674713134766, 433.787292480469, 431.314727783203, 532.267272949219, 448.674713134766, 729.227294921875, 483.394714355469], [531.399291992188, 453.598724365234, 432.919281005859, 436.238708496094, 629.879272460938, 470.958709716797, 432.919281005859, 436.238708496094], [530.531311035156, 458.522705078125, 432.051300048828, 441.162719726563, 629.011291503906, 475.882720947266, 530.531311035156, 458.522705078125], [529.663269042969, 463.446716308594, 431.183288574219, 446.086700439453, 628.143310546875, 480.806732177734, 628.143310546875, 480.806732177734], [528.795288085938, 468.370727539063, 430.315277099609, 451.010711669922, 627.275268554688, 485.730712890625, 725.755310058594, 503.090728759766], [527.927307128906, 473.294708251953, 429.447296142578, 455.934722900391, 724.887329101563, 508.014709472656, 429.447296142578, 455.934722900391], [527.059265136719, 478.218719482422, 428.579284667969, 460.858703613281, 724.019287109375, 512.938720703125, 527.059265136719, 478.218719482422], [526.191284179688, 483.142730712891, 427.711273193359, 465.78271484375, 723.151306152344, 517.862731933594, 624.671325683594, 500.502716064453], [525.323303222656, 488.066711425781, 426.843292236328, 470.706726074219, 722.283325195313, 522.786743164063, 722.283325195313, 522.786743164063], [524.455322265625, 492.99072265625, 524.455322265625, 492.99072265625, 425.975280761719, 475.630706787109, 425.975280761719, 475.630706787109], [523.587280273438, 497.914703369141, 523.587280273438, 497.914703369141, 425.107299804688, 480.554718017578, 523.587280273438, 497.914703369141], [522.719299316406, 502.838714599609, 522.719299316406, 502.838714599609, 424.239288330078, 485.478729248047, 621.199279785156, 520.19873046875], [521.851318359375, 507.762725830078, 521.851318359375, 507.762725830078, 423.371276855469, 490.402709960938, 718.811279296875, 542.482727050781], [520.983276367188, 512.686706542969, 520.983276367188, 512.686706542969, 520.983276367188, 512.686706542969, 422.503295898438, 495.326721191406], [520.115295410156, 517.610717773438, 520.115295410156, 517.610717773438, 520.115295410156, 517.610717773438, 520.115295410156, 517.610717773438], [519.247314453125, 522.534729003906, 519.247314453125, 522.534729003906, 519.247314453125, 522.534729003906, 617.727294921875, 539.894714355469], [518.379272460938, 527.458740234375, 518.379272460938, 527.458740234375, 518.379272460938, 527.458740234375, 715.339294433594, 562.1787109375], [517.511291503906, 532.382690429688, 517.511291503906, 532.382690429688, 615.991271972656, 549.742736816406, 419.031280517578, 515.022705078125], [516.643310546875, 537.306701660156, 516.643310546875, 537.306701660156, 615.123291015625, 554.666748046875, 516.643310546875, 537.306701660156], [515.775268554688, 542.230712890625, 515.775268554688, 542.230712890625, 614.255310058594, 559.590698242188, 614.255310058594, 559.590698242188], [514.907287597656, 547.154724121094, 514.907287597656, 547.154724121094, 613.387268066406, 564.514709472656, 711.867309570313, 581.874694824219], [514.039306640625, 552.078735351563, 514.039306640625, 552.078735351563, 710.999328613281, 586.798706054688, 415.559295654297, 534.718688964844], [513.171264648438, 557.002746582031, 513.171264648438, 557.002746582031, 710.131286621094, 591.722717285156, 513.171264648438, 557.002746582031], [512.303283691406, 561.926696777344, 512.303283691406, 561.926696777344, 709.263305664063, 596.646728515625, 610.783325195313, 579.286743164063], [511.435302734375, 566.850708007813, 511.435302734375, 566.850708007813, 708.395324707031, 601.570739746094, 708.395324707031, 601.570739746094], [510.567291259766, 571.774719238281, 609.047302246094, 589.134704589844, 412.087280273438, 554.414733886719, 412.087280273438, 554.414733886719], [509.699279785156, 576.69873046875, 608.179321289063, 594.058715820313, 411.219299316406, 559.338745117188, 509.699279785156, 576.69873046875], [508.831298828125, 581.622741699219, 607.311279296875, 598.982727050781, 410.351287841797, 564.2626953125, 607.311279296875, 598.982727050781], [507.963287353516, 586.546691894531, 606.443298339844, 603.90673828125, 409.483276367188, 569.186706542969, 704.923278808594, 621.266723632813], [507.095275878906, 591.470703125, 605.575317382813, 608.830749511719, 507.095275878906, 591.470703125, 408.615295410156, 574.110717773438], [506.227294921875, 596.394714355469, 604.707275390625, 613.754699707031, 506.227294921875, 596.394714355469, 506.227294921875, 596.394714355469], [505.359283447266, 601.318725585938, 603.839294433594, 618.6787109375, 505.359283447266, 601.318725585938, 603.839294433594, 618.6787109375], [504.491302490234, 606.242736816406, 602.971313476563, 623.602722167969, 504.491302490234, 606.242736816406, 701.451293945313, 640.962707519531], [503.623291015625, 611.166748046875, 602.103271484375, 628.526733398438, 602.103271484375, 628.526733398438, 405.143280029297, 593.806701660156], [502.755279541016, 616.090698242188, 601.235290527344, 633.450744628906, 601.235290527344, 633.450744628906, 502.755279541016, 616.090698242188], [501.887298583984, 621.014709472656, 600.367309570313, 638.374694824219, 600.367309570313, 638.374694824219, 600.367309570313, 638.374694824219], [501.019287109375, 625.938720703125, 599.499267578125, 643.298706054688, 599.499267578125, 643.298706054688, 697.979309082031, 660.658752441406], [500.151275634766, 630.862731933594, 598.631286621094, 648.222717285156, 697.111328125, 665.582702636719, 401.671295166016, 613.502746582031], [499.283294677734, 635.786743164063, 597.763305664063, 653.146728515625, 696.243286132813, 670.506713867188, 499.283294677734, 635.786743164063], [498.415283203125, 640.710693359375, 596.895263671875, 658.070739746094, 695.375305175781, 675.430725097656, 596.895263671875, 658.070739746094], [497.547302246094, 645.634704589844, 596.027282714844, 662.994750976563, 694.50732421875, 680.354736328125, 694.50732421875, 680.354736328125], [496.679290771484, 650.558715820313, 693.639282226563, 685.278747558594, 398.199279785156, 633.19873046875, 398.199279785156, 633.19873046875], [495.811279296875, 655.482727050781, 692.771301269531, 690.202697753906, 397.331298828125, 638.122741699219, 495.811279296875, 655.482727050781], [494.943298339844, 660.40673828125, 691.9033203125, 695.126708984375, 396.463287353516, 643.046691894531, 593.423278808594, 677.766723632813], [494.075286865234, 665.330749511719, 691.035278320313, 700.050720214844, 395.595275878906, 647.970703125, 691.035278320313, 700.050720214844], [493.207275390625, 670.254699707031, 690.167297363281, 704.974731445313, 493.207275390625, 670.254699707031, 394.727294921875, 652.894714355469], [492.339294433594, 675.1787109375, 689.29931640625, 709.898742675781, 492.339294433594, 675.1787109375, 492.339294433594, 675.1787109375], [491.471282958984, 680.102722167969, 688.431274414063, 714.82275390625, 491.471282958984, 680.102722167969, 589.951293945313, 697.462707519531], [490.603302001953, 685.026733398438, 687.563293457031, 719.746704101563, 490.603302001953, 685.026733398438, 687.563293457031, 719.746704101563], [489.735290527344, 689.950744628906, 686.6953125, 724.670715332031, 588.215270996094, 707.310729980469, 391.255279541016, 672.590698242188], [488.867279052734, 694.874694824219, 685.827270507813, 729.5947265625, 587.347290039063, 712.234741210938, 488.867279052734, 694.874694824219], [487.999298095703, 699.798706054688, 684.959289550781, 734.518737792969, 586.479309082031, 717.158752441406, 586.479309082031, 717.158752441406], [487.131286621094, 704.722717285156, 684.09130859375, 739.442749023438, 585.611267089844, 722.082702636719, 684.09130859375, 739.442749023438], [486.263275146484, 709.646728515625, 683.223266601563, 744.36669921875, 683.223266601563, 744.36669921875, 387.783294677734, 692.286743164063], [485.395294189453, 714.570739746094, 682.355285644531, 749.290710449219, 682.355285644531, 749.290710449219, 485.395294189453, 714.570739746094], [484.527282714844, 719.494750976563, 681.4873046875, 754.214721679688, 681.4873046875, 754.214721679688, 583.007263183594, 736.854736328125], [483.659301757813, 724.418701171875, 680.619323730469, 759.138732910156, 680.619323730469, 759.138732910156, 680.619323730469, 759.138732910156], [581.271301269531, 746.702697753906, 384.311279296875, 711.982727050781, 384.311279296875, 711.982727050781, 384.311279296875, 711.982727050781], [580.4033203125, 751.626708984375, 383.443298339844, 716.90673828125, 383.443298339844, 716.90673828125, 481.923278808594, 734.266723632813], [579.535278320313, 756.550720214844, 382.575286865234, 721.830749511719, 382.575286865234, 721.830749511719, 579.535278320313, 756.550720214844], [578.667297363281, 761.474731445313, 381.707275390625, 726.754699707031, 381.707275390625, 726.754699707031, 677.147277832031, 778.834716796875], [577.79931640625, 766.398742675781, 380.839294433594, 731.6787109375, 479.319274902344, 749.038757324219, 380.839294433594, 731.6787109375], [576.931274414063, 771.32275390625, 379.971282958984, 736.602722167969, 478.451293945313, 753.962707519531, 478.451293945313, 753.962707519531], [576.063293457031, 776.246704101563, 379.103271484375, 741.526733398438, 477.583282470703, 758.88671875, 576.063293457031, 776.246704101563], [575.1953125, 781.170715332031, 378.235290527344, 746.450744628906, 476.715301513672, 763.810729980469, 673.67529296875, 798.53076171875], [574.327270507813, 786.0947265625, 377.367279052734, 751.374755859375, 574.327270507813, 786.0947265625, 377.367279052734, 751.374755859375], [573.459289550781, 791.018737792969, 376.499298095703, 756.298706054688, 573.459289550781, 791.018737792969, 474.979278564453, 773.658752441406], [572.59130859375, 795.942749023438, 375.631286621094, 761.222717285156, 572.59130859375, 795.942749023438, 572.59130859375, 795.942749023438], [571.723266601563, 800.866760253906, 374.763275146484, 766.146728515625, 571.723266601563, 800.866760253906, 670.203308105469, 818.226745605469], [570.855285644531, 805.790710449219, 373.895294189453, 771.070739746094, 669.335266113281, 823.150756835938, 373.895294189453, 771.070739746094], [569.9873046875, 810.714721679688, 373.027282714844, 775.994750976563, 668.46728515625, 828.07470703125, 471.507293701172, 793.354736328125], [569.119262695313, 815.638732910156, 372.159271240234, 780.918701171875, 667.599304199219, 832.998718261719, 569.119262695313, 815.638732910156], [568.251281738281, 820.562744140625, 371.291290283203, 785.842712402344, 666.731323242188, 837.922729492188, 666.731323242188, 837.922729492188], [567.38330078125, 825.486755371094, 468.903289794922, 808.126708984375, 370.423278808594, 790.766723632813, 370.423278808594, 790.766723632813], [566.515319824219, 830.410705566406, 468.035278320313, 813.050720214844, 369.555267333984, 795.690734863281, 468.035278320313, 813.050720214844], [565.647277832031, 835.334716796875, 467.167297363281, 817.974731445313, 368.687286376953, 800.61474609375, 565.647277832031, 835.334716796875], [564.779296875, 840.258728027344, 466.299285888672, 822.898742675781, 367.819274902344, 805.538757324219, 663.25927734375, 857.618713378906], [563.911315917969, 845.182739257813, 465.431274414063, 827.82275390625, 465.431274414063, 827.82275390625, 366.951293945313, 810.462707519531], [563.043273925781, 850.106750488281, 464.563293457031, 832.746704101563, 464.563293457031, 832.746704101563, 464.563293457031, 832.746704101563], [562.17529296875, 855.03076171875, 463.695281982422, 837.670715332031, 463.695281982422, 837.670715332031, 562.17529296875, 855.03076171875], [561.307312011719, 859.954711914063, 462.827270507813, 842.5947265625, 462.827270507813, 842.5947265625, 659.787292480469, 877.314758300781], [560.439270019531, 864.878723144531, 461.959289550781, 847.518737792969, 560.439270019531, 864.878723144531, 363.479278564453, 830.158752441406], [559.5712890625, 869.802734375, 461.091278076172, 852.442749023438, 559.5712890625, 869.802734375, 461.091278076172, 852.442749023438], [558.703308105469, 874.726745605469, 460.223297119141, 857.366760253906, 558.703308105469, 874.726745605469, 558.703308105469, 874.726745605469], [557.835266113281, 879.650756835938, 459.355285644531, 862.290710449219, 557.835266113281, 879.650756835938, 656.315307617188, 897.0107421875], [556.96728515625, 884.57470703125, 458.487274169922, 867.214721679688, 655.447265625, 901.934753417969, 360.007293701172, 849.854736328125], [556.099304199219, 889.498718261719, 457.619293212891, 872.138732910156, 654.579284667969, 906.858764648438, 457.619293212891, 872.138732910156], [555.231262207031, 894.422729492188, 456.751281738281, 877.062744140625, 653.711303710938, 911.78271484375, 555.231262207031, 894.422729492188], [554.36328125, 899.346740722656, 455.883270263672, 881.986755371094, 652.843322753906, 916.706726074219, 652.843322753906, 916.706726074219], [553.495300292969, 904.270751953125, 553.495300292969, 904.270751953125, 356.535278320313, 869.550720214844, 356.535278320313, 869.550720214844], [552.627319335938, 909.194763183594, 552.627319335938, 909.194763183594, 355.667266845703, 874.474731445313, 454.147277832031, 891.834716796875], [551.75927734375, 914.118713378906, 551.75927734375, 914.118713378906, 354.799285888672, 879.398742675781, 551.75927734375, 914.118713378906], [550.891296386719, 919.042724609375, 550.891296386719, 919.042724609375, 353.931274414063, 884.32275390625, 649.371276855469, 936.402709960938], [550.023315429688, 923.966735839844, 550.023315429688, 923.966735839844, 451.543273925781, 906.606750488281, 353.063293457031, 889.246704101563], [549.1552734375, 928.890747070313, 549.1552734375, 928.890747070313, 450.67529296875, 911.53076171875, 450.67529296875, 911.53076171875], [548.287292480469, 933.814758300781, 548.287292480469, 933.814758300781, 449.807281494141, 916.454711914063, 548.287292480469, 933.814758300781], [547.419311523438, 938.738708496094, 547.419311523438, 938.738708496094, 448.939270019531, 921.378723144531, 645.899291992188, 956.098754882813], [546.55126953125, 943.662719726563, 546.55126953125, 943.662719726563, 546.55126953125, 943.662719726563, 349.591278076172, 908.942749023438], [545.683288574219, 948.586730957031, 545.683288574219, 948.586730957031, 545.683288574219, 948.586730957031, 447.203277587891, 931.226745605469], [544.815307617188, 953.5107421875, 544.815307617188, 953.5107421875, 544.815307617188, 953.5107421875, 544.815307617188, 953.5107421875], [543.947265625, 958.434753417969, 543.947265625, 958.434753417969, 543.947265625, 958.434753417969, 642.427307128906, 975.794738769531], [543.079284667969, 963.358764648438, 543.079284667969, 963.358764648438, 641.559265136719, 980.71875, 346.119293212891, 928.638732910156], [542.211303710938, 968.28271484375, 542.211303710938, 968.28271484375, 640.691284179688, 985.642761230469, 443.731292724609, 950.922729492188], [541.34326171875, 973.206726074219, 541.34326171875, 973.206726074219, 639.823303222656, 990.566711425781, 541.34326171875, 973.206726074219], [540.475280761719, 978.130737304688, 540.475280761719, 978.130737304688, 638.955322265625, 995.49072265625, 638.955322265625, 995.49072265625], [539.607299804688, 983.054748535156, 638.087280273438, 1000.414733886719, 342.647277832031, 948.334716796875, 342.647277832031, 948.334716796875], [538.7392578125, 987.978759765625, 637.219299316406, 1005.338745117188, 341.779266357422, 953.258728027344, 440.25927734375, 970.618713378906], [537.871276855469, 992.902709960938, 636.351318359375, 1010.262756347656, 340.911285400391, 958.182739257813, 537.871276855469, 992.902709960938], [537.003295898438, 997.826721191406, 635.483276367188, 1015.186767578125, 340.043273925781, 963.106750488281, 635.483276367188, 1015.186767578125], [536.135314941406, 1002.750732421875, 634.615295410156, 1020.110717773438, 437.6552734375, 985.390747070313, 339.17529296875, 968.03076171875], [535.267272949219, 1007.674743652344, 633.747314453125, 1025.034790039063, 436.787292480469, 990.314758300781, 436.787292480469, 990.314758300781], [534.399291992188, 1012.598754882813, 632.879272460938, 1029.958740234375, 435.919281005859, 995.238708496094, 534.399291992188, 1012.598754882813], [533.531311035156, 1017.522766113281, 632.011291503906, 1034.882690429688, 435.05126953125, 1000.162719726563, 632.011291503906, 1034.882690429688], [532.663269042969, 1022.446716308594, 631.143310546875, 1039.806762695313, 532.663269042969, 1022.446716308594, 335.703277587891, 987.726745605469], [531.795288085938, 1027.370727539063, 630.275268554688, 1044.730712890625, 531.795288085938, 1027.370727539063, 433.315277099609, 1010.0107421875], [530.927307128906, 1032.294799804688, 629.407287597656, 1049.65478515625, 530.927307128906, 1032.294799804688, 530.927307128906, 1032.294799804688], [530.059265136719, 1037.21875, 628.539306640625, 1054.578735351563, 530.059265136719, 1037.21875, 628.539306640625, 1054.578735351563], [529.191284179688, 1042.142700195313, 627.671264648438, 1059.502685546875, 627.671264648438, 1059.502685546875, 332.231292724609, 1007.422729492188], [528.323303222656, 1047.066772460938, 626.803283691406, 1064.4267578125, 626.803283691406, 1064.4267578125, 429.843292236328, 1029.706787109375], [527.455261230469, 1051.99072265625, 625.935302734375, 1069.350708007813, 625.935302734375, 1069.350708007813, 527.455261230469, 1051.99072265625], [526.587280273438, 1056.914794921875, 625.067260742188, 1074.274780273438, 625.067260742188, 1074.274780273438, 625.067260742188, 1074.274780273438], [624.199279785156, 1079.19873046875, 328.75927734375, 1027.118774414063, 328.75927734375, 1027.118774414063, 328.75927734375, 1027.118774414063], [623.331298828125, 1084.122802734375, 327.891265869141, 1032.042724609375, 327.891265869141, 1032.042724609375, 426.371276855469, 1049.402709960938], [622.463317871094, 1089.046752929688, 327.023284912109, 1036.966796875, 327.023284912109, 1036.966796875, 523.983276367188, 1071.686767578125], [621.595275878906, 1093.970703125, 326.1552734375, 1041.890747070313, 326.1552734375, 1041.890747070313, 621.595275878906, 1093.970703125], [620.727294921875, 1098.894775390625, 325.287292480469, 1046.814697265625, 423.767272949219, 1064.174682617188, 325.287292480469, 1046.814697265625], [619.859313964844, 1103.818725585938, 324.419281005859, 1051.73876953125, 422.899291992188, 1069.098754882813, 422.899291992188, 1069.098754882813], [618.991271972656, 1108.742797851563, 323.55126953125, 1056.662719726563, 422.031280517578, 1074.022705078125, 520.511291503906, 1091.382690429688], [618.123291015625, 1113.666748046875, 322.683288574219, 1061.586791992188, 421.163269042969, 1078.94677734375, 618.123291015625, 1113.666748046875], [617.255310058594, 1118.590698242188, 321.815277099609, 1066.5107421875, 518.775268554688, 1101.230712890625, 321.815277099609, 1066.5107421875], [616.387268066406, 1123.514770507813, 320.947265625, 1071.434692382813, 517.907287597656, 1106.15478515625, 419.427276611328, 1088.794799804688], [615.519287109375, 1128.438720703125, 320.079284667969, 1076.358764648438, 517.039306640625, 1111.078735351563, 517.039306640625, 1111.078735351563], [614.651306152344, 1133.36279296875, 319.211273193359, 1081.28271484375, 516.171264648438, 1116.002685546875, 614.651306152344, 1133.36279296875], [613.783264160156, 1138.286743164063, 318.34326171875, 1086.206787109375, 613.783264160156, 1138.286743164063, 318.34326171875, 1086.206787109375], [612.915283203125, 1143.210693359375, 317.475280761719, 1091.130737304688, 612.915283203125, 1143.210693359375, 415.955291748047, 1108.49072265625], [612.047302246094, 1148.134765625, 316.607269287109, 1096.0546875, 612.047302246094, 1148.134765625, 513.567260742188, 1130.774780273438], [611.179260253906, 1153.058715820313, 315.739288330078, 1100.978759765625, 611.179260253906, 1153.058715820313, 611.179260253906, 1153.058715820313], [610.311279296875, 1157.982788085938, 413.351287841797, 1123.2626953125, 314.871276855469, 1105.902709960938, 314.871276855469, 1105.902709960938], [609.443298339844, 1162.90673828125, 412.483276367188, 1128.186767578125, 314.003265380859, 1110.826782226563, 412.483276367188, 1128.186767578125], [608.575317382813, 1167.830688476563, 411.615295410156, 1133.110717773438, 313.135284423828, 1115.750732421875, 510.095275878906, 1150.470703125], [607.707275390625, 1172.754760742188, 410.747283935547, 1138.034790039063, 312.267272949219, 1120.674682617188, 607.707275390625, 1172.754760742188], [606.839294433594, 1177.6787109375, 409.879272460938, 1142.958740234375, 409.879272460938, 1142.958740234375, 311.399261474609, 1125.598754882813], [605.971313476563, 1182.602783203125, 409.011291503906, 1147.882690429688, 409.011291503906, 1147.882690429688, 409.011291503906, 1147.882690429688], [605.103271484375, 1187.526733398438, 408.143280029297, 1152.806762695313, 408.143280029297, 1152.806762695313, 506.623291015625, 1170.166748046875], [604.235290527344, 1192.450805664063, 407.275268554688, 1157.730712890625, 407.275268554688, 1157.730712890625, 604.235290527344, 1192.450805664063], [603.367309570313, 1197.374755859375, 406.407287597656, 1162.65478515625, 504.887298583984, 1180.014770507813, 307.927276611328, 1145.294799804688], [602.499267578125, 1202.298706054688, 405.539276123047, 1167.578735351563, 504.019287109375, 1184.938720703125, 405.539276123047, 1167.578735351563], [601.631286621094, 1207.222778320313, 404.671264648438, 1172.502685546875, 503.151275634766, 1189.86279296875, 503.151275634766, 1189.86279296875], [600.763305664063, 1212.146728515625, 403.803283691406, 1177.4267578125, 502.283294677734, 1194.786743164063, 600.763305664063, 1212.146728515625], [599.895263671875, 1217.07080078125, 402.935272216797, 1182.350708007813, 599.895263671875, 1217.07080078125, 304.455261230469, 1164.99072265625], [599.027282714844, 1221.994750976563, 402.067291259766, 1187.274780273438, 599.027282714844, 1221.994750976563, 402.067291259766, 1187.274780273438], [598.159301757813, 1226.918701171875, 401.199279785156, 1192.19873046875, 598.159301757813, 1226.918701171875, 499.679290771484, 1209.558715820313], [597.291259765625, 1231.8427734375, 400.331268310547, 1197.122802734375, 597.291259765625, 1231.8427734375, 597.291259765625, 1231.8427734375], [596.423278808594, 1236.766723632813, 497.943298339844, 1219.40673828125, 300.983276367188, 1184.686767578125, 300.983276367188, 1184.686767578125], [595.555297851563, 1241.690795898438, 497.075286865234, 1224.330688476563, 300.115264892578, 1189.610717773438, 398.595275878906, 1206.970703125], [594.687316894531, 1246.61474609375, 496.207275390625, 1229.254760742188, 299.247283935547, 1194.534790039063, 496.207275390625, 1229.254760742188], [593.819274902344, 1251.538696289063, 495.339294433594, 1234.1787109375, 298.379272460938, 1199.458740234375, 593.819274902344, 1251.538696289063], [592.951293945313, 1256.462768554688, 494.471282958984, 1239.102783203125, 395.991271972656, 1221.742797851563, 297.511260986328, 1204.382690429688], [592.083312988281, 1261.38671875, 493.603271484375, 1244.026733398438, 395.123291015625, 1226.666748046875, 395.123291015625, 1226.666748046875], [591.215270996094, 1266.310791015625, 492.735290527344, 1248.950805664063, 394.255279541016, 1231.590698242188, 492.735290527344, 1248.950805664063], [590.347290039063, 1271.234741210938, 491.867279052734, 1253.874755859375, 393.387268066406, 1236.514770507813, 590.347290039063, 1271.234741210938], [589.479309082031, 1276.15869140625, 490.999267578125, 1258.798706054688, 490.999267578125, 1258.798706054688, 294.039276123047, 1224.078735351563], [588.611267089844, 1281.082763671875, 490.131286621094, 1263.722778320313, 490.131286621094, 1263.722778320313, 391.651275634766, 1246.36279296875], [587.743286132813, 1286.006713867188, 489.263275146484, 1268.646728515625, 489.263275146484, 1268.646728515625, 489.263275146484, 1268.646728515625], [586.875305175781, 1290.930786132813, 488.395294189453, 1273.57080078125, 488.395294189453, 1273.57080078125, 586.875305175781, 1290.930786132813], [586.007263183594, 1295.854736328125, 487.527282714844, 1278.494750976563, 586.007263183594, 1295.854736328125, 290.567260742188, 1243.774780273438], [585.139282226563, 1300.77880859375, 486.659271240234, 1283.418701171875, 585.139282226563, 1300.77880859375, 388.179290771484, 1266.058715820313], [584.271301269531, 1305.702758789063, 485.791290283203, 1288.3427734375, 584.271301269531, 1305.702758789063, 485.791290283203, 1288.3427734375], [583.403259277344, 1310.626708984375, 484.923278808594, 1293.266723632813, 583.403259277344, 1310.626708984375, 583.403259277344, 1310.626708984375], [582.535278320313, 1315.55078125, 582.535278320313, 1315.55078125, 287.095275878906, 1263.470703125, 287.095275878906, 1263.470703125], [581.667297363281, 1320.474731445313, 581.667297363281, 1320.474731445313, 286.227264404297, 1268.394775390625, 384.707275390625, 1285.754760742188], [580.799255371094, 1325.398803710938, 580.799255371094, 1325.398803710938, 285.359283447266, 1273.318725585938, 482.319274902344, 1308.038696289063], [579.931274414063, 1330.32275390625, 579.931274414063, 1330.32275390625, 284.491271972656, 1278.242797851563, 579.931274414063, 1330.32275390625], [579.063293457031, 1335.246704101563, 579.063293457031, 1335.246704101563, 382.103271484375, 1300.526733398438, 283.623260498047, 1283.166748046875], [578.1953125, 1340.170776367188, 578.1953125, 1340.170776367188, 381.235290527344, 1305.450805664063, 381.235290527344, 1305.450805664063], [577.327270507813, 1345.0947265625, 577.327270507813, 1345.0947265625, 380.367279052734, 1310.374755859375, 478.847290039063, 1327.734741210938], [576.459289550781, 1350.018798828125, 576.459289550781, 1350.018798828125, 379.499267578125, 1315.298706054688, 576.459289550781, 1350.018798828125], [575.59130859375, 1354.942749023438, 575.59130859375, 1354.942749023438, 477.111267089844, 1337.582763671875, 280.151275634766, 1302.86279296875], [574.723266601563, 1359.86669921875, 574.723266601563, 1359.86669921875, 476.243286132813, 1342.506713867188, 377.763275146484, 1325.146728515625], [573.855285644531, 1364.790771484375, 573.855285644531, 1364.790771484375, 475.375274658203, 1347.430786132813, 475.375274658203, 1347.430786132813], [572.9873046875, 1369.714721679688, 572.9873046875, 1369.714721679688, 474.507293701172, 1352.354736328125, 572.9873046875, 1369.714721679688], [572.119262695313, 1374.638793945313, 572.119262695313, 1374.638793945313, 572.119262695313, 1374.638793945313, 276.679260253906, 1322.558715820313], [571.251281738281, 1379.562744140625, 571.251281738281, 1379.562744140625, 571.251281738281, 1379.562744140625, 374.291290283203, 1344.8427734375], [570.38330078125, 1384.48681640625, 570.38330078125, 1384.48681640625, 570.38330078125, 1384.48681640625, 471.903289794922, 1367.126708984375], [569.515258789063, 1389.410766601563, 569.515258789063, 1389.410766601563, 569.515258789063, 1389.410766601563, 569.515258789063, 1389.410766601563]]";
   
    data1=JSON.parse(data1);
    data2=JSON.parse(data2);
    data3=JSON.parse(data3);
    if (typeof(randomdata)!="undefined" && typeof(randomdata[0])!="undefined") data4=randomdata;
    else alert("randomdata not exists");
   
    var CPoint = function() {
      var arg = arguments;
      if(arg.length == 1) {
        this.X = arg[0].X;
        this.Y = arg[0].Y
      }else {
        if(arg.length == 2) {
          this.X = arg[0];
          this.Y = arg[1]
        }
      }
    };
   
    function Subdivide(x1, y1, x2, y2, x3, y3, x4, y4, t)
    {
      var p1pX = x1 + (x2 - x1) * t;
          p1pY = y1 + (y2 - y1) * t,
          p2pX = x2 + (x3 - x2) * t,
          p2pY = y2 + (y3 - y2) * t,
          p3pX = x3 + (x4 - x3) * t,
          p3pY = y3 + (y4 - y3) * t,
          p1dX = p1pX + (p2pX - p1pX) * t,
          p1dY = p1pY + (p2pY - p1pY) * t,
          p2dX = p2pX + (p3pX - p2pX) * t,
          p2dY = p2pY + (p3pY - p2pY) * t,
          p1tX = p1dX + (p2dX - p1dX) * t,
          p1tY = p1dY + (p2dY - p1dY) * t;
      return [[x1, y1, p1pX, p1pY, p1dX, p1dY, p1tX, p1tY],
              [p1tX, p1tY, p2dX, p2dY, p3pX, p3pY, x4, y4]];
    }
   
    function find_Inflection_Points(p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y)
    {
      var ax = -p1x + 3*p2x - 3*p3x + p4x;
      var bx = 3*p1x - 6*p2x + 3*p3x;
      var cx = -3*p1x + 3*p2x;
   
      var ay = -p1y + 3*p2y - 3*p3y + p4y;
      var by = 3*p1y - 6*p2y + 3*p3y;
      var cy = -3*p1y + 3*p2y;
      var a = 3*(ay*bx-ax*by);
      var b = 3*(ay*cx-ax*cy);
      var c = by*cx-bx*cy;
      var r2 = b*b - 4*a*c;
      var firstIfp = 0;
      var secondIfp = 0;
      if (r2>=0 && a!==0)
      {
        var r = Math.sqrt(r2);
        firstIfp = (-b + r) / (2*a);
        secondIfp = (-b - r) / (2*a);
        if ((firstIfp>0 && firstIfp<1) && (secondIfp>0 && secondIfp<1))
        {
          if (firstIfp>secondIfp)
          {
            var tmp = firstIfp;
            firstIfp = secondIfp;
            secondIfp = tmp;
          }
          if (secondIfp-firstIfp >0.00001)
            return [firstIfp, secondIfp];
          else return [firstIfp];
        }
        else if (firstIfp>0 && firstIfp<1)
          return [firstIfp];
        else if (secondIfp>0 && secondIfp<1)
        {
          firstIfp = secondIfp;
          return [firstIfp];
        }
        return [];
      }
      else return [];
    };
   
    var CPoint2 = function(x, y)
    {
        this.X = x;
        this.Y = y;
    };
     
    function compare_num(a,b) {
      return a < b ? -1 : a > b ? 1 : 0;
    }
   
    var get_t_values_of_extremes = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
      var tvalues=[],
      a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x),
      b = 2 * (c1x - p1x) - 2 * (c2x - c1x),
      sqrt1 = Math.sqrt(b * b - 4 * a * (p1x - c1x)),
      t1 = (-b + sqrt1) / 2 / a,
      t2 = (-b - sqrt1) / 2 / a;
      Math.abs(t1) > "1e12" && (t1 = 0.5);
      Math.abs(t2) > "1e12" && (t2 = 0.5);
      if (t1 > 0 && t1 < 1) tvalues.push(t1);
      if (t2 > 0 && t2 < 1 && t2!==t1) tvalues.push(t2);
       
      a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y);
      b = 2 * (c1y - p1y) - 2 * (c2y - c1y);
      sqrt1 = Math.sqrt(b * b - 4 * a * (p1y - c1y));
      var t3 = (-b + sqrt1) / 2 / a;
      var t4 = (-b - sqrt1) / 2 / a;
      Math.abs(t3) > "1e12" && (t3 = 0.5);
      Math.abs(t4) > "1e12" && (t4 = 0.5);
      if (t3 > 0 && t3 < 1 && t3!==t1 && t3!==t2) tvalues.push(t3);
      if (t4 > 0 && t4 < 1 && t4!==t1 && t4!==t2 && t4!==t3) tvalues.push(t4);
      /*
      var inflectionpoints = find_Inflection_Points(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);
      if (inflectionpoints[0]) tvalues.push(inflectionpoints[0]);
      if (inflectionpoints[1]) tvalues.push(inflectionpoints[1]);
      console.log(inflectionpoints[0],inflectionpoints[1]);
      */

      tvalues.sort(compare_num);
      return tvalues;
    };
   
   
    var approximate = function(x1, y1, x2, y2, x3, y3, x4, y4, m_approximation_scale, m_angle_tolerance, split)
    {
      if (typeof(m_approximation_scale) == "undefined") m_approximation_scale = 1;
      if (typeof(m_angle_tolerance) == "undefined") m_angle_tolerance = 179;
     
      var m_cusp_limit = 0;
     
      var pi =    3.141592653589793;
      var pi2 =   6.283185307179586;
      var pi180 = 0.017453292519943; // pi/180;
     
      var m_points = [];
     
      var m_angle_tolerance = m_angle_tolerance * pi180;
      var m_cusp_limit = m_cusp_limit * pi180;
     
      var m_distance_tolerance_square = 0.5 / m_approximation_scale;
      m_distance_tolerance_square *= m_distance_tolerance_square;
           
      var curve_distance_epsilon                  = 1e-12; // 1e-30
      var curve_collinearity_epsilon              = 1e-12; // 1e-30
      var curve_angle_tolerance_epsilon           = 0.01;
      var curve_recursion_limit = 32;
   
      if (m_cusp_limit !== 0) m_cusp_limit = pi - m_cusp_limit;
      var atan_calc=0;
   
     if (split)
     {
       var args = [x1, y1, x2, y2, x3, y3, x4, y4];
       var tvalues = get_t_values_of_extremes(x1, y1, x2, y2, x3, y3, x4, y4);
       var parts = [], part2 = [], t, i, part = args, pl;
       if (tvalues.length==0) parts.push(args);
       else
       {
         pl = tvalues.length;
         for(i = 0; i < pl; i++)
         {
           t = !i ? tvalues[i] : (tvalues[i]-tvalues[i-1])/(1-tvalues[i-1]);
           part2 = Subdivide(part[0], part[1], part[2], part[3], part[4], part[5], part[6], part[7], t);
           parts.push(part2[0]);
           part = part2[1].slice(0);
         }
         parts.push(part2[1]);
       }
       pl = parts.length;
       for(i = 0; i < pl; i++)
       {
         m_points.push(new CPoint2(parts[i][0], parts[i][1]));
         recursive_bezier(parts[i][0], parts[i][1], parts[i][2], parts[i][3], parts[i][4], parts[i][5], parts[i][6], parts[i][7], 0);
       }
       pl--;
       m_points.push(new CPoint2(parts[pl][6], parts[pl][7]));
      }
      else // original behaviour
      {
          m_points.push(new CPoint2(x1, y1));
          recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0);
          m_points.push(new CPoint2(x4, y4));
        }
   
        if (typeof(parts)=="undefined") return [m_points, atan_calc, [], []];
      else return [m_points, atan_calc, parts, tvalues];
   
      function calc_sq_distance(x1, y1, x2, y2)
      {
        var dx = x2-x1;
        var dy = y2-y1;
        return dx * dx + dy * dy;
      }
   
      function recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, level)
      {
   
        if(level > curve_recursion_limit)
        {
          return;
        }
   
        // Calculate all the mid-points of the line segments
        //----------------------
        var x12   = (x1 + x2) / 2;
        var y12   = (y1 + y2) / 2;
        var x23   = (x2 + x3) / 2;
        var y23   = (y2 + y3) / 2;
        var x34   = (x3 + x4) / 2;
        var y34   = (y3 + y4) / 2;
        var x123  = (x12 + x23) / 2;
        var y123  = (y12 + y23) / 2;
        var x234  = (x23 + x34) / 2;
        var y234  = (y23 + y34) / 2;
        var x1234 = (x123 + x234) / 2;
        var y1234 = (y123 + y234) / 2;
   
            // Try to approximate the full cubic curve by a single straight line
            //------------------
            var dx = x4-x1;
            var dy = y4-y1;
   
            var d2 = Math.abs(((x2 - x4) * dy - (y2 - y4) * dx));
            var d3 = Math.abs(((x3 - x4) * dy - (y3 - y4) * dx));
            var da1, da2, k;
           
            var d2d3 = ( ( d2 > curve_collinearity_epsilon?1:0) << 1 ) +
                       (d3 > curve_collinearity_epsilon?1:0);
           
            switch( d2d3)
            {
            case 0:
                // All collinear OR p1==p4
                //----------------------
                k = dx*dx + dy*dy;
                if(k == 0)
                {
                    d2 = calc_sq_distance(x1, y1, x2, y2);
                    d3 = calc_sq_distance(x4, y4, x3, y3);
                }
                else
                {
                    k   = 1 / k;
                    da1 = x2 - x1;
                    da2 = y2 - y1;
                    d2  = k * (da1*dx + da2*dy);
                    da1 = x3 - x1;
                    da2 = y3 - y1;
                    d3  = k * (da1*dx + da2*dy);
                    if(d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1)
                    {
                        // Simple collinear case, 1---2---3---4
                        // We can leave just two endpoints
                        return;
                    }
                         if(d2 <= 0) d2 = calc_sq_distance(x2, y2, x1, y1);
                    else if(d2 >= 1) d2 = calc_sq_distance(x2, y2, x4, y4);
                    else             d2 = calc_sq_distance(x2, y2, x1 + d2*dx, y1 + d2*dy);
   
                         if(d3 <= 0) d3 = calc_sq_distance(x3, y3, x1, y1);
                    else if(d3 >= 1) d3 = calc_sq_distance(x3, y3, x4, y4);
                    else             d3 = calc_sq_distance(x3, y3, x1 + d3*dx, y1 + d3*dy);
                }
                if(d2 > d3)
                {
                    if(d2 < m_distance_tolerance_square)
                    {
                        m_points.push(new CPoint2(x2, y2));
                        return;
                    }
                }
                else
                {
                    if(d3 < m_distance_tolerance_square)
                    {
                        m_points.push(new CPoint2(x3, y3));
                        return;
                    }
                }
                break;
   
            case 1:
                // p1,p2,p4 are collinear, p3 is significant
                //----------------------
                if(d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy))
                {
                    if(m_angle_tolerance < curve_angle_tolerance_epsilon)
                    {
                        m_points.push(new CPoint2(x23, y23));
                        return;
                    }
   
                    // Angle Condition
                    //----------------------
                    da1 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - Math.atan2(y3 - y2, x3 - x2));
    atan_calc++;
                    if(da1 >= pi) da1 = pi2 - da1;
   
                    if(da1 < m_angle_tolerance)
                    {
                        m_points.push(new CPoint2(x2, y2));
                        m_points.push(new CPoint2(x3, y3));
                        return;
                    }
   
                    if(m_cusp_limit != 0.0)
                    {
                        if(da1 > m_cusp_limit)
                        {
                            m_points.push(new CPoint2(x3, y3));
                            return;
                        }
                    }
                }
                break;
   
            case 2:
                // p1,p3,p4 are collinear, p2 is significant
                //----------------------
                if(d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy))
                {
                    if(m_angle_tolerance < curve_angle_tolerance_epsilon)
                    {
                        m_points.push(new CPoint2(x23, y23));
                        return;
                    }
   
                    // Angle Condition
                    //----------------------
                    da1 = Math.abs(Math.atan2(y3 - y2, x3 - x2) - Math.atan2(y2 - y1, x2 - x1));
    atan_calc++;
                    if(da1 >= pi) da1 = pi2 - da1;
   
                    if(da1 < m_angle_tolerance)
                    {
                        m_points.push(new CPoint2(x2, y2));
                        m_points.push(new CPoint2(x3, y3));
                        return;
                    }
   
                    if(m_cusp_limit != 0.0)
                    {
                        if(da1 > m_cusp_limit)
                        {
                            m_points.push(new CPoint2(x2, y2));
                            return;
                        }
                    }
                }
                break;
   
            case 3:
                // Regular case
                //-----------------
                 
                if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy))
                {
                    // If the curvature doesn't exceed the distance_tolerance value
                    // we tend to finish subdivisions.
                    //----------------------
                    if(m_angle_tolerance < curve_angle_tolerance_epsilon)
                    {
                        m_points.push(new CPoint2(x23, y23));
                        return;
                    }
   
                    // Angle & Cusp Condition
                    //----------------------
                  if (!split)
                  {
                    k   = Math.atan2(y3 - y2, x3 - x2);
                    da1 = Math.abs(k - Math.atan2(y2 - y1, x2 - x1));
                    da2 = Math.abs(Math.atan2(y4 - y3, x4 - x3) - k);
    atan_calc++;
                    if(da1 >= pi) da1 = pi2 - da1;
                    if(da2 >= pi) da2 = pi2 - da2;
                 
                    if(da1 + da2 < m_angle_tolerance)
                    {
                        // Finally we can stop the recursion
                        //----------------------
                        m_points.push(new CPoint2(x23, y23));
                        return;
                    }
                    }
                else
                {
                da1 = Math.abs(Math.atan2(y2 - y1, x2 - x1) - Math.atan2(y4 - y3, x4 - x3));
                if(da1 >= pi) da1 = pi2 - da1;
                  if(da1 < m_angle_tolerance)
                  {
                        // Finally we can stop the recursion
                        //----------------------
                        m_points.push(new CPoint2(x23, y23));
                        return;
                  }
                }
   
                    if(m_cusp_limit != 0.0)
                    {
                        if(da1 > m_cusp_limit)
                        {
                            m_points.push(new CPoint2(x2, y2));
                            return;
                        }
                      if (!split)
                      {
                        if(da2 > m_cusp_limit)
                        {
                            m_points.push(new CPoint2(x3, y3));
                            return;
                        }
                      }
                    }
                }
                break;
            }
   
            // Continue subdivision
            //----------------------
            recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1);
            recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1);
      }
    }
   
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Split false
var data = data4;
var newdata = [], newdata_item, m_approximation_scale, m_angle_tolerance, split;
m_approximation_scale = 1;
m_angle_tolerance = 0;
split = false;
for(var i = 0;i < data.length;i++) {
  x1 = data[i][0], y1 = data[i][1], x2 = data[i][2], y2 = data[i][3], x3 = data[i][4], y3 = data[i][5], x4 = data[i][6], y4 = data[i][7];
  newdata_item = approximate(x1, y1, x2, y2, x3, y3, x4, y4, m_approximation_scale, m_angle_tolerance, split);
  newdata.push(newdata_item)
}
;
pending…
Split true
var data = data4;
var newdata = [], newdata_item, m_approximation_scale, m_angle_tolerance, split;
m_approximation_scale = 1;
m_angle_tolerance = 0;
split = true;
for(var i = 0;i < data.length;i++) {
  x1 = data[i][0], y1 = data[i][1], x2 = data[i][2], y2 = data[i][3], x3 = data[i][4], y3 = data[i][5], x4 = data[i][6], y4 = data[i][7];
  newdata_item = approximate(x1, y1, x2, y2, x3, y3, x4, y4, m_approximation_scale, m_angle_tolerance, split);
  newdata.push(newdata_item)
}
;
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment