.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/distance/plot_triangle_to_triangle.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__auto_examples_distance_plot_triangle_to_triangle.py: ============================== Distance between two triangles ============================== .. GENERATED FROM PYTHON SOURCE LINES 6-38 .. image-sg:: /_auto_examples/distance/images/sphx_glr_plot_triangle_to_triangle_001.png :alt: plot triangle to triangle :srcset: /_auto_examples/distance/images/sphx_glr_plot_triangle_to_triangle_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0.8075663555917334 0.7364084890735492 0.9793824230804206 0.7519594546206699 0.8882982195597395 0.42925586756880435 0.636038013103758 0.888655117563636 0.6819977438738622 1.2101345022847285 0.9026617099863593 0.28642015768812434 1.0398594641896701 0.8572531046581983 0.9034362235058828 0.557417127603292 0.6000056457979137 0.8737838906532984 0.3724122695374449 0.9205397348724627 1.0084288078095296 1.1437143776350691 0.8417765048085866 0.6509863278350614 0.38209717862805165 1.176009811887328 1.0339601234145115 1.2865146929899736 0.7091663193162115 0.9235275674784067 0.6460094585839955 1.0343141938757108 1.2013688604501582 0.49551080278601184 0.2756780647608428 0.9987504778547819 0.8605911844251758 0.6668832102919336 1.0680517859310203 0.9369112729099354 0.9046102283663779 0.3951700552024691 0.5991571876533499 0.4614548438594232 0.9537293162465587 0.6173401174678054 0.7412392423276336 0.6174054505741953 1.2170665909512168 1.1850536770088052 1.5312885410545902 1.0009100084629843 1.0211593350952881 0.41135285819679873 1.084118890664966 1.1702451846295254 0.6667841721866409 0.7717167630184834 0.6419093047025571 0.9303655258022037 0.5612915089204705 0.8418106122769007 0.8824549565848215 1.2425459105539314 1.152014412532961 0.7913968226560916 0.880047845181785 0.9412549794285057 0.49469089171446967 0.7790564443428794 0.9012539550501805 0.3902070694323611 0.7501810840965928 1.0279726942950373 0.9370842411398457 0.9677195389705405 0.33873180457644975 0.9066271344431286 0.6286423992290707 0.6981802800234321 0.8931714294880166 1.2097884591486856 0.5961940435505687 0.5406941377047998 0.8163233465780426 0.8522920481003122 0.9310667012597648 0.472654453313901 0.37750932455216807 0.9281478168725491 0.9504659988076248 1.0082279066451 1.0114410101932199 0.386432344390326 0.356199872047767 1.105950149109294 0.6399285512798879 0.4969943034007786 0.7258408179039447 0.8536350823475403 0.3802714373323758 0.8582747544922724 0.7623190246979933 0.7343830892008164 0.6481331499519186 0.2744847461283306 0.5967596774077827 0.8285748447110814 1.09612285682126 1.097484378169564 0.6362976142498915 0.9678230276793037 0.6090192155681106 1.078419372645532 0.4934132297773027 0.691824269898277 0.6429324685075243 0.8961291000543551 0.15988420271285167 1.265404041930798 0.9697035839403887 0.8497201044103109 1.0401866692268007 0.636556570138969 1.1686425075720226 1.2921925893204051 1.1375942961774776 0.7318981139499098 0.778722281510104 0.7215612937795909 0.9884236634002854 0.13999505550051183 0.6195410289535456 0.7892127803477187 0.5401632014770218 0.912919443393475 1.020710759342881 0.7264133791469892 0.3928170165801188 0.49300409730093564 0.7877047216905285 0.668368815408932 1.1945960241503157 0.6271524168517582 0.5419014416501806 1.2523222227197428 1.1699289360698921 0.6553017097018582 0.7301758731989979 1.1192090603738203 0.8290546935799149 1.0149328418111474 0.9910518928802934 1.1913848628346368 0.6750312685623772 0.8947523428797373 0.9297948406648181 0.6793909486645862 0.6641383729162679 1.1396496510161522 0.38598563312783735 0.5271594873346054 1.0054166250945022 1.1237099476222627 0.7793712531662118 0.756879539449709 0.7097460289720563 0.5226039311093073 0.7550884766999121 0.9188445892039463 0.3711318098648297 0.377999825712174 0.8594650376341396 1.06902291440454 0.9173710590530398 0.744836695582241 0.629620709779575 1.0957660629226145 0.882472658498606 1.4120854069949833 0.4749543902710976 1.1076953380543542 1.1424857261467452 0.668549192689845 1.2338892190006032 0.5667830136755492 0.30946155282441634 0.8458419632863112 1.0191837265315857 0.551312116901006 1.2487587338961057 0.5984804545852848 0.6065533750161133 0.5135001072335974 1.1454568068587336 0.4436383373295339 0.6489391957347331 0.7289005867233627 0.9017883243193947 0.8547598991433208 0.6681333886615852 0.36830226186686077 0.9100533636283897 0.9233780152547377 0.3192998115373184 0.8244684353879763 0.5739843072402899 1.021016416697831 0.7040233517194601 0.9312220516959263 0.9889002626345522 1.0511036098038946 0.6875428770181983 0.6234088500829659 0.6614944804342798 0.6112662734479338 0.9660650781247029 0.9778108746305126 0.20517883155936917 0.7092569847328363 0.3954925576838896 0.5009032022076498 0.15371821777309735 0.7801863084291606 0.6847169836232733 0.9690935404233705 0.8520719844510491 0.9297584170189878 0.39879077761158666 0.9508478201430368 0.9025507481581301 0.6113245953066053 0.4798661701900473 0.776611723548002 1.0953693230981334 0.9159089303840976 1.2455050634654106 0.588362575347742 1.113003504570732 0.7515110888907508 1.1069148438794665 0.5520666449512884 0.7390669499400179 1.0900377286237302 0.9278485811285251 0.7310235759714903 0.4738726684761869 1.0115878202630002 0.7624219242755857 1.1471130070144229 0.8216108598521877 1.3192800949193213 0.6424097344194812 0.9630719304555313 1.0157183672829124 1.2883064684393233 0.6066601966063961 0.9102717354803889 0.8630077939261738 0.6684071735280873 0.9869574514880038 0.7983709869706956 0.37704215043599476 0.5659452309481909 1.0651854001734393 0.6291579236122607 1.1055151226604634 1.175137029024117 0.4283392614341514 0.7576140624754896 0.533167598301162 0.7340872626462752 1.092619013201495 0.41987659966305135 0.6716206110084205 0.6387934464253155 0.9681234104673954 0.7135554775794608 0.8747961814166588 0.8511770277431399 1.201602021934104 0.6038096588200698 0.9586233344013804 0.7714247597124343 0.617644693845203 0.8150771248707401 0.6177541517741155 1.2080833540007754 0.7482829000665061 1.0252708514131015 0.9745135363045557 0.6915187567033075 0.3832121922793131 0.3340037974263668 0.5533310933673727 0.8421293117631683 0.5870917559447186 0.7510366914253498 0.5313726537021175 0.8799723585069799 0.8807281975613066 0.529053675519777 0.9069696649189103 0.5751214829203245 0.40169252586644766 0.9596522514834668 0.658305531733546 0.5784132386649046 0.9878655711682967 0.6621939747172093 1.0677152896097475 0.4959562701934501 0.41577342024304204 0.8811950765689015 0.6857762495952887 1.104273431210741 0.9180241711208471 1.0911896253081008 0.7091587637511525 0.7796076300816408 0.5135032602471358 0.5801217794883795 1.0502451381863316 0.8480458449478093 0.7843770056309646 0.6798663876376536 0.9681221705169304 0.15136737118353238 0.9717608041643366 1.1483659481478332 0.5043022808964409 0.5477990804219647 0.6572040353678251 0.6081836629708408 1.1197654850412988 1.1968581387681485 0.37804103528687305 0.7542358573741559 1.1665231333659423 1.175457464677702 1.3357863143672963 0.6926791035644699 1.0218403137313896 1.179794923859185 0.9836462490321776 0.5178365249831074 0.34631673336351504 0.4984696493617165 0.48260659379332654 0.8347591408689256 0.7534824060333034 1.1170689485031777 1.2470781914899487 0.24845290975405368 0.5819191228233309 0.9530734020578604 0.9829201434311279 0.898792129281073 1.0265187420381439 1.0905882880499647 0.9896745776846276 0.5300158170076233 1.0662000410159755 1.0596497624223835 0.9162127945503712 0.8135357883755954 0.33477456518542575 1.1212075850122802 0.9075748816745937 0.9780180153384057 0.5909085689029698 0.6926588413609748 1.3763649687313317 0.8639800034469753 0.7853632372413852 1.018755908187434 0.911434649716106 0.5487291261216956 0.5186894458918152 0.6519507468637458 1.0683526108775565 0.2761076878233884 0.6419315492310793 1.1166140614368953 0.5007539255072759 1.0140551795029757 0.8994988928673403 0.9352505614560623 0.7411903061617272 0.44609094651935655 0.8575574507263012 0.784254919446256 0.6405272424243473 0.5712090802643933 0.45301590836481953 1.158606404293058 0.6253916391167336 1.372148542018661 0.8151756075501062 1.0117444302198804 0.8106107601613328 0.8377669599679308 0.44166885987726306 0.727032923884986 0.7220765988893664 0.8319553895380942 0.998316336917836 0.4287497059263635 0.9572875667314138 1.03248046717355 0.6073527425429055 0.9857314297329736 1.1436407983982566 0.6406203624921049 0.6854437161394947 0.3923164838497692 0.9682593534583859 1.041826686537081 0.5114891113697263 1.0813249138426324 0.2089755945072352 0.9214029096372148 1.2011978133990608 0.9460735406866471 0.5570977543557347 1.0150112867939993 0.9693925631625748 0.7184823306534633 0.48115723512421366 0.7564567684183363 0.7887895712362168 0.15293103992649487 0.40067918344028924 0.7222228235413044 1.1767356001901383 0.8988855714417164 0.708495129395896 0.8625152265975723 1.150810083408139 0.7640753613940556 1.0369804595867422 0.9224787259105225 1.390107896815303 1.1604226899167294 0.47855209328689596 0.5925848601787346 1.1082712021197878 0.9336476747256669 0.2013340168625249 0.9256309132053152 1.1569322526211672 0.4656519874854613 0.18133670798920173 1.1513851101343957 1.1773727845561632 0.08057444784801457 0.8705372824860693 0.638353302164538 0.9756852316955364 0.887426564449814 1.132135696750643 0.843765643479598 0.96064616419052 0.6686062523613195 1.0487998503036984 1.0968394006018611 0.0 1.137469652300796 0.8075223432353934 1.016777260339149 0.7063100039129816 0.17582499507683347 0.7611683018193921 0.46932259847327834 0.71043788456922 0.8617077742116209 0.7054009324020689 0.908646624747456 0.48983597965204195 0.27879788835261277 0.5801986272422185 1.1650731049166545 0.6094826853930421 0.12657501069613575 1.0125799557783086 0.8761904676793645 0.7989040721829251 0.8204668567228719 0.4340611825627007 1.2995091813052928 0.5211400189756352 0.8296904948399534 0.8735737441444994 1.0642643086577104 1.2390886881173655 0.8036812508968912 0.48142403511448073 0.67378722028856 0.9393358192223199 0.825748835995077 0.6859819548196672 1.2067834318515183 0.8718813148005004 1.1020015900843816 0.9274463912386325 0.9319922489231106 1.1715063762762816 0.39513296270902976 0.9888065572157559 0.3302402000712572 0.6819399194799741 0.9120130298296195 0.39670956488107467 1.296090225928408 0.7915374485393925 0.8781759928761527 0.8283493731139667 0.7807363717855378 0.2267816060775008 0.9139742633265618 0.6774723723430863 0.7821041178557496 0.5746934741448781 0.8889307628061984 0.2206537348179116 0.4453471476611992 1.4787812018400839 1.2967464698879252 0.9572174787559423 0.4912443909787344 0.8139683267883415 0.7056838104636678 1.1703193891252741 0.3304392146700121 1.2238191096393807 0.6981769487342792 0.5675868966094909 0.8246972986771269 0.8930437883176197 1.033811846369897 1.2165579015649217 1.1052536521913268 0.6239675700119202 0.9752845839182783 0.33769096333779136 1.3128093907642993 1.3130540694494797 0.6690255959184108 0.6943833831983435 0.6153067280558382 0.09061869672047962 0.6040553502300261 0.7135402982298964 0.676993685238603 0.5471882201316203 1.0497601261923084 0.5509885114817451 0.2750746007908892 0.9236998705948333 0.7330686195229877 0.9951441931591551 0.7920142693761757 0.4709678907030008 0.9532145760709689 0.5476768411661135 0.4165505386441488 1.0506403151319381 0.7516714721068152 0.9373374433123522 0.34408792854203135 0.8158838234596016 0.6087973696022131 0.8296319671387389 1.253418064063281 0.6241466695828438 0.5590883210304077 0.5569335445528525 0.6909230053403401 1.3000370360748532 0.7248415619268178 0.2356701320305712 0.7802394185410166 0.733733284779915 1.0297199619978281 1.0000128194728315 1.1117484458995859 1.2417960130217967 1.1208851153579367 1.031460561616565 1.0664153540800954 0.6783727065327237 0.754711876320075 0.6359842555571127 0.8540407360424376 1.0010531418314632 1.1172810168367937 0.9468657069915402 0.9859079963122435 0.9349660445322405 0.8760683602095756 0.44411276479919937 0.9295942868000048 0.7463008032489463 0.8003740956528974 1.018563965835793 1.037864328270576 0.33779190072042253 1.2480133892567873 0.6112424240552657 0.3270337646736332 0.41860547273498483 0.7269020744219602 0.708080190964768 0.6938687272059259 0.5037345733738194 0.9639479865692215 0.4280616566278487 0.7423722966627516 0.844520068576492 0.8166503544558384 1.2694769861576296 0.9481259336726834 0.6468223652563047 0.6978139461923311 0.8561442499050164 1.0279020022232914 1.0057632873517626 0.7711179584105099 0.9703692480040813 0.4459509765213093 0.8093558578787265 1.0678542451742954 0.894011282863089 0.21980386348713185 0.5912393704544182 0.7018410517765995 0.8796306777262723 0.9169625043087787 0.7860210315556383 0.6236075893759058 0.9537798018907603 0.34801773276264975 0.7008994599441873 0.48322259193659295 0.6500329128064822 0.5943368900953829 0.9071035197244929 0.9127828940373587 0.737597419589552 1.0177733284994261 0.9198647850534135 1.3735155962493761 0.4224642370744884 0.8408916404806754 1.0314428634319 0.8784487972699692 0.7921584203317413 0.9259976662773202 0.7480282704478504 0.4166225737953164 0.7809018203827033 0.9863311010730308 0.9689981613606572 0.8652124436162791 1.24494295242507 1.3687556900863822 0.6391796261131153 0.9558436891675711 0.38866440506676736 1.4304344915316207 0.7805358489385398 0.6916879788606616 0.9209986184791992 1.2058259549488024 0.7977846069755551 0.8440162999810219 1.204431604313431 0.9216533103298562 1.0813633907174476 0.7786116907627497 0.8176766798765077 1.1034757911012714 0.5620459981847709 0.9592290189641817 0.4481372918895123 0.5179750065277507 1.0567728836183907 1.0289328421950628 0.8624023848255987 0.6787562960487113 0.6717350253796245 1.0445821035256817 0.9314748347211128 0.5500220987558991 0.48468420209820673 0.8806172312933193 0.9400614899543034 0.8805687369660502 0.5519507083267744 0.5065803852355575 1.0215216739799242 1.2934016734841545 0.8716117235389521 0.5698053219598668 1.2134398101667871 1.3249403999479945 0.9186791891842152 0.6266920786460137 0.6136239003469832 0.5162840067409801 0.2884026662684708 1.166399914334119 0.4254996735203578 0.9462367132380716 0.9792980314991909 0.8618965125923493 0.3951179206240246 0.18568448144352848 1.0997668792538842 0.6022552992006814 0.2525739703377076 0.7497482923909627 0.8194574152878965 1.1552215595962034 0.6933681398244815 0.6157027002641635 0.7402820471961459 0.37141144164823137 0.5689353883047127 0.5168283010129405 0.9187233711713937 0.7943464113696672 0.6488141799116367 0.9518862845433741 0.8393730318579256 0.8706252279786469 1.4030342298894127 1.1269209513193061 0.808167826534916 0.7918028258442392 1.141907589055826 0.8009711479238294 0.9340019747722578 1.2775395736785298 1.0231507103754778 0.6726299773398 0.6371960223191625 0.41323166739635436 1.0057473130629642 0.7157139750527999 0.7502664295049325 1.2718787162131584 1.3421059532931925 0.8509248903017357 0.6021721841798405 0.05601453031230527 0.7511992517563044 1.2979121524345305 1.1232200357116173 0.976201028190456 0.6460425049816457 0.7856043654957425 1.071588424371622 0.9808642986298723 0.7845261539231113 0.44709183649249223 0.5107632155845715 0.8871246594974693 1.1469314189216937 1.012712179477937 1.179285380278311 0.9239983087546011 0.7723749897280622 0.5448182478409991 0.7977679372094479 0.8601469845527759 0.34405141803595646 0.37272934796581947 0.7604784655928065 0.173941233928342 0.6556154069997832 1.1291231698987432 1.0736727841002607 0.8199756349618496 0.45099630265159185 0.6996890319359017 0.4992244862268537 0.4615666561567924 0.6801164815473181 1.0868365016302461 0.7560390336174788 0.7452196615836432 0.8435350073656639 0.3587622044501232 1.3414000473852277 0.6275182808072574 0.6658590025299114 1.2299895858238576 1.1404283877309547 0.9915501865088254 0.7998902808358842 0.9572392602051966 0.7693022034202879 0.7399080922496825 1.242895213795161 1.1979446911847444 0.7248887130335749 0.9395014855649545 0.6995184261115844 0.755425172850355 0.4965353348223149 0.5430478287455269 1.5043897873528267 0.36483240429672215 0.5355191153077118 0.3459641648641523 1.2395133729639873 0.9646143649757961 0.5101566403425077 0.5817186161516193 0.7415515321155332 0.37713043160331544 1.0822277685447528 0.6647021429051676 0.6196803663234607 0.9787444460368555 0.42524313442344763 0.5423088894106448 1.0287072867122806 0.5428421712044537 1.347333164137048 0.4812509531587234 0.48736380161021686 0.5467899280390688 0.8756276607088845 0.6602348438190284 0.9324975121877362 0.5282523136473791 0.5355949060516723 0.43337401353071875 0.6619010995012954 0.7653444063014735 0.8476665586110589 0.5318069514700955 0.9373872984757147 0.7109636202260224 1.1770340270026396 0.5868105510144104 1.1797763367726348 0.3102740723211172 0.6754409210485054 0.9937751448984207 0.4985738032196881 0.8620556073836353 0.9332242551246329 0.7843724414009153 1.0744542020593664 0.899153039136266 0.8557236903852364 0.9842678035252372 1.0060124540558204 0.7470617935336881 0.6624985131567087 1.044277847181277 0.40991299414889076 1.2228462069530874 0.6720259299161956 1.4053644238882625 0.368095766306514 0.598657406495561 0.9529025347019722 0.6596573223278354 0.8903574608136973 0.8292269163156418 1.2573089411712974 1.0279057047560545 0.8156682578501615 0.6706917020412286 0.5615571371628134 0.36789200526686056 0.8761732936809302 1.0749713111228671 0.5996944445859109 0.3105460257994015 0.8365686461571887 0.739412089097315 0.6709712052949175 0.8791839422257401 0.5367029978526449 0.726987631602322 0.9573567524450313 0.7590641287769316 0.7137796703210604 1.0624055539653707 0.9410362025173088 0.6900189129391975 0.6861152899785853 0.8659563239657124 0.931617681997934 0.6906669647170308 1.1100069263938497 0.6868338215187384 0.8049000175571808 0.904587325837933 1.0242429726099334 0.8030655559144607 1.0611023553952388 0.8277674247017924 0.5461804568056471 0.8429606480444742 1.0976902821558574 1.064541400727502 0.6301747109319026 1.1927955523055633 0.7559198556810539 0.3497678839282401 0.7832320525694838 1.3348538522745383 0.6626986791843035 0.9004028635837179 0.7516265607883021 1.1482457996019375 0.7997891389739965 0.8376615725055209 1.0195057665812297 1.228052931046931 0.9122551120997529 0.872423985011146 1.2815801053249225 0.8212334811151097 0.1910236753004927 1.0542622151100094 0.8700477162206715 0.5551662894025519 0.9542217731029531 1.4078274061992722 0.652180247238821 0.7508508198087759 0.7202562911961472 1.038599140404142 1.0427535221841786 1.2937115028959574 0.691977407306293 0.908144606767128 0.8937164433237125 1.1186243136666858 1.108523930650164 0.8678708450053529 0.9109638188747923 1.0290402700592258 0.9203490825860827 0.6376757399633279 0.6821564491944518 1.0593497702045158 0.49465750107303563 0.763514116582058 0.7737997452421428 0.7557012553179693 0.42204572998044604 1.2684284680648665 0.574962418026565 1.3874991257433062 0.8567044692727904 0.7414325616285009 1.1711791161123308 0.9790533792593571 0.9924654188541908 0.1632496444113844 0.20750243421052786 0.39726529664646937 0.8956018431948761 0.3913849671363457 0.9274418914425893 0.34225994329257997 0.6242322223096598 0.5127553183078895 0.7814672639880581 1.1244432409139429 0.5536588170595279 0.5927584493542835 0.21654347637476667 0.8615132744288976 0.7845673123594009 1.2720434231603728 1.4754453635293727 1.2903700430776963 0.8809273447527093 0.9536138103093421 0.9394210996129617 0.9513554848187719 0.6437308084071046 0.7258017674027736 0.851609394900822 0.7570444629121841 0.9385501327642517 0.801381300819867 0.7134437902666786 0.303669369677425 0.814806840117408 1.1984513339400344 0.8947230668683225 0.7180764140487771 0.6941479285258197 0.6669202521382042 0.5963182725941891 0.9199757268880298 0.3775362075326862 0.2507292305112242 0.9430563979570915 0.6490431755522322 0.4022020595382411 0.7774177399012822 0.978747339273117 0.7004126079354402 1.2453376751611085 0.6112555709475413 0.3001774632524181 0.7055116249195718 0.7660162126283037 0.29637526031251404 1.0567892537602785 0.9908710411069848 1.0763380677701218 0.9091082255164529 0.885027245684541 1.1168648607324023 0.9965846566149699 1.3781153931631207 0.5298877283082407 0.9610490002055047 0.8209389755365686 1.1603798677659878 0.632903471882869 0.5779106581955692 0.9576045509937452 1.4035954620378854 0.3838417039938534 0.6431952472400752 0.7635178413430821 1.176412633361759 1.3639502365967393 0.6795741270730173 1.3733296167249254 0.23531723283137 0.3991055539341348 0.4010157553175506 0.7160062605083615 0.5353294556126897 1.0374552751412818 0.5656488837827035 0.6165868842124566 1.355723815455634 0.5755527269132433 0.7127146592629071 0.9749051562631543 1.3629297911816176 0.9645581937697322 0.8028340805855773 0.7133984473818701 0.5409225640243838 1.240850455505977 1.2077505548508212 0.8381549987684536 0.9523129807238812 0.797586796241358 1.0375659041721152 0.8931905346115357 0.9497225312865863 0.8826795085567333 0.7906116582695992 0.652067154455328 1.1244889156007176 0.5866999948871932 1.2947432179719514 0.7095970254818068 1.258503748260872 0.956546368082743 1.1305351690774876 0.3776588023015582 0.27049152097494555 0.9025151752769655 0.799736984035526 0.9043951174578433 1.014232075765451 0.6688205472549182 0.508155829616291 0.9278602568382477 0.6233331546218926 0.8243688890038752 1.1600468753532205 0.6192739860686229 1.024885337644744 0.35956612703234386 0.693493238899848 0.47872260540399625 0.7563500126719179 0.770240826488912 0.5632316719740719 0.7294938238348395 0.5389971474619085 0.8116977287161735 0.917365985865999 1.0342993006430823 0.6813588399075672 0.9356748910782937 0.5456113655456859 1.0759332069680985 1.019132745851595 1.3062255961814015 0.9566561021096797 0.7628250484095036 0.3786116859125106 0.95389273451827 0.807577460471398 1.148966666824073 1.1051557870298017 0.23984709660676748 0.5191608948767343 0.49560265979570484 0.8165215427487248 0.8005224050812537 0.8572800164106138 0.5264238073197623 0.7150735514725388 1.1357961798756075 0.41035194939103103 0.6996613441282145 0.7029524793023612 0.5345915587309465 0.6993580271734294 0.46138941831575275 0.4724980263944029 1.0828861745267269 0.24337432803767378 0.5356415207883797 1.0699444356508356 0.44735285303607836 1.3746814322565575 0.606259984253714 0.6503268154324073 1.0085619065568174 0.7363359590549315 0.6735312097968198 1.0071795645698087 0.9030308729138481 0.671020594488272 0.0 0.5114206494491063 0.5491130592109071 0.5016686531097692 1.157997050523782 0.8691514640266846 1.1061097547369823 1.2981497835402702 0.9517258285225088 0.6481477525753876 0.4234548533979452 0.11926774580757253 1.0677139197885994 0.3789260669321806 0.43270637992699984 0.6143045179024821 0.6748532307344409 1.0147094385181668 0.47237358106634625 1.166178967238988 0.6278696988461094 0.8431437102666666 0.24382439490652896 1.1185791882247202 0.7373388625436554 0.726874390776615 0.0 0.7753185294550454 0.8174781495092266 0.8568733040312445 0.6614301700747912 0.9148506437770657 0.8918643276891216 0.1452945524213095 1.0783356043390235 0.4170907503219187 0.45117934626278206 0.8173225527803201 0.7368998080876061 1.2029832115454104 0.7566897050167551 0.4059753867593573 0.9593598022182659 0.6972805800793339 0.6392024355580356 0.8177275464747019 1.2871740226072064 0.8720914681847286 0.6997166163241175 1.0872893346417964 0.44935253581323986 0.7415277227928178 0.6231066620450235 0.6150721388253564 0.20423202010340397 0.8076208009071184 1.0112471744893998 0.2621936360846832 0.5901320912830396 0.9161516579295473 1.1687721504756108 0.9611858626797128 0.9790774070724848 0.5837720379150864 0.5857286146217356 0.8523177585156795 0.8632732770049373 0.6557832252137358 0.956966807913615 0.5638028727306891 0.5949919610071367 1.0292674971485158 0.7479722593363619 0.6588137800584931 0.4798421235413356 1.139697709990401 0.6790178672225559 0.7085500358457486 0.9929951231001848 0.8312428260284714 1.3728411927176098 1.2270066898383913 0.6436475147266939 0.861602571038559 0.7778868248294132 1.0264630240112658 0.6971157210041738 0.571693905252311 0.9695023036674097 0.5572981336696765 0.618262358724347 0.8304469724706098 0.7275655899699771 1.0131517771469862 0.5930232780718103 0.8932221738939871 0.7305702433392393 0.6015898984672087 0.4462144352951812 0.9426387655160843 0.7271965537038134 0.49705987465293017 0.5961247525377242 0.5360046706172001 0.6132626219416688 0.8868012474942145 0.0 1.2989058820986825 0.6485757224502693 1.1336340353371672 0.5111966915332359 0.8802836308851761 1.097753146755942 0.5376591946898618 0.9630868983802625 0.4546798097602787 1.100897583580004 0.8282597126378657 0.44802607031182323 0.8577122045163889 0.5192073904412241 1.0211976547945192 1.1076610026317257 0.9829785384706927 0.4635007390766046 0.38758908062420133 0.9332590214668053 0.8891274081846208 0.7884392788782871 0.7038950923705775 0.37233223728981374 0.8273875089956889 0.5628358510891329 1.3136241480988395 0.5968629203339796 0.5250770186463367 1.026420046796651 0.7064978520607287 0.5998117048177944 0.9878717256185421 0.8178885578950125 0.5454141222532759 0.5369770178404334 0.28838765552769347 0.8315527962827858 0.6137800360340312 0.709810824202827 0.7203809666665054 0.3656930381438365 0.9096928215763017 0.9823212017374573 0.9655903306410496 1.097188159926347 0.0995386864966281 accumulated_time=0.05263853073120117 | .. code-block:: default print(__doc__) import time import numpy as np import matplotlib.pyplot as plt import pytransform3d.plot_utils as ppu from distance3d.distance import triangle_to_triangle from distance3d import random, plotting random_state = np.random.RandomState(0) triangle_points1 = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0]], dtype=float) ax = ppu.make_3d_axis(ax_s=1) accumulated_time = 0.0 for i in range(1300): triangle_points2 = random.randn_triangle(random_state) * 0.3 + 0.7 * np.sign(random_state.randn(3)) start = time.time() dist, closest_point_triangle1, closest_point_triangle2 = triangle_to_triangle( triangle_points1, triangle_points2) end = time.time() accumulated_time += end - start print(dist) if i > 10: continue plotting.plot_segment( ax, closest_point_triangle1, closest_point_triangle2, c="k", lw=1) plotting.plot_triangle(ax, triangle_points2) print(f"{accumulated_time=}") plotting.plot_triangle(ax, triangle_points1, surface_alpha=0.8) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.194 seconds) .. _sphx_glr_download__auto_examples_distance_plot_triangle_to_triangle.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_triangle_to_triangle.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_triangle_to_triangle.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_