Skip to content

Instantly share code, notes, and snippets.

@fogleman
Last active January 4, 2017 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogleman/4b48774d7564779cd06bd854a2fca043 to your computer and use it in GitHub Desktop.
Save fogleman/4b48774d7564779cd06bd854a2fca043 to your computer and use it in GitHub Desktop.
Constant Jerk Motion Planning
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script src="pieces.js"></script>
<script src="sketch.js"></script>
</body>
</html>
var PIECES = [
[80.0,0.0,79.8061139072,5.55217126122,266.666666667,0.5],
[79.8061139072,5.55217126122,79.8051240208,5.58051789953,0,0.000849474292192],
[79.8051240208,5.58051789953,79.2214454993,11.1338480768,0,0.132144325708],
[79.2214454993,11.1338480768,78.2518080587,16.6329352654,0,0.0970510342857],
[78.2518080587,16.6329352654,76.9009356751,22.0509884654,0,0.0804922608386],
[76.9009356751,22.0509884654,75.1754096629,27.3616114661,0,0.0703041108034],
[75.1754096629,27.3616114661,73.0836366114,32.5389314461,0,0.0632188917456],
[73.0836366114,32.5389314461,70.6358074287,37.5577250229,0,0.0579227553681],
[70.6358074287,37.5577250229,67.8438476925,42.3935411387,0,0.0537695924121],
[67.8438476925,42.3935411387,64.72135955,47.0228201834,0,0.050399290771],
[64.72135955,47.0228201834,61.2835554495,51.4230087749,0,0.0475930217278],
[61.2835554495,51.4230087749,57.5471840271,55.5726696367,0,0.0452090763369],
[57.5471840271,55.5726696367,53.5304485087,59.4515860382,0,0.0431510854134],
[53.5304485087,59.4515860382,49.2529180261,63.0408602885,0,0.0413509157273],
[49.2529180261,63.0408602885,44.7354322777,66.3230058044,0,0.0397588475996],
[44.7354322777,66.3230058044,40.0,69.2820323028,0,0.0383376315091],
[40.0,69.2820323028,35.0696917431,71.9035237039,0,0.0370587336592],
[35.0696917431,71.9035237039,29.9685274733,74.1747083653,0,0.0358998770908],
[29.9685274733,74.1747083653,24.72135955,76.0845213036,0,0.0348433809793],
[24.72135955,76.0845213036,19.8717894374,77.4751131563,0,0.0306456937318],
[19.8717894374,77.4751131563,19.353751648,77.6236581021,-266.666666667,0.00322932408722],
[19.353751648,77.6236581021,13.8918542134,78.784620241,-266.666666667,0.0329954613512],
[13.8918542134,78.784620241,8.36227706141,79.5617516295,-266.666666667,0.0322270065508],
[8.36227706141,79.5617516295,2.7919597362,79.9512661615,-266.666666667,0.0315581927666],
[2.7919597362,79.9512661615,-2.7919597362,79.9512661615,-266.666666667,0.030974108598],
[-2.7919597362,79.9512661615,-8.36227706141,79.5617516295,-266.666666667,0.0304630755624],
[-8.36227706141,79.5617516295,-13.8918542134,78.784620241,-266.666666667,0.0300158307784],
[-13.8918542134,78.784620241,-19.353751648,77.6236581021,-266.666666667,0.0296249524682],
[-19.353751648,77.6236581021,-24.72135955,76.0845213036,-266.666666667,0.0292844479585],
[-24.72135955,76.0845213036,-29.9685274733,74.1747083653,-266.666666667,0.0289894531393],
[-29.9685274733,74.1747083653,-35.0696917431,71.9035237039,-266.666666667,0.0287360101017],
[-35.0696917431,71.9035237039,-40.0,69.2820323028,-266.666666667,0.0285209007655],
[-40.0,69.2820323028,-44.7354322777,66.3230058044,-266.666666667,0.0283415214216],
[-44.7354322777,66.3230058044,-49.2529180261,63.0408602885,-266.666666667,0.0281957877757],
[-49.2529180261,63.0408602885,-53.5304485087,59.4515860382,-266.666666667,0.0280820632218],
[-53.5304485087,59.4515860382,-57.5471840271,55.5726696367,-266.666666667,0.0279991052277],
[-57.5471840271,55.5726696367,-61.2835554495,51.4230087749,-266.666666667,0.0279460262365],
[-61.2835554495,51.4230087749,-64.0927069979,47.827458757,-266.666666667,0.0228167319889],
[-64.0927069979,47.827458757,-64.72135955,47.0228201834,0,0.00510550503203],
[-64.72135955,47.0228201834,-67.8438476925,42.3935411387,0,0.027919597362],
[-67.8438476925,42.3935411387,-70.6358074287,37.5577250229,0,0.027919597362],
[-70.6358074287,37.5577250229,-73.0836366114,32.5389314461,0,0.027919597362],
[-73.0836366114,32.5389314461,-75.1754096629,27.3616114661,0,0.027919597362],
[-75.1754096629,27.3616114661,-76.9009356751,22.0509884654,0,0.027919597362],
[-76.9009356751,22.0509884654,-78.2518080587,16.6329352654,0,0.027919597362],
[-78.2518080587,16.6329352654,-79.2214454993,11.1338480768,0,0.027919597362],
[-79.2214454993,11.1338480768,-79.8051240208,5.58051789953,0,0.027919597362],
[-79.8051240208,5.58051789953,-80.0,9.7699626167e-15,0,0.027919597362],
[-80.0,9.79717439318e-15,-79.8051240208,-5.58051789953,0,0.027919597362],
[-79.8051240208,-5.58051789953,-79.2214454993,-11.1338480768,0,0.027919597362],
[-79.2214454993,-11.1338480768,-78.2518080587,-16.6329352654,0,0.027919597362],
[-78.2518080587,-16.6329352654,-76.9009356751,-22.0509884654,0,0.027919597362],
[-76.9009356751,-22.0509884654,-75.1754096629,-27.3616114661,0,0.027919597362],
[-75.1754096629,-27.3616114661,-73.0836366114,-32.5389314461,0,0.027919597362],
[-73.0836366114,-32.5389314461,-70.6358074287,-37.5577250229,0,0.027919597362],
[-70.6358074287,-37.5577250229,-67.8438476925,-42.3935411387,0,0.027919597362],
[-67.8438476925,-42.3935411387,-64.72135955,-47.0228201834,0,0.027919597362],
[-64.72135955,-47.0228201834,-63.3923858563,-48.7238289421,0,0.010793055494],
[-63.3923858563,-48.7238289421,-61.2835554495,-51.4230087749,-288.417951709,0.0171277495204],
[-61.2835554495,-51.4230087749,-57.5471840271,-55.5726696367,-288.417951709,0.0279403910917],
[-57.5471840271,-55.5726696367,-53.5304485087,-59.4515860382,-288.417951709,0.0279913242285],
[-53.5304485087,-59.4515860382,-49.2529180261,-63.0408602885,-288.417951709,0.0280744867722],
[-49.2529180261,-63.0408602885,-44.7354322777,-66.3230058044,-288.417951709,0.0281908397014],
[-44.7354322777,-66.3230058044,-40.0,-69.2820323028,-288.417951709,0.0283417564843],
[-40.0,-69.2820323028,-35.0696917431,-71.9035237039,-288.417951709,0.0285290697637],
[-35.0696917431,-71.9035237039,-29.9685274733,-74.1747083653,-288.417951709,0.0287551362942],
[-29.9685274733,-74.1747083653,-24.72135955,-76.0845213036,-288.417951709,0.0290229248437],
[-24.72135955,-76.0845213036,-19.353751648,-77.6236581021,-288.417951709,0.0293361338645],
[-19.353751648,-77.6236581021,-13.8918542134,-78.784620241,-288.417951709,0.0296993487473],
[-13.8918542134,-78.784620241,-8.36227706141,-79.5617516295,-288.417951709,0.0301182529259],
[-8.36227706141,-79.5617516295,-2.7919597362,-79.9512661615,-288.417951709,0.030599913847],
[-2.7919597362,-79.9512661615,2.7919597362,-79.9512661615,-288.417951709,0.0311531753262],
[2.7919597362,-79.9512661615,8.36227706141,-79.5617516295,-288.417951709,0.031789204573],
[8.36227706141,-79.5617516295,13.8918542134,-78.784620241,-288.417951709,0.0325222697364],
[13.8918542134,-78.784620241,14.4054945361,-78.67544262,-288.417951709,0.00310009717751],
[14.4054945361,-78.67544262,19.353751648,-77.6236581021,0,0.0302626996676],
[19.353751648,-77.6236581021,24.72135955,-76.0845213036,0,0.0342866816395],
[24.72135955,-76.0845213036,29.9685274733,-74.1747083653,0,0.0352918643246],
[29.9685274733,-74.1747083653,35.0696917431,-71.9035237039,0,0.0363910059173],
[35.0696917431,-71.9035237039,40.0,-69.2820323028,0,0.0375997257674],
[40.0,-69.2820323028,44.7354322777,-66.3230058044,0,0.0389375397185],
[44.7354322777,-66.3230058044,49.2529180261,-63.0408602885,0,0.0404292067785],
[49.2529180261,-63.0408602885,53.5304485087,-59.4515860382,0,0.042106692496],
[53.5304485087,-59.4515860382,57.5471840271,-55.5726696367,0,0.0440121134951],
[57.5471840271,-55.5726696367,61.2835554495,-51.4230087749,0,0.0462023013347],
[61.2835554495,-51.4230087749,64.72135955,-47.0228201834,0,0.0487561568456],
[64.72135955,-47.0228201834,67.8438476925,-42.3935411387,0,0.0517870679091],
[67.8438476925,-42.3935411387,70.6358074287,-37.5577250229,0,0.0554651120787],
[70.6358074287,-37.5577250229,73.0836366114,-32.5389314461,0,0.0600597161861],
[73.0836366114,-32.5389314461,75.1754096629,-27.3616114661,0,0.0660296629225],
[75.1754096629,-27.3616114661,76.9009356751,-22.0509884654,0,0.0742388488711],
[76.9009356751,-22.0509884654,78.2518080587,-16.6329352654,0,0.0865799884811],
[78.2518080587,-16.6329352654,79.1252113816,-11.6796188788,0,0.0961477653629],
[79.1252113816,-11.6796188788,79.2214454993,-11.1338480768,288.417951709,0.0122906120092],
[79.2214454993,-11.1338480768,79.8051240208,-5.58051789953,288.417951709,0.158628851053],
[79.8051240208,-5.58051789953,80.0,-1.95943487864e-14,288.417951709,0.291372611836],
[80.0,-1.95943487864e-14,78.6387400579,-1.82606986816e-14,1652.94917503,0.0806639038561],
[78.6387400579,-1.82606986816e-14,73.6027391477,-1.33268407655e-14,0,0.161327807712],
[73.6027391477,-1.33268407655e-14,69.9279981797,-9.72663295417e-15,-1652.94917503,0.0806639038561],
[69.9279981797,-9.72663295417e-15,66.3547207831,-6.22583077323e-15,-1701.80502916,0.0783481838687],
[66.3547207831,-6.22583077323e-15,61.3907216933,-1.36251429614e-15,0,0.156696367737],
[61.3907216933,-1.36251429614e-15,60.0,0.0,1701.80502916,0.0783481838687],
[60.0,0.0,59.8538430156,4.18538842465,298.35924688,0.225822201475],
[59.8538430156,4.18538842465,59.4160841245,8.3503860576,298.35924688,0.142349662571],
[59.4160841245,8.3503860576,58.8575359623,11.5180700951,298.35924688,0.0787166930464],
[58.8575359623,11.5180700951,58.688856044,12.4747014491,0,0.020591276297],
[58.688856044,12.4747014491,57.6757017563,16.538241349,0,0.0779258958128],
[57.6757017563,16.538241349,56.3815572472,20.5212085995,0,0.0661129911781],
[56.3815572472,20.5212085995,54.8127274586,24.4041985845,0,0.0584504385679],
[54.8127274586,24.4041985845,52.9768555715,28.1682937672,0,0.0529604064756],
[52.9768555715,28.1682937672,50.8828857694,31.795155854,0,0.0487767835214],
[50.8828857694,31.795155854,48.5410196625,35.2671151375,0,0.0454513458905],
[48.5410196625,35.2671151375,45.9626665871,38.5672565812,0,0.0427255258353],
[45.9626665871,38.5672565812,43.1603880203,41.6795022275,0,0.0404382317444],
[43.1603880203,41.6795022275,40.1478363815,44.5886895286,0,0.0384831463961],
[40.1478363815,44.5886895286,36.9396885195,47.2806452164,0,0.0367868804777],
[36.9396885195,47.2806452164,33.5515742082,49.7422543533,0,0.0352969166746],
[33.5515742082,49.7422543533,30.0,51.9615242271,0,0.0339745462561],
[30.0,51.9615242271,26.3022688073,53.927642778,0,0.0327905245238],
[26.3022688073,53.927642778,22.476395605,55.631031274,0,0.0317222885815],
[22.476395605,55.631031274,18.5410196625,57.0633909777,0,0.030752113918],
[18.5410196625,57.0633909777,14.515313736,58.2177435766,0,0.0298658569142],
[14.515313736,58.2177435766,10.41889066,59.0884651807,0,0.0290520751291],
[10.41889066,59.0884651807,6.27170779606,59.6713137221,0,0.0283013981389],
[6.27170779606,59.6713137221,2.09396980215,59.9634496211,0,0.0276060687242],
[2.09396980215,59.9634496211,-2.09396980215,59.9634496211,0,0.0269596024383],
[-2.09396980215,59.9634496211,-6.27170779606,59.6713137221,0,0.0263565310687],
[-6.27170779606,59.6713137221,-10.41889066,59.0884651807,0,0.0257922066019],
[-10.41889066,59.0884651807,-11.4817262383,58.8625525046,0,0.006604063017],
[-11.4817262383,58.8625525046,-14.515313736,58.2177435766,-298.35924688,0.0186605160112],
[-14.515313736,58.2177435766,-18.5410196625,57.0633909777,-298.35924688,0.0247863824289],
[-18.5410196625,57.0633909777,-22.476395605,55.631031274,-298.35924688,0.0243597841351],
[-22.476395605,55.631031274,-26.3022688073,53.927642778,-298.35924688,0.0239783922086],
[-26.3022688073,53.927642778,-30.0,51.9615242271,-298.35924688,0.0236369158188],
[-30.0,51.9615242271,-33.5515742082,49.7422543533,-298.35924688,0.0233309959035],
[-33.5515742082,49.7422543533,-36.9396885195,47.2806452164,-298.35924688,0.0230570141022],
[-36.9396885195,47.2806452164,-40.1478363815,44.5886895286,-298.35924688,0.0228119484532],
[-40.1478363815,44.5886895286,-43.1603880203,41.6795022275,-298.35924688,0.0225932630321],
[-43.1603880203,41.6795022275,-45.9626665871,38.5672565812,-298.35924688,0.0223988226185],
[-45.9626665871,38.5672565812,-48.5410196625,35.2671151375,-298.35924688,0.0222268260957],
[-48.5410196625,35.2671151375,-50.8828857694,31.795155854,-298.35924688,0.0220757540701],
[-50.8828857694,31.795155854,-52.9768555715,28.1682937672,-298.35924688,0.0219443274306],
[-52.9768555715,28.1682937672,-54.8127274586,24.4041985845,-298.35924688,0.0218314744399],
[-54.8127274586,24.4041985845,-56.3815572472,20.5212085995,-298.35924688,0.0217363045732],
[-56.3815572472,20.5212085995,-57.6757017563,16.538241349,-298.35924688,0.0216580877707],
[-57.6757017563,16.538241349,-58.688856044,12.4747014491,-298.35924688,0.0215962381078],
[-58.688856044,12.4747014491,-59.4160841245,8.3503860576,-298.35924688,0.0215503011347],
[-59.4160841245,8.3503860576,-59.8538430156,4.18538842465,-298.35924688,0.0215199443328],
[-59.8538430156,4.18538842465,-59.9974871727,0.071957958736,-298.35924688,0.021135264424],
[-59.9974871727,0.071957958736,-60.0,7.34788079488e-15,-296.821157181,0.000369685861621],
[-60.0,2.55266940384e-14,-59.8538430156,-4.18538842465,-296.821157181,0.0215051985015],
[-59.8538430156,-4.18538842465,-59.4160841245,-8.3503860576,-296.821157181,0.0215206382531],
[-59.4160841245,-8.3503860576,-58.688856044,-12.4747014491,-296.821157181,0.0215513664382],
[-58.688856044,-12.4747014491,-57.6757017563,-16.538241349,-296.821157181,0.0215976020503],
[-57.6757017563,-16.538241349,-56.3815572472,-20.5212085995,-296.821157181,0.0216596781531],
[-56.3815572472,-20.5212085995,-54.8127274586,-24.4041985845,-296.821157181,0.0217380486896],
[-54.8127274586,-24.4041985845,-52.9768555715,-28.1682937672,-296.821157181,0.0218332979708],
[-52.9768555715,-28.1682937672,-50.8828857694,-31.795155854,-296.821157181,0.0219461532443],
[-50.8828857694,-31.795155854,-48.5410196625,-35.2671151375,-296.821157181,0.0220775008886],
[-48.5410196625,-35.2671151375,-45.9626665871,-38.5672565812,-296.821157181,0.0222284069707],
[-45.9626665871,-38.5672565812,-43.1603880203,-41.6795022275,-296.821157181,0.0224001431519],
[-43.1603880203,-41.6795022275,-40.1478363815,-44.5886895286,-296.821157181,0.0225942192541],
[-40.1478363815,-44.5886895286,-36.9396885195,-47.2806452164,-296.821157181,0.0228124242469],
[-36.9396885195,-47.2806452164,-33.5515742082,-49.7422543533,-296.821157181,0.0230568780245],
[-33.5515742082,-49.7422543533,-30.0,-51.9615242271,-296.821157181,0.0233300971992],
[-30.0,-51.9615242271,-26.3022688073,-53.927642778,-296.821157181,0.0236350793477],
[-26.3022688073,-53.927642778,-22.476395605,-55.631031274,-296.821157181,0.0239754118941],
[-22.476395605,-55.631031274,-18.5410196625,-57.0633909777,-296.821157181,0.0243554143732],
[-18.5410196625,-57.0633909777,-14.515313736,-58.2177435766,-296.821157181,0.0247803266439],
[-14.515313736,-58.2177435766,-11.226523664,-58.9167974863,-296.821157181,0.0202367059217],
[-11.226523664,-58.9167974863,-10.41889066,-59.0884651807,0,0.0050198174124],
[-10.41889066,-59.0884651807,-6.27170779606,-59.6713137221,0,0.0257830825835],
[-6.27170779606,-59.6713137221,-2.09396980215,-59.9634496211,0,0.0263467950902],
[-2.09396980215,-59.9634496211,2.09396980215,-59.9634496211,0,0.0269491828827],
[2.09396980215,-59.9634496211,6.27170779606,-59.6713137221,0,0.0275948816636],
[6.27170779606,-59.6713137221,10.41889066,-59.0884651807,0,0.0282893444721],
[10.41889066,-59.0884651807,14.515313736,-58.2177435766,0,0.0290390368626],
[14.515313736,-58.2177435766,18.5410196625,-57.0633909777,0,0.029851692264],
[18.5410196625,-57.0633909777,22.476395605,-55.631031274,0,0.0307366507641],
[22.476395605,-55.631031274,26.3022688073,-53.927642778,0,0.0317053155784],
[26.3022688073,-53.927642778,30.0,-51.9615242271,0,0.0327717788034],
[30.0,-51.9615242271,33.5515742082,-49.7422543533,0,0.0339536960662],
[33.5515742082,-49.7422543533,36.9396885195,-47.2806452164,0,0.0352735362851],
[36.9396885195,-47.2806452164,40.1478363815,-44.5886895286,0,0.0367604129262],
[40.1478363815,-44.5886895286,43.1603880203,-41.6795022275,0,0.0384528464328],
[43.1603880203,-41.6795022275,45.9626665871,-38.5672565812,0,0.0404030752001],
[45.9626665871,-38.5672565812,48.5410196625,-35.2671151375,0,0.0426840592474],
[48.5410196625,-35.2671151375,50.8828857694,-31.795155854,0,0.0454014234709],
[50.8828857694,-31.795155854,52.9768555715,-28.1682937672,0,0.0487150758689],
[52.9768555715,-28.1682937672,54.8127274586,-24.4041985845,0,0.0528814027034],
[54.8127274586,-24.4041985845,56.3815572472,-20.5212085995,0,0.0583441804661],
[56.3815572472,-20.5212085995,57.6757017563,-16.538241349,0,0.0659590545868],
[57.6757017563,-16.538241349,58.688856044,-12.4747014491,0,0.0776730354731],
[58.688856044,-12.4747014491,58.915344443,-11.1902219098,0,0.0278191770545],
[58.915344443,-11.1902219098,59.4160841245,-8.3503860576,296.821157181,0.0711340617537],
[59.4160841245,-8.3503860576,59.8538430156,-4.18538842465,296.821157181,0.143011083274],
[59.8538430156,-4.18538842465,60.0,-1.46957615898e-14,296.821157181,0.235059132052],
[60.0,-1.46957615898e-14,58.6387400579,-1.36955240112e-14,1652.94917503,0.0806639038561],
[58.6387400579,-1.36955240112e-14,53.6027391477,-9.99513057413e-15,0,0.161327807712],
[53.6027391477,-9.99513057413e-15,49.9279981797,-7.29497471563e-15,-1652.94917503,0.0806639038561],
[49.9279981797,-7.29497471563e-15,46.3547207831,-4.66937307992e-15,-1701.80502916,0.0783481838687],
[46.3547207831,-4.66937307992e-15,41.3907216933,-1.02188572211e-15,0,0.156696367737],
[41.3907216933,-1.02188572211e-15,40.0,0.0,1701.80502916,0.0783481838687],
[40.0,0.0,39.9025620104,2.79025894977,372.260818583,0.158858097187],
[39.9025620104,2.79025894977,39.6107227497,5.5669240384,372.260818583,0.112496669893],
[39.6107227497,5.5669240384,39.1259040294,8.31646763271,372.260818583,0.0815287865147],
[39.1259040294,8.31646763271,39.075322813,8.51933781066,372.260818583,0.00528826217902],
[39.075322813,8.51933781066,38.4504678375,11.0254942327,0,0.0589464956924],
[38.4504678375,11.0254942327,37.5877048314,13.680805733,0,0.0543495643266],
[37.5877048314,13.680805733,36.5418183057,16.269465723,0,0.0479781919745],
[36.5418183057,16.269465723,35.3179037144,18.7788625114,0,0.0434301847914],
[35.3179037144,18.7788625114,33.9219238463,21.1967705693,0,0.0399728725971],
[33.9219238463,21.1967705693,32.360679775,23.5114100917,0,0.0372295113662],
[32.360679775,23.5114100917,30.6417777248,25.7115043875,0,0.0349837186508],
[30.6417777248,25.7115043875,28.7735920135,27.7863348184,0,0.0331011163233],
[28.7735920135,27.7863348184,26.7652242544,29.7257930191,0,0.0314932348106],
[26.7652242544,29.7257930191,24.626459013,31.5204301443,0,0.0300991232218],
[24.626459013,31.5204301443,22.3677161388,33.1615029022,0,0.0288752338588],
[22.3677161388,33.1615029022,20.0,34.6410161514,0,0.0277895110919],
[20.0,34.6410161514,17.5348458716,35.951761852,0,0.0268177633271],
[17.5348458716,35.951761852,14.9842637366,37.0873541827,0,0.0259413437904],
[14.9842637366,37.0873541827,12.360679775,38.0422606518,0,0.0251456162257],
[12.360679775,38.0422606518,9.67687582399,38.811829051,0,0.0244189096384],
[9.67687582399,38.811829051,6.94592710668,39.3923101205,0,0.0237517878898],
[6.94592710668,39.3923101205,4.18113853071,39.7808758147,0,0.0231365278447],
[4.18113853071,39.7808758147,1.3959798681,39.9756330808,0,0.0225667391494],
[1.3959798681,39.9756330808,-1.3959798681,39.9756330808,0,0.0220370823372],
[-1.3959798681,39.9756330808,-4.18113853071,39.7808758147,0,0.0215430565534],
[-4.18113853071,39.7808758147,-6.94592710668,39.3923101205,0,0.0210808374464],
[-6.94592710668,39.3923101205,-8.48069911536,39.0660842594,0,0.0116552086401],
[-8.48069911536,39.0660842594,-9.67687582399,38.811829051,-372.260818583,0.00899227341162],
[-9.67687582399,38.811829051,-12.360679775,38.0422606518,-372.260818583,0.0202499865123],
[-12.360679775,38.0422606518,-14.9842637366,37.0873541827,-372.260818583,0.0198951947281],
[-14.9842637366,37.0873541827,-17.5348458716,35.951761852,-372.260818583,0.0195783163121],
[-17.5348458716,35.951761852,-20.0,34.6410161514,-372.260818583,0.0192948514302],
[-20.0,34.6410161514,-22.3677161388,33.1615029022,-372.260818583,0.0190411009638],
[-22.3677161388,33.1615029022,-24.626459013,31.5204301443,-372.260818583,0.0188140004267],
[-24.626459013,31.5204301443,-26.7652242544,29.7257930191,-372.260818583,0.0186109949457],
[-26.7652242544,29.7257930191,-28.7735920135,27.7863348184,-372.260818583,0.0184299439306],
[-28.7735920135,27.7863348184,-30.6417777248,25.7115043875,-372.260818583,0.0182690475606],
[-30.6417777248,25.7115043875,-32.360679775,23.5114100917,-372.260818583,0.0181267895468],
[-32.360679775,23.5114100917,-33.9219238463,21.1967705693,-372.260818583,0.0180018922133],
[-33.9219238463,21.1967705693,-35.3179037144,18.7788625114,-372.260818583,0.017893281029],
[-35.3179037144,18.7788625114,-36.5418183057,16.269465723,-372.260818583,0.0178000564916],
[-36.5418183057,16.269465723,-37.5877048314,13.680805733,-372.260818583,0.0177214718107],
[-37.5877048314,13.680805733,-38.4504678375,11.0254942327,-372.260818583,0.017656915236],
[-38.4504678375,11.0254942327,-39.1259040294,8.31646763271,-372.260818583,0.0176058961642],
[-39.1259040294,8.31646763271,-39.6107227497,5.5669240384,-372.260818583,0.0175680343815],
[-39.6107227497,5.5669240384,-39.9025620104,2.79025894977,-372.260818583,0.0175430519636],
[-39.9025620104,2.79025894977,-39.9974871727,0.0719579587362,-372.260818583,0.0170787167156],
[-39.9974871727,0.0719579587362,-40.0,4.89858719659e-15,-369.869468723,0.000452050770733],
[-40.0,-4.19081942515e-15,-39.9025620104,-2.79025894976,-369.869468723,0.0175310777501],
[-39.9025620104,-2.79025894977,-39.6107227497,-5.5669240384,-369.869468723,0.0175439309528],
[-39.6107227497,-5.5669240384,-39.1259040294,-8.31646763271,-369.869468723,0.017569406793],
[-39.1259040294,-8.31646763271,-38.4504678375,-11.0254942327,-369.869468723,0.0176076891583],
[-38.4504678375,-11.0254942327,-37.5877048314,-13.680805733,-369.869468723,0.0176590574018],
[-37.5877048314,-13.680805733,-36.5418183057,-16.269465723,-369.869468723,0.0177238921293],
[-36.5418183057,-16.269465723,-35.3179037144,-18.7788625114,-369.869468723,0.0178026832626],
[-35.3179037144,-18.7788625114,-33.9219238463,-21.1967705693,-369.869468723,0.0178960407252],
[-33.9219238463,-21.1967705693,-32.360679775,-23.5114100917,-369.869468723,0.0180047082202],
[-32.360679775,-23.5114100917,-30.6417777248,-25.7115043875,-369.869468723,0.0181295807387],
[-30.6417777248,-25.7115043875,-28.7735920135,-27.7863348184,-369.869468723,0.0182717266489],
[-28.7735920135,-27.7863348184,-26.7652242544,-29.7257930191,-369.869468723,0.0184324155048],
[-26.7652242544,-29.7257930191,-24.626459013,-31.5204301443,-369.869468723,0.0186131531024],
[-24.626459013,-31.5204301443,-22.3677161388,-33.1615029022,-369.869468723,0.0188157258471],
[-22.3677161388,-33.1615029022,-20.0,-34.6410161514,-369.869468723,0.0190422572487],
[-20.0,-34.6410161514,-17.5348458716,-35.951761852,-369.869468723,0.0192952804295],
[-17.5348458716,-35.951761852,-14.9842637366,-37.0873541827,-369.869468723,0.0195778320804],
[-14.9842637366,-37.0873541827,-12.360679775,-38.0422606518,-369.869468723,0.0198935755739],
[-12.360679775,-38.0422606518,-9.67687582399,-38.811829051,-369.869468723,0.0202469643686],
[-9.67687582399,-38.811829051,-8.29694674754,-39.1051420309,-369.869468723,0.0103784870542],
[-8.29694674754,-39.1051420309,-6.94592710668,-39.3923101205,0,0.0102644769802],
[-6.94592710668,-39.3923101205,-4.18113853071,-39.7808758147,0,0.0210758434172],
[-4.18113853071,-39.7808758147,-1.3959798681,-39.9756330808,0,0.0215377268007],
[-1.3959798681,-39.9756330808,1.3959798681,-39.9756330808,0,0.0220313774777],
[1.3959798681,-39.9756330808,4.18113853071,-39.7808758147,0,0.0225606130123],
[4.18113853071,-39.7808758147,6.94592710668,-39.3923101205,0,0.0231299258903],
[6.94592710668,-39.3923101205,9.67687582399,-38.811829051,0,0.0237446451519],
[9.67687582399,-38.811829051,12.360679775,-38.0422606518,0,0.0244111480132],
[12.360679775,-38.0422606518,14.9842637366,-37.0873541827,0,0.0251371408463],
[14.9842637366,-37.0873541827,17.5348458716,-35.951761852,0,0.0259320380975],
[17.5348458716,-35.951761852,20.0,-34.6410161514,0,0.0268074822449],
[20.0,-34.6410161514,22.3677161388,-33.1615029022,0,0.0277780713815],
[22.3677161388,-33.1615029022,24.626459013,-31.5204301443,0,0.028862400158],
[24.626459013,-31.5204301443,26.7652242544,-29.7257930191,0,0.0300845872893],
[26.7652242544,-29.7257930191,28.7735920135,-27.7863348184,0,0.0314765836833],
[28.7735920135,-27.7863348184,30.6417777248,-25.7115043875,0,0.0330817816307],
[30.6417777248,-25.7115043875,32.360679775,-23.5114100917,0,0.0349608923134],
[32.360679775,-23.5114100917,33.9219238463,-21.1967705693,0,0.0372019976919],
[33.9219238463,-21.1967705693,35.3179037144,-18.7788625114,0,0.0399388109824],
[35.3179037144,-18.7788625114,36.5418183057,-16.269465723,0,0.0433864837107],
[36.5418183057,-16.269465723,37.5877048314,-13.680805733,0,0.0479192351141],
[37.5877048314,-13.680805733,38.4504678375,-11.0254942327,0,0.0542637399566],
[38.4504678375,-11.0254942327,39.1259040294,-8.31646763271,0,0.0640927653271],
[39.1259040294,-8.31646763271,39.1347216329,-8.26646051812,0,0.0012953043517],
[39.1347216329,-8.26646051812,39.6107227497,-5.5669240384,369.869468723,0.0802374001853],
[39.6107227497,-5.5669240384,39.9025620104,-2.79025894976,369.869468723,0.113944446677],
[39.9025620104,-2.79025894976,40.0,-9.79717439318e-15,369.869468723,0.166305688899],
[40.0,-9.79717439318e-15,38.6387400579,-9.1303493408e-15,1652.94917503,0.0806639038561],
[38.6387400579,-9.1303493408e-15,33.6027391477,-6.66342038276e-15,0,0.161327807712],
[33.6027391477,-6.66342038276e-15,29.9279981797,-4.86331647708e-15,-1652.94917503,0.0806639038561],
[29.9279981797,-4.86331647708e-15,26.3547207831,-3.11291538661e-15,-1701.80502916,0.0783481838687],
[26.3547207831,-3.11291538661e-15,21.3907216933,-6.81257148071e-16,0,0.156696367737],
[21.3907216933,-6.81257148071e-16,20.0,0.0,1701.80502916,0.0783481838687],
[20.0,0.0,19.9512810052,1.39512947488,550.951658354,0.0838194992482],
[19.9512810052,1.39512947488,19.8053613748,2.7834620192,550.951658354,0.0697868680982],
[19.8053613748,2.7834620192,19.5629520147,4.15823381636,550.951658354,0.0555241036723],
[19.5629520147,4.15823381636,19.3239528362,5.11680716435,550.951658354,0.0328750322077],
[19.3239528362,5.11680716435,19.2252339188,5.51274711634,0,0.012377371847],
[19.2252339188,5.51274711634,18.7938524157,6.84040286651,0,0.0384001656858],
[18.7938524157,6.84040286651,18.2709091529,8.13473286152,0,0.0339045663457],
[18.2709091529,8.13473286152,17.6589518572,9.38943125572,0,0.0306941120808],
[17.6589518572,9.38943125572,16.9609619231,10.5983852847,0,0.0282528801706],
[16.9609619231,10.5983852847,16.1803398875,11.7557050458,0,0.0263153787263],
[16.1803398875,11.7557050458,15.3208888624,12.8557521937,0,0.0247290439903],
[15.3208888624,12.8557521937,14.3867960068,13.8931674092,0,0.0233990948356],
[14.3867960068,13.8931674092,13.3826121272,14.8628965095,0,0.0222631128703],
[13.3826121272,14.8628965095,12.3132295065,15.7602150721,0,0.021278085281],
[12.3132295065,15.7602150721,11.1838580694,16.5807514511,0,0.020413274928],
[11.1838580694,16.5807514511,10.0,17.3205080757,0,0.0196460526097],
[10.0,17.3205080757,8.76742293578,17.975880926,0,0.0189593384178],
[8.76742293578,17.975880926,7.49213186832,18.5436770913,0,0.0183399657798],
[7.49213186832,18.5436770913,6.1803398875,19.0211303259,0,0.0177775989816],
[6.1803398875,19.0211303259,4.83843791199,19.4059145255,0,0.0172639956069],
[4.83843791199,19.4059145255,3.47296355334,19.6961550602,0,0.0167924910741],
[3.47296355334,19.6961550602,2.09056926535,19.8904379074,0,0.0163576303111],
[2.09056926535,19.8904379074,0.69798993405,19.9878165404,0,0.0159548993644],
[0.69798993405,19.9878165404,-0.69798993405,19.9878165404,0,0.0155805263983],
[-0.69798993405,19.9878165404,-2.09056926535,19.8904379074,0,0.0152313318275],
[-2.09056926535,19.8904379074,-3.47296355334,19.6961550602,0,0.0149046138598],
[-3.47296355334,19.6961550602,-4.83843791199,19.4059145255,0,0.0145980599666],
[-4.83843791199,19.4059145255,-4.89207739533,19.3905336512,0,0.000577415493804],
[-4.89207739533,19.3905336512,-6.1803398875,19.0211303259,-550.951658354,0.0137346772535],
[-6.1803398875,19.0211303259,-7.49213186832,18.5436770913,-550.951658354,0.0140549559221],
[-7.49213186832,18.5436770913,-8.76742293578,17.975880926,-550.951658354,0.013825849422],
[-8.76742293578,17.975880926,-10.0,17.3205080757,-550.951658354,0.0136213748433],
[-10.0,17.3205080757,-11.1838580694,16.5807514511,-550.951658354,0.013438750164],
[-11.1838580694,16.5807514511,-12.3132295065,15.7602150721,-550.951658354,0.0132756796104],
[-12.3132295065,15.7602150721,-13.3826121272,14.8628965095,-550.951658354,0.0131302561424],
[-13.3826121272,14.8628965095,-14.3867960068,13.8931674092,-550.951658354,0.0130008874963],
[-14.3867960068,13.8931674092,-15.3208888624,12.8557521937,-550.951658354,0.0128862394365],
[-15.3208888624,12.8557521937,-16.1803398875,11.7557050458,-550.951658354,0.0127851917766],
[-16.1803398875,11.7557050458,-16.9609619231,10.5983852847,-550.951658354,0.0126968040181],
[-16.9609619231,10.5983852847,-17.6589518572,9.38943125572,-550.951658354,0.0126202883376],
[-17.6589518572,9.38943125572,-18.2709091529,8.13473286152,-550.951658354,0.012554988269],
[-18.2709091529,8.13473286152,-18.7938524157,6.84040286651,-550.951658354,0.0125003618647],
[-18.7938524157,6.84040286651,-19.2252339188,5.51274711634,-550.951658354,0.0124559684366],
[-19.2252339188,5.51274711634,-19.5629520147,4.15823381636,-550.951658354,0.0124214582056],
[-19.5629520147,4.15823381636,-19.8053613748,2.7834620192,-550.951658354,0.012396564366],
[-19.8053613748,2.7834620192,-19.9512810052,1.39512947488,-550.951658354,0.0123810971988],
[-19.9512810052,1.39512947488,-19.9836581223,0.467970149192,-550.951658354,0.0082241104629],
[-19.9836581223,0.467970149192,-20.0,2.44929359829e-15,-510.342407372,0.00415082522027],
[-20.0,-2.09540971258e-15,-19.9512810052,-1.39512947488,-510.342407372,0.0123777796649],
[-19.9512810052,-1.39512947488,-19.8053613748,-2.7834620192,-510.342407372,0.0123892572704],
[-19.8053613748,-2.7834620192,-19.5629520147,-4.15823381636,-510.342407372,0.0124094151388],
[-19.5629520147,-4.15823381636,-19.2252339188,-5.51274711634,-510.342407372,0.0124383948848],
[-19.2252339188,-5.51274711634,-18.7938524157,-6.84040286651,-510.342407372,0.0124764025323],
[-18.7938524157,-6.84040286651,-18.2709091529,-8.13473286152,-510.342407372,0.0125237126791],
[-18.2709091529,-8.13473286152,-17.6589518572,-9.38943125572,-510.342407372,0.0125806741811],
[-17.6589518572,-9.38943125572,-16.9609619231,-10.5983852847,-510.342407372,0.012647717594],
[-16.9609619231,-10.5983852847,-16.1803398875,-11.7557050458,-510.342407372,0.0127253646937],
[-16.1803398875,-11.7557050458,-15.3208888624,-12.8557521937,-510.342407372,0.0128142405082],
[-15.3208888624,-12.8557521937,-14.3867960068,-13.8931674092,-510.342407372,0.0129150884331],
[-14.3867960068,-13.8931674092,-13.3826121272,-14.8628965095,-510.342407372,0.0130287891982],
[-13.3826121272,-14.8628965095,-12.3132295065,-15.7602150721,-510.342407372,0.0131563847046],
[-12.3132295065,-15.7602150721,-11.1838580694,-16.5807514511,-510.342407372,0.0132991081135],
[-11.1838580694,-16.5807514511,-10.0,-17.3205080757,-510.342407372,0.0134584220577],
[-10.0,-17.3205080757,-8.76742293578,-17.975880926,-510.342407372,0.013636067555],
[-8.76742293578,-17.975880926,-7.49213186832,-18.5436770913,-510.342407372,0.0138341272147],
[-7.49213186832,-18.5436770913,-6.1803398875,-19.0211303259,-510.342407372,0.0140551078173],
[-6.1803398875,-19.0211303259,-4.83843791199,-19.4059145255,-510.342407372,0.0143020495715],
[-4.83843791199,-19.4059145255,-3.89478297749,-19.6064945738,-510.342407372,0.0100435712162],
[-3.89478297749,-19.6064945738,-3.47296355334,-19.6961550602,0,0.00453501783116],
[-3.47296355334,-19.6961550602,-2.09056926535,-19.8904379074,0,0.0148829439371],
[-2.09056926535,-19.8904379074,-0.69798993405,-19.9878165404,0,0.0152082073857],
[-0.69798993405,-19.9878165404,0.69798993405,-19.9878165404,0,0.0155557770835],
[0.69798993405,-19.9878165404,2.09056926535,-19.8904379074,0,0.0159283255141],
[2.09056926535,-19.8904379074,3.47296355334,-19.6961550602,0,0.0163289961351],
[3.47296355334,-19.6961550602,4.83843791199,-19.4059145255,0,0.0167615157906],
[4.83843791199,-19.4059145255,6.1803398875,-19.0211303259,0,0.0172303417664],
[6.1803398875,-19.0211303259,7.49213186832,-18.5436770913,0,0.0177408568607],
[7.49213186832,-18.5436770913,8.76742293578,-17.975880926,0,0.0182996321775],
[8.76742293578,-17.975880926,10.0,-17.3205080757,0,0.0189147873179],
[10.0,-17.3205080757,11.1838580694,-16.5807514511,0,0.0195964937421],
[11.1838580694,-16.5807514511,12.3132295065,-15.7602150721,0,0.0203576938519],
[12.3132295065,-15.7602150721,13.3826121272,-14.8628965095,0,0.0212151543881],
[13.3826121272,-14.8628965095,14.3867960068,-13.8931674092,0,0.0221910550069],
[14.3867960068,-13.8931674092,15.3208888624,-12.8557521937,0,0.0233154665237],
[15.3208888624,-12.8557521937,16.1803398875,-11.7557050458,0,0.0246303754616],
[16.1803398875,-11.7557050458,16.9609619231,-10.5983852847,0,0.0261965436489],
[16.9609619231,-10.5983852847,17.6589518572,-9.38943125572,0,0.028105916963],
[17.6589518572,-9.38943125572,18.2709091529,-8.13473286152,0,0.0305058259286],
[18.2709091529,-8.13473286152,18.7938524157,-6.84040286651,0,0.033651072049],
[18.7938524157,-6.84040286651,19.2252339188,-5.51274711634,0,0.038032344794],
[19.2252339188,-5.51274711634,19.5629520147,-4.15823381636,0,0.0447640176617],
[19.5629520147,-4.15823381636,19.6499279609,-3.66496871375,0,0.0185766386796],
[19.6499279609,-3.66496871375,19.8053613748,-2.7834620192,510.342407372,0.0384374408902],
[19.8053613748,-2.7834620192,19.9512810052,-1.39512947488,510.342407372,0.0828512873504],
[19.9512810052,-1.39512947488,20.0,-4.89858719659e-15,510.342407372,0.139973772009],
[20.0,-4.89858719659e-15,16.6762953226,-2.76975389781,456.166532732,0.292290915194],
[16.6762953226,-2.76975389781,-13.3070076318,-27.7558396932,0,0.584581830389],
[-13.3070076318,-27.7558396932,-39.9666059089,-49.9721715908,-456.166532732,0.292290915194],
[-39.9666059089,-49.9721715908,-66.8680120744,-72.390010062,-451.828766646,0.295097043783],
[-66.8680120744,-72.390010062,-96.8847091199,-97.4039242666,0,0.590194087566],
[-96.8847091199,-97.4039242666,-100,-100,451.828766646,0.295097043783],
[-100,-100,-95.0577026031,-100.0,395.782288607,0.336885548372],
[-95.0577026031,-100.0,-44.8204419598,-100.0,0,0.673771096744],
[-44.8204419598,-100.0,0.474521286631,-100.0,-395.782288607,0.336885548372],
[0.474521286631,-100.0,43.1082618261,-100.0,-421.938633647,0.316001718499],
[43.1082618261,-100.0,92.8710011828,-100.0,0,0.632003436997],
[92.8710011828,-100.0,100,-100,421.938633647,0.316001718499],
[100,-100,100.0,-88.1088049843,289.128699053,0.461155650649],
[100.0,-88.1088049843,100.0,0.0,0,0.853771316174],
[100.0,0.0,99.756405026,6.97564737441,0,0.0428285980875],
[99.756405026,6.97564737441,99.3061233448,11.259791396,0,0.0257113870367],
[99.3061233448,11.259791396,99.0268068742,13.917310096,-289.128699053,0.0156917526607],
[99.0268068742,13.917310096,97.8147600734,20.7911690818,-289.128699053,0.040155633006],
[97.8147600734,20.7911690818,96.1261695938,27.5637355817,-289.128699053,0.0391097433279],
[96.1261695938,27.5637355817,93.9692620786,34.2020143326,-289.128699053,0.0382319337316],
[93.9692620786,34.2020143326,91.3545457643,40.6736643076,-289.128699053,0.037494028798],
[91.3545457643,40.6736643076,88.2947592859,46.9471562786,-289.128699053,0.0368749986751],
[88.2947592859,46.9471562786,84.8048096156,52.9919264233,-289.128699053,0.0363589305182],
[84.8048096156,52.9919264233,80.9016994375,58.7785252292,-289.128699053,0.0359336855426],
[80.9016994375,58.7785252292,76.6044443119,64.2787609687,-289.128699053,0.0355899887596],
[76.6044443119,64.2787609687,71.9339800339,69.4658370459,-289.128699053,0.0353208016533],
[71.9339800339,69.4658370459,66.9130606359,74.3144825477,-289.128699053,0.0351208863796],
[66.9130606359,74.3144825477,61.5661475326,78.8010753607,-289.128699053,0.0349865044087],
[61.5661475326,78.8010753607,55.9192903471,82.9037572555,-289.128699053,0.034915213586],
[55.9192903471,82.9037572555,55.0082301981,83.4730508203,-289.128699053,0.00537154960201],
[55.0082301981,83.4730508203,50.0,86.6025403784,0,0.0295279844434],
[50.0,86.6025403784,43.8371146789,89.8794046299,0,0.0348994967025],
[43.8371146789,89.8794046299,37.4606593416,92.7183854567,0,0.0348994967025],
[37.4606593416,92.7183854567,30.9016994375,95.1056516295,0,0.0348994967025],
[30.9016994375,95.1056516295,24.19218956,97.0295726276,0,0.0348994967025],
[24.19218956,97.0295726276,17.3648177667,98.4807753012,0,0.0348994967025],
[17.3648177667,98.4807753012,10.4528463268,99.4521895368,0,0.0348994967025],
[10.4528463268,99.4521895368,3.48994967025,99.9390827019,0,0.0348994967025],
[3.48994967025,99.9390827019,-3.48994967025,99.9390827019,0,0.0348994967025],
[-3.48994967025,99.9390827019,-10.4528463268,99.4521895368,0,0.0348994967025],
[-10.4528463268,99.4521895368,-17.3648177667,98.4807753012,0,0.0348994967025],
[-17.3648177667,98.4807753012,-24.19218956,97.0295726276,0,0.0348994967025],
[-24.19218956,97.0295726276,-30.9016994375,95.1056516295,0,0.0348994967025],
[-30.9016994375,95.1056516295,-37.4606593416,92.7183854567,0,0.0348994967025],
[-37.4606593416,92.7183854567,-43.8371146789,89.8794046299,0,0.0348994967025],
[-43.8371146789,89.8794046299,-50.0,86.6025403784,0,0.0348994967025],
[-50.0,86.6025403784,-55.9192903471,82.9037572555,0,0.0348994967025],
[-55.9192903471,82.9037572555,-61.5661475326,78.8010753607,0,0.0348994967025],
[-61.5661475326,78.8010753607,-66.9130606359,74.3144825477,0,0.0348994967025],
[-66.9130606359,74.3144825477,-71.9339800339,69.4658370459,0,0.0348994967025],
[-71.9339800339,69.4658370459,-76.6044443119,64.2787609687,0,0.0348994967025],
[-76.6044443119,64.2787609687,-80.9016994375,58.7785252292,0,0.0348994967025],
[-80.9016994375,58.7785252292,-84.8048096156,52.9919264233,0,0.0348994967025],
[-84.8048096156,52.9919264233,-88.2947592859,46.9471562786,0,0.0348994967025],
[-88.2947592859,46.9471562786,-91.3545457643,40.6736643076,0,0.0348994967025],
[-91.3545457643,40.6736643076,-93.9692620786,34.2020143326,0,0.0348994967025],
[-93.9692620786,34.2020143326,-96.1261695938,27.5637355817,0,0.0348994967025],
[-96.1261695938,27.5637355817,-97.8147600734,20.7911690818,0,0.0348994967025],
[-97.8147600734,20.7911690818,-99.0268068742,13.917310096,0,0.0348994967025],
[-99.0268068742,13.917310096,-99.756405026,6.97564737441,0,0.0348994967025],
[-99.756405026,6.97564737441,-100.0,1.24344978758e-14,0,0.0348994967025],
[-100.0,1.22464679915e-14,-99.756405026,-6.97564737441,0,0.0348994967025],
[-99.756405026,-6.97564737441,-99.0268068742,-13.917310096,0,0.0348994967025],
[-99.0268068742,-13.917310096,-97.8147600734,-20.7911690818,0,0.0348994967025],
[-97.8147600734,-20.7911690818,-96.1261695938,-27.5637355817,0,0.0348994967025],
[-96.1261695938,-27.5637355817,-93.9692620786,-34.2020143326,0,0.0348994967025],
[-93.9692620786,-34.2020143326,-91.3545457643,-40.6736643076,0,0.0348994967025],
[-91.3545457643,-40.6736643076,-88.2947592859,-46.9471562786,0,0.0348994967025],
[-88.2947592859,-46.9471562786,-84.8048096156,-52.9919264233,0,0.0348994967025],
[-84.8048096156,-52.9919264233,-80.9016994375,-58.7785252292,0,0.0348994967025],
[-80.9016994375,-58.7785252292,-76.6044443119,-64.2787609687,0,0.0348994967025],
[-76.6044443119,-64.2787609687,-71.9339800339,-69.4658370459,0,0.0348994967025],
[-71.9339800339,-69.4658370459,-66.9130606359,-74.3144825477,0,0.0348994967025],
[-66.9130606359,-74.3144825477,-61.5661475326,-78.8010753607,0,0.0348994967025],
[-61.5661475326,-78.8010753607,-55.9192903471,-82.9037572555,0,0.0348994967025],
[-55.9192903471,-82.9037572555,-50.0,-86.6025403784,0,0.0348994967025],
[-50.0,-86.6025403784,-43.8371146789,-89.8794046299,0,0.0348994967025],
[-43.8371146789,-89.8794046299,-37.4606593416,-92.7183854567,0,0.0348994967025],
[-37.4606593416,-92.7183854567,-30.9016994375,-95.1056516295,0,0.0348994967025],
[-30.9016994375,-95.1056516295,-24.19218956,-97.0295726276,0,0.0348994967025],
[-24.19218956,-97.0295726276,-17.3648177667,-98.4807753012,0,0.0348994967025],
[-17.3648177667,-98.4807753012,-10.4528463268,-99.4521895368,0,0.0348994967025],
[-10.4528463268,-99.4521895368,-3.48994967025,-99.9390827019,0,0.0348994967025],
[-3.48994967025,-99.9390827019,3.48994967025,-99.9390827019,0,0.0348994967025],
[3.48994967025,-99.9390827019,10.4528463268,-99.4521895368,0,0.0348994967025],
[10.4528463268,-99.4521895368,17.3648177667,-98.4807753012,0,0.0348994967025],
[17.3648177667,-98.4807753012,24.19218956,-97.0295726276,0,0.0348994967025],
[24.19218956,-97.0295726276,30.9016994375,-95.1056516295,0,0.0348994967025],
[30.9016994375,-95.1056516295,37.4606593416,-92.7183854567,0,0.0348994967025],
[37.4606593416,-92.7183854567,43.8371146789,-89.8794046299,0,0.0348994967025],
[43.8371146789,-89.8794046299,50.0,-86.6025403784,0,0.0348994967025],
[50.0,-86.6025403784,55.0082301981,-83.4730508203,0,0.0295279844434],
[55.0082301981,-83.4730508203,55.9192903471,-82.9037572555,-289.128699053,0.00537154960201],
[55.9192903471,-82.9037572555,61.5661475326,-78.8010753607,-289.128699053,0.034915213586],
[61.5661475326,-78.8010753607,66.9130606359,-74.3144825477,-289.128699053,0.0349865044087],
[66.9130606359,-74.3144825477,71.9339800339,-69.4658370459,-289.128699053,0.0351208863796],
[71.9339800339,-69.4658370459,76.6044443119,-64.2787609687,-289.128699053,0.0353208016533],
[76.6044443119,-64.2787609687,80.9016994375,-58.7785252292,-289.128699053,0.0355899887596],
[80.9016994375,-58.7785252292,84.8048096156,-52.9919264233,-289.128699053,0.0359336855426],
[84.8048096156,-52.9919264233,88.2947592859,-46.9471562786,-289.128699053,0.0363589305182],
[88.2947592859,-46.9471562786,91.3545457643,-40.6736643076,-289.128699053,0.0368749986751],
[91.3545457643,-40.6736643076,93.9692620786,-34.2020143326,-289.128699053,0.037494028798],
[93.9692620786,-34.2020143326,96.1261695938,-27.5637355817,-289.128699053,0.0382319337316],
[96.1261695938,-27.5637355817,97.8147600734,-20.7911690818,-289.128699053,0.0391097433279],
[97.8147600734,-20.7911690818,99.0268068742,-13.917310096,-289.128699053,0.040155633006],
[99.0268068742,-13.917310096,99.3061233448,-11.259791396,-289.128699053,0.0156917526607],
[99.3061233448,-11.259791396,99.756405026,-6.97564737441,0,0.0257113870367],
[99.756405026,-6.97564737441,100.0,-2.44929359829e-14,0,0.0428285980875],
[100.0,-2.44929359829e-14,100.0,88.1088049843,0,0.853771316174],
[100.0,88.1088049843,100,100,289.128699053,0.461155650649],
[100,100,92.8462902703,100.0,420.826903928,0.316836523731],
[92.8462902703,100.0,42.8462902703,100.0,0,0.633673047463],
[42.8462902703,100.0,0.0,100.0,-420.826903928,0.316836523731],
[0.0,100.0,-42.8462902703,100.0,-420.826903928,0.316836523731],
[-42.8462902703,100.0,-92.8462902703,100.0,0,0.633673047463],
[-92.8462902703,100.0,-100,100,420.826903928,0.316836523731],
[-100,100,-100.0,92.8777252822,422.24240677,0.31577437793],
[-100.0,92.8777252822,-100.0,43.1795019775,0,0.63154875586],
[-100.0,43.1795019775,-100.0,0.603553390593,-422.24240677,0.31577437793],
[-100.0,0.603553390593,-100.0,-46.903680155,-375.990671321,0.354618727281],
[-100.0,-46.903680155,-100.0,-97.2054568503,0,0.709237454562],
[-100.0,-97.2054568503,-100,-100,375.990671321,0.354629126357],
];
function makePieces(records) {
var pieces = [];
for (var i = 0; i < records.length; i++) {
var r = records[i];
var x1 = r[0] * 1;
var y1 = r[1] * 1;
var x2 = r[2] * 1;
var y2 = r[3] * 1;
var j = r[4];
var t = r[5];
pieces.push(new Piece(pieces, x1, y1, x2, y2, j, t));
}
return pieces;
}
var Piece = function(parent, x1, y1, x2, y2, jerk, duration) {
if (Array.isArray(parent)) {
parent = parent[parent.length - 1];
}
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.jerk = jerk;
this.duration = duration;
this.length = dist(x1, y1, x2, y2);
if (parent) {
this.t0 = parent.t1;
this.t1 = this.t0 + duration;
this.a0 = parent.a(this.t0);
this.v0 = parent.v(this.t0);
this.x0 = parent.x(this.t0);
} else {
this.t0 = 0;
this.t1 = duration;
this.a0 = 0;
this.v0 = 0;
this.x0 = 0;
}
}
Piece.prototype.hasT = function(t) {
return t >= this.t0 && t < this.t1;
}
Piece.prototype.j = function(t) {
return this.jerk;
}
Piece.prototype.a = function(t) {
t = min(t - this.t0, this.duration);
return this.a0 + this.jerk * t;
}
Piece.prototype.v = function(t) {
t = min(t - this.t0, this.duration);
return this.v0 + this.a0 * t + this.jerk * t * t / 2;
}
Piece.prototype.x = function(t) {
t = min(t - this.t0, this.duration);
return this.x0 + this.v0 * t + this.a0 * t * t / 2 + this.jerk * t * t * t / 6;
}
function evaluate(pieces, n, t) {
for (var i = 0; i < pieces.length; i++) {
if (pieces[i].hasT(t) || i == pieces.length - 1) {
switch (n) {
case 0: return pieces[i].x(t);
case 1: return pieces[i].v(t);
case 2: return pieces[i].a(t);
case 3: return pieces[i].j(t);
default: return 0;
}
}
}
return 0;
}
function computeBounds(pieces) {
var p = pieces[0];
var minx = p.x1;
var maxx = p.x1;
var miny = p.y1;
var maxy = p.y1;
for (var i = 0; i < pieces.length; i++) {
var piece = pieces[i];
minx = min(minx, piece.x1, piece.x2);
maxx = max(maxx, piece.x1, piece.x2);
miny = min(miny, piece.y1, piece.y2);
maxy = max(maxy, piece.y1, piece.y2);
}
var width = maxx - minx;
var height = maxy - miny;
return {
minx: minx, miny: miny, maxx: maxx, maxy: maxy,
width: width, height: height,
}
}
function drawPiece(dc, piece) {
dc.vertex(piece.x1, piece.y1);
dc.vertex(piece.x2, piece.y2);
}
function drawPieceLength(dc, piece, length) {
var x1 = piece.x1;
var y1 = piece.y1;
var x2 = lerp(piece.x1, piece.x2, length / piece.length);
var y2 = lerp(piece.y1, piece.y2, length / piece.length);
dc.vertex(x1, y1);
dc.vertex(x2, y2);
}
function drawPieces(dc, pieces, length) {
dc.beginShape();
for (var i = 0; i < pieces.length; i++) {
if (length <= 0) {
break;
}
var piece = pieces[i];
if (piece.length < length) {
drawPiece(dc, piece);
} else {
drawPieceLength(dc, piece, length);
}
length -= piece.length;
}
dc.endShape();
}
function Drawing(pieces) {
this.pieces = pieces;
this.bounds = computeBounds(pieces);
}
Drawing.prototype.setTransform = function(dc) {
var bounds = this.bounds;
var sx = dc.width / (bounds.width + 40);
var sy = dc.height / (bounds.height + 40);
var s = min(sx, sy);
var dx = (dc.width - bounds.width * s) / 2;
var dy = (dc.height - bounds.height * s) / 2;
dc.resetMatrix();
dc.translate(dx, dy);
dc.scale(s);
dc.translate(-bounds.minx, -bounds.miny);
}
Drawing.prototype.draw = function(dc, t) {
var length = evaluate(this.pieces, 0, t);
drawPieces(window, this.pieces, length);
}
var drawing;
function setup() {
drawing = new Drawing(makePieces(PIECES));
createCanvas(windowWidth, windowHeight);
restart();
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
restart();
}
function setStyle(dc) {
dc.stroke(0);
dc.strokeWeight(1);
dc.strokeJoin(ROUND);
dc.noFill();
}
function restart() {
background(255);
}
function draw() {
var time = millis() / 1000;
var distance = evaluate(drawing.pieces, 0, time);
var velocity = evaluate(drawing.pieces, 1, time);
var acceleration = evaluate(drawing.pieces, 2, time);
var jerk = evaluate(drawing.pieces, 3, time);
var lastPiece = drawing.pieces[drawing.pieces.length - 1];
var maxTime = lastPiece.t1;
var maxDistance = lastPiece.x(maxTime);
var maxVelocity = 200;
var maxAcceleration = 200;
var maxJerk = 1000;
background(255);
setStyle(window);
drawing.setTransform(window);
drawing.draw(window, time);
resetMatrix();
noStroke();
fill(0);
rect(0, 0, time / maxTime * width, 10);
fill(255, 0, 0);
rect(0, height - 10, distance / maxDistance * width, 10);
fill(0, 255, 0);
rect(0, height - 20, velocity / maxVelocity * width, 10);
fill(0, 0, 255);
var w = acceleration / maxAcceleration * width / 2;
rect(width / 2, height - 30, w, 10);
fill(128);
var w = jerk / maxJerk * width / 2;
rect(width / 2, height - 40, w, 10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment