SGL
Public Member Functions | Public Attributes | List of all members
GPoint Struct Reference

This struct contains real-valued x and y fields. More...

#include "gtypes.h"

Public Member Functions

 GPoint(double x, double y)
 Creates a GPoint object with the specified x and y coordinates. More...
 
 GPoint()
 
string toString() const
 Converts the GPoint to a string in the form "(</code><i>x</i><code>,</code>&nbsp;<i>y</i><code>)". More...
 

Public Attributes

double x
 
double y
 

Detailed Description

This struct contains real-valued x and y fields.

It is used to represent a location on the graphics plane.

Constructor & Destructor Documentation

◆ GPoint() [1/2]

GPoint ( double  x,
double  y 
)

Creates a GPoint object with the specified x and y coordinates.

◆ GPoint() [2/2]

GPoint ( )

Member Function Documentation

◆ toString()

string toString ( ) const

Converts the GPoint to a string in the form "(</code><i>x</i><code>,</code>&nbsp;<i>y</i><code>)".

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const GPoint p1,
const GPoint p2 
)
friend

Compares two GPoint objects for inequality.

◆ operator*

GPoint operator* ( const GPoint p,
double  scale 
)
friend

Multiplies the x and y coordinates of the given point by the given scale factor and returns the scaled point.

◆ operator<

bool operator< ( const GPoint p1,
const GPoint p2 
)
friend

Relational operators that compare points by x-coordinate and then by y-coordinate.

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const GPoint p 
)
friend

Writes the given point to the given output stream.

◆ operator<=

bool operator<= ( const GPoint p1,
const GPoint p2 
)
friend

Relational operators that compare points by x-coordinate and then by y-coordinate.

◆ operator==

bool operator== ( const GPoint p1,
const GPoint p2 
)
friend

Compares two GPoint objects for equality.

◆ operator>

bool operator> ( const GPoint p1,
const GPoint p2 
)
friend

Relational operators that compare points by x-coordinate and then by y-coordinate.

◆ operator>=

bool operator>= ( const GPoint p1,
const GPoint p2 
)
friend

Relational operators that compare points by x-coordinate and then by y-coordinate.

Member Data Documentation

◆ x

double x

◆ y

double y