Class Edge (version 0.18)Description: An edge class An edge is a connection between points, usually participating in a larger context such as a polygon. An edge has a defined direction (from p1 to p2).
Method Overview
[const] bool !=( Edge e )Description: Inequality test
[const] bool <( Edge e )Description: Less operator
[const] bool ==( Edge e )Description: Equality test
assign( Edge 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] Box bboxDescription: Return the bounding box of the edge.
[const] bool coincident?( Edge e )Description: Coincidence check. Checks whether a edge is coincident with another edge. Coincidence is defined by being parallel and that at least one point of one edge is on the other edge.
[const] bool contains?( Point p )Description: Test whether a point is on an edge. A point is on a edge if it is on (or at least closer than a grid point to) the edge.
[const] bool contains_excl?( Point p )Description: Test whether a point is on an edge excluding the endpoints. A point is on a edge if it is on (or at least closer than a grid point to) the edge.
[const] bool crossed_by?( Edge e )Description: Check, if an edge is cut by a line (given by an edge) This method returns true if p1 is in one semispace while p2 is in the other or one of them is on the line through the edge "e"
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] int distance( Point p )Description: Distance between the edge and a point. Returns the distance between the edge and the point. The distance is signed which is negative if the point is to the "left" of the edge and positive if the point is to the "right". The distance is measured by projecting the point onto the line through the edge. If the edge is degenerated, the distance is not defined.
[const] unsigned int distance_abs( Point p )Description: Absolute distance between the edge and a point. Returns the distance between the edge and the point.
[const] Edge dupDescription: Creates a copy of self.
[const] int dxDescription: The horizontal extend of the edge.
[const] unsigned int dx_absDescription: The absolute value of the horizontal extend of the edge.
[const] int dyDescription: The vertical extend of the edge.
[const] unsigned int dy_absDescription: The vertical extend of the edge.
ref Edge enlarge( Point p )Description: Enlarges the edge. Enlarges the edge by the given distance and returns the enlarged edge. The edge is overwritten.
[const] Edge enlarged( Point p )Description: Returns the enlarged edge Enlarges the edge by the given offset and returns the moved edge. The edge is not modified. Enlargement means that the first point is shifted by -p, the second by p.
[static] Edge from_dedge( DEdge double_edge )Description: Construct an integer coordinate edge from a floating-point coordinate edge Create a integer coordinate edge from a floating-point coordinate edge
[const] bool intersect?( Edge e )Description: Intersection test. Returns true if the edges intersect. If the edges coincide, they also intersect. For degenerated edges, the intersection is mapped to point containment tests.
[const] bool is_degenerate?Description: Test for degenerated edge An edge is degenerate, if both end and start point are identical.
[const] bool is_parallel?( Edge e )Description: Test for being parallel
[const] unsigned int lengthDescription: The length of the edge
ref Edge move( Point p )Description: Moves the edge. Moves the edge by the given offset and returns the moved edge. The edge is overwritten.
[const] Edge moved( Point p )Description: Returns the moved edge Moves the edge by the given offset and returns the moved edge. The edge is not modified.
[static] Edge new( int x1, int y1, int x2, int y2 )
|
returns: | The orthogonal length (abs(dx)+abs(dy)) |
Description: The first point.
Description: The second point.
Description: Side of the pointdistanc
Returns -1 if the point is "left" of the edge, 0 if on and 1 if the point is "right" of the edge.
p: | The point to test. |
returns: | The side value |
Description: The square of the length of the edge
Description: Swap the points of the edge
Description: Convert to a string
Description: Transform the edge.
Transforms the edge with the given transformation. Does not modify the edge but returns the transformed edge.
t: | The transformation to apply. |
returns: | The transformed edge. |
Description: Transform the edge.
Transforms the edge with the given complex transformation. Does not modify the edge but returns the transformed edge.
This method has been introduced in version 0.18.
t: | The transformation to apply. |
returns: | The transformed edge (in this case an integer coordinate edge). |
Description: Transform the edge.
Transforms the edge with the given complex transformation. Does not modify the edge but returns the transformed edge.
t: | The transformation to apply. |
returns: | The transformed edge. |
Description: Shortcut for p1.x
Description: Shortcut for p2.x
Description: Shortcut for p1.y
Description: Shortcut for p2.y