-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing more chnkr.h issues and adding test for arclengthfun
- Loading branch information
Showing
10 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
adj = chnkr.adj; | ||
d = chnkr.d; | ||
d2 = chnkr.d2; | ||
h = chnkr.h; | ||
|
||
[~,~,u] = lege.exps(k); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ | |
|
||
obj.wts = weights(obj); | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
function wchnk = whts(chnkr) | ||
function wts = whts(chnkr) | ||
|
||
|
||
warning('whts is deprecated and will be removed, use weights instead'); | ||
|
||
k = chnkr.k; | ||
nch = chnkr.nch; | ||
[~,w] = lege.exps(k); | ||
wchnk = reshape(sqrt(sum((chnkr.d).^2,1)),k,nch); | ||
wchnk = wchnk.*bsxfun(@times,w(:),(chnkr.h(:)).'); | ||
w = chnkr.wstor; | ||
wts = reshape(sqrt(sum((chnkr.d).^2,1)),k,nch); | ||
wts = wts.*w(:); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
%ARCLENGTHFUNTEST tests the arclengthfun routine for computing distance | ||
% along length of curve | ||
% | ||
|
||
clearvars; close all; | ||
seed = 8675309; | ||
rng(seed); | ||
addpaths_loc(); | ||
|
||
% geometry parameters and construction | ||
|
||
|
||
cparams = []; | ||
cparams.eps = 1.0e-9; | ||
pref = []; | ||
pref.k = 16; | ||
narms = 0; | ||
amp = 0.0; | ||
start = tic; chnkr = chunkerfunc(@(t) starfish(t,narms,amp),cparams,pref); | ||
|
||
[s, ~, chnkr] = arclengthfun(chnkr); | ||
% Compare to analytic arclength for circle | ||
ts = squeeze(atan2(chnkr.r(2,:,:), chnkr.r(1,:,:))); | ||
ts(ts<0) = ts(ts<0) + 2*pi; | ||
assert(norm(s-ts) < 1e-12); | ||
|
||
% Now test two circles | ||
chnkrs(2) = chunker(); | ||
chnkrs(1) = chnkr; | ||
rfac = 1.1; | ||
chnkrs(2) = move(chnkr, [0;0], [3;0], 0, rfac); | ||
chnkrtotal = merge(chnkrs); | ||
[s, nchs, ~] = arclengthfun(chnkrtotal); | ||
|
||
assert(norm(s(:,1:nchs(1)) - ts) < 1e-12); | ||
assert(norm(s(:,nchs(1)+1:end) - rfac*ts) < 1e-12); |