2010/03/15
주어진 점이 다각형에 포함되는지 확인하기
function PtInPoly
(const Points: Array of TPoint; X,Y: Integer):
Boolean;
var Count, K, J : Integer;
begin
Result := False;
Count := Length(Points) ;
J := Count-1;
for K := 0 to Count-1 do begin
if ((Points[K].Y <=Y) and (Y < Points[J].Y)) or
((Points[J].Y <=Y) and (Y < Points[K].Y)) then
begin
if (x < (Points[j].X - Points[K].X) *
(y - Points[K].Y) /
(Points[j].Y - Points[K].Y) + Points[K].X) then
Result := not Result;
end;
J := K;
end;
end;
출처 : http://delphi.about.com/cs/adptips2001/a/bltip0601_5.htm<
Original Post : http://neodreamer-dev.tistory.com/381
Labels:
polygon
,
PtInPoly
,
TistoryOldPost
,
다각형
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment