![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Low-level algorithm for 2D point-in-polygon classification. More...
#include <CSLib_Class2d.hxx>
Public Types | |
| enum | Result { Result_Inside = 1 , Result_Outside = -1 , Result_Uncertain = 0 } |
| Classification result for point-in-polygon tests. More... | |
Public Member Functions | |
| CSLib_Class2d ()=default | |
| Default constructor. Creates an empty classifier. | |
| CSLib_Class2d (const NCollection_Array1< gp_Pnt2d > &thePnts2d, double theTolU, double theTolV, double theUMin, double theVMin, double theUMax, double theVMax) | |
| Constructs a 2D classifier from an array of polygon vertices. | |
| CSLib_Class2d (const NCollection_Sequence< gp_Pnt2d > &thePnts2d, double theTolU, double theTolV, double theUMin, double theVMin, double theUMax, double theVMax) | |
| Constructs a 2D classifier from a sequence of polygon vertices. | |
| CSLib_Class2d (const NCollection_DynamicArray< gp_Pnt2d > &thePnts2d, double theTolU, double theTolV, double theUMin, double theVMin, double theUMax, double theVMax) | |
| Constructs a 2D classifier from a vector of polygon vertices. | |
| CSLib_Class2d (CSLib_Class2d &&theOther) noexcept | |
| Move constructor. | |
| CSLib_Class2d & | operator= (CSLib_Class2d &&theOther) noexcept |
| Move assignment operator. | |
| Result | SiDans (const gp_Pnt2d &thePoint) const |
| Classifies a point relative to the polygon. | |
| Result | SiDans_OnMode (const gp_Pnt2d &thePoint, double theTol) const |
| Classifies a point with explicit ON tolerance. | |
Low-level algorithm for 2D point-in-polygon classification.
This class determines whether a 2D point lies inside, outside, or on the boundary of a closed polygon. It uses a ray-casting algorithm where a horizontal ray from the test point is extended to infinity, and the number of polygon edge crossings determines the classification.
The polygon is internally normalized to [0,1] x [0,1] domain for numerical stability.
|
default |
Default constructor. Creates an empty classifier.
| CSLib_Class2d::CSLib_Class2d | ( | const NCollection_Array1< gp_Pnt2d > & | thePnts2d, |
| double | theTolU, | ||
| double | theTolV, | ||
| double | theUMin, | ||
| double | theVMin, | ||
| double | theUMax, | ||
| double | theVMax ) |
Constructs a 2D classifier from an array of polygon vertices.
The polygon is automatically closed (no need to repeat the first point at the end). Points are normalized internally to the UV bounds for numerical stability.
| [in] | thePnts2d | Array of polygon vertices (minimum 3 points required) |
| [in] | theTolU | Tolerance in U direction for boundary detection |
| [in] | theTolV | Tolerance in V direction for boundary detection |
| [in] | theUMin | Minimum U bound of the polygon domain |
| [in] | theVMin | Minimum V bound of the polygon domain |
| [in] | theUMax | Maximum U bound of the polygon domain |
| [in] | theVMax | Maximum V bound of the polygon domain |
| CSLib_Class2d::CSLib_Class2d | ( | const NCollection_Sequence< gp_Pnt2d > & | thePnts2d, |
| double | theTolU, | ||
| double | theTolV, | ||
| double | theUMin, | ||
| double | theVMin, | ||
| double | theUMax, | ||
| double | theVMax ) |
Constructs a 2D classifier from a sequence of polygon vertices.
Same as the array constructor but accepts a sequence for convenience.
| [in] | thePnts2d | Sequence of polygon vertices (minimum 3 points required) |
| [in] | theTolU | Tolerance in U direction for boundary detection |
| [in] | theTolV | Tolerance in V direction for boundary detection |
| [in] | theUMin | Minimum U bound of the polygon domain |
| [in] | theVMin | Minimum V bound of the polygon domain |
| [in] | theUMax | Maximum U bound of the polygon domain |
| [in] | theVMax | Maximum V bound of the polygon domain |
| CSLib_Class2d::CSLib_Class2d | ( | const NCollection_DynamicArray< gp_Pnt2d > & | thePnts2d, |
| double | theTolU, | ||
| double | theTolV, | ||
| double | theUMin, | ||
| double | theVMin, | ||
| double | theUMax, | ||
| double | theVMax ) |
Constructs a 2D classifier from a vector of polygon vertices.
Same as the array constructor but accepts a vector for convenience.
| [in] | thePnts2d | Vector of polygon vertices (minimum 3 points required) |
| [in] | theTolU | Tolerance in U direction for boundary detection |
| [in] | theTolV | Tolerance in V direction for boundary detection |
| [in] | theUMin | Minimum U bound of the polygon domain |
| [in] | theVMin | Minimum V bound of the polygon domain |
| [in] | theUMax | Maximum U bound of the polygon domain |
| [in] | theVMax | Maximum V bound of the polygon domain |
|
inlinenoexcept |
Move constructor.
|
inlinenoexcept |
Move assignment operator.
Classifies a point relative to the polygon.
| [in] | thePoint | The 2D point to classify |
Classifies a point with explicit ON tolerance.
Similar to SiDans() but uses the specified tolerance for boundary detection instead of the tolerances specified at construction.
| [in] | thePoint | The 2D point to classify |
| [in] | theTol | Tolerance for boundary detection |