Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a pre-set split option to chunkerfunc #61

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions chunkie/@chunkgraph/chunkgraph.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
obj.verts = verts;
obj.edge2verts = edge2verts;
obj.echnks = chunker.empty;

if nargin < 3
fchnks = [];
end

if (nargin < 4)
cploc = [];
Expand Down
39 changes: 32 additions & 7 deletions chunkie/chunkerfunc.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
% cparams - curve parameters structure (defaults)
% cparams.ta = left end of t interval (0)
% cparams.tb = right end of t interval (2*pi)
% cparams.tsplits = set of initial break points for discretization in
% parameter space (should be in [ta,tb])
% cparams.ifclosed = flag determining if the curve
% is to be interpreted as a closed curve (true)
% cparams.chsmall = max size of end intervals if
Expand Down Expand Up @@ -139,19 +141,42 @@

ab = zeros(2,nchmax);
adjs = zeros(2,nchmax);
ab(1,1)=ta;
ab(2,1)=tb;
nch=1;

if (isfield(cparams,'tsplits'))
tsplits = cparams.tsplits;
tsplits = [tsplits(:); ta; tb];
else
tsplits = [ta;tb];
end

tsplits = sort(unique(tsplits),'ascend');
lab = length(tsplits);
if (lab-1 > nchmax)
error(['nchmax exceeded in chunkerfunc on initial splits.\n ',...
'try increasing nchmax in preference struct']);
end
if (any(tsplits > tb) || any(tsplits < ta))
error(['tsplits outside of interval of definition.\n', ...
'check definition of splits, ta and tb']);
end

ab(1,1:(lab-1)) = tsplits(1:end-1);
ab(2,1:(lab-1)) = tsplits(2:end);

nch=lab-1;
adjs(1,1:nch) = 0:(nch-1);
adjs(2,1:nch) = 2:(nch+1);

if ifclosed
adjs(1,1)=1;
adjs(2,1)=1;
adjs(1,1)=nch;
adjs(2,nch)=1;
else
adjs(1,1)=-1;
adjs(2,1)=-1;
adjs(2,nch)=-1;
end
nchnew=nch;

maxiter_res=nchmax;
maxiter_res=nchmax-nch;

rad_curr = 0;
for ijk = 1:maxiter_res
Expand Down
Loading