Skip to content

Commit

Permalink
add new simpler calling sequence if same function for all edges
Browse files Browse the repository at this point in the history
  • Loading branch information
askhamwhat committed Jun 10, 2024
1 parent 9e7b3b3 commit 5d296dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chunkie/@chunkgraph/chunkgraph.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@
fchnks = [];
end

if isa(fchnks,"function_handle")
fchnks0 = fchnks;
fchnks = cell(nedge,1);
for j = 1:nedge
fchnks{j} = fchnks0;
end
end

if (nargin < 4)
cparams = [];
end
Expand Down
13 changes: 13 additions & 0 deletions devtools/test/chunkgraph_basicTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@

assert(all(2*nchs1 == nchs2))

%%

verts = exp(1i*2*pi*(0:4)/5);
verts = [real(verts);imag(verts)];

endverts = [1:5; [2:5 1]];

amp = 0.5;
frq = 6;
fchnks = @(t) sinearc(t,amp,frq);
% simpler calling sequence if all edges same function
cgrph = chunkgraph(verts,endverts,fchnks);

function idstrue = polygonids(cg,xx,yy)

verts = cg.verts;
Expand Down

0 comments on commit 5d296dc

Please sign in to comment.