Geometrie - Kurs

Verschieben eines Polygons nach einem Master-Modell

Wichtige Definitionen

master  =  {{5, 5}, {-5, 
          5}, {-5, -5}, {5, -5}}

dataCloud = {{0.6298874074498093`, 
          0.18111028988374112`}, {0.9544968553828121`, 
          0.07019874952461791`}, {1.2515196545918552`, -0.06829943955846485`}, {1.5512723266566992`, -0.20406775578574565`}, {1.8690032033658162`, -0.32185786736875477`}, {2.165990161018984`, -0.4603918980077125`}, {2.473520953412195`, -0.5883820939066263`}, {2.800540981588025`, -0.696883054022922`}, {3.0987859626130936`, -0.8341590612899787`}, {3.41828225980917`, -0.9501837523860275`}, {3.7103708178388883`, -1.0936161826484352`}, {4.0155578585949145`, -1.223950130184535`}, {4.337444466705293`, -1.3375845103662825`}, {4.631990361033494`, -1.4785596043302063`}, {4.956096123008071`, -1.589974830647754`}, {5.25409885157891`, -1.7274930903690415`}, {5.561427104929471`, -1.8556858253106068`}, {5.867195666541863`, -1.985438251990339`}, {6.1727013318649036`, -2.1154535749594237`}, {6.4912055002814695`, -2.2324703948349836`}, {6.789235923449184`, -2.3699609599593945`}, {7.113301716998717`, -2.481416154701986`}, {7.408613758537009`, -2.6216251014558214`}, {7.7233266062365376`, -2.742433242048417`}, {8.015978009759834`, -2.885302826817246`}, {8.345394199546796`, -2.9914076253224104`}, {8.651643286046472`, -3.1206795271148593`}, {8.952563305851585`, -3.2552804956018715`}, {9.257443676836195`, -3.3859211129093874`}, {9.575832753140416`, -3.5030530248972904`}, {0.7712767104261395`, 
          0.5028982929088044`}, {0.8947378461771212`, 
          0.8067581287085179`}, {1.0289343802583581`, 
          1.1213533628384866`}, {1.1553883034881993`, 
          1.4282059861170608`}, {1.2755390278570715`, 
          1.7287554105346654`}, {1.4017729670224557`, 
          2.035388049748782`}, {1.5220427371637435`, 
          2.3360565199388024`}, {1.6619106102358128`, 
          2.656323093059604`}, {1.787915416800536`, 
          2.9627265996730596`}, {1.9021064715655114`, 
          3.257316354486767`}, {2.045007832526668`, 
          3.5806164154966558`}, {2.165066988156773`, 
          3.8810742711754926`}, {2.2935259735688844`, 
          4.189931956636337`}, {2.4191727040877224`, 
          4.495977387203907`}, {2.550003486051594`, 
          4.807206869216511`}, {2.6759566923025933`, 
          5.113558775516243`}, {2.7950634803468435`, 
          5.4130642636092245`}, {2.935957207336581`, 
          5.734356690647695`}, {3.060096429947585`, 
          6.03889461330743`}, {3.186593290582052`, 
          6.345790173990631`}, {3.3074108362970542`, 
          6.647006419754365`}, {3.433344387652107`, 
          6.95333867115815`}, {3.5605630834489306`, 
          7.260956067003705`}, {3.6986307119496047`, 
          7.579422395553112`}, {3.820729963558142`, 
          7.881920347210382`}, {3.9507635232839107`, 
          8.192352606984883`}, {4.071346829121193`, 
          8.493334612870898`}, {4.210521678513722`, 
          8.812908162312159`}, {4.340031349875084`, 
          9.122816533722254`}, {9.883353116019133`, -3.6310536503106987`}, {9.703267951666398`, -3.1952191263225775`}, {9.522176227938123`, -2.7603911617099923`}, {9.32328239268603`, -2.3433653086212285`}, {9.160053402554404`, -1.8906746104119974`}, {8.964628021362206`, -1.4701803032633376`}, {8.791038286125529`, -1.0278503501591596`}, {8.613246609583019`, -0.5897223383608099`}, {8.429932033054248`, -0.15711722654872107`}, {8.253237014019877`, 
          0.2821074427577641`}, {8.081255216653895`, 
          0.7260453337326391`}, {7.889917896188832`, 
          1.150627701608435`}, {7.7152707367920215`, 
          1.591900230552483`}, {7.519997639268343`, 
          2.0125468213696616`}, {7.34908012538959`, 
          2.4575489958317656`}, {7.164486403331223`, 
          2.8888749621142558`}, {6.991466836701056`, 
          3.3317750838249474`}, {6.81853618750225`, 
          3.7747641229669995`}, {6.637112189244519`, 
          4.209259813050126`}, {6.4579803596993095`, 
          4.646047671845774`}, {6.260488377465072`, 
          5.064475377952395`}, {6.094535566550681`, 
          5.514442255378861`}, {5.901497863022116`, 
          5.937324240191155`}, {5.720417506237241`, 
          6.372163571747138`}, {5.54112590344262`, 
          6.808791657293375`}, {5.3748595568322335`, 
          7.258444999023847`}, {5.18251487698321`, 
          7.682020007515678`}, {4.997929655401696`, 
          8.113354474275026`}, {4.82346834268997`, 
          8.554812849904154`}, {4.650228677223048`, 
          8.997492872778091`}, {4.4730750325619715`, 
          9.436258916457875`}}

