63#define BOOL3_NOTSET -1
118 for(
int iPoint=0; iPoint<
m_nPoints; iPoint++, pPoint++,
B=
A)
123 double d =
B.x *
A.y -
A.x *
B.y;
163 if( x == pB->
x && y == pB->
y )
170 for(
int iPoint=0; iPoint<
m_nPoints; iPoint++, pB=pA++)
172 if( pA->
x == pB->
x && pA->
y == pB->
y )
177 if( x == pA->
x && y == pA->
y )
189 if( (y == pA->
y && pB->
y >= pA->
y) || (y == pB->
y && pA->
y >= pB->
y) )
194 double c = (pB->
x - x) * (pA->
y - y) - (pA->
x - x) * (pB->
y - y);
201 if( (pB->
y < pA->
y) == (c > 0.) )
203 bInterior = !bInterior;
267 for(
int iPoint=0; iPoint<
m_nPoints; iPoint++, pB=pA++)
273 if( ((y - pB->
y) * (pA->
x - pB->
x)) >= ((x - pB->
x) * (pA->
y - pB->
y)) )
283 if( ((y - pB->
y) * (pA->
x - pB->
x)) <= ((x - pB->
x) * (pA->
y - pB->
y)) )
291 return( nCrossings % 2 != 0 );
319 bool bNeighbour =
false;
322 for(
int iPoint=0; iPoint<pPart->
Get_Count(); iPoint++)
336 for(
int iPoint=0; iPoint<
Get_Count(); iPoint++)
349 return( bNeighbour );
378 double *Distances =
new double[Points.
Get_Count()];
389 Part.
Add(Points[Index[i]]);
399 if( !bVertex && P == P1 )
408 if( !bVertex && P == P1 )
440 if( bVertexCheck ==
false )
490 P1 = Part[0];
bool bOnEdge =
false;
497 C1.
x = P0.
x + 0.5 * (P1.
x - P0.
x);
498 C1.
y = P0.
y + 0.5 * (P1.
y - P0.
y);
571 for(
int iPoint=0; iPoint<m_nPoints && Distance>0.0; iPoint++, pB=pA++)
575 if( d >= 0.0 && d < Distance )
724 for(
int iPart=0; iPart<
m_nParts; iPart++)
744 for(
int iPoint=0; iPoint<pPart->
m_nPoints; iPoint++, pB=pA++)
787 for(
int iPoint=0; iPoint<pPart->
m_nPoints; iPoint++)
793 for(iPart=0; !bEdge && iPart<
m_nParts; iPart++)
844 double Perimeter = 0.0;
846 for(
int iPart=0; iPart<
m_nParts; iPart++)
859 return( pPart ? pPart->
Get_Area() : 0.0 );
867 for(
int iPart=0; iPart<
m_nParts; iPart++)
903 for(iPart=0, Weights=0.0; iPart<
m_nParts; iPart++)
910 Centroid.
x += w * p.
x;
911 Centroid.
y += w * p.
y;
919 Centroid.
x /= Weights;
920 Centroid.
y /= Weights;
958 for(
int iPart=0; iPart<
m_nParts; iPart++)
969 if( nContained % 2 != 0 )
994 return( pPart && pPart->
is_OnEdge(x, y) );
1008 for(
int iPart=0; iPart<
m_nParts; iPart++)
1036 return( pPart && pPart->
Contains(x, y) );
1052 for(
int iPart=0; iPart<
m_nParts; iPart++)
1060 return( nContained % 2 != 0 );
1088 bool bNeighbour =
false;
1118 return( bNeighbour );
1180 return( pPart ? pPart->
Get_Distance(Point, Next) : -1. );
double Get_Length(void) const
sLong Get_Count(void) const
bool Add(double x, double y)
sLong Get_Count(void) const
double Get_YCenter(void) const
TSG_Intersection Intersects(const CSG_Rect &Rect) const
double Get_XCenter(void) const
friend class CSG_Shape_Points
const CSG_Rect & Get_Extent(void)
TSG_Point Get_Point(int iPoint, bool bAscending=true) const
CSG_Shape_Part(class CSG_Shape_Points *pOwner)
int Get_Count(void) const
virtual void _Invalidate(void)
CSG_Shape_Points(class CSG_Shapes *pOwner, sLong Index)
virtual void _Invalidate(void)
friend class CSG_Shape_Part
virtual TSG_Point Get_Point(int iPoint=0) const
CSG_Shape_Part ** m_pParts
virtual int Get_Part_Count(void) const
virtual int Get_Point_Count(void) const
virtual const CSG_Rect & Get_Extent(void)
virtual ~CSG_Shape_Polygon_Part(void)
TSG_Polygon_Point_Relation Get_Point_Relation(const CSG_Point &p)
bool Contains(const CSG_Point &p)
virtual void _Invalidate(void)
double Get_Perimeter(void)
bool _is_OnEdge(CSG_Shape_Polygon_Part *pPart, const CSG_Point &P, bool bVertex, double Epsilon)
const TSG_Point & Get_Centroid(void)
bool is_Neighbour(CSG_Shape_Polygon_Part *pPart, bool bSimpleCheck=true)
CSG_Lines Get_Shared_Edges(CSG_Shape_Polygon_Part *pPart, bool bVertexCheck, double Epsilon=0.)
double Get_Distance(TSG_Point Point, TSG_Point &Next)
bool is_OnEdge(const CSG_Point &p)
void _Add_Edge_Points(CSG_Shape_Polygon_Part *pPart, const CSG_Point &P0, const CSG_Point &P1, CSG_Points &Part, double Epsilon)
double Get_Shared_Length(CSG_Shape_Polygon_Part *pPart, bool bVertexCheck, double Epsilon=0.)
CSG_Shape_Polygon_Part(class CSG_Shape_Points *pOwner)
virtual ~CSG_Shape_Polygon(void)
double Get_Perimeter(void)
bool is_OnEdge(const CSG_Point &p, int iPart)
CSG_Shape_Polygon_Part * Get_Polygon_Part(int iPart) const
bool Contains(const CSG_Point &p, int iPart)
TSG_Polygon_Point_Relation Get_Point_Relation(const CSG_Point &p, int iPart)
virtual double Get_Distance(TSG_Point Point, TSG_Point &Next, int iPart) const
CSG_Lines Get_Shared_Edges(CSG_Shape_Polygon *pPolygon, bool bVertexCheck, double Epsilon=0.)
TSG_Point Get_Centroid(void)
double Get_Shared_Length(CSG_Shape_Polygon *pPolygon, bool bVertexCheck, double Epsilon=0.)
virtual void _Invalidate(void)
bool is_Clockwise(int iPart)
bool is_Neighbour(CSG_Shape_Polygon *pPolygon, bool bSimpleCheck=true)
CSG_Shape_Polygon(class CSG_Shapes *pOwner, sLong Index)
virtual TSG_Intersection On_Intersects(CSG_Shape *pShape)
virtual int Get_Point_Count(void) const =0
TSG_Intersection Intersects(CSG_Shape *pShape)
TSG_Shape_Type Get_Type(void) const
virtual int Get_Part_Count(void) const =0
virtual TSG_Point Get_Point(int iPoint=0) const =0
bool SG_Get_Crossing_InRegion(TSG_Point &Crossing, const TSG_Point &a, const TSG_Point &b, const TSG_Rect &Region)
double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
double SG_Get_Nearest_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, TSG_Point &Line_Point, bool bExactMatch)
bool SG_Get_Crossing(TSG_Point &Crossing, const TSG_Point &a1, const TSG_Point &a2, const TSG_Point &b1, const TSG_Point &b2, bool bExactMatch)
bool SG_Is_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch, double Epsilon)
TSG_Polygon_Point_Relation
@ SG_POLYGON_POINT_Vertex
@ SG_POLYGON_POINT_Outside
@ SG_POLYGON_POINT_Interior