Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Point_

 

template <class T>

struct Point_ : public Moveable< Point_<T> > 

 

Point_ is a generic structure that describes a two dimensional point object. The horizontal coordinate is represented by x and the vertical one by y. Both coordinates are of type T.

 

 

To get a specialized version of Point_, use one of the following:

 

Point

typedef Point_<int> Point

Point with with int coordinates .

 


 

Point16

typedef Point_<int16> Point16

Point with with int16 coordinates .

 


 

Point64

typedef Point_<int64> Point64

Point with with int64 coordinates .

 


 

Pointf

typedef Point_<double> Pointf

Point with with double coordinates .

 

 

Constructor List

 

Point_()

Creates an uninitialized Point_.

 


 

Point_(const Value& src)

Default copy constructor.

 


 

Point_(T x, T y)

Creates a Point_ object an initializes it's horizontal coordinate with x and it's vertical coordinate with y.

 


 

Point_(const Point_<int>& pt)

Creates a Point_ object and initializes it with a Point sz.

 


 

Point_(const Point_<short>& pt)

Creates a Point_ object and initializes it with a Point16 sz.

 


 

Point_(const Point_<double>& pt)

Creates a Point_ object and initializes it with a Pointf sz.

 


 

Point_(const Point_<int64>& pt)

Creates a Point_ object and initializes it with a Point64 sz.

 


 

Point_(const Size_<T>& sz)

Creates a Point_ object and initializes it with a Size sz.

 


 

Point_(const Nuller&)

Creates a Point_ object and initializes with Null.

 

 

Public Field List

 

T x

the horizontal coordinate

 


 

T y

the vertical coordinate

 

 

Method List

 

void Clear()

Sets both coordinates to 0.

 


 

bool IsZero() const

Returns true if both coordinates are 0, false otherwise.

 


 

void SetNull()

Reinitializes the object to Null.

 


 

bool IsNullInstance() const

Verifies if point is Null.

 


 

void Offset(T dx, T dy)

Offsets coordinates by dx and dy respectively.

 


 

unsigned GetHashValue() const

Returns the hash value of the point.

 


 

String ToString() const

Returns the String representation of the point.

 


 

Point_& operator+=(Point_ p)

Increases x with p's horizontal coordinate and y with p's vertical coordinate.

 


 

Point_& operator+=(Size_<T> p)

Increases x with p's horizontal dimension and y with p's vertical dimension.

 


 

Point_& operator+=(T t)

Increases both coordinates with the same value t.

 


 

Point_& operator-=(Point_ p)

Decreases x with p's horizontal coordinate and y with p's vertical coordinate.

 


 

Point_& operator-=(Size_<T> p)

Decreases x with p's horizontal dimension and y with p's vertical dimension.

 


 

Point_& operator-=(T t)

Decreases both coordinates with the same value t.

 


 

Point_& operator*=(Point_ p)

Multiplies x with p's horizontal coordinate and y with p's vertical coordinate.

 


 

Point_& operator*=(Size_<T> p)

Multiplies x with p's horizontal dimension and y with p's vertical dimension.

 


 

Point_& operator*=(T t)

Multiplies both dimension with the same value t.

 


 

Point_& operator/=(Point_ p)

Divides x with p's horizontal coordinate and y with p's vertical coordinate.

 


 

Point_& operator/=(Size_<T> p)

Divides x with p's horizontal dimension and y with p's vertical dimension.

 


 

Point_& operator/=(T t)

Divides both coordinates with the same value t.

 


 

Point_& operator<<=(int sh)

Shift both coordinates left by sh.

 


 

Point_& operator>>=(int sh)

Shift both coordinates right by sh.

 


 

Point_& operator++()

Increments both coordinates.

 


 

Point_& operator--()

Decrements both coordinates.

 


 

operator Value() const

Returns a conversion of the point to Value.

 


 

void Serialize(Stream& s)

Serializes the point to a stream s.

 

 

Friend List

 

friend Point_ operator+(Point_ p)

Returns an unmodified point s.

 


 

friend Point_ operator-(Point_ p)

Returns a negated point s.

 


 

friend Point_ operator+(Point_ a, Point_ b)

friend Point_ operator+(Point_ a, Size_<Tb)

friend Point_ operator+(Point_ a, T t)

friend Point_ operator+(T t, Point_ b)

friend Size_<Toperator+(Size_<Ta, Point_ b)

Returns the result of the addition of two Point_ values, a Point_ with a Size_ or a Point_ with single value.

 


 

friend Size_<Toperator-(Point_ a, Point_ b)

friend Point_ operator-(Point_ a, Size_<Tb)

friend Point_ operator-(Point_ a, T t)

friend Size_<Toperator-(Size_<Ta, Point_ b)

Returns the result of the subtraction of two Point_ values, a Point_ with a Size_ or a Point_ with single value.

 


 

friend Point_ operator*(Point_ a, Point_ b)

friend Point_ operator*(Point_ a, T b)

friend Point_ operator*(T a, Point_ b)

Returns the result of the multiplication of two Point_ values or a Point_ with single value.

 


 

friend Point_ operator/(Point_ a, Sz b)

friend Point_ operator/(Point_ a, T b)

Returns the result of the division of a Point_ with a Size_ or a Point_ with single value.

 


 

friend Point_ operator<<(Point_ a, int sh)

Returns the result of left shifting a by sh.

 


 

friend Point_ operator>>(Point_ a, int sh)

Returns the result of right shifting a by sh.

 


 

friend bool operator==(Point_ a, Point_ b)

Returns true if a and b have their respective coordinates equal, false otherwise.

 


 

friend bool operator!=(Point_ a, Point_ b)

Returns true if a and b have at least an unequal coordinates , false otherwise.

 


 

friend Point_ min(Point_ a, Point_ b)

Returns a Point_ with it's coordinates equaling the minimum of the respective coordinates between a and b.

 


 

friend Point_ max(Point_ a, Point_ b)

Returns a Point_ with it's coordinates equaling the maximum of the respective coordinates between a and b.

 


 

friend Point_ Nvl(Point_ a, Point_ b)

Returns b if a is Null, a otherwise.

 

 

Last edit by cbpporter on 01/29/2010. Do you want to contribute?. T++