|
SAGA API
v9.6
|
Go to the documentation of this file.
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;
164 if( x == pB->
x && y == pB->
y )
169 double dy = pB->
y - pA->
y;
173 for(
int iPoint=
m_nPoints-2; dy==0.0 && iPoint>0; iPoint--)
181 for(
int iPoint=0; iPoint<
m_nPoints; iPoint++, pB=pA++)
183 if( x == pA->
x && y == pA->
y )
188 if( pA->
x == pB->x && pA->
y == pB->y )
197 double cx = pB->x + (y - pB->y) * (pA->
x - pB->x) / (pA->
y - pB->y);
209 else if( y == pB->y && pB->x < x && dy < 0.0 )
218 double cx = pB->x + (y - pB->y) * (pA->
x - pB->x) / (pA->
y - pB->y);
230 else if( y == pB->y && pB->x < x && dy > 0.0 )
239 if( (pA->
x < x && x < pB->x)
240 || (pA->
x > x && x > pB->x) )
253 if( nCrossings % 2 != 0 )
312 for(
int iPoint=0; iPoint<
m_nPoints; iPoint++, pB=pA++)
318 if( ((y - pB->y) * (pA->
x - pB->x)) >= ((x - pB->x) * (pA->
y - pB->y)) )
328 if( ((y - pB->y) * (pA->
x - pB->x)) <= ((x - pB->x) * (pA->
y - pB->y)) )
336 return( nCrossings % 2 != 0 );
364 bool bNeighbour =
false;
367 for(
int iPoint=0; iPoint<pPart->
Get_Count(); iPoint++)
381 for(
int iPoint=0; iPoint<
Get_Count(); iPoint++)
394 return( bNeighbour );
423 double *Distances =
new double[Points.
Get_Count()];
434 Part.
Add(Points[Index[i]]);
444 if( !bVertex && P == P1 )
453 if( !bVertex && P == P1 )
485 if( bVertexCheck ==
false )
535 P1 = Part[0];
bool bOnEdge =
false;
542 C1.
x = P0.
x + 0.5 * (P1.
x - P0.
x);
543 C1.
y = P0.
y + 0.5 * (P1.
y - P0.
y);
616 for(
int iPoint=0; iPoint<m_nPoints && Distance>0.0; iPoint++, pB=pA++)
620 if( d >= 0.0 && d < Distance )
769 for(
int iPart=0; iPart<
m_nParts; iPart++)
789 for(
int iPoint=0; iPoint<pPart->
m_nPoints; iPoint++, pB=pA++)
832 for(
int iPoint=0; iPoint<pPart->
m_nPoints; iPoint++)
838 for(iPart=0; !bEdge && iPart<
m_nParts; iPart++)
889 double Perimeter = 0.0;
891 for(
int iPart=0; iPart<
m_nParts; iPart++)
904 return( pPart ? pPart->
Get_Area() : 0.0 );
912 for(
int iPart=0; iPart<
m_nParts; iPart++)
948 for(iPart=0, Weights=0.0; iPart<
m_nParts; iPart++)
955 Centroid.
x += w * p.
x;
956 Centroid.
y += w * p.
y;
964 Centroid.
x /= Weights;
965 Centroid.
y /= Weights;
1003 for(
int iPart=0; iPart<
m_nParts; iPart++)
1014 if( nContained % 2 != 0 )
1039 return( pPart && pPart->
is_OnEdge(x, y) );
1053 for(
int iPart=0; iPart<
m_nParts; iPart++)
1081 return( pPart && pPart->
Contains(x, y) );
1097 for(
int iPart=0; iPart<
m_nParts; iPart++)
1105 return( nContained % 2 != 0 );
1133 bool bNeighbour =
false;
1163 return( bNeighbour );
1225 return( pPart ? pPart->
Get_Distance(Point, Next) : -1. );
const TSG_Point & Get_Centroid(void)
TSG_Polygon_Point_Relation Get_Point_Relation(const CSG_Point &p, int iPart)
CSG_Shape_Part ** m_pParts
bool is_Neighbour(CSG_Shape_Polygon_Part *pPart, bool bSimpleCheck=true)
bool Add(double x, double y)
@ SG_POLYGON_POINT_Interior
double Get_Distance(TSG_Point Point, TSG_Point &Next)
bool SG_Get_Crossing_InRegion(TSG_Point &Crossing, const TSG_Point &a, const TSG_Point &b, const TSG_Rect &Region)
virtual ~CSG_Shape_Polygon_Part(void)
bool is_Clockwise(int iPart)
TSG_Point Get_Point(int iPoint, bool bAscending=true) const
TSG_Polygon_Point_Relation Get_Point_Relation(const CSG_Point &p)
TSG_Intersection Intersects(const CSG_Rect &Rect) const
CSG_Lines Get_Shared_Edges(CSG_Shape_Polygon *pPolygon, bool bVertexCheck, double Epsilon=0.)
bool _is_OnEdge(CSG_Shape_Polygon_Part *pPart, const CSG_Point &P, bool bVertex, double Epsilon)
bool is_OnEdge(const CSG_Point &p, int iPart)
virtual void _Invalidate(void)
TSG_Intersection Intersects(CSG_Shape *pShape)
double Get_Shared_Length(CSG_Shape_Polygon *pPolygon, bool bVertexCheck, double Epsilon=0.)
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)
TSG_Shape_Type Get_Type(void) const
bool is_OnEdge(const CSG_Point &p)
TSG_Polygon_Point_Relation
virtual TSG_Point Get_Point(int iPoint=0) const
virtual TSG_Point Get_Point(int iPoint=0) const =0
void _Add_Edge_Points(CSG_Shape_Polygon_Part *pPart, const CSG_Point &P0, const CSG_Point &P1, CSG_Points &Part, double Epsilon)
@ SG_POLYGON_POINT_Vertex
virtual int Get_Part_Count(void) const =0
bool Contains(const CSG_Point &p, int iPart)
sLong Get_Count(void) const
@ SG_POLYGON_POINT_Outside
virtual void _Invalidate(void)
TSG_Point Get_Centroid(void)
CSG_Shape_Polygon_Part(class CSG_Shape_Points *pOwner)
const CSG_Rect & Get_Extent(void)
double SG_Get_Distance(double ax, double ay, double bx, double by, bool bPolar)
double Get_Perimeter(void)
virtual void _Invalidate(void)
virtual TSG_Intersection On_Intersects(CSG_Shape *pShape)
virtual double Get_Distance(TSG_Point Point, TSG_Point &Next, int iPart) const
CSG_Shape_Polygon_Part * Get_Polygon_Part(int iPart) const
sLong Get_Count(void) const
virtual ~CSG_Shape_Polygon(void)
CSG_Shape_Polygon(class CSG_Shapes *pOwner, sLong Index)
bool SG_Is_Point_On_Line(const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch, double Epsilon)
virtual void _Invalidate(void)
virtual int Get_Point_Count(void) const =0
double Get_Perimeter(void)
bool is_Neighbour(CSG_Shape_Polygon *pPolygon, bool bSimpleCheck=true)
virtual const CSG_Rect & Get_Extent(void)
double Get_Length(void) const
double Get_XCenter(void) const
int Get_Count(void) const
double Get_YCenter(void) const
virtual int Get_Point_Count(void) const
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)
virtual int Get_Part_Count(void) const
CSG_Lines Get_Shared_Edges(CSG_Shape_Polygon_Part *pPart, bool bVertexCheck, double Epsilon=0.)
double Get_Shared_Length(CSG_Shape_Polygon_Part *pPart, bool bVertexCheck, double Epsilon=0.)
bool Contains(const CSG_Point &p)