dataCloud2 = {{-5.5169373122140355`, -0.6901029885631376`}, {-5.090528547389169`, -0.9169757061764594`}, {-4.598341656761776`, -1.0780702979872547`}, {-4.165544840855359`, -1.2985549645190257`}, {-3.6792782374714603`, -1.4655698435733162`}, {-3.2175537839248967`, -1.6571268724649404`}, {-2.774796251498906`, -1.8676508224771378`}, {-2.3129328587862714`, -2.059068912202692`}, {-1.8259448527792521`, -2.2253623886338603`}, {-1.3731866762872473`, -2.425885694580044`}, {-0.9241510559247426`, -2.6301315566557277`}, {-0.4651554894352697`, -2.824417472604443`}, {-0.009110475441661024`, -3.0216539410490224`}, {0.4901580519873128`, -3.1756668960582366`}, {0.927551488108483`, -3.391554942375255`}, {1.383849265826547`, -3.5885386470953797`}, {1.8520758941686255`, -3.7735935011914883`}, {2.302384983639547`, -3.976565894158756`}, {2.789201649179154`, -4.143030711057338`}, {3.2246028866332086`, -4.3609109560414705`}, {3.686391205639062`, -4.552404119473805`}, {-1.7143034031132656`, 
          8.524491921999603`}, {-1.234477305439457`, 
          8.351036537235222`}, {-0.8012081600934913`, 
          8.131024200142999`}, {-0.33562800922382446`, 
          7.943322868574478`}, {0.13310915117223804`, 
          7.758778546532352`}, {0.6226881244742962`, 
          7.595076037396223`}, {1.0851002201694886`, 
          7.404206650653226`}, {1.5263535339109005`, 
          7.19217848195645`}, {1.9953060070160422`, 
          7.007849472623404`}, {2.4640672141477533`, 
          6.8233291973169266`}, {2.9265556833859545`, 
          6.6325361841169395`}, {3.38276075737599`, 
          6.435459775668787`}, {3.820894820244771`, 
          6.220312356099379`}, {4.302560173269621`, 
          6.048696226686041`}, {4.7679928422739914`, 
          5.860847413252224`}, {5.230092668526062`, 
          5.669665757066105`}, {5.670897970221512`, 
          5.457189576323368`}, {6.137109653380835`, 
          5.270119777044502`}, {6.608184310922787`, 
          5.087912952148265`}, {7.063997275088421`, 
          4.890444433875712`}, {7.516433253568593`, 
          4.689598929917695`}, {-5.529801377575455`, -0.7029670539245577`}, {-5.3427862413050144`, -0.24535386758101785`}, {-5.1574198799626885`, 
          0.21061054383440664`}, {-4.946848344265257`, 
          0.6917801296049364`}, {-4.75399794188116`, 
          1.1552285820621322`}, {-4.578312184701042`, 
          1.6015123893153485`}, {-4.396586207972739`, 
          2.05383641611675`}, {-4.192812066415726`, 
          2.5282086077468606`}, {-3.9876008710780444`, 
          3.004017853157641`}, {-3.8123874433374754`, 
          3.449829330971309`}, {-3.6099750140949407`, 
          3.922839810286942`}, {-3.413213579387427`, 
          4.390199295067554`}, {-3.254823824925813`, 
          4.819187099602267`}, {-3.0401591001678017`, 
          5.304449874433377`}, {-2.8720119786596587`, 
          5.743195046014617`}, {-2.6514448405652824`, 
          6.234360234182093`}, {-2.4727806728728745`, 
          6.683622451947599`}, {-2.2616088508635914`, 
          7.165392324029981`}, {-2.0936217893518756`, 
          7.6039774356147944`}, {-1.8919201866973059`, 
          8.076277088342463`}, {-1.7175279359085778`, 
          8.521267389204292`}, {3.705128280093822`, -4.533667045019046`}, {3.8792421436955467`, -4.088955131344222`}, {4.090447534125588`, -3.6071516908410826`}, {4.285444767294599`, -3.141556407598973`}, {4.451808277929679`, -2.704594846890795`}, {4.6718974963716215`, -2.213907578375754`}, {4.863873067286777`, -1.7513339573874998`}, {5.057361614254236`, -1.287247360346942`}, {5.239381083891742`, -0.8346298406363384`}, {5.429086041787927`, -0.3743268326670548`}, {5.6086291873286145`, 0.0758143629467319`}, {5.828248255140936`, 
          0.5660314808321523`}, {5.986396013220418`, 
          0.9947772889847318`}, {6.205030258056613`, 
          1.4840095838940255`}, {6.379153685072332`, 
          1.9287310609828436`}, {6.5917247146055855`, 
          2.411900140589194`}, {6.766549464109599`, 
          2.8573229401663074`}, {6.968378303620198`, 
          3.329749829750004`}, {7.153276308724085`, 
          3.78524588492699`}, {7.338524886747474`, 
          4.241092513023477`}, {7.533519530424751`, 
          4.706685206773853`}}

