-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakeTesselatedPlane.m
More file actions
41 lines (34 loc) · 941 Bytes
/
MakeTesselatedPlane.m
File metadata and controls
41 lines (34 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%% Generates a tesselated plane using Delaunay triangulation.
%
% ARGUMENTS:
% n -- <description>
%
% OUTPUT:
% Vertices -- <description>
% Triangles --
%
% REQUIRES:
% DelaunayTri() -- Not yet available in Octave...
%
% USAGE:
%{
<example-commands-to-make-this-function-run>
%}
%
% MODIFICATION HISTORY:
% SAK(29-09-2010) -- Original.
% SAK(Nov 2013) -- Move to git, future modification history is
% there...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Vertices Triangles]=MakeTesselatedPlane(n)
% Set any argument that weren't specified
if nargin < 1,
n = 10;
end
%
[X Y] = ind2sub(size(ones(n)), find(ones(n)));
DT = DelaunayTri(X,Y);
Triangles = DT.Triangulation;
Vertices = [X Y ones(size(X))];
%TR = TriRep(DT.Triangulation, X, Y, ones(size(X)));
end %function MakeTesselatedPlane()