2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _BASE_CIRCLE_HPP_
|
|
|
|
#define _BASE_CIRCLE_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include "Config.hpp"
|
|
|
|
#include "Base/Vector2f.hpp"
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
struct Circle
|
|
|
|
{
|
2015-11-01 09:55:47 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
typedef SQFloat Value;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
static const Circle NIL;
|
|
|
|
static const Circle MIN;
|
|
|
|
static const Circle MAX;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
static SQChar Delim;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
Vector2f pos;
|
|
|
|
Value rad;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle(Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle(const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle(const Vector2f & p, Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle(Value x, Value y, Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle(const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle(Circle && c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
~Circle();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator = (const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator = (Circle && c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator = (Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator = (const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator += (const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator -= (const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator *= (const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator /= (const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator %= (const Circle & c);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator += (Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator -= (Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator *= (Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator /= (Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator %= (Value r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator += (const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator -= (const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator *= (const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator /= (const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator %= (const Vector2f & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator ++ ();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle & operator -- ();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator ++ (int);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator -- (int);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator + (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator - (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator * (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator / (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator % (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator + (Value r) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator - (Value r) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator * (Value r) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator / (Value r) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator % (Value r) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator + (const Vector2f & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator - (const Vector2f & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator * (const Vector2f & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator / (const Vector2f & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator % (const Vector2f & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator + () const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle operator - () const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator == (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator != (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator < (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator > (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator <= (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator >= (const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInteger Cmp(const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * ToString() const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(Value nr);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const Circle & nc);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const Vector2f & np);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const Vector2f & np, Value nr);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(Value nx, Value ny);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(Value nx, Value ny, Value nr);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const SQChar * values, SQChar delim);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate(Value min, Value max, bool r);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate(Value xmin, Value xmax, Value ymin, Value ymax);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value rmin, Value rmax);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
pos.Clear(); rad = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Circle Abs() const;
|
2015-09-30 02:56:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
|
|
|
#endif // _BASE_CIRCLE_HPP_
|