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).

Class overview

Index

Method Overview

[static] Edge from_dedge( DEdge double_edge )Construct an integer coordinate edge from a floating-point coordinate edge
[const] Edge transformed_cplx( ICplxTrans t )Transform the edge.
[static] Edge newDefault constructor: creates a degenerated edge 0,0 to 0,0
[static] Edge new( int x1, int y1, int x2, int y2 )Constructor with two coordinates given as single values
[static] Edge new( Point p1, Point p2 )Constructor with two points
[const] bool <( Edge e )Less operator
[const] bool ==( Edge e )Equality test
[const] bool !=( Edge e )Inequality test
[const] Edge moved( Point p )Returns the moved edge
[const] Edge enlarged( Point p )Returns the enlarged edge
[const] Edge transformed( Trans t )Transform the edge.
[const] DEdge transformed_cplx( CplxTrans t )Transform the edge.
ref Edge move( Point p )Moves the edge.
ref Edge enlarge( Point p )Enlarges the edge.
[const] const ref Point p1The first point.
[const] const ref Point p2The second point.
[const] int dxThe horizontal extend of the edge.
[const] int dyThe vertical extend of the edge.
[const] int x1Shortcut for p1.x
[const] int y1Shortcut for p1.y
[const] int x2Shortcut for p2.x
[const] int y2Shortcut for p2.y
[const] unsigned int dx_absThe absolute value of the horizontal extend of the edge.
[const] unsigned int dy_absThe vertical extend of the edge.
[const] Box bboxReturn the bounding box of the edge.
[const] bool is_degenerate?Test for degenerated edge
[const] unsigned int lengthThe length of the edge
[const] long long sq_lengthThe square of the length of the edge
[const] unsigned int ortho_lengthThe orthogonal length of the edge ("manhattan-length")
[const] string to_sConvert to a string
[const] bool is_parallel?( Edge e )Test for being parallel
[const] bool contains?( Point p )Test whether a point is on an edge.
[const] bool contains_excl?( Point p )Test whether a point is on an edge excluding the endpoints.
[const] bool coincident?( Edge e )Coincidence check.
[const] bool intersect?( Edge e )Intersection test.
[const] int distance( Point p )Distance between the edge and a point.
[const] int side_of( Point p )Side of the pointdistanc
[const] unsigned int distance_abs( Point p )Absolute distance between the edge and a point.
swap_pointsSwap the points of the edge
[const] bool crossed_by?( Edge e )Check, if an edge is cut by a line (given by an edge)
assign( Edge other )Assign the contents of another object to self
[const] Edge dupCreates a copy of self.
destroyExplicitly destroy the object
[const] bool destroyedTell, if the object was destroyed

[const] bool !=( Edge e )

Description: Inequality test

e:The object to compare against

[const] bool <( Edge e )

Description: Less operator

e:The object to compare against
returns:True, if the edge is 'less' as the other edge with respect to first and second point

[const] bool ==( Edge e )

Description: Equality test

e:The object to compare against

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 bbox

Description: 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.

e:the edge to test with
returns:True if the edges are coincident.

[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.

p:The point to test with the edge.
returns:True if the point is on 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.

p:The point to test with the edge.
returns:True if the point is on the edge but not equal p1 or p2.

[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"

destroy

Description: 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 destroyed

Description: 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.

p:The point to test.
returns:The distance

[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.

p:The point to test.
returns:The distance

[const] Edge dup

Description: Creates a copy of self.

[const] int dx

Description: The horizontal extend of the edge.

[const] unsigned int dx_abs

Description: The absolute value of the horizontal extend of the edge.

[const] int dy

Description: The vertical extend of the edge.

[const] unsigned int dy_abs

Description: 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.

p:The distance to move the edge points.
returns:The enlarged edge.

[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.

p:The distance to move the edge.
returns:The moved edge.

[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.

e:The edge to test.

[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

e:The edge to test against
returns:True if both edges are parallel

[const] unsigned int length

Description: 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.

p:The distance to move the edge.
returns:The moved edge.

[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.

p:The distance to move the edge.
returns:The moved edge.

[static] Edge new( int x1, int y1, int x2, int y2 )
synonym: [static] Edge new_xyxy( int x1, int y1, int x2, int y2 )

Description: Constructor with two coordinates given as single values

Two points are given to create a new edge.

[static] Edge new

Description: Default constructor: creates a degenerated edge 0,0 to 0,0

[static] Edge new( Point p1, Point p2 )
synonym: [static] Edge new_pp( Point p1, Point p2 )

Description: Constructor with two points

Two points are given to create a new edge.

[const] unsigned int ortho_length

Description: The orthogonal length of the edge ("manhattan-length")

returns:The orthogonal length (abs(dx)+abs(dy))

[const] const ref Point p1

Description: The first point.

[const] const ref Point p2

Description: The second point.

[const] int side_of( Point p )

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

[const] long long sq_length

Description: The square of the length of the edge

swap_points

Description: Swap the points of the edge

[const] string to_s

Description: Convert to a string

[const] Edge transformed( Trans t )

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.

[const] Edge transformed_cplx( ICplxTrans t )

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).

[const] DEdge transformed_cplx( CplxTrans t )

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.

[const] int x1

Description: Shortcut for p1.x

[const] int x2

Description: Shortcut for p2.x

[const] int y1

Description: Shortcut for p1.y

[const] int y2

Description: Shortcut for p2.y