we generate random truncated Fourier series and plot them in polar coordinates. we constrain series so that the shapes are convex. images below.
checking that a shape is convex was done probabilistically using the definition of convexity. pick pairs of random points on the boundary and test that points between them are inside.
future work: walking around the boundary, checking between pairs of close boundary points might be more efficient.
future work: compute signed curvature. assume violations of convexity correspond the curvature of the wrong sign, say negative. (is this true?) for a given number of Fourier series terms, there can only be so many minima. find all the local minima numerically and show they are not negative. perhaps avoid not only negative but also close to zero.
another way to get a curved convex shape: start with a random convex polygon (future post rgvdheir), then round off the vertices with splines or subdivision surface. many details remain, and one does not get infinite differentiability.
these blobs are all roughly circular. apply a linear transformation to get something elongated or skewed. convexity is not altered by general linear transformation. a line segment wholly inside a convex shape transforms to another line segment inside the transformed shape. linear transformations preserve linearity.
in the images below, we've chosen Fourier series with 16 terms.
seed 0: r(t) = 1.0000000000000000e+00 + 3.1026881231766978e-01*cos(1*t-1.9948920218042132e-01) + 1.0803345445950185e-02*cos(2*t-2.5245426524015122e+00) + 1.7217718957912354e-02*cos(3*t-1.2168604824404212e+00) + 5.7226020274541156e-03*cos(4*t-1.7434891806994748e+00) + 5.9413578426870117e-04*cos(5*t-4.4861109953966380e+00) + 4.3355528312041258e-03*cos(6*t-4.1399500867594652e-01) + 8.2844694592765222e-04*cos(7*t-8.9157045630376519e-01) + 6.2675612691265314e-04*cos(8*t-3.2640745979455894e+00) + 4.3009200116692625e-03*cos(9*t-5.3340660162383626e+00) + 1.3393785280975123e-03*cos(10*t-5.6201311827849842e+00) + 2.8110015671316546e-03*cos(11*t-2.6751358645844721e+00) + 7.6659814141066818e-07*cos(12*t-4.3886706074448361e+00) + 5.9511108258547551e-04*cos(13*t-4.8213055915201082e+00) + 2.4976073664362275e-04*cos(14*t-6.1368379123038119e+00) + 9.1301974355673110e-04*cos(15*t-6.7925602833935805e-01) + 2.2246833123773513e-04*cos(16*t-3.7493954592785679e+00)
seed 1: r(t) = 1.0000000000000000e+00 + 7.6890395426111979e-02*cos(1*t-5.0865516038641188e+00) + 9.0646089659955464e-02*cos(2*t-1.4297026108218742e+00) + 1.4889144319738534e-03*cos(3*t-2.1542236772995058e+00) + 1.5622465048412693e-02*cos(4*t-8.9483112298071854e-01) + 1.5340587750216628e-03*cos(5*t-3.8654278299120564e+00) + 1.2162881446258211e-03*cos(6*t-4.4115895248796528e+00) + 4.8831439777679009e-03*cos(7*t-1.3338875981668485e+00) + 7.1896126064991961e-03*cos(8*t-4.6074069537692147e-01) + 6.5520325166446014e-04*cos(9*t-2.3138038970522923e-01) + 4.4318237776863612e-04*cos(10*t-4.5957577619568313e-01) + 1.1594282364804087e-03*cos(11*t-3.6537367214201129e+00) + 7.9691302439499623e-04*cos(12*t-2.1383294814958012e+00) + 3.8117375851953739e-04*cos(13*t-4.3778212717643141e+00) + 2.6863231680707145e-04*cos(14*t-3.5997255038135140e-01) + 6.9672604371362468e-04*cos(15*t-1.5626947127686130e+00) + 5.1785350120070461e-04*cos(16*t-1.7332657446983115e+00)
seed 2: r(t) = 1.0000000000000000e+00 + 1.4016552072941835e-02*cos(1*t-4.8182954450284603e+00) + 2.9909870994888621e-02*cos(2*t-1.9225402029763492e+00) + 4.1172285483170867e-04*cos(3*t-1.4138076331952685e+00) + 1.1574077941887140e-03*cos(4*t-2.0310731646644204e+00) + 2.8311669387903748e-03*cos(5*t-2.1022678615514128e+00) + 8.5415682961880179e-03*cos(6*t-5.5849617513208143e+00) + 6.7967490194185132e-03*cos(7*t-2.9694445403010490e+00) + 2.8178479130396283e-03*cos(8*t-2.3876933545116557e+00) + 3.1760953411641424e-03*cos(9*t-5.3952781385470372e+00) + 3.4245105712926716e-05*cos(10*t-3.1528367227020115e-01) + 1.9505124447505295e-04*cos(11*t-2.4399476999760266e+00) + 7.2502940555807527e-04*cos(12*t-5.0149023219088873e+00) + 1.6870660245515978e-04*cos(13*t-4.8447780208738198e+00) + 2.2167164895670055e-03*cos(14*t-1.8576964757152339e+00) + 1.3541225289515069e-05*cos(15*t-4.3642601321065166e+00) + 5.3967218054751243e-04*cos(16*t-1.1258425204043310e+00)
seed 3: r(t) = 1.0000000000000000e+00 + 4.2867790561946251e-01*cos(1*t-3.3649063609510379e+00) + 1.2290666275587725e-01*cos(2*t-9.3347571399416607e-01) + 9.9400551499968515e-03*cos(3*t-3.3731382903668199e+00) + 9.1995351719980079e-03*cos(4*t-2.7833998011818362e+00) + 2.1014146670061962e-03*cos(5*t-5.7700739203830222e+00) + 1.7808304379016704e-03*cos(6*t-2.4137462940114500e+00) + 1.5449621912857481e-03*cos(7*t-1.3110991615340011e+00) + 2.1739826663313977e-03*cos(8*t-3.0642883478786503e-01) + 4.4875599097338181e-04*cos(9*t-1.2225315654151965e+00) + 2.6324219049733699e-03*cos(10*t-2.5315558482434435e+00) + 1.4469411951623101e-04*cos(11*t-2.0166302928596544e+00) + 6.9924281566002833e-04*cos(12*t-2.5856574053972876e+00) + 6.9905655839619385e-04*cos(13*t-5.9847888418883795e+00) + 2.9286082362034449e-04*cos(14*t-3.3215460364626264e+00) + 6.2597452968660150e-04*cos(15*t-3.8989484641848842e+00) + 1.8220016145065188e-04*cos(16*t-3.5477382193010492e+00)
seed 4: r(t) = 1.0000000000000000e+00 + 1.4198849250755785e-01*cos(1*t-5.6407019879052251e+00) + 6.7083903720256188e-02*cos(2*t-4.2947999070951868e+00) + 7.4391719203319440e-03*cos(3*t-1.2140015389277208e+00) + 2.2441631141848717e-02*cos(4*t-6.1730435434633861e+00) + 1.6356755673207601e-02*cos(5*t-4.3591126132160909e+00) + 3.9706527918603740e-03*cos(6*t-3.9868515422199815e+00) + 2.7422176897182737e-03*cos(7*t-3.5546743315826990e+00) + 1.1234928090146923e-03*cos(8*t-1.4498192321423984e+00) + 1.8139766754643460e-04*cos(9*t-4.7623482058577435e+00) + 5.1976757921678995e-04*cos(10*t-3.5759055531558421e+00) + 1.4116031811433061e-03*cos(11*t-3.6534209843831298e+00) + 1.0324659753173648e-03*cos(12*t-2.2946132922356797e+00) + 6.7897960370189026e-04*cos(13*t-2.9464739906113011e+00) + 9.0587796442065383e-04*cos(14*t-5.2363710141781166e+00) + 6.6887428612716349e-05*cos(15*t-5.3862505097433644e-01) + 1.5062273416432959e-04*cos(16*t-4.8359754893145208e+00)
seed 5: r(t) = 1.0000000000000000e+00 + 1.8075800763310212e-01*cos(1*t-4.3795225389206607e+00) + 2.7588787786768876e-02*cos(2*t-1.4443804390423349e+00) + 1.2666742483077087e-02*cos(3*t-4.0977096478974007e+00) + 2.0100891750232108e-03*cos(4*t-2.5937746528726242e+00) + 1.0061962025652349e-02*cos(5*t-4.3562999390101345e+00) + 5.6988215449926827e-03*cos(6*t-4.3801340541195763e+00) + 5.2107335356055273e-04*cos(7*t-3.4164085413970384e+00) + 6.6290470042318361e-04*cos(8*t-2.0564755179701795e+00) + 1.6807779353698038e-03*cos(9*t-9.1837071363060563e-01) + 4.9817815462205317e-04*cos(10*t-1.8996798608944001e+00) + 5.4292914189026931e-03*cos(11*t-2.9218319847721328e+00) + 1.4095471933117665e-03*cos(12*t-2.8797859411054666e-01) + 7.1655976071482996e-04*cos(13*t-3.2497448003002356e+00) + 8.5131397442950174e-04*cos(14*t-4.3001668660303005e-01) + 5.6040775421806188e-04*cos(15*t-4.2534034361169013e+00) + 1.2774948768878858e-04*cos(16*t-3.6140114306580579e-01)
seed 6: r(t) = 1.0000000000000000e+00 + 3.8388592254570142e-03*cos(1*t-3.2722053309013557e+00) + 1.3218233073324370e-03*cos(2*t-4.3331268748029466e+00) + 6.6129706569952873e-03*cos(3*t-4.5369406639517607e+00) + 5.6846536554289173e-04*cos(4*t-3.5959065200367517e+00) + 9.0295609947332878e-05*cos(5*t-8.1020988375738068e-01) + 2.6605494658713980e-02*cos(6*t-3.0393633525905854e+00) + 7.0558833172640334e-05*cos(7*t-1.2500004990652909e+00) + 7.4181011619600667e-05*cos(8*t-5.0550796488814265e-01) + 1.5239600940120113e-04*cos(9*t-4.6142802783899706e+00) + 7.6692004647327394e-05*cos(10*t-3.3199375869239343e+00) + 1.4343604597755188e-04*cos(11*t-7.3864099241958037e-01) + 2.6438115813789409e-03*cos(12*t-6.2776675468508234e+00) + 6.4977417729039644e-05*cos(13*t-2.1665208774488143e+00) + 7.2260396642320757e-05*cos(14*t-6.0214304920560782e+00) + 9.1244188915595714e-06*cos(15*t-2.1717775616690487e+00) + 5.4555244567211503e-05*cos(16*t-1.5703607405118054e+00)
seed 7: r(t) = 1.0000000000000000e+00 + 1.1601444049572152e-01*cos(1*t-5.2861613959010068e-01) + 8.6409981331101449e-03*cos(2*t-4.2307745271471688e+00) + 1.6530169963804298e-02*cos(3*t-2.3185251081544171e+00) + 3.1728264188611632e-02*cos(4*t-6.0886219185336241e+00) + 2.2755351630046050e-03*cos(5*t-3.1096492433839420e+00) + 5.7796420876066179e-03*cos(6*t-5.7406333051858613e+00) + 2.6260799675270619e-05*cos(7*t-3.3966619128836237e+00) + 6.5161746165607326e-03*cos(8*t-5.4222204651010726e+00) + 1.5272373136099304e-04*cos(9*t-1.3327462853930858e+00) + 1.1497579528203516e-03*cos(10*t-1.9363004375866029e+00) + 5.4293967118113073e-04*cos(11*t-4.0310390170769681e+00) + 2.1897648702200456e-03*cos(12*t-5.0480394100089150e+00) + 5.9983230552518307e-04*cos(13*t-5.9698433549773871e+00) + 1.1117569266616556e-03*cos(14*t-5.3302058874226110e-01) + 8.5677307847120687e-04*cos(15*t-5.3553082674324521e+00) + 4.0227136091885995e-04*cos(16*t-4.4870103857350783e+00)
seed 8: r(t) = 1.0000000000000000e+00 + 1.2485547992605106e-01*cos(1*t-5.3174582068887624e+00) + 3.8042172219530102e-02*cos(2*t-1.9441315169507507e+00) + 2.1669140330676129e-02*cos(3*t-2.5257663177696981e+00) + 2.4176966038986336e-02*cos(4*t-4.2575651630958520e+00) + 8.8723565769299739e-04*cos(5*t-5.4064624976242577e+00) + 1.0517537037895153e-02*cos(6*t-5.3659348986792530e+00) + 1.7045703718565619e-04*cos(7*t-5.1183632824097822e+00) + 1.5513321857909546e-03*cos(8*t-5.0695954372600008e-02) + 2.1641807679273484e-04*cos(9*t-7.6847983487240659e-02) + 1.8726783846290118e-05*cos(10*t-3.4782854965716387e-01) + 1.1129904744677788e-04*cos(11*t-4.9475317136651347e+00) + 2.3478188842283032e-03*cos(12*t-3.6463511639634727e+00) + 1.2285616731233517e-04*cos(13*t-2.8550254155481820e+00) + 1.2870578351424911e-03*cos(14*t-4.0761532468081096e+00) + 3.4212649920917215e-04*cos(15*t-5.0580826248244373e+00) + 6.9035345481083255e-04*cos(16*t-1.9995699424333840e-01)
seed 9: r(t) = 1.0000000000000000e+00 + 7.4076262463325548e-02*cos(1*t-3.4131986682413080e+00) + 2.6479311058260180e-02*cos(2*t-7.6897406595360152e-01) + 2.9075122799859798e-03*cos(3*t-4.8841969242944154e+00) + 2.8909796489138273e-03*cos(4*t-4.6096305570037149e-01) + 8.2700638045452024e-04*cos(5*t-2.6509178191248659e+00) + 1.5867570236309803e-03*cos(6*t-5.5950512647502162e+00) + 9.1812546572000997e-04*cos(7*t-2.5250923459318693e+00) + 5.2018811802412301e-04*cos(8*t-2.6059091199431346e+00) + 7.2348100691499440e-04*cos(9*t-4.7209338781916155e-01) + 8.3641602745352372e-03*cos(10*t-4.2021588276354098e+00) + 4.0202216545637270e-04*cos(11*t-1.7246508896391486e+00) + 4.3330427768495383e-05*cos(12*t-3.5994177037570938e+00) + 5.2758267948149751e-04*cos(13*t-3.5902081074394809e+00) + 5.7263552726283251e-05*cos(14*t-6.1571401838983082e+00) + 4.8148884491894250e-05*cos(15*t-3.1175522120239951e+00) + 9.1064198187496004e-05*cos(16*t-4.7603656787377324e-02)
the program does a quick check of convexity when generating the coefficients (the "coeff" subcommand), then one can do more tests with the "check" command. below is a non-convex blob which passed the initial check but failed additional tests:
seed 12: r(t) = 1.0000000000000000e+00 + 1.7074636645904917e-02*cos(1*t-2.7908629530574700e+00) + 3.1008901604714367e-03*cos(2*t-2.8491605711257457e+00) + 1.7482994413704489e-03*cos(3*t-2.7162250540518422e+00) + 6.0184792013266986e-03*cos(4*t-4.9506197404474843e+00) + 2.7361926647309076e-03*cos(5*t-8.7707002563052605e-01) + 1.7034525786350230e-03*cos(6*t-6.1228378710385545e-01) + 1.2767672622686632e-03*cos(7*t-5.2934295729793766e+00) + 2.8941128323722864e-04*cos(8*t-4.3939721846533022e+00) + 5.3779116634800062e-04*cos(9*t-3.6874519126015923e+00) + 9.1476619033414863e-05*cos(10*t-1.0026680044521565e+00) + 7.0235284556012800e-03*cos(11*t-1.0449042497447651e+00) + 1.5471128785193855e-04*cos(12*t-1.6214511145967392e+00) + 4.4482960497660429e-04*cos(13*t-4.7056165996511519e+00) + 1.8452520703604591e-04*cos(14*t-2.2976253388390644e+00) + 4.3065938111297442e-04*cos(15*t-5.7536279842531899e+00) + 4.9704807302930476e-04*cos(16*t-2.5356668841591663e+00)
extra: some blobs generated without enforcing convexity. (but we do continue to enforce positivity.)
seed 1: r(t) = 1.0000000000000000e+00 + 4.9986975717453319e-01*cos(1*t-1.0679895692821468e+00) + 4.2795668961659317e-03*cos(2*t-5.8557956698301983e-01) + 9.3226168117901409e-03*cos(3*t-1.0323102278939627e+00) + 5.0223379674285695e-03*cos(4*t-1.8058657218483452e+00) + 2.9374784208446414e-02*cos(5*t-2.5043848398705881e+00) + 1.1683444842546464e-02*cos(6*t-7.8149185251086228e-01)
seed 2: r(t) = 1.0000000000000000e+00 + 9.3216198786794990e-02*cos(1*t-5.7617289986055438e+00) + 7.9415539967587989e-02*cos(2*t-5.0228062388155603e+00) + 7.8752499889418459e-02*cos(3*t-5.8762835378591243e+00) + 1.5564505229775349e-01*cos(4*t-5.3048584103434475e+00) + 2.0859576952120307e-01*cos(5*t-6.0935112250389141e+00) + 2.7693878563847107e-01*cos(6*t-4.8047998121091924e+00)
seed 3: r(t) = 1.0000000000000000e+00 + 3.8595970561204496e-01*cos(1*t-5.2861647919793651e+00) + 1.0635100313909263e-01*cos(2*t-3.9507786204112092e+00) + 5.3129764297192850e-02*cos(3*t-5.5705133601956556e+00) + 2.3703980098250810e-02*cos(4*t-3.9450511286613579e+00) + 9.4198549439532542e-02*cos(5*t-1.4990878562119667e+00) + 1.4123422679183406e-01*cos(6*t-2.1858134116144301e+00)
seed 4: r(t) = 1.0000000000000000e+00 + 2.3513083660162692e-03*cos(1*t-3.3196486822953881e+00) + 2.8683069602347189e-01*cos(2*t-4.2604872922318933e+00) + 2.7983193465853873e-02*cos(3*t-3.3447130986534668e+00) + 3.9907230769140511e-01*cos(4*t-2.3514196297523178e+00) + 1.6794974178559130e-02*cos(5*t-1.2620686511285593e+00) + 2.1145151207498003e-01*cos(6*t-4.7115573515694131e-01)
seed 5: r(t) = 1.0000000000000000e+00 + 2.7137730116502112e-01*cos(1*t-8.2171359324515392e-01) + 1.0330274599316525e-01*cos(2*t-3.6437348528891063e+00) + 4.2180013783998049e-02*cos(3*t-4.9087159421629405e+00) + 1.9495931185372228e-01*cos(4*t-7.2914190708666826e-01) + 3.2093383795910313e-03*cos(5*t-5.5199562820689243e+00) + 4.6039904890733396e-02*cos(6*t-1.0534449541528004e+00)
seed 6: r(t) = 1.0000000000000000e+00 + 3.3639595122592780e-01*cos(1*t-1.4425433708799338e+00) + 3.3030200384674302e-01*cos(2*t-3.6957044766720020e+00) + 1.0648250731875919e-01*cos(3*t-5.5528420514022354e+00) + 1.3673457097291575e-01*cos(4*t-1.3464098766988966e+00) + 5.2016649200659515e-02*cos(5*t-4.2658085793282083e+00) + 2.0568296730024471e-01*cos(6*t-5.2723672608925494e+00)
No comments :
Post a Comment