Avatar

Liegen die Orte innerhalb oder außerhalb des Gebiets? (Geodäsie/Vermessung)

MichaeL ⌂, Bad Vilbel, Wednesday, 13.03.2019, 20:39 (vor 1833 Tagen) @ Eckart Müller

Hallo Eckart,

ich reduziere es mal auf den Teil, den ich meine verstanden zu haben. Du möchtest prüfen, ob ein Punkt (oder mehrere) in einem Gebiet liegen (oder eben nicht). Dein Suchwort lautet "Point-In-Polygon"-Test, z.B. Wikipedia. Andy Wolf und ich haben im Rahmen unserer Abschlußarbeit auch eine Routine hierzu geschrieben, die ich hier mal anfüge. Vielleicht ist es hilfreich:

% Fuction PointInPolygon
% @author A.Wolf & M.Loesler
% @version 2.0 
% 
 
function isPointinPolygon = PointInPolygon(y,x, Yhull, Xhull);
  if (size(Xhull) == size(Yhull))
      ax = Xhull(length(Xhull));
      ay = Yhull(length(Yhull));
      alpha = 0;
      isPointinPolygon = false;
 
      for i=1:length(Xhull)
          bx = Xhull(i);
          by = Yhull(i);
          if (bx == x && by == y)
              alpha = 400;
              break;
          end
 
          %        (Sy,Sx,Zy,Zx)
          sr = riwi(y , x,ay,ax);
          er = riwi(y , x,by,bx);
 
          if (sr > 200)
              sr = sr - 400;
          end
 
          if (er > 200)
              er = er - 400;
          end
 
          if ((sr < 0 && er < 0) || (sr > 0 && er > 0))
 
              dw = er - sr
              if (dw > 0)
                  dw = dw - 400;
              end
              dw
          else    
 
              dw = mod((er - sr + 400),400);
 
              if (dw > 0)
                  dw = dw - 400;
              end
          end
 
          dw = mod(dw,400)
 
          if (dw == 200)
              alpha = 400;
              break;
          end
 
          if (dw > 200)
              dw = dw - 400;
          end
 
          alpha = alpha + dw;
          ax = bx;
          ay = by;
      end
 
      if (abs(abs(alpha)-400) < 1.0e-003)
         isPointinPolygon = true;
      end
 
      return;
  else
      error('Hülle ist nicht korrekt');
  end
  return;


Viele Grüße

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences


gesamter Thread:

 RSS-Feed dieser Diskussion