#include "gtypes.h"

struct GPoint

A GPoint struct contains two fields, x and y, used to specify the x,y coordinates of a point in the graphics plane.
Fields
x
Type double
y
Type double
Constructor
GPoint()
GPoint(xy) 
Initializes a GPoint with the specified x and y coordinates.
Methods
toString() Returns a string representation of this GPoint in the form "(x, y)".

Constructor detail


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

Usage:

GPoint origin;      // x,y = 0,0
GPoint pt(x, y);

pt.x += 10;
if (origin.y == pt.y) ...

Method detail


string toString() const;
Returns a printable string representation of this GPoint in the form "(x, y)".

Usage:

string str = pt.toString();