GSegment Class Reference
[libgfc Index] [libgfc Hierarchy]
[Headers]
The ADT of Segments More...
#include <src/gadt_segment.h>
Inherits: GSpatial
Public Members
- GSegment ()
- GSegment (const GSegment& a)
- GSegment (const GPoint& p1, const GPoint& p2)
- GSegment (int x1, int y1, int x2, int y2)
- virtual ~GSegment ()
- virtual GType type () const
- virtual uint32 getPSize () const
- virtual Result init (void)
- virtual Result input (const char* in)
- virtual Result output (char*& out)
- virtual Result pack (DataPipe& p)
- virtual Result unpack (DataPipe& p)
- virtual Result scale (double xf, double yf, double zf=1)
- virtual Result translate (double xf, double yf, double zf=1)
- virtual Result rotate (double d, bool clock_wise)
- virtual Result transform (const GMatrix& m)
- virtual Result mbr (GRect& box) const
- virtual int cmp (const GADT& a) const
- virtual GADT* clone () const
- void set (Coord _x1, Coord _y1, Coord _x2, Coord _y2)
- void set (const GPoint& pt1, const GPoint& pt2)
- inline Coord getX1 () const
- inline Coord getY1 () const
- inline Coord getX2 () const
- inline Coord getY2 () const
- double distance (const GPoint& pnt) const
- double distance (const GPoint& pnt, int& flag) const
- Result bufferzone (double size, Coord* xcoords, Coord* ycoords) const
- double length () const
- virtual int covers (const GSpatial&) const
- virtual int intersects (const GSpatial& a) const
- int isInside (const GRect& other) const
- int isInside (const GCircle& other) const
The ADT of Segments.
A Segment is a straight line with two ends and
no direction.
void set(Coord _x1, Coord _y1, Coord _x2, Coord _y2) [public]
set the two ends of the segment
inline Coord getX1() const [public]
retrieve the coordinates of the two ends.
double distance(const GPoint& pnt) const [public]
calculate the vertical distance from the point to the segment.
uses the more advanced distance calculating method below.
double distance(const GPoint& pnt, int& flag) const [public]
calculate the vertical distance from the point to the segment.
also indicates whether the point' projection falls on the segments.
Returns the vertical distance.
the 'flag' indicates whether the point's perpendicular projection
is on the segment (1) or not (0).
Result bufferzone(double size, Coord* xcoords, Coord* ycoords) const [public]
generates a rectangular bufferzone along this segement. Two opposite
sides of the rectangle are in right angle with the segment, while
the other two are parallel along the segment. In other words, this
segement is the central line that splits the rectangle into two equal
parts. The size of of cushion along each side of the segment is given by
the first parameter. The four coordinates are stored into xcoords and
ycoords. The first corner is repeated at the end (to make the zone
closed), so you need to provide space for at least five doubles in
each array.
double length() const [public]
get the length of the segment
int covers(const GSpatial&) const [public virtual]
this function is not defined.
int intersects(const GSpatial& a) const [public virtual]
intesecting a segment with other ADTs.
int isInside(const GRect& other) const [public]
check if this segment is inside a rectangle.
simply use the bounding rectangle and call
covers() method of incoming rectangle.
int isInside(const GCircle& other) const [public]
check if the segment is inside a circle.
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999
|
Kdoc
|