////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
//                                                                            //
//                       (C) 2010-2016 Robot Developers                       //
//                       See LICENSE for licensing info                       //
//                                                                            //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////

//----------------------------------------------------------------------------//
// Prefaces                                                                   //
//----------------------------------------------------------------------------//

#include "Point.h"
#include "Size.h"
ROBOT_NS_BEGIN



//----------------------------------------------------------------------------//
// Constructors                                                         Point //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

Point::Point (int32 value)
{
	X = value;
	Y = value;
}

////////////////////////////////////////////////////////////////////////////////

Point::Point (int32 x, int32 y)
{
	X = x;
	Y = y;
}



//----------------------------------------------------------------------------//
// Functions                                                            Point //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

bool Point::IsZero (void) const
{
	return X == 0 && Y == 0;
}

////////////////////////////////////////////////////////////////////////////////

Size Point::ToSize (void) const
{
	return Size (X, Y);
}



//----------------------------------------------------------------------------//
// Operators                                                            Point //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

Point& Point::operator += (const Point& point)
{
	X += point.X;
	Y += point.Y;
	return *this;
}

////////////////////////////////////////////////////////////////////////////////

Point& Point::operator -= (const Point& point)
{
	X -= point.X;
	Y -= point.Y;
	return *this;
}

////////////////////////////////////////////////////////////////////////////////

Point Point::operator + (const Point& point) const
{
	return Point (X + point.X, Y + point.Y);
}

////////////////////////////////////////////////////////////////////////////////

Point Point::operator - (const Point& point) const
{
	return Point (X - point.X, Y - point.Y);
}

////////////////////////////////////////////////////////////////////////////////

bool Point::operator == (const Point& point) const
{
	return X == point.X && Y == point.Y;
}

////////////////////////////////////////////////////////////////////////////////

bool Point::operator != (const Point& point) const
{
	return X != point.X || Y != point.Y;
}

////////////////////////////////////////////////////////////////////////////////

Point Point::operator - (void) const
{
	return Point (-X, -Y);
}

ROBOT_NS_END
