This function will take the given source polygon shape and recalculate it to be an offset of that polygon (either inset or outset) with the given border line distance. The given source polygon remains unchanged.
SYNTAX:
success% = OffsetPolygon% (srcPolyX%(), srcPolyY%(), offPolyX%(), offPolyY%(), displace#)
INPUTS:
srcPolyX%(), srcPolyY%() (INTEGER arrays)
- These are 1-dimensional arrays containing the x/y coordinates of the source polygon's corners. Start with the first corner in the lowest array index, end with last corner in the highest index, ie. you must not return to the first corner. Obviously the arrays must match and must have exactly "number of corners" elements. The corners may be traced in either direction (clockwise or counter-clockwise).
offPolyX%(), offPolyY%() (INTEGER arrays)
- Arrays which get the new corner coordinates on success, note this is an intended argument side effect. These must be 1-dimensional REDIMed (dynamic) INTEGER arrays of at least one element, they are adjusted internally to be exact copies of the source polygon arrays with the same lower and upper bounds. On failure these arrays remain unchanged.
displace# (DOUBLE)
- The displacement (line distance) of the new polygon, negative for inset, positive for outset (if source is traced clockwise), or positive for inset and negative for outset (if source is traced counter-clockwise). Note this is a type DOUBLE argument, hence you may even specify fractions here.
RESULT:
success% (INTEGER)
- This flag is true (-1) on success or false (0) on failure. On success the new polygon corners are stored in the given offset polygon arrays. The function fails, if the source polygon has less than 3 corners.