Hello
doing on Windows some graphic task and having a need to find if mouse click is inside a polygon I use in Delphi !VCL! (not tested under Lazarus):
function PointInPolygon(Point: TPoint; const Polygon: array of TPoint): Boolean;
var
rgn: HRGN;
begin
rgn := CreatePolygonRgn(Polygon[0], Length(Polygon), WINDING);
Result := PtInRegion(rgn, Point.X, Point.Y);
DeleteObject(rgn);
end;
It is not my code but found on stackoverflow.com. The question is (especially in Delphi, but perhaps in Lazarus as well) what about different OS than Windows. Should I find out some algorithm or maybe there already are some libraries that copes with such problems because it is not the only I expect to find.
I only mention that try to write simply prog in FireMonkey...