Skip to content

Instantly share code, notes, and snippets.

@JoshCheek JoshCheek/hydra.js
Last active Jun 22, 2019

Embed
What would you like to do?
Attempting to draw a hydra with hydra
solid().constructor.prototype.sin = function (radius, frequency, offset=0) {
return this.scrollX(radius).rotate(offset,frequency)
}
// need to figure out how to convert these to epicycles
// 94.75,70.19999694824219 87.60526275634766,68.36907196044922 81.8226547241211,69.729736328125 79.25341796875,76.64624786376953 76.66010284423828,83.35103607177734 69.29661560058594,83.73706817626953 62.081077575683594,85.23097229003906 57.438026428222656,80.36616516113281 53.0716667175293,74.41837310791016 47.33558654785156,73.1541748046875 40.800262451171875,76.56771850585938 34.873775482177734,80.94866180419922 36.75628662109375,87.4500503540039 39.90579605102539,94.12261199951172 38.09734344482422,100.01497650146484 33.584781646728516,105.8336181640625 28.309032440185547,108.61717224121094 21.038862228393555,107.36031341552734 14.398143768310547,107.5927505493164 12.04347038269043,114.56926727294922 10.539800643920898,121.79061889648438 13.436785697937012,126.81439208984375 20.323444366455078,129.46315002441406 25.62188720703125,133.25405883789062 26.282424926757812,140.59725952148438 27.586313247680664,147.61619567871094 21.558713912963867,151.87152099609375 15.605525016784668,156.2305908203125 16.587318420410156,162.4755401611328 20.288959503173828,168.8521728515625 24.920997619628906,173.7542266845703 31.668582916259766,170.76976013183594 38.36617660522461,167.67503356933594 44.09968185424805,171.16818237304688 50.23177719116211,175.2642364501953 50.879337310791016,181.72146606445312 49.74076461791992,189.01150512695312 52.39448928833008,194.26495361328125 59.44780731201172,196.4138641357422 66.68782806396484,197.82969665527344 70.22776794433594,192.4477081298828 72.8497085571289,185.55079650878906 77.78639221191406,181.8400421142578 85.11157989501953,181.0491180419922 91.21418762207031,181.93765258789062 95.50341796875,187.9405975341797 99.823974609375,193.70082092285156 106.4197006225586,190.3999481201172 112.6788558959961,186.5001678466797 115.47217559814453,181.21670532226562 112.41719818115234,174.50042724609375 109.64889526367188,167.8552703857422 114.48423767089844,162.29104614257812 118.54242706298828,156.33937072753906 125.83050537109375,157.48733520507812 133.11256408691406,158.6764373779297 137.09536743164062,154.05465698242188 139.09832763671875,146.95925903320312 139.8841094970703,139.84129333496094 132.99900817871094,137.18939208984375 126.08031463623047,134.6256866455078 124.11851501464844,128.46810913085938 123.01233673095703,121.17877960205078 126.22237396240234,115.90928649902344 132.17616271972656,111.55108642578125 135.22860717773438,106.35303497314453 131.85450744628906,99.79696655273438 127.68584442138672,93.71746826171875 121.54838562011719,93.7383804321289 114.87088775634766,96.87691497802734 108.77733612060547,96.74858856201172 103.04918670654297,92.13558959960938 99.43072509765625,86.93553924560547 100.58171844482422,79.64747619628906 101.31316375732422,72.53980255126953 61.526180267333984,112.95169067382812 68.0947494506836,109.66932678222656 75.35318756103516,108.5234375 82.6128921508789,109.6706771850586 89.2857666015625,112.75871276855469 94.52806854248047,117.90861511230469 97.98191833496094,124.39651489257812 99.44993591308594,131.59017944335938 98.61741638183594,138.90472412109375 95.6948471069336,145.6405487060547 90.79998016357422,151.1188507080078 84.42313385009766,154.78697204589844 77.27704620361328,156.4340362548828 69.9363784790039,155.91754150390625 63.09963607788086,153.22674560546875 57.40793228149414,148.58677673339844 53.32437515258789,142.46450805664062 51.47722625732422,135.35594177246094 51.7880859375,128.0640869140625 54.15150833129883,121.10551452636719 58.59143829345703,115.24999237060547 66.7590560913086,113.8402099609375 60.75259017944336,118.05325317382812 56.785888671875,124.22415924072266 55.07877731323242,131.36671447753906 55.790985107421875,138.6726837158203 59.39196014404297,145.00315856933594 64.71858215332031,150.03823852539062 71.54037475585938,152.7247772216797 78.88407135009766,152.9939727783203 85.80013275146484,150.5583038330078 91.49579620361328,145.92733764648438 95.04275512695312,139.51226806640625 96.23285675048828,132.26531982421875 94.65437316894531,125.09722137451172 90.84489440917969,118.8238296508789 85.12574768066406,114.25144958496094 78.07991790771484,112.16519927978516 70.75843811035156,112.39107513427734 78.971435546875,117.53419494628906 85.54798889160156,120.7283706665039 89.80564880371094,126.6732406616211 90.99683380126953,133.86488342285156 88.71051025390625,140.8181915283203 83.42903137207031,145.88172912597656 76.48578643798828,147.89566040039062 69.2866439819336,146.6326904296875 63.45183181762695,142.2459716796875 60.56124496459961,135.53172302246094 60.749961853027344,128.2478790283203 64.43370056152344,121.96339416503906 70.64149475097656,118.07804107666016 176.53102111816406,14.6190767288208 170.8019256591797,13.828452110290527 165.0970916748047,18.50581169128418 158.96673583984375,18.08323097229004 152.37513732910156,15.383718490600586 151.68304443359375,8.038165092468262 149.1191864013672,2.3533012866973877 141.75741577148438,1.9999998807907104 135.79063415527344,4.160652160644531 134.99729919433594,11.495062828063965 131.5960693359375,16.411632537841797 124.84734344482422,19.36890411376953 118.93695068359375,16.74091911315918 113.23837280273438,12.053961753845215 107.70037841796875,16.613428115844727 102.83758544921875,22.155263900756836 106.88115692138672,27.825010299682617 110.25800323486328,33.62095642089844 107.14850616455078,40.29051208496094 102.4715347290039,44.11126708984375 95.13233947753906,44.861080169677734 92.56864929199219,50.60075759887695 92.99340057373047,57.96064376831055 98.43476867675781,60.707481384277344 105.77885437011719,61.41908645629883 108.31654357910156,68.06395721435547 109.84687042236328,74.33201599121094 105.18732452392578,80.05317687988281 105.02213287353516,85.8123550415039 110.19329071044922,91.06294250488281 115.89415740966797,91.7544937133789 121.50162506103516,86.9590835571289 127.84224700927734,87.55850219726562 134.57772827148438,90.09420776367188 135.34483337402344,97.43257141113281 138.02182006835938,103.08401489257812 145.3956298828125,103.19924926757812 151.36441040039062,101.11654663085938 152.06573486328125,93.7715835571289 155.42681884765625,88.70516204833984 162.138671875,85.68022155761719 167.89385986328125,88.52147674560547 173.67723083496094,93.09983825683594 179.30224609375,88.44058227539062 184.00157165527344,82.76251983642578 179.96778869628906,77.01971435546875 176.4745635986328,71.228271484375 179.38180541992188,64.45845794677734 184.5588836669922,61.23627853393555 191.9058074951172,60.555599212646484 193.85000610351562,54.4195556640625 193.52952575683594,47.10234451293945 188.01528930664062,44.51615524291992 180.67166137695312,43.80116271972656 178.0321502685547,37.24252700805664 177.16555786132812,30.89347267150879 181.89273071289062,25.228288650512695 181.5498504638672,19.507633209228516 134.15367126464844,36.177345275878906 141.15907287597656,34.07582473754883 148.4984588623047,34.479976654052734 154.99691772460938,37.80234909057617 159.8123321533203,43.3446044921875 161.8268280029297,50.387855529785156 161.36065673828125,57.713600158691406 157.97816467285156,64.21857452392578 152.36642456054688,68.92640686035156 145.30831909179688,70.93384552001953 138.0152587890625,70.28377532958984 131.5563201904297,66.82977294921875 127.00077056884766,61.08127975463867 124.98307037353516,54.04713439941406 125.77408599853516,46.76182556152344
freqs = [[0.1,0],[0.2,0],[0.3,0.5]]
solid().out()
setTimeout(() => {
let o = shape(100,0.01,0)
freqs.forEach(([r, freq], i) => {
o = o.sin(r, i, freq)
})
o.add(o0,1).out()
}, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.