Changeset 1131


Ignore:
Timestamp:
06/26/09 13:48:40 (16 years ago)
Author:
Mathieu Morlighem
Message:

Added refining

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/utils/Exp/expcoarsen.m

    r1093 r1131  
    3737
    3838        %stop if we have reached end of profile (always keep the last point)
    39         while j<numpoints-1,,
     39        while j<numpoints,
    4040
    4141                %See whether we keep this point or not
    42                 if sqrt((A(i).x(j)-A(i).x(j+1))^2+(A(i).y(j)-A(i).y(j+1))^2)<resolution
     42                distance=sqrt((A(i).x(j)-A(i).x(j+1))^2+(A(i).y(j)-A(i).y(j+1))^2);
     43                if distance<resolution & j<numpoints-1  %do not remove last point
    4344                        A(i).x(j+1)=[];
    4445                        A(i).y(j+1)=[];
    4546                        numpoints=numpoints-1;
    4647                else
    47                         %update current point
    48                         j=j+1;
     48                        division=floor(distance/resolution)+2;
     49                        if division>2,
     50                                x=linspace(A(i).x(j),A(i).x(j+1),division)';
     51                                y=linspace(A(i).y(j),A(i).y(j+1),division)';
     52                                A(i).x=[A(i).x(1:j);x(2:end-1); A(i).x(j+1:end)];
     53                                A(i).y=[A(i).y(1:j);y(2:end-1); A(i).y(j+1:end)];
     54
     55                                %update current point
     56                                j=j+1+division-2;
     57                                numpoints=numpoints+division-2;
     58                        else
     59                                %update current point
     60                                j=j+1;
     61                        end
    4962                end
    5063        end
Note: See TracChangeset for help on using the changeset viewer.