badQuadDataCloud = {{0.1264482773124449`, 
          10.855215104648842`}, {0.07252489883941493`, 
          10.757242958585095`}, {-0.18038498930404234`, 
          10.405856492991829`}, {-0.017624118299762515`, 
          10.163003894764037`}, {-0.006591607054969195`, 
          10.100504827548939`}, {-0.3157120641171165`, 
          9.903533418091966`}, {-0.13606033881717394`, 
          9.588385798411243`}, {-0.11657284005973789`, 
          9.514279853837724`}, {-0.27674242903731994`, 
          9.128889456748972`}, {-0.3929995544221194`, 
          9.005236031082152`}, {-0.36253912575961156`, 
          8.826911805614596`}, {-0.39633728687257186`, 
          8.79191355294744`}, {-0.40970148839248033`, 
          8.357267236793689`}, {-0.3307871454485678`, 
          8.142488387715211`}, {-0.37747873571121104`, 
          8.221125970187405`}, {-0.6055395757383124`, 
          7.964124166983231`}, {-0.530580948229181`, 
          7.800792122587875`}, {-0.7197466312766494`, 
          7.40301308509598`}, {-0.6542373873845797`, 
          7.24678648402738`}, {-0.5400667479891492`, 
          7.10960295053021`}, {-0.5877143818277428`, 
          6.824159054756518`}, {-0.8214498529560972`, 
          6.64479092225843`}, {-0.7311631737508675`, 
          6.490110499290216`}, {-0.8880109123790865`, 
          6.287644710716622`}, {-0.8920730122954144`, 
          6.089503802918631`}, {-0.9910983946564595`, 
          6.038643468468575`}, {-1.0303736389039537`, 
          5.735284316097827`}, {-0.8311007957465986`, 
          5.442350604620921`}, {-1.0185346910154278`, 
          5.374525387613691`}, {-0.9452698894902154`, 
          5.009282162106574`}, {-0.91169435943495`, 
          4.859613148672107`}, {-1.2262907269455852`, 
          4.724492727376804`}, {-1.0560886160197613`, 
          4.54008138004729`}, {-1.2522387773640453`, 
          4.336647822593709`}, {-1.0500599915554023`, 
          4.141053706624475`}, {-1.2248664873428714`, 
          3.875616405899608`}, {-1.3886689538869694`, 
          3.8226183939672396`}, {-1.3615020560107878`, 
          3.4652250284809423`}, {-1.304917860708163`, 
          3.2743201146959233`}, {-1.481353007426299`, 
          3.165312766492195`}, {-1.3719365720838441`, 
          2.8390240024858606`}, {-1.5387959959922188`, 
          2.8270280845491724`}, {-1.389192653578779`, 
          2.4259693825821746`}, {-1.584531768000427`, 
          2.4042575381999516`}, {-1.5569889108064823`, 
          2.1198809003390378`}, {-1.5557720401330242`, 
          1.92201805469435`}, {-1.6052074570770465`, 
          1.9090157560374585`}, {-1.6536507672452547`, 
          1.4452171345861697`}, {-1.569488629764341`, 
          1.2778937058232271`}, {-1.578484534627746`, 
          1.3396543716116858`}, {-1.8436535626703607`, 
          0.9639187992097513`}, {9.971661915940354`, 
          9.236338280161693`}, {9.755101531225518`, 
          8.646962594624252`}, {9.765220741396405`, 
          8.226156352888708`}, {9.693263333300685`, 
          7.6781712437846625`}, {9.42725512473074`, 
          7.061642546359724`}, {9.438156383172297`, 
          6.717752572236632`}, {9.206028087253008`, 
          6.146917075353802`}, {9.371835452504072`, 
          5.538482930600543`}, {9.06377237538615`, 
          5.016840385012749`}, {9.202516819061742`, 
          4.747463048031292`}, {8.943916481263063`, 
          4.298772022471977`}, {8.938604085835117`, 
          3.579187349157775`}, {8.76349065098421`, 
          3.079764985151148`}, {8.793995379518922`, 
          2.6693767786531146`}, {8.53617893471426`, 
          2.227415070087991`}, {8.520493026852069`, 
          1.8385630736923146`}, {0.03511021901081346`, 
          10.835669219010065`}, {0.4848777944816436`, 
          10.778535831061314`}, {0.8448176178683124`, 
          10.550074139429688`}, {1.3347566757320442`, 
          10.486275070262522`}, {1.8399272051052673`, 
          10.500763413894578`}, {2.397871322013018`, 
          10.353839494450094`}, {2.9543588738945026`, 
          10.379784883646265`}, {3.3157436166700243`, 
          10.304762871963849`}, {3.817826087179411`, 
          10.081432792994324`}, {4.566429959249722`, 
          9.999373443446895`}, {5.0011077492091704`, 
          9.82493673220502`}, {5.271691648166806`, 
          9.885613295530655`}, {5.862852925075794`, 
          9.67280345853897`}, {6.355211727534535`, 
          9.711034360612139`}, {6.8439910143235`, 
          9.708886353876107`}, {7.417387396053077`, 
          9.683266282296293`}, {7.974257274207334`, 
          9.435542617985842`}, {8.311298135443108`, 
          9.427548582356499`}, {8.788936729085504`, 
          9.157559335779496`}, {9.407085762509068`, 
          9.150561606944335`}, {9.752131968683301`, 
          9.073506632266128`}, {-1.7033324129399174`, 
          1.0088817549409042`}, {-1.144498851329045`, 
          1.009945790804144`}, {-0.6488690114031934`, 
          0.8789294189868366`}, {-0.2998426744994376`, 
          0.7596115254607056`}, {0.1504729994731271`, 
          0.6083989319011334`}, {0.639062737596177`, 
          0.5800766679856313`}, {1.0723875510397556`, 
          0.4448955811443698`}, {1.7718725972882674`, 
          0.4736877539091351`}, {2.111831471193079`, 
          0.18811676884996942`}, {2.837990706184366`, 
          0.22355019363067719`}, {3.1776425654758516`, 
          0.2641157215068608`}, {3.533263950125512`, -0.06557069371243784`}, {4.191221444747189`, -0.19112338986655697`}, {4.668392053163611`, -0.13815361020046613`}, {5.2245945578295565`, -0.3538825396660492`}, {5.621055663107375`, -0.3424042360202648`}, {8.175330333933683`, -0.6010601606531347`}}

dreieckCloud = {{0.6298874074498093`, 
          0.18111028988374112`}, {0.9544968553828121`, 
          0.07019874952461791`}, {1.2515196545918552`, -0.06829943955846485`}, {1.5512723266566992`, -0.20406775578574565`}, {1.8690032033658162`, -0.32185786736875477`}, {2.165990161018984`, -0.4603918980077125`}, {2.473520953412195`, -0.5883820939066263`}, {2.800540981588025`, -0.696883054022922`}, {3.0987859626130936`, -0.8341590612899787`}, {3.41828225980917`, -0.9501837523860275`}, {3.7103708178388883`, -1.0936161826484352`}, {4.0155578585949145`, -1.223950130184535`}, {4.337444466705293`, -1.3375845103662825`}, {4.631990361033494`, -1.4785596043302063`}, {4.956096123008071`, -1.589974830647754`}, {5.25409885157891`, -1.7274930903690415`}, {5.561427104929471`, -1.8556858253106068`}, {5.867195666541863`, -1.985438251990339`}, {6.1727013318649036`, -2.1154535749594237`}, {6.4912055002814695`, -2.2324703948349836`}, {6.789235923449184`, -2.3699609599593945`}, {7.113301716998717`, -2.481416154701986`}, {7.408613758537009`, -2.6216251014558214`}, {7.7233266062365376`, -2.742433242048417`}, {8.015978009759834`, -2.885302826817246`}, {8.345394199546796`, -2.9914076253224104`}, {8.651643286046472`, -3.1206795271148593`}, {8.952563305851585`, -3.2552804956018715`}, {9.257443676836195`, -3.3859211129093874`}, {9.575832753140416`, -3.5030530248972904`}, {0.7712767104261395`, 
          0.5028982929088044`}, {0.8947378461771212`, 
          0.8067581287085179`}, {1.0289343802583581`, 
          1.1213533628384866`}, {1.1553883034881993`, 
          1.4282059861170608`}, {1.2755390278570715`, 
          1.7287554105346654`}, {1.4017729670224557`, 
          2.035388049748782`}, {1.5220427371637435`, 
          2.3360565199388024`}, {1.6619106102358128`, 
          2.656323093059604`}, {1.787915416800536`, 
          2.9627265996730596`}, {1.9021064715655114`, 
          3.257316354486767`}, {2.045007832526668`, 
          3.5806164154966558`}, {2.165066988156773`, 
          3.8810742711754926`}, {2.2935259735688844`, 
          4.189931956636337`}, {2.4191727040877224`, 
          4.495977387203907`}, {2.550003486051594`, 
          4.807206869216511`}, {2.6759566923025933`, 
          5.113558775516243`}, {2.7950634803468435`, 
          5.4130642636092245`}, {2.935957207336581`, 
          5.734356690647695`}, {3.060096429947585`, 
          6.03889461330743`}, {3.186593290582052`, 
          6.345790173990631`}, {3.3074108362970542`, 
          6.647006419754365`}, {3.433344387652107`, 
          6.95333867115815`}, {3.5605630834489306`, 
          7.260956067003705`}, {3.6986307119496047`, 
          7.579422395553112`}, {3.820729963558142`, 
          7.881920347210382`}, {3.9507635232839107`, 
          8.192352606984883`}, {4.071346829121193`, 
          8.493334612870898`}, {4.210521678513722`, 
          8.812908162312159`}, {4.340031349875084`, 
          9.122816533722254`}, {9.883353116019133`, -3.6310536503106987`}, {9.703267951666398`, -3.1952191263225775`}, {9.522176227938123`, -2.7603911617099923`}, {9.32328239268603`, -2.3433653086212285`}, {9.160053402554404`, -1.8906746104119974`}, {8.964628021362206`, -1.4701803032633376`}, {8.791038286125529`, -1.0278503501591596`}, {8.613246609583019`, -0.5897223383608099`}, {8.429932033054248`, -0.15711722654872107`}, {8.253237014019877`, 
          0.2821074427577641`}, {8.081255216653895`, 
          0.7260453337326391`}, {7.889917896188832`, 
          1.150627701608435`}, {7.7152707367920215`, 
          1.591900230552483`}, {7.519997639268343`, 
          2.0125468213696616`}, {7.34908012538959`, 
          2.4575489958317656`}, {7.164486403331223`, 
          2.8888749621142558`}, {6.991466836701056`, 
          3.3317750838249474`}, {6.81853618750225`, 
          3.7747641229669995`}, {6.637112189244519`, 
          4.209259813050126`}, {6.4579803596993095`, 
          4.646047671845774`}, {6.260488377465072`, 
          5.064475377952395`}, {6.094535566550681`, 
          5.514442255378861`}, {5.901497863022116`, 
          5.937324240191155`}, {5.720417506237241`, 
          6.372163571747138`}, {5.54112590344262`, 
          6.808791657293375`}, {5.3748595568322335`, 
          7.258444999023847`}, {5.18251487698321`, 
          7.682020007515678`}, {4.997929655401696`, 
          8.113354474275026`}, {4.82346834268997`, 
          8.554812849904154`}, {4.650228677223048`, 
          8.997492872778091`}, {4.4730750325619715`, 
          9.436258916457875`}}

