This interface functionalities of various filtering, clipping and offsetting operations to the LPolygon object. More...
Public Member Functions | |
ILPolygon * | Expand (ILPolygon *poly, double delta, double miterLimit) |
LArray< ILPolygon * > | Intersect (ILPolygon *poly1, ILPolygon *poly2) |
ILPolygon * | Intersect1 (ILPolygon *poly1, ILPolygon *poly2) |
ILPolygon * | Shrink (ILPolygon *poly, double delta, double miterLimit) |
ILPolygon * | Simplify (ILPolygon *poly, int maxVertexes, double areaThreshold, double angleThreshold) |
ILPolygon * | SimplifyDP (ILPolygon *poly, double dt) |
ILPolygon * | Smooth (ILPolygon *poly, double nbRange) |
ILPolygon * | SmoothIterative (ILPolygon *poly, double filterNbRng, double updateNbRng, int maxIterCount, double stopCriteria) |
LArray< ILPolygon * > | Subtract (ILPolygon *poly1, ILPolygon *poly2) |
ILPolygon * | Subtract1 (ILPolygon *poly1, ILPolygon *poly2) |
ILPolygon * | TrimCollinear (ILPolygon *poly) |
LArray< ILPolygon * > | Union (ILPolygon *poly1, ILPolygon *poly2) |
ILPolygon * | Union1 (ILPolygon *poly1, ILPolygon *poly2) |
LArray< ILPolygon * > | XOR (ILPolygon *poly1, ILPolygon *poly2) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
This interface functionalities of various filtering, clipping and offsetting operations to the LPolygon object.
To use this interface, you should create a LPolyClipper object.
Offset the polygon to the outer to create a parallel and inflated polygon.
[in] | poly | The input polygon object |
[in] | delta | The offset distance |
[in] | miterLimit | The miter threshold for the offset segments to avoid narrow angled joins producing excessively long and narrow spikes. When the mitered joins exceed the specified distance limit (relative to the offset distance), we would use squared connection instead. |
resultPoly | Return the result polygon object. |
Intersect the two input polygons, @math_eq{P = P_1 \cap P_2} . If the two inputs are intersected in multiple places, the results are plural.
Note: Only closed polygons are acceptable.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPolys | Return the result polygon collection (a list of LPolygon object). |
Similar functionality as Intersect(), provided for convenience. It report the single polygon. If the intersection results are plural, it reports the one part of the biggest area.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPoly | Return the result polygon object. |
Offset the polygon to the inner to create a parallel and deflated polygon.
[in] | poly | The input polygon object |
[in] | delta | The offset distance |
[in] | miterLimit | The miter threshold for the offset segments to avoid narrow angled joins producing excessively long and narrow spikes. When the mitered joins exceed the specified distance limit (relative to the offset distance), we would use squared connection instead. |
resultPoly | Return the result polygon object. |
ILPolygon* Simplify | ( | ILPolygon * | poly, |
int | maxVertexes, | ||
double | areaThreshold, | ||
double | angleThreshold | ||
) |
Simplify the polygon by removing the redundant vertexes that meet the area or angle threshold.
[in] | poly | The input polygon object |
[in] | maxVertexes | The maximum count of vertexes in the result polygon. You may set it to 0 to remove all unwanted vertexes. |
[in] | areaThreshold | The area threshold for the aggregated area for removing the vertex(and its removed neighbors). For smaller than the threshold, the vertexes are treated as redundant and eliminated. Negative or zero value means simplify by area is not enabled. |
[in] | angleThreshold | The angle threshold for removing the sharp vertexes in the polygon, in 0 ~ 180. Negative or zero value means simplify by angle is not enabled. If both area and angle threshold is specified, then the simplification score is weighted by them both. If neither of them are specified, then the simplification is in fact the redundant vertexes removal operation for those are on the adjacent collinear segments. |
resultPoly | Return the result polygon object. |
Simplify the polygon using the classic Douglas-Peucker algorithm
[in] | poly | The input polygon object |
[in] | dt | The maximum allowable offset between the original and simplified polygon |
resultPoly | Return the result polygon object. |
Smooth the polygon by averaging the vertexes in the specified neighbor range.
[in] | poly | The input polygon object |
[in] | nbRange | The neighbor range \( (-nbRange, nbRange) \) in distance measured along the polygon. We may create the interpolated vertex on the endings of the neighborhood for longer edges. |
resultPoly | Return the result polygon object. |
ILPolygon* SmoothIterative | ( | ILPolygon * | poly, |
double | filterNbRng, | ||
double | updateNbRng, | ||
int | maxIterCount, | ||
double | stopCriteria | ||
) |
Smooth the polygon by iteratively applying the mean filtering on to the edge normals then update the vertexes. This approach usually results in better-looking polygon than the naive averaging filtering(aka. Smooth()) and resistant to over-smoothing, but it's also considerable time-consuming.
[in] | poly | The input polygon object |
[in] | filterNbRng | The filtering neighbor range \( (-filterNbRng, filterNbRng) \) in distance measured along the polygon and interpolation is involved at the end of the neighborhood. The larger value indicates more edge normals contribute to the filtering result. |
[in] | updateNbRng | The updating neighbor range \( (-updateNbRng, updateNbRng) \) in distance measured along the polygon and interpolation is involved at the end of the neighborhood. Those neighbors are taken over to calculate the new vertex. The range is usually smaller then the filtering range. The proper value may speed up the convergence and stop the iteration earlier. It's recommended to use 2 ~ 5. By default, it's set to 0 which means 10% of the filtering range. |
[in] | maxIterCount | The maximum count of iteration. The default value is 30. |
[in] | stopCriteria | The stop criteria of the iteration. The default value is 0.001. It stops when the maximum movement of the vertexes is smaller than the criteria, or the difference of maximum movement between the two iterations is smaller than 0.1%: @math_eq{m_i < criteria || (m_i - m_{i-1}) / m_{i-1} < 0.1%} |
resultPoly | Return the result polygon object. |
Subtract the two input polygons and get the differences, @math_eq{P = P_1 - P_2} . If the first polygon is separated into several parts by the subtraction, the results are plural.
Note: Only closed polygons are acceptable.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPolys | Return the result polygon collection (a list of LPolygon object). |
Similar functionality as Subtract(), provided for convenience. It report the single polygon. If the difference results are plural, it reports the one part of the biggest area.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPoly | Return the result polygon object. |
Remove the vertexes that are on the adjacent collinear segments, and also remove the duplicated vertexes. It is usually used to reduce the count of vertexes while not changing the shape of the polygon.
[in] | poly | The input polygon object |
resultPoly | Return the result polygon object. |
Union the polygons, @math_eq{P = P_1 \cup P_2} . For the two not-intersected inputs, the results are plural; otherwise, they are merged into one.
Note: Only closed polygons are acceptable.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPolys | Return the result polygon collection (a list of LPolygon object). |
Similar functionality as Union(), provided for convenience. It report the single polygon. If the unioned results are plural, it reports the one part of the biggest area.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPoly | Return the result polygon object. |
Calculate the symmetric difference of the two input polygons, @math_eq{P = P_1 \oplus P_2} . The results are commonly plural.
Note: Only closed polygons are acceptable.
[in] | poly1 | The first input polygon object |
[in] | poly2 | The second input polygon object |
resultPolys | Return the result polygon collection (a list of LPolygon object). |