void Convert2CounterClockwise(int n, int* xy);
used to convert a polygon so that the vertices are arranged in the counter clockwise direction. Some CAD systems expect a polygon's vertices to appear in this direction and treat it as filled. The location of the first coordinate is not constrained.
n - number of vertices
xy - an array of xy coordinate pairs. The first and last pair are the same point.
xy - an array of coordinate pairs. The first and last pair are not changed but the order of the inner pairs may be to produce the desired direction.
tests a polygon for convex (in X or both in X and Y) and breaks down polygons as needed to insure that they are convex. A single source polygon can generate multiple convex polygons.
n - number of vertices in the source polygon
xy - an array containing the vertex pairs for the source polygon.
cnv - BOOL_CONVEX_IN_X or BOOL_FULLY_CONVEX (this controls the type of convexing output independent of the Set_Cnv_Output_MT.)
validate - 0: do not perform validation on input; 1: perform validation on input.
numarr - an array where each element contains the number of vertices for the output polygons.
XYarr - an contiguous array containing the vertex data for the polygons.
pnumpolys - number of output convex polygons
CONVEX_ERR no output polygons - internal error CONVEX_OK input data is not Manhattan CONVEX_MANH input data is Manhattan
double AreaOfPolygon(int n, int* xy);
Used to compute the area of a polygon
n - number of vertices in the input polygon
xy - array containing the vertex pair list
AreaOfPolygon - the computed area of the polygon.
The polygon input must be standard - not a Leonov polygon - however it may contain cut lines.
Converts a path of Type 1 (round endcap) into boundary data. Each segment of the path is converted into its own boundary with an approximation of the round end caps.
xy - an array of vertices for the path
u - the number of vertices in the path
width - the width of the path
arcres - arc resolution (in degrees) to use for fracturing the end caps.
chord_error - chord error parameter to use for fracturing the end caps and bend radii. If set ==0 then the arc resolution parameter determines the number of chords.
If both arcres and chord_error are simultaneously specified, then the parameter that would produce the "finer" approximation is used.
XY_out_arr - an array containing the XY coordinates of the resulting boundaries.
pair_num_out_arr - an array containing the vertex count for each of the output boundaries
OPath2Bndrys - the function returns the number of output polys.
Return Code:the number of polygons output
Converts a path (of type 0 or 2) into a boundary. If unionize = 0, then the function returns boundaries representing individual path sections; if unionize = 1 then the individual sections are unionized into a single boundary.
Path - an array whose first element is the Path Type (0 | 2) and second element the path width. Following those two elements are the list of XY coordinate pairs.
N = (2 x number of vertices) + 2 in the path.
unionize - 0 = do not unionize segments; 1 = unionize returned polygonal segments
bdll_handle - handle for this call.
XY_out_arr - an array containing the XY coordinate pairs.
pair_num_out_arr - an array containing vertex count of each output polygon.
Error codes:0: (success)
non-zero value: the number of polygons created.
Used to test and clip a path (only type 0|2 - does not support type 1 paths) to a user specified window. If the path is fully contained inside of the window then the function returns 0. Otherwise, the path is broken into its segments. This function does not take into account a path's width.
xy - an array containing the XY coordinates of the path. The first element of the array contains the path type (0|2) and the second element of the array contains the path width.
n - number of vertices in the path
Wnd - an array (4 elements) containing the LLx, LLy, URx and URy coordinates of the window.
Output:pXYarr - an XY coordinate array of all vertices for the resulting output paths
pNarr - an array of the number of vertices belonging to each path
Return Codes0: (success)
non-zero value: indicating that an error occurred during initialization.
For a polygon with coordinate list xy, this function calculates the list of cutlines and returns them in an array.
xy - an array of the input polygon's coordinates
n - the number of vertices contained in the polygon.
pXY - an array containing the cut line coordinates (in pairs)
pN - the number of cut lines in the polygon. Since each cutline requires two vertices and cutlines always are enumerated in pairs, the number of elements in pXY is 4 x pN.
0 no cutlines were found 1 cut lines returned
BoolRelease_array should be called after this function to release memory.
RtnEdges_MT(int **xy, int bdll_handle);
will return a list of shared edges where a polygon was broken as a result of a polygon violating the max number of vertices restriction and when the output mode is set to butting. This function does not apply when output is set to cut lines.
If there are N returned edges, then the size of the xy array = 4 x N x sizeof(int).
xy[i*2],xy[i*2 + 1] and xy [i*2 +2],xy[i*2+3] are the endpoint coordinates of the ith returned edge.
bdll_handle: thread handle
Return Codethe number of edges found.
BoolRelease_array should be called after this function call to release memory; BoolSet_Maxpts_MT is used to set the maximum vertex count for a polygon.
This function takes a list of polygons as input and creates sets of touching/overlapping polygons. It then returns the number of groups, the number of polygons per group and indexes to the polygons by group.
Inputs:XY_in_arr - an array of coordinate pairs for the input boundaries
pair_num_in_arrays - an array of the number of coordinate pairs
bndrs - the number of boundaries in the input set
pindexarr - an array of lists. This array will have one list for each connected set. Each list points to the locations of the polygons for that set.
pnumbers - an array containing the number of polygons in each set.
psets - an integer showing number of polygon sets (7 in this example)
Return codes:0: all polygons are closed
non-zero value: indicates the number of non-closed boundaries.
This function takes a path as the first input argument and a "clipping" boundary as the second input argument. The function first checks the validity of the clipping boundary and then whether the path lies fully outside of the boundary, completely inside of the boundary or crosses the boundary. If it crosses the boundary the function returns a new path that has been clipped to the edges of the boundary.
xy - array of xy coordinates for the path
Returns:-2: the boundary is not closed
-1: the path is fully outside of the boundary
0: the path is completely inside of the boundary
positive integer: the number of boundaries returned within the region
This function tells you if the entity under consideration (a path or boundary) is enclosed by the "reference" boundary. The first entity is either a boundary ( if pathtype1 = -1), or a path in which case pathtype1 = 0, 1 or 2. The second entity (i.e. the reference boundary) is always a boundary.
The first object is either a a path or boundary description
int* xy1 an array of xy coordinates int n1 the number of vertices int pathtype1 the pathtype -1 = boundary 0 = flush 1 = half round, 2 = half width extended int width1 the path width
The second object is the reference boundary description
int* xy2 an array of xy coordinates int n2 the number of vertices in this boundary
pstatus - the address of the variable answering the question: is object 1 inside of object 2?
1 = object 1 lies completely inside of object 2
2 = object 2 lies completely inside of object 1
3 = the objects are disjoint
Return Codes-2: the second object, the reference boundary is not closed
-1: the first object (a boundary) is not closed
given a point x,y and an array of polygons, you wish to determine if the point is inside or touching any of the polygons. Similar to the function PointInsidePoly but allows the user to specify a number of polygons at one time.
The first object is either a a path or boundary description
int x, int y the point to evaluate int** XYarr an array of polygons int* pairnumarr an array of vertex counts for the polygons in XYarr int N the number of polygons in XYarr
int* indexarr the caller's array where return values (0,1,2,3) will be stored for each point/polygon test.
0 success -1 failed
int PointInsidePoly (int x, int y, int n, int* xy);
This function determines whether the specified point is outside, inside, on an edge or on a vertex of a given polygon.
int x, int y the coordinates of a point int n the number of vertices in the polygon int* xy an array of xy pairs for the polygon vertices
0 - point is outside the polygon 1 - point is inside the polygon 2 - point is on an edge of the polygon 3 - point is on a vertex of the polygon