rechteckCloud = {{0.6640958220604327`, -1.7754772664796108`}, {1.1077550183583624`, -1.9850995526198694`}, {1.7440870070417773`, -2.0020490463746423`}, {2.0713055759153054`, -2.328111959939303`}, {2.574172273709049`, -2.478526744583748`}, {2.914793942046215`, -2.79118655868477`}, {3.456137116250022`, -2.9031248669191507`}, {4.1012903171375`, -2.911253148469862`}, {4.3261923234604245`, -3.339632624585125`}, {4.797941063859711`, -3.5211653666240266`}, {5.388944566462964`, -3.5834433464589623`}, {5.7071267651330615`, -2.994663097715765`}, {5.643532346655232`, -2.787659466120497`}, {5.859268863538586`, -2.3013248991640447`}, {6.014636040678627`, -1.875359671950906`}, {6.374628740873009`, -1.2447689216834248`}, {6.706129486412204`, -0.642670126071132`}, {6.6485770831892586`, -0.42962447922097885`}, {6.902294690652743`, 
          0.09469117831560489`}, {7.268884805568112`, 
          0.7318793433040715`}, {7.374151047816206`, 
          1.107743635625264`}, {7.531348971665702`, 
          1.5355396095478597`}, {7.8341785028072195`, 
          2.1089671907624754`}, {7.95369789994135`, 
          2.499084637969704`}, {8.052306097382285`, 
          2.8682908854837383`}, {8.227784591189497`, 
          3.314367429364048`}, {8.356221899903241`, 
          3.713402788150892`}, {8.610462494419489`, 
          4.238241432740237`}, {8.668143760322327`, 
          4.566520748716171`}, {8.964940352048012`, 
          5.133915390514958`}, {4.79457659025716`, 
          7.766964503179086`}, {5.136201800214671`, 
          7.455308230698409`}, {5.701518876123324`, 
          7.367343824168873`}, {5.859104543778467`, 
          6.8716480093858285`}, {6.4496727582695375`, 
          6.80893474143871`}, {7.064457485739496`, 
          6.770437986470481`}, {7.484710696308523`, 
          6.53740971460132`}, {8.017901563262857`, 
          6.417319099117465`}, {8.244444316796432`, 
          5.990580370212853`}, {8.690578060254552`, 
          5.783432631232785`}, {9.37067224146693`, 
          5.810245330006975`}, {1.0359271915463246`, -1.1330478469206198`}, {1.3294960037258607`, -0.5688809846679854`}, {1.3297832983780593`, -0.2979956399426881`}, {1.4253549034517903`, 
          0.06817401520414094`}, {1.5709856320715638`, 
          0.4844027938970127`}, {1.7530666292921275`, 
          0.9370818411906752`}, {2.225176242992741`, 
          1.6797895049643867`}, {2.4134813668080803`, 
          2.138692678852825`}, {2.5749753178031876`, 
          2.5707846799210303`}, {2.8199607224925507`, 
          3.086368134683492`}, {2.8291714578594624`, 
          3.3661769201235026`}, {3.1511370319545113`, 
          3.9587405442916497`}, {3.207176107406475`, 
          4.285377669816711`}, {3.594469327512803`, 
          4.943268939996138`}, {3.723994619177846`, 
          5.34339228173428`}, {3.942582883619886`, 
          5.8325785962494185`}, {3.9029760576723502`, 
          6.063569820374981`}, {4.16164082954325`, 
          6.592832642318979`}, {4.538321159993979`, 
          7.240111022842806`}}

e1 = {-5, -5}
e2 = {5, -5}
e3 = {5, -1}
e4 = {0, -1}
e5 = {0, 5}
e6 = {-5, 5}

LShapeMaster = {e5, e6, e1, e4, e2, e3}

