Check validity of Geometry Description matrix
gstat = csgchk(gd,xlim,ylim)
gstat = csgchk(gd)
gstat = csgchk(gd,xlim,ylim) checks if the solid objects in the Geometry Description matrix gd are valid, given optional real numbers xlim and ylim as current length of the x- and y-axis, and using a special format for polygons. For a polygon, the last vertex coordinate can be equal to the first one, to indicate a closed polygon. If xlim and ylim are specified and if the first and the last vertices are not equal, the polygon is considered as closed if these vertices are within a certain "closing distance." These optional input arguments are meant to be used only when calling csgchk from the PDE app.
gstat is a row vector of integers that indicates the validity status of the corresponding solid objects, i.e., columns, in gd.
For a circle solid, gstat = 0 indicates that the circle has a positive radius, 1 indicates a nonpositive radius, and 2 indicates that the circle is not unique.
For a polygon, gstat = 0 indicates that the polygon is closed and does not intersect itself, i.e., it has a well-defined, unique interior region. 1 indicates an open and non-self-intersecting polygon, 2 indicates a closed and self-intersecting polygon, and 3 indicates an open and self-intersecting polygon.
For a rectangle solid, gstat is identical to that of a polygon. This is so because a rectangle is considered as a polygon by csgchk.
For an ellipse solid, gstat = 0 indicates that the ellipse has positive semiaxes, 1 indicates that at least one of the semiaxes is nonpositive, and 2 indicates that the ellipse is not unique.
If gstat consists of zero entries only, then gd is valid and can be used as input argument by decsg.