Back to FabImage Library website
You are here: Start » Function Reference » Path » Polygon Relations » TestPointInPolygon
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Tests whether a point lies inside a polygon.
Syntax
C++
C#
void fil::TestPointInPolygon ( const fil::Point2D& inPoint, const fil::Path& inPolygon, bool& outIsContained )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inPoint | const Point2D& | Point the position of which will be tested | |
![]() |
inPolygon | const Path& | Polygon against which the position will be tested | |
![]() |
outIsContained | bool& | True if point lies inside the polygon, false otherwise |
Description
The operation tests if inPoint lies inside inPolygon.
Due to inaccuracy of floating point representation a point lying extremely close to a path may considered to be on either of the sides of the path or exactly on the path itself.
Examples
![]() |
![]() |
TestPointInPolygon run on the sample data produces the outIsContained = true |
TestPointInPolygon run on the sample data produces the outIsContained = false |
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Empty polygon on input in TestPointInPolygon. |
DomainError | Open path on input in TestPointInPolygon. |
See Also
- TestPolygonInPolygon – Tests whether a polygon lies inside another one.