The SimpleCxxLib package


#include "gtypes.h"

class GPoint

This class contains real-valued x and y fields. It is used to represent a location on the graphics plane.
Constructor
GPoint()
GPoint(x, y) 
Creates a GPoint object with the specified x and y coordinates.
Methods
getX() Returns the x component of the point.
getY() Returns the y component of the point.
toString() Converts the GPoint to a string in the form "(x, y)".

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.

Usage:

GPoint origin;
GPoint pt(x, y);

Method detail


double getX() const;
Returns the x component of the point.

Usage:

double x = pt.getX();

double getY() const;
Returns the y component of the point.

Usage:

double y = pt.getY();

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

Usage:

string str = pt.toString();