Class DSimplePolygon (version 0.18)Description: A simple polygon class A simple polygon consists of an outer hull only. The contour consists of several points. The point list is normalized such that the leftmost, lowest point is the first one. The orientation is normalized such that the orientation of the hull contour is clockwise. It is in no way checked that the contours are not over- lapping. This must be ensured by the user of the object when filling the contours.
Method Overview
[const] bool !=( DSimplePolygon )Description: Inequality test
[const] bool ==( DSimplePolygon )Description: Equality test
[const] double areaDescription: The area of the polygon The area is correct only if the polygon is not self-overlapping and the polygon is oriented clockwise.
assign( DSimplePolygon other )Description: Assign the contents of another object to self This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.
[const] const ref DBox bboxDescription: Return the bounding box of the simple polygon
compress( bool remove_reflected )Description: Compress the simple polygon. This method removes redundant points from the polygon, such as points being on a line formed by two other points. If remove_reflected is true, points are also removed if the two adjacent edges form a spike. This method was introduced in version 0.18.
destroyDescription: Explicitly destroy the object Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing.
[const] bool destroyedDescription: Tell, if the object was destroyed This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.
[const] DSimplePolygon dupDescription: Creates a copy of self.
yield DEdge each_edgeDescription: Iterate over the edges that make up the simple polygon
[const] yield DPoint each_pointDescription: Iterate over the points that make up the simple polygon
[static] DSimplePolygon from_ipoly( SimplePolygon int_poly )Description: Construct a floating-point coordinate polygon from an integer coordinate one This method has been added in version 0.15.
[const] bool inside( DPoint p )Description: Test, if the given point is inside the polygon If the given point is inside the polygon, true is returned. This tests works well only if the polygon is not self-overlapping and oriented clockwise.
ref DSimplePolygon move( DPoint p )Description: Moves the simple polygon. Moves the simple polygon by the given offset and returns the moved simple polygon. The polygon is overwritten.
[const] DSimplePolygon moved( DPoint p )Description: Returns the moved simple polygon Moves the simple polygon by the given offset and returns the moved simple polygon. The polygon is not modified.
[static] DSimplePolygon new( DBox box )
|
box: | The box to convert to a polygon |
Description: Constructor given the points of the simple polygon
pts: | The points forming the simple polygon |
Description: Default constructor: creates an empty (invalid) polygon
Description: Get a specific point of the contour@args p
If the index of the point is not a valid index, a default value is returned. This method was introduced in version 0.18.
p: | The index of the point to get |
Description: Get the number of points
Description: Set the points of the simple polygon
p: | An array of points to assign to the simple polygon |
Description: Convert to a string
Description: Transform the simple polygon.
Transforms the simple polygon with the given transformation. Does not modify the simple polygon but returns the transformed polygon.
t: | The transformation to apply. |
returns: | The transformed simple polygon. |
Description: Transform the simple polygon.
Transforms the simple polygon with the given complex transformation. Does not modify the simple polygon but returns the transformed polygon.
t: | The transformation to apply. |
returns: | The transformed simple polygon. |