Glade Reference


EdgeF class

The EdgeF class represents an edge, i.e a connected pair of vertices.

 

EdgeF::EdgeF

Creates an EdgeF object. The endpoints are undefined.

 

EdgeF::EdgeF(Point p0, Point p1)

EdgeF::EdgeF(PointF p0, PointF p1)

Creates and Edge object and initialises the endpoints to the two points.

 

EdgeF::EdgeF(float64_t x0, float64_t y0, float64_t x1, float64_t y1)

Creates an EdgeF object and initialises the endpoints.

 

PointF EdgeF::getP0()

Gets one endpoint P0.

 

PointF EdgeF::getP1()

Gets the other endpoint P1.

 

EdgeF::setP0(PointF p)

sets endpoint P0 to p.

 

EdgeF::setP1(PointF p)

sets endpoint P1 to p.

 

EdgeF::offset(int32_t dx, int32_t dy)

EdgeF::offset(float64_t dx, float64_t dy)

Transposes the edge by the distance specified by dx, dy.

 

bool EdgeF::operator ==

Returns true if the edges are the same i.e. endpoints P0 and P1 are identical.

 

bool EdgeF::operator !=

Returns true if of the edges are not the same i.e. endpoints P0 and P1 are not identical.

 

int EdgeF::length()

Returns the Euclidian length of the edge e.

 

bool EdgeF::isHorizontal()

Returns true if the edge is horizontal.

 

bool EdgeF::isVertical()

Returns true if the edge is vertical.

 

bool EdgeF::isDiagonal()

Returns true if the edge is diagonal.

 

bool EdgeF::isOrthogonal()

Returns true if the edge is either horizontal or vertical.

 

float64_t EdgeF::deltax()

Returns the horizontal distance between the edges endpoints i.e. P1-P0.

 

float64_t EdgeF::deltay()

Returns the vertical distance between the edges endpoints i.e. P1-P0.

 

bool EdgeF::contains(const Point &p, bool includeEnds=true)

bool EdgeF::contains(const PointF &p, bool includeEnds=true)

Returns true if the point p lies on the edge e. If includeEnds is true, the point p can lie on the endpoints of the edge and be considered ' contained'.

 

bool EdgeF::crosses(const Rect &r, bool touch = true)

Returns true if the edge crosses the Rect r, i.e. if the edge intersects one of the Rect's edges. If touch is true, this includes the endpoint of the edge touching an edge of the Rect.

 

bool EdgeF::crosses(Point *pts, int numPoints, bool touch = true)

bool EdgeF::crosses(PointF *pts, int numPoints, bool touch = true)

Returns true if the edge crosses the polygon given by pts, i.e. if the edge intersects one of the polygon's edges. If touch is true, this includes the endpoint of the edge touching an edge of the polygon.

 

int EdgeF::pointToEdge(const Point &p)

int EdgeF::pointToEdge(const PointF &p)

Returns the shortest distance of a point p to the edge.

 

int EdgeF::distance(const EdgeF &e)

Returns the shortest distance of the edge to another edge.

 

bool EdgeF::intersects(const EdgeF &other, bool includeEnds = true)

Returns true if the edges intersect at some point. If includeEnds is true, returns true if the edges intersect at endpoint(s).

 

PointF EdgeF::interSectsAt(const EdgeF &other)

Returns the point of intersection of two edges. The result is only valid if the edges intersect.

 

bool EdgeF::isColinear(const EdgeF &other)

Returns true if the edges are colinear, i.e. the edges are parallel and a point of one edge is on the other edge.

 

bool EdgeF::parallel(const EdgeF &other)

Returns true if this edge is parallel to the other edge.

 

bool EdgeF::left(const PointF &p)

Returns true if point p is to the left of edge e, i.e. 'inside'. Note this assumes the direction of the Edge is from endpoint P0 to endpoint P1.

 

PointF EdgeF::nearestPoint(const PointF &pt)

Returns the point on the edge that is nearest the Point pt. The point p is either on a line perpendicular to the edge, or if no such line exists, is the nearest endpoint of the edge.

 

Vector EdgeF::normalTo(const PointF &pt)

Returns a Vector that is the perpendicular distance from the Point pt to the edge.

 

bool EdgeF::projects(const EdgeF &e1, const EdgeF &e2, EdgeF &e3, EdgeF &e4)

Returns true if edges E1 and E2 are parallel and project. e3 and e4 are the resulting projecting edges.

 

 

Contents|Index

Copyright © Peardrop Design 2024.