-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmStat_sinuosity.m
executable file
·65 lines (58 loc) · 2.85 KB
/
mStat_sinuosity.m
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function [sinuosityOfBends, lengthStraight, lengthCurved] = ...
sinuosity2(intS, nBends, newInflectionPts)
% This function finds the sinuosity of each individual bend in the
% graphical output plot (i.e. the length along the given centerline
% divided by the length of the chord centerline between the inflection
% points). It outputs the sinuosity of each curve as a vector
% called "sinuosityOfBends" and also outputs the curved legnth of the
% bends in "lengthCurved" and the chord length of the bends in
% "lengthStraight".
%
% Last Modifed: October, 2017 by Dominguez Ruben L.
%--------------------------------------------------------------------------
% First, find the curved length between the limit points following the
% given (blue) centerline.
%
% Note: The starting and ending limits for the individual bend are
% already computed in the main code and are given by the
% inflection points along the resampled data centerline (blue).
% These limit points are stored as S-ordintates in the "inflectionS"
% structure.
% This process loops through inflectionS and calculates the
% distance along the blue centerline between the limit
% points of each individual bend. Then, it displays the resulting,
% curved lengths in the secondary window.
j = 1;
for i = 2:nBends+1
lengthCurved(j) = intS(i) - intS(i-1);
j=j+1;
end
%--------------------------------------------------------------------------
% Next, the distance between the inflection points of the individual
% bends along a constructed chord are found.
%
% Note: in order to find the straight distance along the chord,
% centerline, the x,y coordinates of the inflection points
% for each bend must be known. These x,y coordinates are contained
% in the "newInflectionPts" structure from the main code.
%
% This process circulates through the river data and calculates the
% distance between the limiting inflection points of each individual
% bend. These are the chord lengths of each bend.
j = 1;
lengthStraight = zeros(length(nBends));
for i = 2:nBends+1
lengthStraight(j) = sqrt((newInflectionPts(i,1) - newInflectionPts(i-1,1)).^(2)...
+ (newInflectionPts(i,2) - newInflectionPts(i-1,2)).^(2));
j = j+1;
end
%--------------------------------------------------------------------------
% Finally, the sinuosity of each individual bend can be calculated as
% the curved length divided by the length along the wavelet filter
% centerline. The sinuosity values for each bend are stored in the
% structure "sinuosityOfBends".
for j = 1:nBends
sinuosityOfBends(j) = lengthCurved(j) / lengthStraight(j);
end
sinuosityOfBends = sinuosityOfBends.';
%--------------------------------------------------------------------------