Home | ClipperLib |
Orientation
Del.» function Orientation(const poly: TPolygon): boolean;
C++ » bool Orientation(const Polygon &poly); // Function in the ClipperLib namespace.
C# » public static bool Orientation(Polygon poly); // Static method of the Clipper class in the ClipperLib namespace.
Orientation returns a boolean value that is based on the polygon's orientation relative to the display's orientation (ie Y-axis positive upward vs Y-axis positive downward).
- On Y-axis positive upward displays, Orientation will return true if the polygon's orientation is counter-clockwise.
- On Y-axis positive downward displays, Orientation will return true if the polygon's orientation is clockwise.
Notes:
- Duplicate coordinates in 'poly' must be removed before calling this function (including duplicate start & end nodes).
- The majority of 2D graphic display libraries (eg GDI, GDI+, XLib, Cairo, AGG, Graphics32) and even the SVG file format have their coordinate origins at the top-left corner of their respective viewports with their Y axes increasing downward. However, some display libraries (eg Quartz, OpenGL) have their coordinate origins undefined or in the classic bottom-left position with their Y axes increasing upward.
- It doesn't matter which Orientation is used by the polygons that are passed to Clipper objects - as long as polygon 'holes' are oriented opposite to outer polygons. Also it doesn't matter if Subject and Clip polygons have opposite orientations, as long as all Subject polygons have consistent outer and inner orientations, and all Clip polygons do likewise.
- The Orientations of polygon 'solutions' returned by Clipper's Execute method will always be 'true' for outer polygons and 'false' for inner 'hole' polygons (unless the ReverseSolution property has been enabled).
- For the OffsetPolygons function to work as expected, outer polygons must have a 'true' Orientation and polygon holes must have a 'false' Orientation.
- Self-intersecting polygons have indeterminate orientations, so passing a self-intersecting polygon to this function will deliver unpredictable results.
See Also
Clipper.ReverseSolution, OffsetPolygons, Polygon
Copyright ©2010-2012 Angus Johnson - Clipper version 5.1.0 - Help file built on 17-February-2013