{"id":8762,"date":"2022-10-03T17:06:06","date_gmt":"2022-10-03T21:06:06","guid":{"rendered":"https:\/\/blogs.mathworks.com\/student-lounge\/?p=8762"},"modified":"2022-10-20T05:01:04","modified_gmt":"2022-10-20T09:01:04","slug":"path-planning-for-formula-student-driverless-cars-using-delaunay-triangulation","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/student-lounge\/2022\/10\/03\/path-planning-for-formula-student-driverless-cars-using-delaunay-triangulation\/","title":{"rendered":"Path Planning for Formula Student Driverless Cars Using Delaunay Triangulation"},"content":{"rendered":"<div class=\"rtcContent\">\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In this blog, <a href=\"https:\/\/www.linkedin.com\/in\/veer-alakshendra-b5324222\/\">Veer Alakshendra<\/a> will show how you can develop a basic path planning algorithm for Formula Student Driverless competitions.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Before we get started, we just want to mention that you can run this code in your browser or can download the complete live script using the buttons at the bottom right corner.<\/div>\r\n<div style=\"margin-bottom: 20px; padding-bottom: 4px;\">\r\n<div style=\"margin: 0px; padding: 10px 0px 10px 5px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: bold; text-align: start;\"><span style=\"font-weight: bold;\">Table of Contents<\/span><\/div>\r\n<div style=\"margin: -1px 0px 0px; padding: 10px 0px 10px 7px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: start;\"><a href=\"#H_427B1F1B\">Introduction\r\n<\/a><a href=\"#H_93F21B69\">What is Delaunay Triangulation?\r\n<\/a><a href=\"#H_30BB5D2B\">Methodology\r\n<\/a> <a href=\"#H_3D19D8D8\">Step 1: Create 2-D Delaunay triangulation\r\n<\/a> <a href=\"#H_39884E89\">Step 2: Remove exterior triangles\r\n<\/a> <a href=\"#H_76AD97E6\">Step 3: Find midpoints of internal edges\r\n<\/a> <a href=\"#H_03C2C226\">Step 4: Interpolate midpoints\r\n<\/a><a href=\"#H_1903E92B\">What next?<\/a><\/div>\r\n<\/div>\r\n<h3 id=\"H_427B1F1B\" style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Introduction<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Various Formula Student competitions have introduced the driverless category, where the goal for the teams is to design and build an autonomous vehicle that can compete in different disciplines. In this script, we have demonstrated the steps to plan a path through a racing track using Delaunay triangulation. The application is analogous to the first lap path planning of the Formula Student Driverless competition to plan the path through the coordinates of the detected cones.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Please note that the Delaunay triangulation is just one of the methods for planning a path for Formula Student Driverless competitions. You can also try to develop a sampling-based planner like RRT, RRT*, etc, or any other custom algorithm that best fulfills your requirements. To develop such planners using MATLAB, please check out the functions listed on the <a href=\"https:\/\/in.mathworks.com\/help\/nav\/motion-planning.html\">motion planning<\/a> webpage.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 109px; height: 275px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_1.png\" alt=\"\" width=\"109\" height=\"275\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 1<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><\/div>\r\n<h3 id=\"H_93F21B69\" style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">What is Delaunay Triangulation?<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">First, let us briefly try to understand Delaunay triangulations. The fundamental property is the Delaunay criterion. The criterion says that for a set of points in 2-D, a Delaunay triangulation of these points ensures the circumcircle associated with each triangle contains no other point in its interior. In the figure below, the circumcircle associated with <span style=\"font-family: monospace;\">T2<\/span> is empty. It does not contain a point in its interior. Hence, this triangulation is a Delaunay triangulation.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In the algorithm below, we have used this property to create a path using the detected cones as vertices.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 209px; height: 189px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_2.png\" alt=\"\" width=\"209\" height=\"189\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 2<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><span style=\"font-style: italic;\">Reference:<\/span> <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/math\/delaunay-triangulation.html\">Working with Delaunay Triangulations<\/a><\/div>\r\n<h4 id=\"H_A1DFFABC\" style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\"><\/h4>\r\n<h3 id=\"H_30BB5D2B\" style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Methodology<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Figure 3 shows the methodology we have implemented to plan the path through the cones. To understand the algorithm, let us go through the code.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 599px; height: 248px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_3.png\" alt=\"\" width=\"599\" height=\"248\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 3<\/div>\r\n<h4 id=\"H_3D19D8D8\" style=\"margin: 3px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\">Step 1: Create 2-D Delaunay triangulation<\/h4>\r\n<ul id=\"H_9E258320\" style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-weight: bold;\">Load cone coordinates<\/span><\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">As a first step, we will load the x and y coordinates of the inner and outer cones. It is assumed that the perception algorithm is detecting the yellow and blue cones. As one of the most common approaches in Formula Student competitions, you can use the YOLO network to detect cones. For reference, you can watch <a href=\"https:\/\/in.mathworks.com\/videos\/design-and-train-a-yolov2-network-in-matlab-1578033233204.html\">this<\/a> video to learn how to design and train a YOLO network in MATLAB.<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">clc<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">clear<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">innerConePosition = <\/span>[6.49447171658257,41.7389113024907;8.49189149682204,41.8037451937836;10.4848751821667,41.8690573815958;12.4735170408320,41.9319164105607;14.4579005366844,41.9894100214277;16.4380855350346,42.0386448286094;22.3534294484539,42.1081444836209;24.3165071700586,42.0957886616701;26.2748937812757,42.0609961552005;28.2282468521326,42.0009961057027;30.1761149294924,41.9130441723441;32.0795946202318,41.7896079706255;33.8817199327800,41.5914171121172;37.1238045770298,40.8042280456036;38.5108000329817,40.1631834270328;40.7498148915033,38.2980872410971;41.6428012725483,37.0572740958520;42.3684952713925,35.6541128117207;42.9237412798850,34.1220862330776;43.4562377484922,30.9418382209873;43.4041825643156,29.3682424552239;43.1310900802234,27.8454335309325;42.6373380962399,26.4081334491868;41.9213606895600,25.0723633391567;39.8493389129556,22.6733478226331;37.1330772214184,20.7325660900255;35.6438750732877,19.9947555768891;34.0970198095490,19.4366654165469;32.5117013027651,19.0709696852617;30.9105163807122,18.9081142458350;29.3050197645280,18.9545691109581;27.6851829730976,19.2045278218877;24.4759113345748,20.2570787967781;21.3685688158133,21.9377743574784;19.8072187451783,22.9775182612717;18.2040616100214,24.1054677217171;16.5291821840059,25.2778069272720;14.7490275765791,26.4446189166734;10.7566166245341,28.5122919557571;8.59035703212379,29.2671114310357;6.36970146209175,29.8034933598624;4.11753580708921,30.1252372241127;-0.405973075502234,30.1500578730274;-2.75740378439869,29.8083496207198;-7.53032772904185,27.7630095130657;-9.55882345130782,25.8360602858122;-10.9967405848897,23.4446538263345;-11.7530941810305,20.7728147412547;-11.7945553145768,18.0098876247875;-11.1377067999357,15.3398589997259;-9.84329815385971,12.9293912425976;-4.31864858110937,8.32717777382664;-2.64821833398598,7.33684919790624;-1.23396167898668,6.38669110355496;-0.139159724307982,5.41310565569044;0.583196113153409,4.42232005043196;1.00846697640521,3.25999992647677;1.42452204766312,-0.235409796458984;1.70769766109080,-2.50157264279400;2.43395748729283,-5.02746251429141;5.90118769712182,-9.36241405660719;8.13219227914984,-10.6723062142501;10.4108490166236,-11.5249176387577;14.7174578544944,-12.4162331505645;16.6611999625517,-12.7135418322201;18.4669199253036,-13.0527675263258;20.2513584750154,-13.4902268953088;22.0275043214267,-14.0208096878619;23.7938485314227,-14.6351269687361;29.0380553533840,-16.8864873288738;30.7681622622371,-17.7392626196140;32.3760783979903,-18.6039808584518;33.7897740653103,-19.5166383512928;34.9667330396653,-20.5090458088496;35.8614855279756,-21.5808775016001;36.4612858521334,-22.7451308643890;36.8711477182864,-25.4557910211687;36.6696611457761,-26.8930663715963;35.5175477601575,-29.6867414698392;34.6369025552692,-30.9011171932826;33.5888282300982,-31.9233335254203;32.4026659456202,-32.7184009884738;29.6211021726631,-33.5886007841515;27.9849204584717,-33.7170193136260;26.2183096377485,-33.6848022646400;24.3309596262912,-33.5465676173721;22.3208062313579,-33.3726612899257;18.1328018280879,-33.1964401661521;14.1429922166079,-33.1731958647648;12.2313503871593,-33.1266878316603;10.3778348140314,-33.0132052855498;8.58829435522285,-32.8040580663346;6.84064584789227,-32.4725374962639;5.07009944482550,-32.0172508962124;3.27322533222869,-31.4640545504384;-0.418687595522242,-30.1796696447230;-4.09627739578414,-28.8238238024923;-5.89202160786470,-28.1122858460715;-7.65255868890126,-27.3645667343373;-9.37355826729420,-26.5706223212060;-11.0772549160090,-25.7164049091686;-14.4775165017317,-23.8562440887552;-16.1852335110450,-22.8738429891042;-17.9066984601430,-21.8724503885825;-19.6280899733090,-20.8717543910881;-22.9283852622260,-18.8697018891971;-24.4790807692059,-17.8277052050408;-27.3051265922114,-15.5801090683244;-28.5448479313762,-14.3530174024786;-29.6530218737847,-13.0404842531107;-30.6444406510768,-11.6234683085559;-31.5169602294234,-10.1146356600596;-32.2692264908853,-8.52739205631154;-32.9016624434539,-6.87420998418598;-34.1160057737752,-1.60803776182190;-34.3261608207142,0.237322459171913;-34.4624174228984,2.11880932640591;-34.5407037273032,4.03273612643633;-34.5779532171168,5.97700580252438;-34.5920061096721,7.95066706685753;-34.6203010935088,11.9628384547546;-34.6463516562825,13.9656473217268;-34.6751545298116,15.9616504117489;-34.7230350194217,19.9334733431980;-34.7332354577762,21.9093507078716;-34.7284338451120,23.8784778261844;-34.6466389854161,27.7320065787716;-34.4887912178893,29.4532110956616;-34.1674004338218,30.9833511541837;-33.6523388115164,32.2835000565933;-32.9540435069214,33.3001054449054;-32.0153881487289,34.0792118997941;-28.7867224485036,35.7027232116937;-26.8737074947600,36.7067299514829;-21.7623826032159,39.5958663210330;-20.1418625665089,40.3549987041733;-18.5286281071084,40.9596629960629;-16.9269162480936,41.3805845888608;-15.2947586791386,41.6060043323431;-13.5312107482484,41.6777684016896;-9.64289482747188,41.5853268011948;-7.61112976471737,41.5421552074769;-5.58318659783131,41.5226049040385;-1.53976115651896,41.5427010208205;0.475431094342800,41.5765527022834;2.48619653317858,41.6224387797260;6.49447171658257,41.7389113024907;8.49189149682204,41.8037451937836;10.4848751821667,41.8690573815958;12.4735170408320,41.9319164105607;14.4579005366844,41.9894100214277]<span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% load inner cone x and y coordinates<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">outerConePosition = <\/span>[8.29483356036796,47.8005083348189;10.2903642978411,47.8659036790991;12.2903853701921,47.9291209919643;14.2949817462715,47.9871977358879;16.3042155724446,48.0371512121282;18.3181128601480,48.0759783968909;24.3872198920862,48.0953719564451;26.4188343006777,48.0592693339474;28.4542241392916,47.9967391176812;30.4929111587893,47.9046750145358;32.5715480310539,47.7694057800486;34.7354354110013,47.5303707137414;36.9671887094624,47.1090924863221;41.4608084515852,45.3878796220444;43.5486168233166,43.9466679046951;46.7637769841785,40.1838709296144;47.8711744070693,38.0458741563760;48.6759026786991,35.8287318442088;49.2095764033813,33.5308461962448;49.3717906596030,28.7456240961468;48.9402528124274,26.3442245678724;48.1379348685719,24.0115869446911;46.9718766730536,21.8331831495909;45.5183908761479,19.8937545099424;42.0344522843090,16.7521854290723;38.0024261140352,14.4777602906678;35.7974585974047,13.6826661179064;33.4965697064231,13.1523520909686;31.1302557069132,12.9121393769316;28.7495405480103,12.9803375419597;26.4275819814214,13.3378047377686;24.1935407090117,13.9452300781406;20.0475993937396,15.7534500265274;16.3951857815830,18.0421326577611;14.7344934919394,19.2103582158950;13.1401972893467,20.3265665388672;11.5833537070008,21.3477072094266;10.0428032559345,22.2341839570762;6.90006888859156,23.5101221144020;5.24310276950825,23.9102111346615;3.54614319085073,24.1525066527486;1.82453456285617,24.2384953941222;-1.49646987010121,23.9423419780574;-2.88611819700968,23.5188503619890;-4.87663538345929,22.0841121388762;-5.48860547878733,21.0654842962416;-5.81567263287249,19.9085084532591;-5.83349192339180,18.6923268134878;-5.53917605118359,17.4977407053060;-4.95012865665813,16.4016948398736;-4.05317915721677,15.4107620877673;0.492121533127250,12.4494087837712;2.38653784056378,11.1712478467585;4.26363974073903,9.48929957533922;5.87263326747036,7.25460792254726;6.83628597561633,4.68706884998182;7.22868549746256,2.31823546262226;7.60968340642873,-1.42149659832866;7.97509056184070,-2.72619237583490;8.54802041473498,-3.68009075055991;10.6601317831479,-5.23084300440234;12.1167992046948,-5.77254995615783;13.7805173778787,-6.17261534649334;17.6231089179688,-6.79114948102549;19.7388585053217,-7.18913620702706;21.8298950982966,-7.70159820373082;23.8771264994103,-8.31301696223576;25.8797524901441,-9.00938215804746;27.8385154732156,-9.77726113305095;33.4828656272925,-12.3885256946890;35.3884273243004,-13.4149776838374;37.3243202944926,-14.6682383106842;39.1922962154652,-16.2493960759111;40.8455371260767,-18.2403341823979;42.0705518955054,-20.6153105774461;42.7346589897432,-23.1596769590206;42.5147079384368,-28.2478460553850;41.7538036771420,-30.6144579632713;39.1831183440142,-34.8167170198948;37.3770559671547,-36.5762176430613;35.2523671945937,-37.9984770098583;32.8791324240351,-38.9934826446380;28.1270516052592,-39.7153356388220;25.9046030197368,-39.6765956654354;23.8121031317075,-39.5240911796868;21.8464792201864,-39.3538830619781;19.9742827992146,-39.2418187116909;16.0937484438592,-39.1847191943436;11.9928246424488,-39.1219447460144;9.86352410414552,-38.9911216862446;7.69014987529461,-38.7364552625087;5.51782683234722,-38.3249002543397;3.42382206323132,-37.7869797271760;1.40682879137184,-37.1663842455962;-0.541821138011257,-36.5027177844325;-4.34015621146816,-35.1410426555394;-8.16436000121084,-33.6653461038145;-10.0767778404464,-32.8530238495275;-11.9792230934156,-31.9752972248347;-13.8428086034457,-31.0410375539532;-15.6623928384561,-30.0682796038662;-19.1958077261686,-28.0638760232219;-20.9238240938196,-27.0586776214187;-22.6524765196268,-26.0537507263292;-24.4077080359509,-25.0144494209715;-27.9360780875981,-22.7317004681533;-29.6698538901663,-21.4381474644069;-32.9453564203185,-18.4316844689044;-34.4107565227371,-16.6961594315364;-35.7065080013589,-14.8445665903860;-36.8313109009813,-12.8998963192641;-37.7878917266941,-10.8820330087871;-38.5811746376266,-8.80892992160400;-39.2178699842561,-6.69652639898087;-40.3011807339499,-0.309611756649864;-40.4533406202231,1.78890139416343;-40.5382789183978,3.86217286202336;-40.5775538214583,5.90777727960811;-40.5919497511314,7.92466131148779;-40.6014196538181,9.91275631233656;-40.6457557289961,13.8810850824754;-40.6745334498720,15.8753221224371;-40.7017394704418,17.8763494567535;-40.7332264185658,21.8989357934230;-40.7282871101318,23.9204396925825;-40.7033369152928,25.9485603009070;-40.4291604069450,30.2970202551981;-39.9260632680985,32.6679289532538;-38.9665731582284,35.0689826553948;-37.4022554152914,37.3266934320522;-35.2924298638551,39.1052438930590;-33.2056190082383,40.2549711124138;-29.7935826692359,41.9483259837501;-28.1179159337869,42.9113732230407;-22.4882559681602,45.8771756304123;-20.3655683666973,46.6715497668858;-18.1093389106216,47.2629205744315;-15.7909195473899,47.5854545071348;-13.5681633690504,47.6776546092619;-11.4644254110510,47.6457593795914;-7.51988574761303,47.5414613781388;-5.55737846449435,47.5225493988029;-3.59058902924480,47.5236739806379;0.355197826404633,47.5753479114301;2.33404449770947,47.6205092826547;4.31684977705784,47.6749328204622;8.29483356036796,47.8005083348189;10.2903642978411,47.8659036790991;12.2903853701921,47.9291209919643;14.2949817462715,47.9871977358879;16.3042155724446,48.0371512121282]<span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% load outer cone x and y coordinates<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-weight: bold;\">Preprocess the data<\/span><\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">After loading the data, we have merged the inner and outer coordinates with alternate coordinates (Figure 4). This step will ensure that the input to the function <span style=\"font-family: monospace;\">delaunayTriangulation<\/span> is a matrix whose columns are the <span style=\"font-style: italic;\">x<\/span>-coordinates, and <span style=\"font-style: italic;\">y<\/span>-coordinates of the triangulation points.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 574px; height: 165px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_4.png\" alt=\"\" width=\"574\" height=\"165\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 4<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">[m,nc] = size(innerConePosition); <span style=\"color: #008013;\">% size of the inner\/outer cone positions data<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">P = zeros(2*m,nc); <span style=\"color: #008013;\">% initiate a P matrix consisting of inner and outer coordinates<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">P(1:2:2*m,:) = innerConePosition;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">P(2:2:2*m,:) = outerConePosition; <span style=\"color: #008013;\">% merge the inner and outer coordinates with alternate values<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">xp = []; <span style=\"color: #008013;\">% create an empty numeric xp vector to store the planned x coordinates after each iteration<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">yp = []; <span style=\"color: #008013;\">% create an empty numeric yp vector to store the planned y coordinates after each iteration<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<ul id=\"H_C6DEED8F\" style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-weight: bold;\">Form triangles<\/span><\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In real scenarios, the sensors mounted on the vehicle will detect only a certain number of yellow and blue cones while going through the race track. Hence, we have implemented a <span style=\"font-family: monospace;\">for<\/span> loop that allows the code to create Delaunay triangulation objects for every nth interval of the cone position. For example, if <span style=\"font-family: monospace;\">n=4<\/span>, the Delaunay triangulation will be created based on the coordinates of 4 cones. The image below illustrates the procedure.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 651px; height: 180px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_5.png\" alt=\"\" width=\"651\" height=\"180\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 5<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">interv = <\/span>10<span style=\"white-space: pre;\">; <span style=\"color: #008013;\">% interval<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">for <\/span>i = interv:interv:2*m<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> DT = delaunayTriangulation(P(((abs((i-1)-interv)):i),:)); <span style=\"color: #008013;\">% create Delaunay triangulation for abs((i-1)-interv)):i points<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> Pl = DT.Points; <span style=\"color: #008013;\">% coordinates of abs((i-1)-interv)):i vertices<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> Cl = DT.ConnectivityList; <span style=\"color: #008013;\">% triangulation connectivity matrix<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> [mc,nc] = size(Pl); <span style=\"color: #008013;\">% size<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> figure(1) <span style=\"color: #008013;\">% plot delaunay triangulations<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> triplot(DT,<span style=\"color: #a709f5;\">'k'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> grid <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ax = gca;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ax.GridColor = [0, 0, 0]; <span style=\"color: #008013;\">% [R, G, B]<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xlabel(<span style=\"color: #a709f5;\">'x(m)'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ylabel(<span style=\"color: #a709f5;\">'y (m)'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> set(gca,<span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#EEEEEE'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> title(<span style=\"color: #a709f5;\">'Delaunay Triangulation'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<h4 id=\"H_39884E89\" style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\">Step 2: Remove exterior triangles<\/h4>\r\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-weight: bold;\">Define constraints<\/span><\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">While performing triangulation, the coordinates of the inner and outer cones are bound to create triangles outside the boundary of the track. As an example, Figure 6 shows one of the cases where the exterior triangle is formed.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 313px; height: 242px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_6.png\" alt=\"\" width=\"313\" height=\"242\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 6<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">As these triangles can generate a wrong path, we have removed them by imposing constraints, <span style=\"font-family: monospace;\">C<\/span>. These constraints are the vertex IDs of constrained edges, specified as a 2-column matrix. Each row of <span style=\"font-family: monospace;\">C<\/span> corresponds to a constrained edge and contains two IDs:<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><span style=\"font-family: monospace;\">C(j,1)<\/span> is the ID of the vertex at the start of an edge.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><span style=\"font-family: monospace;\">C(j,2)<\/span> is the ID of the vertex at end of the edge.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">As an example, Figure 7 shows the vertex IDs of the constrained edges where the matrix <span style=\"font-family: monospace;\">C = [2 1;1 3;3 5;5 6;2 4;4 6].<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 440px; height: 261px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_7.png\" alt=\"\" width=\"440\" height=\"261\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 7<\/div>\r\n<div id=\"H_941B408D\" style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">So now we have defined the constraints for the inner and outer boundaries.<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% inner and outer constraints when the interval is even<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0e00ff;\">if <\/span>rem(interv,2) == 0<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> cIn = [2 1;(1:2:mc-3)' (3:2:(mc))'; (mc-1) mc];<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> cOut = [(2:2:(mc-2))' (4:2:mc)'];<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0e00ff;\">else<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% inner and outer constraints when the interval is odd<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> cIn = [2 1;(1:2:mc-2)' (3:2:(mc))'; (mc-1) mc];<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> cOut = [(2:2:(mc-2))' (4:2:mc)'];<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0e00ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> C = [cIn;cOut]; <span style=\"color: #008013;\">% create a matrix connecting the constraint boundaries<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<\/div>\r\n<ul id=\"H_E7B28405\" style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\"><span style=\"font-weight: bold;\">Create Delaunay triangulation with constraints<\/span><\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Once we have defined the constraints, we have used the <a href=\"https:\/\/in.mathworks.com\/help\/matlab\/ref\/delaunaytriangulation.html\"><span style=\"font-family: monospace;\">delaunayTriangulation<\/span><\/a> object to create 2-D Delaunay triangulations.<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; border: 1px solid #bfbfbf;\"><span style=\"white-space: pre;\"> TR = delaunayTriangulation(Pl,C); <span style=\"color: #008013;\">% Delaunay triangulation with constraints<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Before we move to the next step, it is important to introduce you to the 'Connectivity List.' This property will be used in the subsequent steps to create a new triangulation by excluding the exterior triangles.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">As per the <a href=\"https:\/\/in.mathworks.com\/help\/matlab\/ref\/delaunaytriangulation.html\">documentation<\/a>, the triangulation connectivity list is a matrix with the following characteristics:<\/div>\r\n<ul style=\"margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;\">\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Each element in <span style=\"font-family: monospace;\">DT.ConnectivityList<\/span> is a vertex ID.<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Each row represents a triangle or tetrahedron in the triangulation.<\/li>\r\n \t<li style=\"margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;\">Each row number of <span style=\"font-family: monospace;\">DT.ConnectivityList<\/span> is a triangle or tetrahedron ID.<\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">For example, in Figure 8 the elements of the first row <span style=\"font-family: monospace;\">[2 1 3] <\/span>represent the vertices of the first triangle.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 508px; height: 310px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_8.png\" alt=\"\" width=\"508\" height=\"310\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 8<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Now that you understood the meaning of the connection list, let us output the connectivity list of <span style=\"font-family: monospace;\">TR<\/span>.<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; border: 1px solid #bfbfbf;\"><span style=\"white-space: pre;\"> TRC = TR.ConnectivityList; <span style=\"color: #008013;\">% triangulation connectivity matrix<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Once you have listed the connectivity matrix, we need to remove the rows that construct exterior triangles. Figure 9 shows that the second row <span style=\"font-family: monospace;\">[1 5 3] <\/span>represents an exterior triangle.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 492px; height: 254px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_9.png\" alt=\"\" width=\"492\" height=\"254\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 9<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">With the <span style=\"font-family: monospace;\">delaunayTriangulation<\/span> object, you can perform a variety of topological and geometric queries. For our case, we have used the object function <a href=\"https:\/\/in.mathworks.com\/help\/matlab\/ref\/delaunaytriangulation.isinterior.html\"><span style=\"font-family: monospace;\">isInterior<\/span><\/a><span style=\"font-family: monospace;\"> which <\/span>returns a column vector of logical values that indicate whether the triangles are inside a bounded geometric domain. The ith triangle in the triangulation is considered to be inside the domain if the ith logical flag is true, otherwise, it is outside. For example, as shown in Figure 10, the exterior triangle is assigned to the logical value <span style=\"font-family: monospace;\">0 <\/span>or<span style=\"font-family: monospace;\"> false<\/span>.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 605px; height: 280px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_10.png\" alt=\"\" width=\"605\" height=\"280\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 10<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> TL = isInterior(TR); <span style=\"color: #008013;\">% logical values that indicate whether the triangles are inside the bounded region<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> TC = TR.ConnectivityList(TL,:); <span style=\"color: #008013;\">% triangulation connectivity matrix<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<h3 id=\"H_500A0917\" style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\"><\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">From the previous step, we have obtained a new connectivity matrix that doesn't contain the exterior triangles. So now in this step, we have used the updated connectivity matrix <span style=\"font-family: monospace;\">TC <\/span>to create 2-D triangulation using the points in matrix <span style=\"font-family: monospace;\">Pl. <\/span><\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> [~,pt] = sort(sum(TC,2)); <span style=\"color: #008013;\">% optional step. The rows of connectivity matrix are arranged in ascending sum of rows...<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% This ensures that the triangles are connected in progressive order.<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> TS = TC(pt,:); <span style=\"color: #008013;\">% connectivity matrix based on ascending sum of rows<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> TO = triangulation(TS,Pl); <span style=\"color: #008013;\">% create triangulations based on sorted connectivity matrix<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> figure(2) <span style=\"color: #008013;\">% plot delaunay triangulations<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> triplot(TO,<span style=\"color: #a709f5;\">'k'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> grid <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ax = gca;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ax.GridColor = [0, 0, 0]; <span style=\"color: #008013;\">% [R, G, B]<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xlabel(<span style=\"color: #a709f5;\">'x(m)'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ylabel(<span style=\"color: #a709f5;\">'y (m)'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> set(gca,<span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#EEEEEE'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> title(<span style=\"color: #a709f5;\">'Delaunay Triangulation without Outliers'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<\/div>\r\n<h4 id=\"H_76AD97E6\" style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\">Step 3: Find midpoints of internal edges<\/h4>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Once we have removed the outliers, the next step is straightforward. We just need to compute the midpoint of the internal edges.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 566px; height: 208px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_11.png\" alt=\"\" width=\"566\" height=\"208\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 11<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xPo = TO.Points(:,1);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> yPo = TO.Points(:,2);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> E = edges(TO); <span style=\"color: #008013;\">% triangulation edges<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> iseven = rem(E, 2) == 0; <span style=\"color: #008013;\">% neglect boundary edges<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> Eeven = E(any(iseven,2),:);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> isodd = rem(Eeven,2) ~=0;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> Eodd = Eeven(any(isodd,2),:);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xmp = ((xPo((Eodd(:,1))) + xPo((Eodd(:,2))))\/2); <span style=\"color: #008013;\">% x coordinate midpoints<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ymp = ((yPo((Eodd(:,1))) + yPo((Eodd(:,2))))\/2); <span style=\"color: #008013;\">% y coordinate midpoints<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> Pmp = [xmp ymp]; <span style=\"color: #008013;\">% midpoint coordinates<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<h4 id=\"H_03C2C226\" style=\"margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;\">Step 4: Interpolate midpoints<\/h4>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Finally, to obtain a smooth path we have performed interpolation.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 590px; height: 220px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_12.png\" alt=\"\" width=\"590\" height=\"220\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 12<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> distancematrix = squareform(pdist(Pmp));<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> distancesteps = zeros(length(Pmp)-1,1);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0e00ff;\">for <\/span>j = 2:length(Pmp)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> distancesteps(j-1,1) = distancematrix(j,j-1);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0e00ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> totalDistance = sum(distancesteps); <span style=\"color: #008013;\">% total distance travelled<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> distbp = cumsum([0; distancesteps]); <span style=\"color: #008013;\">% distance for each waypoint<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> gradbp = linspace(0,totalDistance,100);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xq = interp1(distbp,xmp,gradbp,<span style=\"color: #a709f5;\">'spline'<\/span>); <span style=\"color: #008013;\">% interpolate x coordinates<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> yq = interp1(distbp,ymp,gradbp,<span style=\"color: #a709f5;\">'spline'<\/span>); <span style=\"color: #008013;\">% interpolate y coordinates<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xp = [xp xq]; <span style=\"color: #008013;\">% store obtained x midpoints after each iteration<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> yp = [yp yq]; <span style=\"color: #008013;\">% store obtained y midpoints after each iteration<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<\/div>\r\n<div id=\"H_3E2ACE02\" style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><span style=\"font-weight: bold;\">Plot results<\/span><\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> figure(3)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% subplot<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> pos1 = [0.1 0.15 0.5 0.7];<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> subplot(<span style=\"color: #a709f5;\">'Position'<\/span>,pos1)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> pathPlanPlot(innerConePosition,outerConePosition,P,DT,TO,xmp,ymp,cIn,cOut,xq,yq)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> title([<span style=\"color: #a709f5;\">'Path planning based on constrained Delaunay' <\/span>newline <span style=\"color: #a709f5;\">' triangulation'<\/span>])<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #008013;\">% subplot<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> pos2 = [0.7 0.15 0.25 0.7];<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> subplot(<span style=\"color: #a709f5;\">'Position'<\/span>,pos2)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> pathPlanPlot(innerConePosition,outerConePosition,P,DT,TO,xmp,ymp,cIn,cOut,xq,yq)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xlim([min(min(xPo(1:2:(mc-1)),xPo(2:2:mc))) max(max(xPo(1:2:(mc-1)),xPo(2:2:mc)))])<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ylim([min(min(yPo(1:2:(mc-1)),yPo(2:2:mc))) max(max(yPo(1:2:(mc-1)),yPo(2:2:mc)))])<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">h = legend(<span style=\"color: #a709f5;\">'yCone'<\/span>,<span style=\"color: #a709f5;\">'bCone'<\/span>,<span style=\"color: #a709f5;\">'start'<\/span>,<span style=\"color: #a709f5;\">'midpoint'<\/span>,<span style=\"color: #a709f5;\">'internal edges'<\/span>,<span style=\"color: #0e00ff;\">...<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #a709f5;\">'inner boundary'<\/span>,<span style=\"color: #a709f5;\">'outer boundary'<\/span>,<span style=\"color: #a709f5;\">'planned path'<\/span>);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">Pp = [xp' yp']; <span style=\"color: #008013;\">% concatenated planned path<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline; width: 448px; height: 336px;\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3_13.gif\" alt=\"pathPlanningGIF.gif\" width=\"448\" height=\"336\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;\">Figure 13<\/div>\r\n<h3 id=\"H_1903E92B\" style=\"margin: 3px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">What next?<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">So, the algorithm only computes the path through the cones. However, in Formula Student Driverless competitions, the vehicle needs to simultaneously plan and track the path in the first lap. Hence as a next task, you can try to implement a trajectory tracking controller. Here is a tutorial that shows how to implement trajectory tracking controllers in MATLAB and Simulink: <a href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2022\/05\/23\/simulating-trajectory-tracking-controllers-for-driverless-cars\/\"><span style=\"text-decoration: underline;\">Simulating Trajectory Tracking Controllers for Driverless Cars<\/span><\/a>.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Further, if you are interested to generate an optimized raceline please feel free to check out this GitHub repository from <a href=\"https:\/\/www.linkedin.com\/in\/gautam-shetty-891904187\/\">Gautam Shetty<\/a>: <a href=\"https:\/\/github.com\/putta54\/MW208_Raceline_Optimization\/tree\/94e9a6e9fb23d14f9718b5472682fb379cc6c130\">Raceline Optimization.<\/a><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Also, in case of any queries related to this blog please feel free to reach out to us at <a href=\"http:\/\/racinglounge@mathworks.com\/\">racinglounge@mathworks.com<\/a>.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"background-color: #f5f5f5; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 1px solid #bfbfbf; border-bottom: 0px none #212121; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">function <\/span>y = pathPlanPlot(innerConePosition,outerConePosition,P,DT,TO,xmp,ymp,cIn,cOut,xq,yq) <span style=\"color: #008013;\">%function to animate the plot<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(innerConePosition(:,1),innerConePosition(:,2),<span style=\"color: #a709f5;\">'.y'<\/span>,<span style=\"color: #a709f5;\">'MarkerFaceColor'<\/span>,<span style=\"color: #a709f5;\">'y'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(outerConePosition(:,1),outerConePosition(:,2),<span style=\"color: #a709f5;\">'.b'<\/span>,<span style=\"color: #a709f5;\">'MarkerFaceColor'<\/span>,<span style=\"color: #a709f5;\">'b'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(P(1,1),P(1,2),<span style=\"color: #a709f5;\">'|'<\/span>,<span style=\"color: #a709f5;\">'MarkerEdgeColor'<\/span>,<span style=\"color: #a709f5;\">'#77AC30'<\/span>,<span style=\"color: #a709f5;\">'MarkerSize'<\/span>,15, <span style=\"color: #a709f5;\">'LineWidth'<\/span>,5) <\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> grid <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ax = gca;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ax.GridColor = [0, 0, 0]; <span style=\"color: #008013;\">% [R, G, B]<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> xlabel(<span style=\"color: #a709f5;\">'x(m)'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> ylabel(<span style=\"color: #a709f5;\">'y (m)'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> set(gca,<span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#EEEEEE'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(xmp,ymp,<span style=\"color: #a709f5;\">'*k'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> drawnow<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> triplot(TO,<span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#0072BD'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> drawnow<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(DT.Points(cOut',1),DT.Points(cOut',2), <span style=\"color: #0e00ff;\">...<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#7E2F8E'<\/span>,<span style=\"color: #a709f5;\">'LineWidth'<\/span>,2)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(DT.Points(cIn',1),DT.Points(cIn',2), <span style=\"color: #0e00ff;\">...<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#7E2F8E'<\/span>,<span style=\"color: #a709f5;\">'LineWidth'<\/span>,2)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> drawnow<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> hold <span style=\"color: #a709f5;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> plot(xq,yq,<span style=\"color: #a709f5;\">'Color'<\/span>,<span style=\"color: #a709f5;\">'#D95319'<\/span>,<span style=\"color: #a709f5;\">'LineWidth'<\/span>,3)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 0px none #212121; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> drawnow <\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #bfbfbf; border-right: 1px solid #bfbfbf; border-top: 0px none #212121; border-bottom: 1px solid #bfbfbf; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: #212121; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0e00ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><span style=\"font-style: italic;\">Copyright 2022 The MathWorks, Inc.<\/span><\/div>\r\n<\/div>\r\n\r\n\r\n<script type=\"text\/javascript\">var css = ''; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text\/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }<\/script><a href=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/22oct3.mlx\"><button class=\"btn btn-sm btn_color_blue pull-right add_margin_10\">Download Live Script<\/button><\/a><div class=\"pull-right\"><div class=\"col-xs-12 containing-block\"><a href=\"#\" class=\"btn btn-sm btn_color_blue add_margin_20  hidden-xs try_live_editor_example\" data-liveeditorexample=\"{\n  &quot;repository&quot; : &quot;Blogs&quot;,\n  &quot;id&quot; : &quot;\/student-lounge\/files\/2022\/10\/22oct3.mlx&quot;\n}\"><span class=\"icon-edit icon_16\"><\/span>Run in your browser<span style=\"color:grey\" class=\"series\"><\/span><\/a><\/div><\/div>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2022\/10\/pathPlanningGIF.gif\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>\r\nIn this blog, Veer Alakshendra will show how you can develop a basic path planning algorithm for Formula Student Driverless competitions.\r\nBefore we get started, we just want to mention that you... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2022\/10\/03\/path-planning-for-formula-student-driverless-cars-using-delaunay-triangulation\/\">read more >><\/a><\/p>","protected":false},"author":183,"featured_media":8879,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[30,512,80,515],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/8762"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/users\/183"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/comments?post=8762"}],"version-history":[{"count":12,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/8762\/revisions"}],"predecessor-version":[{"id":8910,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/8762\/revisions\/8910"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media\/8879"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media?parent=8762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/categories?post=8762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/tags?post=8762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}