LShapeDataCloud = {{-1.5819359152788062`, -0.7551015916279082`}, {-0.9141453106350799`, -0.7405924694223709`}, {-0.688729859561545`, -1.1684585007870243`}, {-0.06682631483865054`, -1.1998364385023177`}, {0.4256775110674056`, -1.36061409503445`}, {0.7587801750555601`, -1.680792913484484`}, {1.203240917937539`, -1.8896136530406928`}, {1.630916665229555`, -2.1152193881868655`}, {1.982314955943255`, -2.4171025799113535`}, {2.7690114362773004`, -2.2836875820154967`}, {3.2147131740182244`, -2.4912673267127605`}, {3.69781259623052`, -2.6614493869386524`}, {4.103403043544262`, -2.9091404220630994`}, {4.378856214630427`, -3.2869687334151223`}, {5.123139754043799`, -3.19596667643994`}, {5.423784680533136`, -3.548603232388791`}, {5.7950566191868855`, -3.8306127761732287`}, {6.151200054601623`, -4.12775082319668`}, {6.93915123265318`, -3.9930811275833102`}, {7.045196324462693`, -4.540317518211986`}, {7.901240381757693`, -4.337554943355176`}, {7.705417606981674`, -4.262779668058094`}, {8.069263612583105`, -3.628335612383566`}, {8.179934909814607`, -3.247066265078966`}, {8.515728337384795`, -2.640674787435679`}, {8.514054724220694`, -2.371750350526681`}, {8.714425045004234`, -1.900781979670043`}, {9.065132563768483`, -1.2794764108326944`}, {9.37036193168826`, -0.7036489928398206`}, {4.6867860420526695`, 
          1.1455899419064728`}, {5.175233436282972`, 
          0.9807558536985864`}, {5.430803024083947`, 
          0.5830439590613739`}, {6.117171917618765`, 
          0.6161313701580031`}, {6.590176742716851`, 
          0.435854712817901`}, {7.094862165461872`, 
          0.2872586531247332`}, {7.329272097306195`, -0.13161289746913174`}, {7.671990309782915`, -0.4421761674306006`}, {8.331481730050479`, -0.4359662296012248`}, {8.95382337963777`, -0.46690606245211974`}, {4.921472204874512`, 
          1.650874154801413`}, {5.084260194880026`, 
          2.084260194880026`}, {5.178949895915398`, 
          2.4495479459884963`}, {5.204682083633678`, 
          2.745878183779875`}, {5.685683479617339`, 
          3.4974776298366343`}, {5.854367178583499`, 
          3.9367593788758932`}, {5.936221370577433`, 
          4.289211620942925`}, {6.189449268876828`, 
          4.813037569315418`}, {6.351121083811533`, 
          5.245307434323221`}, {6.375353071390049`, 
          5.540137471974837`}, {6.6502225927306275`, 
          6.085605043388513`}, {2.2750242238725935`, 
          8.513819548985463`}, {2.9479282862986924`, 
          8.533442128973372`}, {3.1288706722130764`, 
          8.061103032449568`}, {3.738516470705909`, 
          8.017467348504212`}, {4.22680618650275`, 
          7.852475581862864`}, {4.706080427383515`, 
          7.678468340305441`}, {5.062593686018726`, 
          7.381700116502463`}, {5.661174425669116`, 
          7.326999373714665`}, {6.106718484976578`, 
          7.119261950583939`}, {6.413522560268665`, 
          6.7727845434378375`}, {6.889257372682798`, 
          6.595237873413783`}, {-1.4265435779591626`, -0.3291112042351654`}, {-1.0119994520564484`, 
          0.35603097174064713`}, {-0.9095584321924457`, 
          0.729070041677748`}, {-0.6758679436743802`, 
          1.2333585802689124`}, {-0.44878489296183544`, 
          1.7310396810545545`}, {-0.26863123859485716`, 
          2.1817913854946323`}, {-0.0558498985319702`, 
          2.665170775630617`}, {-0.19950139279751972`, 
          2.792117331438166`}, {0.13706918210363553`, 
          3.39928595641242`}, {0.25533665435376474`, 
          3.7881514787356476`}, {0.4977878956644909`, 
          4.301200770119472`}, {0.9212461300029704`, 
          4.9952570545310495`}, {0.7742888997460915`, 
          5.11889787434727`}, {1.2396987944803652`, 
          5.8549058191546415`}, {1.2711857396206363`, 
          6.156990814368012`}, {1.5756413543003753`, 
          6.732044479120849`}, {1.6809780918063069`, 
          7.107979266699879`}, {1.7200380369993844`, 
          7.417637261966055`}, {2.134190507514533`, 
          8.102387782554302`}}

Funktionen für "normales", "braves", konvexes, mit regelmäßiger Punktewolke beschriebenes Polygon

\(OffsetByBaryCenter[masterCloud_, \ dataCloud_] := 
      Module[{baryMaster, \ baryData, offset, ret = {}, 
          i}, 
baryMaster\  = \ 
          BaryCenter[masterCloud]; 
baryData\  = \ 
          BaryCenter[dataCloud]; 
offset\  = \ 
          baryMaster - baryData; 
For[i = 1, 
          i ≤ 
            Length[dataCloud], \(i++\), 
ret\  = \ 
            Append[ret, 
              dataCloud[\([\)\(i\)\(]\)] + 
                offset]; 
]; 
Print["Cloud barycenter: ", 
          baryData]; 
Return[
          ret]; 
]\)

BaryCenter[dataCloud_] := 
      Module[{i}, 
Return[((∑_(i = 1)^(Length[dataCloud]))dataCloud[[i]])/
            Length[dataCloud]]; 
 ]

GetXRelAng[point_] := 
      Module[{x, y, off, res}, 
x  =  
          point[[1]]; 
y  =  
          point[[2]]; 
If[x > 0,  
          off = 0]; 
If[x < 0  &&  y ≥ 0,  
          off = π]; 
If[x < 0  &&  y < 0,  
          off = -π]; 
If[
          x == 0  &&  y > 0,  
          Return[π/2]]; 
If[
          x == 0  &&  y < 0,  
          Return[3  π/2]]; 
If[ArcTan[y/x] + off < 0, 
          Return[ArcTan[y/x] + off + 2  π], 
          Return[ArcTan[y/x] + off]]; 
]

