2 %vorCellColour Determine the Voronoi diagram of the input
data, and colour the
3 %cells
with the value of the orientational correlations defined
at each
7 % avoid too large values to ensure the traingulation does not
run off to
9 %
edgeCol: Defines the Voronoi diagram edge colours
for edge indexed pair.
edgeCol<0
is 12 %
colScheme: defines the colouring scheme, 1
for orientational correlations
on the
site 14 % Returns: p6cp6 = local values of correlations
16 % avg_area = average area of cells
17 % num_edges = cell edges count
20 %Testcase: Generate a 2D grid centred on 0 and calculate voronoi diagram
21 % x=linspace(-1,1,20);
y=
x;
23 %
voronoi2dCellColour(kron(
x',ones(length(y),1)),kron(ones(length(x),1),y'),0.75,
zeros(
length(
x)^2,1),1,0);
25 DT = delaunayTriangulation([
x y]);
26 [v,c]=voronoiDiagram(
DT);
37 %Credit to MathWorks support team
for neighboringVertices.m
40 % 2. Use the connectivity list to
get the vertex indices of all these
43 % 3. Find all the unique vertices and
remove the
current vertex
47 % Calculate the Voronoi diagram
49 %Credit to MathWorks team
for voronoi examples. https:
51 % then it
is an open region and we can
't patch that. 53 area(jj)=polyarea(v(c{jj},1),v(c{jj},2)); 54 avg_area = avg_area + area(jj); 56 [p6(jj),nn(jj)] = psi6_DT([x(jj),y(jj)],x(neighboursOfInternal{jj}),y(neighboursOfInternal{jj})); 57 p6cp6(jj) = sum(conj(p6(jj)).*p6(jj)); 58 h = patch(v(c{jj},1),v(c{jj},2),p6cp6(jj)); % use g6 as color 60 h = patch(v(c{jj},1),v(c{jj},2),area(jj)); % use area as color 67 h.EdgeColor =
'black';
70 h.EdgeColor =
'white';
83 set(gca,
'FontName',
'Latin Modern Roman',
'FontSize',22);
84 set(gca,
'TickLabelInterpreter',
'latex');
and colour the % cells with the value of the orientational correlations defined at each % or with the area of the edgeCol is white % dx
end % Calculate the Voronoi diagram for jj
and colour the % cells with the value of the orientational correlations defined at each % or with the area of the y
% Calculate delaunay triangulation
and colour the % cells with the value of the orientational correlations defined at each % or with the area of the edgeCol
ylabel(' $y$(m)', 'Interpreter', 'latex')
__global__ void zeros(double *field, int n)
Creates a field of all zeros ,.
% Credit to MathWorks support team for neighboringVertices m vTriAtt
end if sqrt(sum([x(ii), y(ii)].^ 2))< radius %% ignore edges if(length(DT.vertexAttachments
def voronoi(dataName, dataType, value)
% Find all the unique vertices and remove the current vertex neighboursOfInternal
and assumes too high and very sparse Start at
% Indexing needs to % be modified if you wish to use the ordered data sets % Calculate the Voronoi diagram of the resulting data
% axis([1e4 1e7 5e-18 1e-10])
xlabel(' $x$(m)', 'Interpreter', 'latex')
and colour the % cells with the value of the orientational correlations defined at each % or with the area of the cell(col=0). % x
% If at least one of the indices is
def run(start, fin, incr)
% voronoi2dCellColour(kron(x', ones(length(y), 1)), kron(ones(length(x), 1), y'), 0.75, zeros(length(x)^ 2, 1), 1, 0)
and colour the % cells with the value of the orientational correlations defined at each % site(col=1)