#include "gtypes.h"

struct GPoint

This struct contains two real-valued fields, x and y. It is used to represent a location on the graphics plane.
Fields
x
 
y
 
Constructor
GPoint()
GPoint(x, y) 
Creates a GPoint object with the specified x and y coordinates.
Methods
toString() Returns a printable string representation of this GPoint.

Constructor detail


GPoint();
GPoint(double x, double y);
Creates a GPoint object with the specified x and y coordinates. If the coordinates are not supplied, the default constructor sets these fields to 0. The GPoint fields x and y can also directly accessed using dot notation.

Usage:

GPoint origin;
GPoint pt(x, y);

pt.x = 44.5;
if (pt.x < pt.y) ...

Method detail


string toString() const;
Converts the GPoint to a string in the form "(x, y)".

Usage:

string str = pt.toString();