\(\(\( (*\ Geht\ nur, \ 
      wenn\ die\ Punktewolke\ bereits\ zentriert\ \(\(ist!!\)!\)\ *) \)\(
\)\( (*\ Geht\ nur, \ 
      wenn\ im\ Master - 
        Modell\ der\ Punkt\ mit\ dem\ geringsten\ Winkel\ zur\ x - 
        Achse\ als\ erstes, \ 
      und\ der\ mit\ dem\ größten\ als\ letztes\ *) \)\(
\)\(NormalDistance[point_, master_, tolerance_] := 
      Module[{secVec = {}, \ secVecNorm\  = \ {}, \ secVecAng = {}, \ 
          baryMaster, \ angPoint, \ res, i}, 
If[
          point == {0, 0}, 
          Print["NormalDistance: Point {0,0} invalid paramter"]; 
          Return[\(-1\)]]; 
 (*Print["NormalDistance: Called with (", point, ", ", master, ", ", 
            tolerance, ")"]; *) 
baryMaster\  = \ 
          BaryCenter[
            master]; 
 (*Print["NormalDistance: BaryCenter[master]=", baryMaster]; *) 
 (*\ 
          Sektor - Geraden - 
            Gleichungen\ aufstellen\ *) 
 (*\ \(\(=\)\(\ \)\(alle\ Eckpunkte\ mit\ dem\ Schwerpunkt\ verbinden\)\), \ 
          diese\ Geraden\ sind\ dann\ die\ Grenzene\ der\ Sektoren*) 
For[i = 1, 
          i ≤ 
            Length[master], \(i++\), 
secVec = \ 
            Append[secVec, 
              master[\([\)\(i\)\(]\)] - 
                baryMaster]; 
secVecNorm\  = \ 
            Append[secVecNorm, \ 
              Norm[secVec[\([\)\(i\)\(]\)]]]; 
secVecAng\  = \ Append[secVecAng, \ 
              GetXRelAng[
                secVec[\([\)\(i\)\(]\)]]]; 
]; 
 (*Print["NormalDistance: First For run ended."]; *) 
 (*\ 
          ev . \ gleiche\ Geraden\ herausfiltern\ *) 

 (*\ 
          Ganz\ falsche\ Punkte\ herausfiltern\ *) 
If[
          Norm[point] > \ Max[secVecNorm] + tolerance, 
          Print["NormalDistance: Point out of tolerance range"]; \ \ Return[\(-1\)]]; 

 (*\ 
          
          Zu\ welchem\ Sektor\ passt\ der\ \(\(Punkt\)\(?\)\)\ *) 
 (*\ 
          Winkel\ von\ Punkt\ und\ Eckpunkten\ vergleichen\ *) 
angPoint\  = \ GetXRelAng[point]; 
If[
          angPoint ≥ \ 
              secVecAng[\([\)\(Length[secVecAng]\)\(]\)]\  || \ 
            angPoint\  ≤ \ secVecAng[\([\)\(1\)\(]\)], 
          res\  = \ 
            GetHessDistance[point, master[\([\)\(Length[master]\)\(]\)], 
              master[\([\)\(1\)\(]\)]]]; 
i = 
          1; 
For[i = 1, 
          i < Length[
              secVecAng], \(i++\), 
 (*Print["NormalDistance: In Second For; i=", i, ", angPoint=", 
              angPoint, ", secVecAng[[i]]=", 
              secVecAng[\([\)\(i\)\(]\)], ", secVecAng[[i+1]]=", 
              secVecAng[\([\)\(i + 1\)\(]\)]]; *) 
If[
            angPoint\  ≥ \ secVecAng[\([\)\(i\)\(]\)]\  && \ 
              angPoint\  ≤ \ 
                secVecAng[\([\)\(i + 
                    1\)\(]\)], 
 (*Print["NormalDistance: Point is in sector between", secVecAng[\([\)\(i\)\(]\)], " and ", 
                secVecAng[\([\)\(i + 1\)\(]\)]]; *) 
res = 
              GetHessDistance[point, \ master[\([\)\(i\)\(]\)], 
                master[\([\)\(i + 
                    1\)\(]\)]]; 
]
]; 
 (*Print["NormalDistance: Nearly finished; res=", 
            res]; *) 
res = 
          Abs[res]; 
Return[
          res]; 
]\)\)\)

(* vec1 und vec2 sind die Punkte,  
      die die Gerade aufstellen sollen! *) 
GetHessDistance[point_, vec1_, vec2_] := 
      Module[{n, d, a, b, c}, 
n = 
          vec2 - vec1; 
n = 
          Reverse[n]; 
n[[1]]  =  
          n[[1]]*-1; 
a  =  
          n[[1]]; 
b  =  
          n[[2]]; 
c  =  -1 (a*
                  vec1[[1]] + 
                b*vec1[[2]]); 
d = (a*
                  point[[1]] + b*point[[2]] + c)/
            Sqrt[a^2 + b^2]; 
Return[
          d]; 
]

GetPolygoneProximity[poly_, master_, tolerance_] := 
      Module[{i}, 
Return[((∑_(i = 1)^(Length[poly]))NormalDistance[poly[[i]], master, 
                  tolerance])/
            Length[poly]]; 
]

(* Geht nur,  
      wenn um den Ursprung rotiert werden soll *) 
RotateCloud[cloud_, alpha_] := 
      Module[{rotMat}, 
rotMat  =  {{Cos[
                alpha], -Sin[alpha]}, {Sin[alpha], 
              Cos[alpha]}}; 
Return[
          cloud . rotMat]; 
]

\(FitRotationByPoint[cloud_, point_, master_, tolerance_] := 
      Module[{intersections, cloudPointAng, intersectionPointAng, intPoint, 
          intPointAng, relAng, minAng, u, rightAng = {}, k, rotatedCloud, 
          tempList = {}, polyProx = {}, polyProxAppend = {0, 0}, i, j, 
          l}, 
 (*\ vorerst\ irgendein\ Punkt, \ 
          später\ könnte\ dieser\ durch\ spezielle\ Algorithmen\ bestimmt\ werden\ *) 
 (*\ 
          nur\ Punkte\ verwenden, \ 
          deren\ Norm\ kleinergleich\ der\ größten\ Norm\ des\ Masters\ ist\ *) 


intersections = 
          GetIntersections[point, master[\([\)\(Length[master]\)\(]\)], 
            master[\([\)\(1\)\(]\)]]; 
cloudPointAng\  = \ 
          GetXRelAng[point]; 
 (*Print[
            intersections]; *) 
For[i = 1, 
          i ≤ 
            Length[intersections], \(i++\), 
intPoint = {x, 
                y} /. intersections[\([\)\(i\)\(]\)]; 
intPointAng = 
            GetXRelAng[intPoint]; 
relAng = 
            intPointAng - 
              cloudPointAng; 
polyProxAppend[\([\)\(1\)\(]\)] = 
            relAng; 
rotatedCloud = 
            RotateCloud[cloud, 
              relAng]; 
polyProxAppend[\([\)\(2\)\(]\)] = 
            GetPolygoneProximity[rotatedCloud, master, 
              tolerance]; 
 (*Print["FitRotation (first cloud): polyProxAppend=", polyProxAppend]; *) 
polyProx = 
            Append[polyProx, 
              polyProxAppend]; 
]; 

 (*Print["FitRotation: polyProx after first cloud member=", polyProx]; *) 
For[u = 1, 
          u < Length[master], \(u++\), 
intersections = 
            GetIntersections[point, master[\([\)\(u\)\(]\)], 
              master[\([\)\(u + 
                  1\)\(]\)]]; 
 (*Print["FitRotation: In u=", u, ", intersections=", 
              intersections]; *) 
cloudPointAng\  = \ 
            GetXRelAng[point]; 
 (*Print[
              intersections]; *) 
For[j = 1, 
            j ≤ 
              Length[intersections], \(j++\), 
intPoint = {x, y} /. intersections[\([\)\(j\)\(]\)]; 
intPointAng = 
              GetXRelAng[intPoint]; 
relAng = 
              intPointAng - 
                cloudPointAng; 
polyProxAppend[\([\)\(1\)\(]\)] = 
              relAng; 
rotatedCloud = 
              RotateCloud[cloud, 
                relAng]; 
 (*Print["FitRotaton: (cloud in for j=", j, ") - calling GetPolygoneProximity[", 
                rotatedCloud, ", ", master, ", ", 
                tolerance, "]"]; *) 
polyProxAppend[\([\)\(2\)\(]\)] = 
              GetPolygoneProximity[rotatedCloud, master, 
                tolerance]; 
 (*Print["FitRotation (cloud in for j=", j, "): polyProxAppend=", 
                polyProxAppend]; *) 
polyProx = 
              Append[polyProx, 
                polyProxAppend]; 
]; 
]; 

For[k = 1, 
          k ≤ 
            Length[polyProx], \(k++\), 
tempList = 
            Append[tempList, \(polyProx[\([\)\(k\)\(]\)]\)[\([\)\(2\)\(]\)]]; 
]; 
minAng = 
          Min[tempList]; 
For[l = 1, 
          l ≤ 
            Length[polyProx], \(l++\), 
If[\(polyProx[\([\)\(l\)\(]\)]\)[\([\)\(2\)\(]\)] == minAng, 
            rightAng = 
              polyProx[\([\)\(l\)\(]\)]]; 
]; 

 (*Print["The first element in list represents angle, the second the inaccuracy"]; 
Print[
            polyProx]; *) 
Return[
          rightAng]; 
]\)

