2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _BASE_CIRCLE_HPP_
|
|
|
|
#define _BASE_CIRCLE_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "SqBase.hpp"
|
|
|
|
#include "Base/Vector2.hpp"
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-09-30 02:56:11 +02:00
|
|
|
*/
|
|
|
|
struct Circle
|
|
|
|
{
|
2015-11-01 09:55:47 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
typedef float 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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Vector2 pos;
|
2015-09-30 02:56:11 +02:00
|
|
|
Value rad;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle(Value rv);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle(const Vector2 & pv, Value rv);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle(Value xv, Value yv, Value rv);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-11-01 09:55:47 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle(const Circle & o);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-11-01 09:55:47 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator = (const Circle & o);
|
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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator = (const Vector2 & 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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator += (const Vector2 & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator -= (const Vector2 & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator *= (const Vector2 & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator /= (const Vector2 & p);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle & operator %= (const Vector2 & 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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle operator + (const Vector2 & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle operator - (const Vector2 & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle operator * (const Vector2 & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle operator / (const Vector2 & p) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Circle operator % (const Vector2 & 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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 Cmp(const Circle & c) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr 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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
void Set(const Vector2 & np);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
void Set(const Vector2 & 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
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
void Set(CSStr 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_
|