본문 바로가기

연구

DelaunayTri neibor 찾기

 x = rand(10,1);
y = rand(10,1);
dt = DelaunayTri(x,y)

dt =

  DelaunayTri

  Properties:
      Constraints: []
                X: [10x2 double]
    Triangulation: [12x3 double]

  Methods, Superclasses

>> triplot(dt);
%
% Display the Vertex and Triangle labels on the plot
hold on
vxlabels = arrayfun(@(n) {sprintf('P%d', n)}, (1:10)');
Hpl = text(x, y, vxlabels, 'FontWeight', 'bold', 'HorizontalAlignment',...
           'center', 'BackgroundColor', 'none');
ic = incenters(dt);
numtri = size(dt,1);
trilabels = arrayfun(@(x) {sprintf('T%d', x)}, (1:numtri)');
Htl = text(ic(:,1), ic(:,2), trilabels, 'FontWeight', 'bold', ...
      'HorizontalAlignment', 'center', 'Color', 'blue');
hold off
>> dt.Triangulation

ans =

     8     2     7
    10     6     9
     4     8     7
    10     3     5
     8    10     2
    10     5     2
     3     1     5
     4    10     8
     4     6    10
    10     9     3
     9     1     3
     9     6     1

>> n1 = neighbors(dt,1)

n1 =

   NaN     3     5


neighbors(dt,1) 하면 T1의 이웃 삼각형인 T3,T5와 경계이무로 NaN이 나온다.



'연구' 카테고리의 다른 글

Understanding Quaternions  (0) 2012.07.20
matlab 화일 접근 pose ground truth 가져오기  (0) 2012.07.16
windows 7 usb로 설치하기  (0) 2012.07.06
참조변수  (0) 2012.04.03
# 복사생성자의 호출시점  (0) 2012.02.01