(* 
      inacurrancy  =  die gewünschte ungenauigkeit,  
      tolerance  =  
        die Toleranzgrenze ab wann Punkte ignoriert werden sollen *)

\(OptimateCloudRotation[cloud_, master_, tolerance_, inacurrancy_, 
        granularity_] := 
      Module[{angles = {}, tempList = {}, i, l, k, tempFit = {}, 
          smallest = {}, tempProx1, tempProx2, 
          tempSmall = {}}, 

Print["Calculating..."]; 
For[i = 1, 
          i ≤ \ 
            Length[cloud], \(i++\), 
 (*Print["Opt: i=", i]; *) 
tempFit = 
            FitRotationByPoint[cloud, cloud[\([\)\(i\)\(]\)], master, 
              tolerance]; 
If[Length[tempFit] == 0, 
            angles = Append[angles, {0, 100}], 
            angles\  = \ 
              Append[angles, 
                tempFit]]; 
 (*Print["Before: tempList=", tempList, ", angles=", angles, ", i = ", 
              i]; *) 
tempList = \ 
            Append[tempList, \(angles[\([\)\(i\)\(]\)]\)[\([\)\(2\)\(]\)]]; 
 (*Print["After: tempList=", 
              tempList, ", angles=", angles, ", i = ", 
              i]; *) 
 (*Print[
              tempFit]; *) 
]; 
 (*Print["OptimateCloudRotation nearly finished, searching for minimum"]; *) 
For[l = 1, 
          l ≤ 
            Length[angles], \(l++\), 
If[\(angles[\([\)\(l\)\(]\)]\)[\([\)\(2\)\(]\)] == \ 
              Min[tempList], 
            smallest\  = \ 
              angles[\([\)\(l\)\(]\)]]; 
]; 

For[k = 1, 
          k ≤ \ 
            2  π/
                granularity, \(k++\), 
 (*Print["Searching (", k, ") for tempSmall=", 
              smallest]; *) 
tempProx1 = 
            GetPolygoneProximity[
              RotateCloud[cloud, smallest[\([\)\(1\)\(]\)] + granularity], 
              master, tolerance]; 
tempProx2 = 
            GetPolygoneProximity[
              RotateCloud[cloud, smallest[\([\)\(1\)\(]\)] - granularity], 
              master, tolerance]; 
 (*Print["tempProx1 = ", tempProx1]; 
Print["tempProx2 = ", 
              tempProx2]; *) 
If[
            tempProx1 < smallest[\([\)\(2\)\(]\)]\  && \ 
              tempProx1 < tempProx2, \ 
            smallest = {smallest[\([\)\(1\)\(]\)] + granularity, 
                tempProx1}]; 
If[
            tempProx2 < smallest[\([\)\(2\)\(]\)]\  && \ 
              tempProx2 < tempProx1, \ 
            smallest = {smallest[\([\)\(1\)\(]\)] - granularity, 
                tempProx2}]; 
If[\((tempProx1 > 
                    smallest[\([\)\(2\)\(]\)]\  && \ 
                  tempProx2 > smallest[\([\)\(2\)\(]\)]\ )\) || 
              smallest[\([\)\(2\)\(]\)] < inacurrancy, 
            Print["After ", k, " optimizations found result:"]; \ 
            Return[smallest]]; 
]; 
Print["After ", 
          k, " optimizations found result:"]; 
Return[
          smallest]; 
]\)

\(GetIntersections[point_, straightPoint1_, straightPoint2_] := 
      Module[{pointNorm, nDirVec, a, b, c, dirVec, straightEqu, 
          intersections, circleEqu}, 
 (*\ 
          wir\ erstellen\ einen\ Kreis\ und\ schneiden\ ihn\ mit\ dem\ Rechteck\ *) 
Clear[x]; 
Clear[
          y]; 
pointNorm = 
          Norm[point]; 
circleEqu = 
          x^2 + y^2 == 
            pointNorm^2; 

dirVec\  = \ 
          straightPoint2 - straightPoint1; 
nDirVec\  = \ 
          Reverse[dirVec]; 
nDirVec[\([\)\(1\)\(]\)]\  = \ 
          nDirVec[\([\)\(1\)\(]\)]*\(-1\); 
a\  = \ 
          nDirVec[\([\)\(1\)\(]\)]; 
b\  = \ 
          nDirVec[\([\)\(2\)\(]\)]; 
c\  = \ \(-1\) \((a*
                  straightPoint1[\([\)\(1\)\(]\)] + 
                b*straightPoint1[\([\)\(2\)\(]\)])\); 

straightEqu = 
          0 == 
            a*x + b*y + 
              c; 
 (*Print["Get intersections:"]; 
Print["    ", 
            GetHessDistance[{0, 0}, straightPoint1, 
              straightPoint2]]; 
Print["    straightPoint1=", straightPoint1, ", straightPoint2", 
            straightPoint2]; 
Print["    point=", 
            point]; *) 
If[
          GetHessDistance[{0, 0}, straightPoint1, straightPoint2] > 
            pointNorm, 
          Return[{{x -> \ point[\([\)\(1\)\(]\)], 
                y -> \ 
                  point[\([\)\(2\)\(]\)]}}]]; 

intersections = 
          Solve[{circleEqu, straightEqu}, {x, y}, 
            Reals]; 
Return[
          intersections]; 
]\)

GetOptPosError[
        cloud_, master_, tolerance_, inacurrancy_, granularity_] := 
      Module[{movedCloud}, 
movedCloud = 
          OffsetByBaryCenter[master, cloud]; 
Return[
          OptimateCloudRotation[movedCloud, master, tolerance, inacurrancy, 
            granularity]]; 
]

