splitting a shape into triangles

Asked by Nasser Ramsis

Nasser Ramsis (view profile)

on 21 Dec 2016
Latest activity Commented on by José-Luis

José-Luis (view profile)

on 21 Dec 2016
Hello,
I'm writing a code to optimize some dimensions for a wing i'm designing. As part of the code i need to split up a 2D airfoil into triangles. I used a Delaunay triangulation and all the points are connected to 1 point. This is the code segment so far:
chord = 0.25;
nacanum = 12;
t = nacanum/100;
x=0:0.01:chord;
distratio = x/chord;
yt = 5*t*(0.2969*sqrt(distratio)-0.126*distratio-0.3516*distratio.^2+0.2843*distratio.^3-0.1015*distratio.^4);
at=delaunayTriangulation(x',yt');
tr=delaunay(x,yt);
triplot(at,x,yt);
triplot(tr,x,yt);
using delaunay and delaunay triangulation seem to plot the same figure but they appear somewhat different in the workspace can anyone explain what the difference is?
Also, all the points are connected to an origin point (1)
how can i change that? as in I want it to create the triangles side by side sharing only 1 or 2 points as opposed to all the triangles sharing an origin point. ( i hope that makes sense)

José-Luis

José-Luis (view profile)

on 21 Dec 2016
at and tr are exactly the same. Note that this is by no means a guarantee since the results of a Delaunay triangulation might not be unique. What happens is that you are overwriting your plot. Try hold on, subplot() or an altogether different figure.
Nasser Ramsis

Nasser Ramsis (view profile)

on 21 Dec 2016
I realized the delaunay functions just number the points and connect them (i think). so i wrote this segment to create the same numbering but it wont plot.
for i=1:1:length(x)
for j= 1:1:3
tr(i,j)= i-1;
end
end
for i=1:1:length(x)
tr(i,3)=i;
end
José-Luis

José-Luis (view profile)

on 21 Dec 2016
I don't understand. What are you trying to accomplish here? Did you try what KSSV suggests?
{"ft_lang_label":"__label__en","ft_lang_prob":0.78130656,"math_prob":0.7863877,"size":1468,"snap":"2019-43-2019-47","text_gpt3_token_len":431,"char_repetition_ratio":0.11338798,"word_repetition_ratio":0.083798885,"special_character_ratio":0.27179837,"punctuation_ratio":0.15614618,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9637421,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-10-14T10:28:41Z\",\"WARC-Record-ID\":\"<urn:uuid:ab647bed-40d4-41c5-b36d-8a401b0fa9f7>\",\"Content-Length\":\"105877\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9f4373c6-f424-4b48-9a8a-0950f20141c3>\",\"WARC-Concurrent-To\":\"<urn:uuid:2ba2d166-4859-4515-b61c-16a453f31fe8>\",\"WARC-IP-Address\":\"104.110.193.39\",\"WARC-Target-URI\":\"https://www.mathworks.com/matlabcentral/answers/317689-splitting-a-shape-into-triangles?s_tid=prof_contriblnk\",\"WARC-Payload-Digest\":\"sha1:LGAUYPTEOFKBETTE6Y7VVC5LNHGOA2V3\",\"WARC-Block-Digest\":\"sha1:F4MGRGTIRGLR3I7YRK23ATJTBGMILPDR\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-43/CC-MAIN-2019-43_segments_1570986653216.3_warc_CC-MAIN-20191014101303-20191014124303-00477.warc.gz\"}"}