How to create Boundary Recognition and Region Triangulation concurrently?

2 次查看(过去 30 天)
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
  1 个评论
Ehsan Ben
Ehsan Ben 2018-2-15
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Delaunay Triangulation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by