This interface represents a polygon(LPolygon object). More...
Public Member Functions | |
void | AddPoints (ILPoints *points) |
double | DistanceToPoint (ILPoint *point, LPVAggregation aggType, ILPoint **rootPoint) |
double | DistanceToPolygon (ILPolygon *polygon, LPVAggregation aggType, ILPoint **rootPoint1, ILPoint **rootPoint2) |
void | Draw (BOOL bFill, HDC hdc, double zoomX, double zoomY, double panX, double panY) |
void | FromPolyRegion (ILPolyRegion *val) |
double | GetArea () |
ILPoint * | GetGravityCenter () |
ILCircle * | GetInscribedCircle () |
double | GetPerimeter () |
ILPoints * | GetPoints () |
LPVIntersectType | IntersectLine (ILLine *line, ILPoints **intersectPoints) |
BOOL | IntersectPolygon (ILPolygon *polygon, ILPoints **intersectPoints) |
ILPoint * | Item (int index) |
LPVPointTestResult | PointTest (ILPoint *point) |
void | RemovePoints (double lbX, double ubX, double lbY, double ubY) |
ILPolygon * | Resample (int num) |
ILPolygon * | ResampleByStep (double step, double stepThreshold) |
void | Set (int index, double x, double y) |
void | SetPolygon (LArray< double > xs, LArray< double > ys, BOOL isClosed) |
ILPolyRegion * | ToPolyRegion () |
ILPolygon * | Transform (ILTransform *tf) |
ILPolygon * | Translate (double offsetX, double offsetY) |
Public Member Functions inherited from ILObjects | |
int | Count () |
BOOL | Empty () |
ILObject * | ItemObject (int objIndex) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
Properties | |
BOOL | Closed [get, set] |
Whether this is a closed polygon. | |
This interface represents a polygon(LPolygon object).
void AddPoints | ( | ILPoints * | points | ) |
Append the points in the given collection to this polygon.
[in] | points | The input points |
double DistanceToPoint | ( | ILPoint * | point, |
LPVAggregation | aggType, | ||
ILPoint ** | rootPoint | ||
) |
Calculate the minimum/maximum distance between the input point and the polygon, it could be either the distance from the input point to any of the polygon's vertexes or segments.
[in] | point | The input point. |
[in] | aggType | The aggregation type, only LPVAggMin or LPVAggMax is acceptable |
[out] | rootPoint | Output the root point, could be either a vertex or the input point's perpendicular root to a polygon segment |
val | Return the minimum distance. |
double DistanceToPolygon | ( | ILPolygon * | polygon, |
LPVAggregation | aggType, | ||
ILPoint ** | rootPoint1, | ||
ILPoint ** | rootPoint2 | ||
) |
Calculate the minimum/maximum distance between the input polygon and this polygon, it could be either the distance between any of the polygons' vertexes or segments. For example, the red one is this polygon, the green one is the input polygon, their minimum distance and root points are shown as below:
[in] | polygon | The input polygon |
[in] | aggType | The aggregation type, only LPVAggMin or LPVAggMax is acceptable |
[out] | rootPoint1 | Output the root point on this polygon |
[out] | rootPoint2 | Output the root point on the input polygon |
val | Return the minimum distance. |
void Draw | ( | BOOL | bFill, |
HDC | hdc, | ||
double | zoomX, | ||
double | zoomY, | ||
double | panX, | ||
double | panY | ||
) |
Draw all the points on HDC.
[in] | bFill | Whether to fill the path using current brush. |
void FromPolyRegion | ( | ILPolyRegion * | val | ) |
Set placement of the polygon from the input polygon region.
double GetArea | ( | ) |
Get the area of the polygon. For open polygons, the first and last vertexes are connected to form closed shapes.
val | Return the area value |
ILPoint* GetGravityCenter | ( | ) |
Get the gravity center of the polygon
ILCircle* GetInscribedCircle | ( | ) |
Get the inscribed circle of the polygon
double GetPerimeter | ( | ) |
Get the perimeter of the polygon
val | Return the perimeter value |
ILPoints* GetPoints | ( | ) |
Get all points in the polygon for further calculation, like generate bounding shape, fitting.
val | Return the collection of points. |
LPVIntersectType IntersectLine | ( | ILLine * | line, |
ILPoints ** | intersectPoints | ||
) |
Determines whether this polygon intersects with the given line. Return the intersection points if they are intersected.
[in] | line | The input line |
[out] | intersectPoints | Output the intersection points, it should be an empty set for not-intersected case, 1 or more points for intersected case. |
type | Return the intersection type depends on the count of intersection points which is on the line segment, LPVIntersectBounded(all), LPVIntersectBoundedPartial(part) or LPVIntersectUnbounded(none). |
Determines whether this polygon intersects with another given polygon, and output the intersection points if intersected.
[in] | polygon | The input another polygon |
[out] | intersectPoints | Output the intersection points, it should be an empty set for not-intersected case, 1 or more points for intersected case. |
result | Return true if they are intersected, false otherwise. |
ILPoint* Item | ( | int | index | ) |
Fetch one point with the given index.
[in] | index | The input index, it should be a 0-based number smaller than total count. |
point | Return the point of given index. |
LPVPointTestResult PointTest | ( | ILPoint * | point | ) |
Determines whether the point is inside this polygon, outside, or lies on the edge. For a not-closed polygon, the result is either outside or on-the-edge
[in] | point | The input point |
val | Return the test result |
void RemovePoints | ( | double | lbX, |
double | ubX, | ||
double | lbY, | ||
double | ubY | ||
) |
Remove some points in the collection which is in the given range.
[in] | lbX | The lower bound of the x-coordinate to be removed |
[in] | ubX | The upper bound of the x-coordinate to be removed |
[in] | lbY | The lower bound of the y-coordinate to be removed |
[in] | ubY | The upper bound of the y-coordinate to be removed |
ILPolygon* Resample | ( | int | num | ) |
Resample the polygon object into another polygon of the specified vertex count. For an open polygon, the two end points are always kept in the resampled result.
[in] | num | The count of the resampled vertexes, at least 3 |
result | Return the resampling result polygon |
ILPolygon* ResampleByStep | ( | double | step, |
double | stepThreshold | ||
) |
Resample the polygon object into another polygon, based on the given fixed interval step. For an open polygon, the two end points are always kept in the resampled result.
[in] | step | The interval step. |
[in] | stepThreshold | The last resampling vertex should be omitted if the remaining length to the end point is smaller than the threshold. By default, it's 0 means \( Step / 4 \). |
result | Return the resampling result polygon |
void Set | ( | int | index, |
double | x, | ||
double | y | ||
) |
Set the point of the given index to specified position.
[in] | index | The input index, it should be a 0-based number smaller than total count. Pass in negative index to add the new point at the end. |
[in] | x | The x-coordinate of the new point |
[in] | y | The y-coordinate of the new point |
Set the points
[in] | xs | The x-coordinate of the points |
[in] | ys | The y-coordinate of the points |
[in] | isClosed | Whether this is a closed polygon |
ILPolyRegion* ToPolyRegion | ( | ) |
Generate a polygon region use the polygon object
ILPolygon* Transform | ( | ILTransform * | tf | ) |
Transform the polygon via the given transformation and return a new polygon
[in] | tf | The transformation. |
Return | the new polygon |
ILPolygon* Translate | ( | double | offsetX, |
double | offsetY | ||
) |
Translate the polygon by the given offset and return a new polygon
[in] | offsetX | The x-coordinate of the offset |
[in] | offsetY | The y-coordinate of the offset |
results | Return the new polygon |