Funktionen für nicht "braven" Schwerpunkt

\(\(\( (*GetCenterPointRelPointNorms[cloud_, centerPoint_, tolerance_] := 
        Module[{normList = {}, i}, 
For[i = 1, \ 
            i ≤ 
              Length[cloud], \(i++\), 
normList\  = \ 
              Append[normList, \ 
                Norm[cloud[\([\)\(i\)\(]\)] - 
                    centerPoint]]; 
]; 
Return[
            normList]; 
]*) \)\(
\)\(OffsetByPseudoCircumCircle[
        cloud_, master_, tolerance_, limit_] := 
      Module[{cloudBary, points, actCenter, sortedCloud = {}, dirVec, u, 
          k}, 
cloudBary\  = \ 
          BaryCenter[cloud]; 
actCenter\  = \ 
          cloudBary; 
sortedCloud\  = \ {actCenter, 
            actCenter, 
            actCenter}; 
 (*Print["cloudBary=", 
            cloudBary]; 
Print["sortedCloud=", 
            sortedCloud]; 
Print["Bedingung1=", \((∑\+\(u = 1\)\%3\((Norm[
                    sortedCloud[\([\)\(u\)\(]\)] - 
                      actCenter])\))\)]; 
Print["Abs=", 
            Abs[Norm[sortedCloud[\([\)\(1\)\(]\)] - actCenter]*3 - 
                tolerance*2]]; *) 
While[\((∑\+\(u = 1\)\%3\((Norm[sortedCloud[\([\)\(u\)\(]\)] - actCenter])\))\) < 
            Abs[Norm[sortedCloud[\([\)\(1\)\(]\)] - actCenter]*3 - 
                tolerance*2], 
 (*Print["entering while with actCenter=", actCenter]; *) 
Clear[
            sortedCloud]; 
sortedCloud = {cloud[\([\)\(1\)\(]\)] - actCenter}; 
For[k = 2, 
            k ≤ 
              Length[cloud], \(k++\), 
sortedCloud = 
              Append[sortedCloud, 
                cloud[\([\)\(k\)\(]\)] - 
                  actCenter]; 
]; 
sortedCloud\  = \ 
            Sort[sortedCloud, \ 
              Norm[#1] > 
                  Norm[#2] &]; 
 (*Print["sortedCloud=", 
              sortedCloud]; *) 
dirVec\  = \ \((sortedCloud[\([\)\(1\)\(]\)] + sortedCloud[\([\)\(2\)\(]\)])\)/
              Norm[sortedCloud[\([\)\(1\)\(]\)] + 
                  
                  sortedCloud[\([\)\(2\)\(]\)]]; 
dirVec\  *= \ \((Norm[sortedCloud[\([\)\(1\)\(]\)]] - 
                  Norm[sortedCloud[\([\)\(2\)\(]\)]])\)/
              2; 
If[Norm[dirVec] < limit, 
            Print["Cloud barycenter: ", actCenter]; \ 
            Return[sortedCloud]]; 
actCenter += 
            dirVec; 

]; 
Print["Cloud barycenter: ", 
          actCenter]; 
Return[
          sortedCloud]; 
]\)\)\)

GetAdvancedOptPosError[cloud_, master_, tolerance_, inacurrancy_, 
        granularity_, circleTolerance_, baryCenterOptLimit_] := 
      Module[{movedCloud}, 
movedCloud = 
          OffsetByPseudoCircumCircle[cloud, master, circleTolerance, 
            baryCenterOptLimit]; 
Return[
          OptimateCloudRotation[movedCloud, master, tolerance, inacurrancy, 
            granularity]]; 
]

Master-Funktionen

\(\(\( (*\ 
      Parameter\ siehe\ GetOptPosError\ und\ GetAdvancedOptPosError; \ 
      Gibt\ die\ zentrierte\ und\ rotierte\ \((also\ dem\ Master\ angepasste)\)\ Cloud\ zurück
\(Advanced : \ 
          Wenn\ Advanced == 1\), \ 
      dann\ wird\ die\ professionelle\ Methode\ zur\ Berechnung\ des\ Schwerpunktes\ verwendet
*) \)\(
\)\(GetMasterAssimilatedDataCloud[master_, cloud_, advanced_:  1, 
        tolerance_:  .5, inacurrancy_:  .001, granularity_:  .0001, 
        circleTolerance_:  .000001, baryCenterOptLimit_:  .0001] := 
      Module[{res, \ offset, ang, i, movedCloud}, 
If[
          advanced == 
            1, \ 
Print["Advanced mode: on"]; 
movedCloud = 
            OffsetByPseudoCircumCircle[cloud, master, circleTolerance, 
              baryCenterOptLimit]; 
res = 
            GetAdvancedOptPosError[cloud, master, tolerance, inacurrancy, 
              granularity, circleTolerance, 
              baryCenterOptLimit];
,  (*\ 
            else\ *) 
Print["Advanced mode: off"]; 
res = 
            GetOptPosError[cloud, master, tolerance, inacurrancy, 
              granularity]; 
movedCloud = 
            OffsetByBaryCenter[master, 
              cloud];
]; 
Print["Optimal angle: ", 
          res[\([\)\(1\)\(]\)]]; 
Print["Minimal error: ", res[\([\)\(2\)\(]\)]]; 
Return[
          RotateCloud[movedCloud, 
            res[\([\)\(1\)\(]\)]]];
]\)\)\)

PlotAssimilatedCloud[master_, cloud_, advanced_:  1, plotMaster_:  1, 
        plotCloud_:  0, tolerance_:  .5, inacurrancy_:  .001, 
        granularity_:  .0001, circleTolerance_:  .000001, 
        baryCenterOptLimit_:  .0001] := 
      Module[{plot1, plot2, plot3}, 
plot2 = 
          ListPlot[
            GetMasterAssimilatedDataCloud[master, cloud, advanced, tolerance, 
              inacurrancy, granularity, circleTolerance, baryCenterOptLimit], 
            PlotStyle -> {RGBColor[0, 1, 0]}, 
            AspectRatio -> 1]; 

If[
          plotMaster == 1,  
          plot1 = ListPlot[master, 
              PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.02]}, 
              AspectRatio -> 1], 
plot1 = 
            ListPlot[{0, 0}]]; 
If[plotCloud == 1, 
          plot3 = ListPlot[cloud, PlotStyle -> {RGBColor[0, 0, 1]}, 
              AspectRatio -> 1], 
plot3 = 
            ListPlot[{0, 0}]]; 
Show[plot1, plot2, 
          plot3]
]

Beispiel mit Bild

PlotAssimilatedCloud[master, badQuadDataCloud, 1]

(C) 2010 by Alexander Niederklapfer and Felix Küng