The "alphaShape" is doing right its duty. to check this, you can use "plot(shp)" in the last line of the CODE. The problem is, Delaunay Triangulation is making extra triangles on each letter that these extra triangles are very large in comparison to others.
How to create Boundary Recognition and Region Triangulation concurrently?
1 view (last 30 days)
Show older comments
Hi guys. How can I fix my code to use Delaunay triangulation by applying alphaShape to just triangulate inside the letters? my code is triangulating the convex-hull of every letter.
Clearly, I want to make a triangulation for every letter by using Delaunay Triangulation and AlphaShape Functions. My m file and xls file are attached here.
My CODE:
close all
clear all
clc
P = xlsread('input.xlsx',1,'A1:B681');
shp = alphaShape(P);
nor = shp.numRegions;
for i = 1 : nor % i = RegionID
[trs{i}, pts{i}] = alphaTriangulation(shp,i);
end
for j = 1 : nor
DT = delaunayTriangulation(pts{1,j}); % DT = delaunayTriangulation(P,C)
IC = incenter(DT);
triplot(DT,'r');
axis ([-100 12000 -100 3500])
grid on
hold on
plot(IC(:,1),IC(:,2),'.r','MarkerSize',10)
hold on
plot(DT.Points(:,1),DT.Points(:,2),'.b','MarkerSize',20)
hold on
k = convexHull(DT);
xHull = DT.Points(k,1);
yHull = DT.Points(k,2);
% plot(xHull,yHull,'k','LineWidth',2)
end
Answers (0)
See Also
Categories
Find more on Delaunay Triangulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!