Mercurial > repos > public > sbplib
annotate +grid/old/max_h.m @ 103:bc5db54f9efd feature/arclen-param
fzero_vec, integral_vec and spline are now local functions in Curve. Renamed arcLengthStretch to arcLengthParametrization. Removed plot_derivative. Added some comments and extra lines + removed unneccesary lines. arcLength is now a method and not static. Constructor does not accept difference operator anymore.
author | Martin Almquist <martin.almquist@it.uu.se> |
---|---|
date | Mon, 07 Dec 2015 17:24:28 +0100 |
parents | 48b6fb693025 |
children |
rev | line source |
---|---|
0 | 1 function [d_max, i1_max, j1_max, i2_max, j2_max] = max_h(X,Y) |
2 ni = size(X,1); | |
3 nj = size(X,2); | |
4 d_max = 0; | |
5 | |
6 i1_max = 0; | |
7 j1_max = 0; | |
8 i2_max = 0; | |
9 j2_max = 0; | |
10 | |
11 D = {[0,-1],[1,0],[0,1],[-1,0]}; | |
12 | |
13 for i = 1:ni | |
14 for j = 1:nj | |
15 p1 = [X(i,j); Y(i,j)]; | |
16 for k = 1:length(D) | |
17 i2 = i+D{k}(1); | |
18 j2 = j+D{k}(2); | |
19 if i2 >= 1 && i2 <= ni && j2 >= 1 && j2 <= nj | |
20 p2 = [X(i2,j2); Y(i2,j2)]; | |
21 d = norm(p2-p1); | |
22 if d > d_max; | |
23 d_max = d; | |
24 i1_max = i; | |
25 j1_max = j; | |
26 i2_max = i2; | |
27 j2_max = j2; | |
28 end | |
29 end | |
30 end | |
31 end | |
32 end | |
33 end |