1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-31 13:11:48 +02:00

Discarded the noexcept specifier entirely.

This commit is contained in:
Sandu Liviu Catalin
2015-11-01 05:48:01 +02:00
parent 2409a896df
commit 46801b1ce8
85 changed files with 4874 additions and 4874 deletions

View File

@@ -15,71 +15,71 @@ const AABB AABB::MAX = AABB(Vector3::MIN, Vector3::MAX);
SQChar AABB::Delim = ',';
// ------------------------------------------------------------------------------------------------
AABB::AABB() noexcept
AABB::AABB()
: min(-1), max(1)
{
}
AABB::AABB(Value s) noexcept
AABB::AABB(Value s)
: min(-s), max(std::fabs(s))
{
}
AABB::AABB(Value xv, Value yv, Value zv) noexcept
AABB::AABB(Value xv, Value yv, Value zv)
: min(-xv, -yv, -zv), max(std::fabs(xv), std::fabs(yv), std::fabs(zv))
{
}
AABB::AABB(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax) noexcept
AABB::AABB(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax)
: min(xmin, ymin, zmin), max(xmax, ymax, zmax)
{
}
// ------------------------------------------------------------------------------------------------
AABB::AABB(const Vector3 & v) noexcept
AABB::AABB(const Vector3 & v)
: min(-v), max(v.Abs())
{
}
AABB::AABB(const Vector3 & vmin, const Vector3 & vmax) noexcept
AABB::AABB(const Vector3 & vmin, const Vector3 & vmax)
: min(vmin), max(vmax)
{
}
// ------------------------------------------------------------------------------------------------
AABB::AABB(const Vector4 & v) noexcept
AABB::AABB(const Vector4 & v)
: min(-v), max(v.Abs())
{
}
AABB::AABB(const Vector4 & vmin, const Vector4 & vmax) noexcept
AABB::AABB(const Vector4 & vmin, const Vector4 & vmax)
: min(vmin), max(vmax)
{
}
// ------------------------------------------------------------------------------------------------
AABB::AABB(const SQChar * values, SQChar delim) noexcept
AABB::AABB(const SQChar * values, SQChar delim)
: AABB(GetAABB(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
AABB::AABB(const AABB & b) noexcept
AABB::AABB(const AABB & b)
: min(b.min), max(b.max)
{
}
AABB::AABB(AABB && b) noexcept
AABB::AABB(AABB && b)
: min(b.min), max(b.max)
{
@@ -92,14 +92,14 @@ AABB::~AABB()
}
// ------------------------------------------------------------------------------------------------
AABB & AABB::operator = (const AABB & b) noexcept
AABB & AABB::operator = (const AABB & b)
{
min = b.min;
max = b.max;
return *this;
}
AABB & AABB::operator = (AABB && b) noexcept
AABB & AABB::operator = (AABB && b)
{
min = b.min;
max = b.max;
@@ -107,21 +107,21 @@ AABB & AABB::operator = (AABB && b) noexcept
}
// ------------------------------------------------------------------------------------------------
AABB & AABB::operator = (Value s) noexcept
AABB & AABB::operator = (Value s)
{
min.Set(-s);
max.Set(std::fabs(s));
return *this;
}
AABB & AABB::operator = (const Vector3 & v) noexcept
AABB & AABB::operator = (const Vector3 & v)
{
min.Set(-v);
max.Set(v.Abs());
return *this;
}
AABB & AABB::operator = (const Vector4 & v) noexcept
AABB & AABB::operator = (const Vector4 & v)
{
min.Set(-v);
max.Set(v.Abs());
@@ -129,35 +129,35 @@ AABB & AABB::operator = (const Vector4 & v) noexcept
}
// ------------------------------------------------------------------------------------------------
AABB & AABB::operator += (const AABB & b) noexcept
AABB & AABB::operator += (const AABB & b)
{
min += b.min;
max += b.max;
return *this;
}
AABB & AABB::operator -= (const AABB & b) noexcept
AABB & AABB::operator -= (const AABB & b)
{
min -= b.min;
max -= b.max;
return *this;
}
AABB & AABB::operator *= (const AABB & b) noexcept
AABB & AABB::operator *= (const AABB & b)
{
min *= b.min;
max *= b.max;
return *this;
}
AABB & AABB::operator /= (const AABB & b) noexcept
AABB & AABB::operator /= (const AABB & b)
{
min /= b.min;
max /= b.max;
return *this;
}
AABB & AABB::operator %= (const AABB & b) noexcept
AABB & AABB::operator %= (const AABB & b)
{
min %= b.min;
max %= b.max;
@@ -165,35 +165,35 @@ AABB & AABB::operator %= (const AABB & b) noexcept
}
// ------------------------------------------------------------------------------------------------
AABB & AABB::operator += (Value s) noexcept
AABB & AABB::operator += (Value s)
{
min += s;
max += s;
return *this;
}
AABB & AABB::operator -= (Value s) noexcept
AABB & AABB::operator -= (Value s)
{
min -= s;
max -= s;
return *this;
}
AABB & AABB::operator *= (Value s) noexcept
AABB & AABB::operator *= (Value s)
{
min *= s;
max *= s;
return *this;
}
AABB & AABB::operator /= (Value s) noexcept
AABB & AABB::operator /= (Value s)
{
min /= s;
max /= s;
return *this;
}
AABB & AABB::operator %= (Value s) noexcept
AABB & AABB::operator %= (Value s)
{
min %= s;
max %= s;
@@ -201,14 +201,14 @@ AABB & AABB::operator %= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
AABB & AABB::operator ++ () noexcept
AABB & AABB::operator ++ ()
{
++min;
++max;
return *this;
}
AABB & AABB::operator -- () noexcept
AABB & AABB::operator -- ()
{
--min;
--max;
@@ -216,7 +216,7 @@ AABB & AABB::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
AABB AABB::operator ++ (int) noexcept
AABB AABB::operator ++ (int)
{
AABB state(*this);
++min;
@@ -224,7 +224,7 @@ AABB AABB::operator ++ (int) noexcept
return state;
}
AABB AABB::operator -- (int) noexcept
AABB AABB::operator -- (int)
{
AABB state(*this);
--min;
@@ -233,171 +233,171 @@ AABB AABB::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
AABB AABB::operator + (const AABB & b) const noexcept
AABB AABB::operator + (const AABB & b) const
{
return AABB(min + b.min, max + b.max);
}
AABB AABB::operator - (const AABB & b) const noexcept
AABB AABB::operator - (const AABB & b) const
{
return AABB(min - b.min, max - b.max);
}
AABB AABB::operator * (const AABB & b) const noexcept
AABB AABB::operator * (const AABB & b) const
{
return AABB(min * b.min, max * b.max);
}
AABB AABB::operator / (const AABB & b) const noexcept
AABB AABB::operator / (const AABB & b) const
{
return AABB(min / b.min, max / b.max);
}
AABB AABB::operator % (const AABB & b) const noexcept
AABB AABB::operator % (const AABB & b) const
{
return AABB(min % b.min, max % b.max);
}
// ------------------------------------------------------------------------------------------------
AABB AABB::operator + (Value s) const noexcept
AABB AABB::operator + (Value s) const
{
return AABB(min + s, max + s);
}
AABB AABB::operator - (Value s) const noexcept
AABB AABB::operator - (Value s) const
{
return AABB(min - s, max - s);
}
AABB AABB::operator * (Value s) const noexcept
AABB AABB::operator * (Value s) const
{
return AABB(min * s, max * s);
}
AABB AABB::operator / (Value s) const noexcept
AABB AABB::operator / (Value s) const
{
return AABB(min / s, max / s);
}
AABB AABB::operator % (Value s) const noexcept
AABB AABB::operator % (Value s) const
{
return AABB(min % s, max % s);
}
// ------------------------------------------------------------------------------------------------
AABB AABB::operator + () const noexcept
AABB AABB::operator + () const
{
return AABB(min.Abs(), max.Abs());
}
AABB AABB::operator - () const noexcept
AABB AABB::operator - () const
{
return AABB(-min, -max);
}
// ------------------------------------------------------------------------------------------------
bool AABB::operator == (const AABB & b) const noexcept
bool AABB::operator == (const AABB & b) const
{
return (min == b.min) && (max == b.max);
}
bool AABB::operator != (const AABB & b) const noexcept
bool AABB::operator != (const AABB & b) const
{
return (min != b.min) && (max != b.max);
}
bool AABB::operator < (const AABB & b) const noexcept
bool AABB::operator < (const AABB & b) const
{
return (min < b.min) && (max < b.max);
}
bool AABB::operator > (const AABB & b) const noexcept
bool AABB::operator > (const AABB & b) const
{
return (min > b.min) && (max > b.max);
}
bool AABB::operator <= (const AABB & b) const noexcept
bool AABB::operator <= (const AABB & b) const
{
return (min <= b.min) && (max <= b.max);
}
bool AABB::operator >= (const AABB & b) const noexcept
bool AABB::operator >= (const AABB & b) const
{
return (min >= b.min) && (max >= b.max);
}
// ------------------------------------------------------------------------------------------------
SQInteger AABB::Cmp(const AABB & b) const noexcept
SQInteger AABB::Cmp(const AABB & b) const
{
return *this == b ? 0 : (*this > b ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * AABB::ToString() const noexcept
const SQChar * AABB::ToString() const
{
return ToStringF("%f,%f,%f,%f,%f,%f", min.x, min.y, min.z, max.x, max.y, max.z);
}
// ------------------------------------------------------------------------------------------------
void AABB::Set(Value ns) noexcept
void AABB::Set(Value ns)
{
min = -ns;
max = std::fabs(ns);
}
void AABB::Set(Value nx, Value ny, Value nz) noexcept
void AABB::Set(Value nx, Value ny, Value nz)
{
min.Set(-nx, -ny, -nz);
max.Set(std::fabs(nx), std::fabs(ny), std::fabs(nz));
}
void AABB::Set(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax) noexcept
void AABB::Set(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax)
{
min.Set(xmin, ymin, zmin);
max.Set(xmax, ymax, zmax);
}
// ------------------------------------------------------------------------------------------------
void AABB::Set(const AABB & b) noexcept
void AABB::Set(const AABB & b)
{
min = b.min;
max = b.max;
}
// ------------------------------------------------------------------------------------------------
void AABB::Set(const Vector3 & v) noexcept
void AABB::Set(const Vector3 & v)
{
min = -v;
max = v.Abs();
}
void AABB::Set(const Vector3 & nmin, const Vector3 & nmax) noexcept
void AABB::Set(const Vector3 & nmin, const Vector3 & nmax)
{
min = nmin;
max = nmax;
}
// ------------------------------------------------------------------------------------------------
void AABB::Set(const Vector4 & v) noexcept
void AABB::Set(const Vector4 & v)
{
min = -v;
max = v.Abs();
}
void AABB::Set(const Vector4 & nmin, const Vector4 & nmax) noexcept
void AABB::Set(const Vector4 & nmin, const Vector4 & nmax)
{
min = nmin;
max = nmax;
}
// ------------------------------------------------------------------------------------------------
void AABB::Set(const SQChar * values, SQChar delim) noexcept
void AABB::Set(const SQChar * values, SQChar delim)
{
Set(GetAABB(values, delim));
}
// ------------------------------------------------------------------------------------------------
AABB AABB::Abs() const noexcept
AABB AABB::Abs() const
{
return AABB(min.Abs(), max.Abs());
}

View File

@@ -24,92 +24,92 @@ struct AABB
// --------------------------------------------------------------------------------------------
Vector3 min, max;
// --------------------------------------------------------------------------------------------
AABB() noexcept;
AABB(Value s) noexcept;
AABB(Value x, Value y, Value z) noexcept;
AABB(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax) noexcept;
AABB();
AABB(Value s);
AABB(Value x, Value y, Value z);
AABB(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax);
// --------------------------------------------------------------------------------------------
AABB(const Vector3 & b) noexcept;
AABB(const Vector3 & vmin, const Vector3 & vmax) noexcept;
AABB(const Vector3 & b);
AABB(const Vector3 & vmin, const Vector3 & vmax);
// --------------------------------------------------------------------------------------------
AABB(const Vector4 & b) noexcept;
AABB(const Vector4 & vmin, const Vector4 & vmax) noexcept;
AABB(const Vector4 & b);
AABB(const Vector4 & vmin, const Vector4 & vmax);
// --------------------------------------------------------------------------------------------
AABB(const SQChar * values, SQChar delim) noexcept;
AABB(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
AABB(const AABB & b) noexcept;
AABB(AABB && b) noexcept;
AABB(const AABB & b);
AABB(AABB && b);
// --------------------------------------------------------------------------------------------
~AABB();
// --------------------------------------------------------------------------------------------
AABB & operator = (const AABB & b) noexcept;
AABB & operator = (AABB && b) noexcept;
AABB & operator = (const AABB & b);
AABB & operator = (AABB && b);
// --------------------------------------------------------------------------------------------
AABB & operator = (Value s) noexcept;
AABB & operator = (const Vector3 & v) noexcept;
AABB & operator = (const Vector4 & v) noexcept;
AABB & operator = (Value s);
AABB & operator = (const Vector3 & v);
AABB & operator = (const Vector4 & v);
// --------------------------------------------------------------------------------------------
AABB & operator += (const AABB & b) noexcept;
AABB & operator -= (const AABB & b) noexcept;
AABB & operator *= (const AABB & b) noexcept;
AABB & operator /= (const AABB & b) noexcept;
AABB & operator %= (const AABB & b) noexcept;
AABB & operator += (const AABB & b);
AABB & operator -= (const AABB & b);
AABB & operator *= (const AABB & b);
AABB & operator /= (const AABB & b);
AABB & operator %= (const AABB & b);
// --------------------------------------------------------------------------------------------
AABB & operator += (Value s) noexcept;
AABB & operator -= (Value s) noexcept;
AABB & operator *= (Value s) noexcept;
AABB & operator /= (Value s) noexcept;
AABB & operator %= (Value s) noexcept;
AABB & operator += (Value s);
AABB & operator -= (Value s);
AABB & operator *= (Value s);
AABB & operator /= (Value s);
AABB & operator %= (Value s);
// --------------------------------------------------------------------------------------------
AABB & operator ++ () noexcept;
AABB & operator -- () noexcept;
AABB & operator ++ ();
AABB & operator -- ();
// --------------------------------------------------------------------------------------------
AABB operator ++ (int) noexcept;
AABB operator -- (int) noexcept;
AABB operator ++ (int);
AABB operator -- (int);
// --------------------------------------------------------------------------------------------
AABB operator + (const AABB & b) const noexcept;
AABB operator - (const AABB & b) const noexcept;
AABB operator * (const AABB & b) const noexcept;
AABB operator / (const AABB & b) const noexcept;
AABB operator % (const AABB & b) const noexcept;
AABB operator + (const AABB & b) const;
AABB operator - (const AABB & b) const;
AABB operator * (const AABB & b) const;
AABB operator / (const AABB & b) const;
AABB operator % (const AABB & b) const;
// --------------------------------------------------------------------------------------------
AABB operator + (Value s) const noexcept;
AABB operator - (Value s) const noexcept;
AABB operator * (Value s) const noexcept;
AABB operator / (Value s) const noexcept;
AABB operator % (Value s) const noexcept;
AABB operator + (Value s) const;
AABB operator - (Value s) const;
AABB operator * (Value s) const;
AABB operator / (Value s) const;
AABB operator % (Value s) const;
// --------------------------------------------------------------------------------------------
AABB operator + () const noexcept;
AABB operator - () const noexcept;
AABB operator + () const;
AABB operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const AABB & b) const noexcept;
bool operator != (const AABB & b) const noexcept;
bool operator < (const AABB & b) const noexcept;
bool operator > (const AABB & b) const noexcept;
bool operator <= (const AABB & b) const noexcept;
bool operator >= (const AABB & b) const noexcept;
bool operator == (const AABB & b) const;
bool operator != (const AABB & b) const;
bool operator < (const AABB & b) const;
bool operator > (const AABB & b) const;
bool operator <= (const AABB & b) const;
bool operator >= (const AABB & b) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const AABB & b) const noexcept;
SQInteger Cmp(const AABB & b) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny, Value nz) noexcept;
void Set(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny, Value nz);
void Set(Value xmin, Value ymin, Value zmin, Value xmax, Value ymax, Value zmax);
// --------------------------------------------------------------------------------------------
void Set(const AABB & b) noexcept;
void Set(const AABB & b);
// --------------------------------------------------------------------------------------------
void Set(const Vector3 & v) noexcept;
void Set(const Vector3 & nmin, const Vector3 & nmax) noexcept;
void Set(const Vector3 & v);
void Set(const Vector3 & nmin, const Vector3 & nmax);
// --------------------------------------------------------------------------------------------
void Set(const Vector4 & v) noexcept;
void Set(const Vector4 & nmin, const Vector4 & nmax) noexcept;
void Set(const Vector4 & v);
void Set(const Vector4 & nmin, const Vector4 & nmax);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { min.Clear(); max.Clear(); }
void Clear() { min.Clear(); max.Clear(); }
// --------------------------------------------------------------------------------------------
AABB Abs() const noexcept;
AABB Abs() const;
};
} // Namespace:: SqMod

View File

@@ -14,44 +14,44 @@ const Circle Circle::MAX = Circle(std::numeric_limits<Circle::Value>::max());
SQChar Circle::Delim = ',';
// ------------------------------------------------------------------------------------------------
Circle::Circle() noexcept
Circle::Circle()
: pos(0.0, 0.0), rad(0.0)
{
}
Circle::Circle(Value r) noexcept
Circle::Circle(Value r)
: pos(0.0, 0.0), rad(r)
{
}
Circle::Circle(const Vector2f & p) noexcept
Circle::Circle(const Vector2f & p)
: pos(p), rad(0.0)
{
}
Circle::Circle(const Vector2f & p, Value r) noexcept
Circle::Circle(const Vector2f & p, Value r)
: pos(p), rad(r)
{
}
Circle::Circle(Value x, Value y, Value r) noexcept
Circle::Circle(Value x, Value y, Value r)
: pos(x, y), rad(r)
{
}
// ------------------------------------------------------------------------------------------------
Circle::Circle(const Circle & c) noexcept
Circle::Circle(const Circle & c)
: pos(c.pos), rad(c.rad)
{
}
Circle::Circle(Circle && c) noexcept
Circle::Circle(Circle && c)
: pos(c.pos), rad(c.rad)
{
@@ -64,14 +64,14 @@ Circle::~Circle()
}
// ------------------------------------------------------------------------------------------------
Circle & Circle::operator = (const Circle & c) noexcept
Circle & Circle::operator = (const Circle & c)
{
pos = c.pos;
rad = c.rad;
return *this;
}
Circle & Circle::operator = (Circle && c) noexcept
Circle & Circle::operator = (Circle && c)
{
pos = c.pos;
rad = c.rad;
@@ -79,48 +79,48 @@ Circle & Circle::operator = (Circle && c) noexcept
}
// ------------------------------------------------------------------------------------------------
Circle & Circle::operator = (Value r) noexcept
Circle & Circle::operator = (Value r)
{
rad = r;
return *this;
}
Circle & Circle::operator = (const Vector2f & p) noexcept
Circle & Circle::operator = (const Vector2f & p)
{
pos = p;
return *this;
}
// ------------------------------------------------------------------------------------------------
Circle & Circle::operator += (const Circle & c) noexcept
Circle & Circle::operator += (const Circle & c)
{
pos += c.pos;
rad += c.rad;
return *this;
}
Circle & Circle::operator -= (const Circle & c) noexcept
Circle & Circle::operator -= (const Circle & c)
{
pos -= c.pos;
rad -= c.rad;
return *this;
}
Circle & Circle::operator *= (const Circle & c) noexcept
Circle & Circle::operator *= (const Circle & c)
{
pos *= c.pos;
rad *= c.rad;
return *this;
}
Circle & Circle::operator /= (const Circle & c) noexcept
Circle & Circle::operator /= (const Circle & c)
{
pos /= c.pos;
rad /= c.rad;
return *this;
}
Circle & Circle::operator %= (const Circle & c) noexcept
Circle & Circle::operator %= (const Circle & c)
{
pos %= c.pos;
rad = std::fmod(rad, c.rad);
@@ -129,76 +129,76 @@ Circle & Circle::operator %= (const Circle & c) noexcept
}
// ------------------------------------------------------------------------------------------------
Circle & Circle::operator += (Value r) noexcept
Circle & Circle::operator += (Value r)
{
rad += r;
return *this;
}
Circle & Circle::operator -= (Value r) noexcept
Circle & Circle::operator -= (Value r)
{
rad -= r;
return *this;
}
Circle & Circle::operator *= (Value r) noexcept
Circle & Circle::operator *= (Value r)
{
rad *= r;
return *this;
}
Circle & Circle::operator /= (Value r) noexcept
Circle & Circle::operator /= (Value r)
{
rad /= r;
return *this;
}
Circle & Circle::operator %= (Value r) noexcept
Circle & Circle::operator %= (Value r)
{
rad = std::fmod(rad, r);
return *this;
}
// ------------------------------------------------------------------------------------------------
Circle & Circle::operator += (const Vector2f & p) noexcept
Circle & Circle::operator += (const Vector2f & p)
{
pos += p;
return *this;
}
Circle & Circle::operator -= (const Vector2f & p) noexcept
Circle & Circle::operator -= (const Vector2f & p)
{
pos -= p;
return *this;
}
Circle & Circle::operator *= (const Vector2f & p) noexcept
Circle & Circle::operator *= (const Vector2f & p)
{
pos *= p;
return *this;
}
Circle & Circle::operator /= (const Vector2f & p) noexcept
Circle & Circle::operator /= (const Vector2f & p)
{
pos /= p;
return *this;
}
Circle & Circle::operator %= (const Vector2f & p) noexcept
Circle & Circle::operator %= (const Vector2f & p)
{
pos %= p;
return *this;
}
// ------------------------------------------------------------------------------------------------
Circle & Circle::operator ++ () noexcept
Circle & Circle::operator ++ ()
{
++pos;
++rad;
return *this;
}
Circle & Circle::operator -- () noexcept
Circle & Circle::operator -- ()
{
--pos;
--rad;
@@ -206,7 +206,7 @@ Circle & Circle::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Circle Circle::operator ++ (int) noexcept
Circle Circle::operator ++ (int)
{
Circle state(*this);
++pos;
@@ -214,7 +214,7 @@ Circle Circle::operator ++ (int) noexcept
return state;
}
Circle Circle::operator -- (int) noexcept
Circle Circle::operator -- (int)
{
Circle state(*this);
--pos;
@@ -223,186 +223,186 @@ Circle Circle::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Circle Circle::operator + (const Circle & c) const noexcept
Circle Circle::operator + (const Circle & c) const
{
return Circle(pos + c.pos, rad + c.rad);
}
Circle Circle::operator - (const Circle & c) const noexcept
Circle Circle::operator - (const Circle & c) const
{
return Circle(pos - c.pos, rad - c.rad);
}
Circle Circle::operator * (const Circle & c) const noexcept
Circle Circle::operator * (const Circle & c) const
{
return Circle(pos * c.pos, rad * c.rad);
}
Circle Circle::operator / (const Circle & c) const noexcept
Circle Circle::operator / (const Circle & c) const
{
return Circle(pos / c.pos, rad / c.rad);
}
Circle Circle::operator % (const Circle & c) const noexcept
Circle Circle::operator % (const Circle & c) const
{
return Circle(pos % c.pos, std::fmod(rad, c.rad));
}
// ------------------------------------------------------------------------------------------------
Circle Circle::operator + (Value r) const noexcept
Circle Circle::operator + (Value r) const
{
return Circle(rad + r);
}
Circle Circle::operator - (Value r) const noexcept
Circle Circle::operator - (Value r) const
{
return Circle(rad - r);
}
Circle Circle::operator * (Value r) const noexcept
Circle Circle::operator * (Value r) const
{
return Circle(rad * r);
}
Circle Circle::operator / (Value r) const noexcept
Circle Circle::operator / (Value r) const
{
return Circle(rad / r);
}
Circle Circle::operator % (Value r) const noexcept
Circle Circle::operator % (Value r) const
{
return Circle(std::fmod(rad, r));
}
// ------------------------------------------------------------------------------------------------
Circle Circle::operator + (const Vector2f & p) const noexcept
Circle Circle::operator + (const Vector2f & p) const
{
return Circle(pos + p);
}
Circle Circle::operator - (const Vector2f & p) const noexcept
Circle Circle::operator - (const Vector2f & p) const
{
return Circle(pos - p);
}
Circle Circle::operator * (const Vector2f & p) const noexcept
Circle Circle::operator * (const Vector2f & p) const
{
return Circle(pos * p);
}
Circle Circle::operator / (const Vector2f & p) const noexcept
Circle Circle::operator / (const Vector2f & p) const
{
return Circle(pos / p);
}
Circle Circle::operator % (const Vector2f & p) const noexcept
Circle Circle::operator % (const Vector2f & p) const
{
return Circle(pos % p);
}
// ------------------------------------------------------------------------------------------------
Circle Circle::operator + () const noexcept
Circle Circle::operator + () const
{
return Circle(pos.Abs(), std::fabs(rad));
}
Circle Circle::operator - () const noexcept
Circle Circle::operator - () const
{
return Circle(-pos, -rad);
}
// ------------------------------------------------------------------------------------------------
bool Circle::operator == (const Circle & c) const noexcept
bool Circle::operator == (const Circle & c) const
{
return (rad == c.rad) && (pos == c.pos);
}
bool Circle::operator != (const Circle & c) const noexcept
bool Circle::operator != (const Circle & c) const
{
return (rad != c.rad) && (pos != c.pos);
}
bool Circle::operator < (const Circle & c) const noexcept
bool Circle::operator < (const Circle & c) const
{
return (rad < c.rad) && (pos < c.pos);
}
bool Circle::operator > (const Circle & c) const noexcept
bool Circle::operator > (const Circle & c) const
{
return (rad > c.rad) && (pos > c.pos);
}
bool Circle::operator <= (const Circle & c) const noexcept
bool Circle::operator <= (const Circle & c) const
{
return (rad <= c.rad) && (pos <= c.pos);
}
bool Circle::operator >= (const Circle & c) const noexcept
bool Circle::operator >= (const Circle & c) const
{
return (rad >= c.rad) && (pos >= c.pos);
}
// ------------------------------------------------------------------------------------------------
SQInteger Circle::Cmp(const Circle & c) const noexcept
SQInteger Circle::Cmp(const Circle & c) const
{
return *this == c ? 0 : (*this > c ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Circle::ToString() const noexcept
const SQChar * Circle::ToString() const
{
return ToStringF("%f,%f,%f", pos.x, pos.y, rad);
}
// ------------------------------------------------------------------------------------------------
void Circle::Set(Value nr) noexcept
void Circle::Set(Value nr)
{
rad = nr;
}
void Circle::Set(const Circle & nc) noexcept
void Circle::Set(const Circle & nc)
{
pos = nc.pos;
rad = nc.rad;
}
void Circle::Set(const Vector2f & np) noexcept
void Circle::Set(const Vector2f & np)
{
pos = np;
}
void Circle::Set(const Vector2f & np, Value nr) noexcept
void Circle::Set(const Vector2f & np, Value nr)
{
pos = np;
rad = nr;
}
// ------------------------------------------------------------------------------------------------
void Circle::Set(Value nx, Value ny) noexcept
void Circle::Set(Value nx, Value ny)
{
pos.Set(nx, ny);
}
void Circle::Set(Value nx, Value ny, Value nr) noexcept
void Circle::Set(Value nx, Value ny, Value nr)
{
pos.Set(nx, ny);
rad = nr;
}
// ------------------------------------------------------------------------------------------------
void Circle::Set(const SQChar * values, SQChar delim) noexcept
void Circle::Set(const SQChar * values, SQChar delim)
{
Set(GetCircle(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Circle::Generate() noexcept
void Circle::Generate()
{
pos.Generate();
rad = RandomVal<Value>::Get();
}
void Circle::Generate(Value min, Value max, bool r) noexcept
void Circle::Generate(Value min, Value max, bool r)
{
if (max < min)
{
@@ -418,12 +418,12 @@ void Circle::Generate(Value min, Value max, bool r) noexcept
}
}
void Circle::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
void Circle::Generate(Value xmin, Value xmax, Value ymin, Value ymax)
{
pos.Generate(xmin, xmax, ymin, ymax);
}
void Circle::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value rmin, Value rmax) noexcept
void Circle::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value rmin, Value rmax)
{
if (std::isless(rmax, rmin))
{
@@ -437,7 +437,7 @@ void Circle::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value rmin
}
// ------------------------------------------------------------------------------------------------
Circle Circle::Abs() const noexcept
Circle Circle::Abs() const
{
return Circle(pos.Abs(), std::fabs(rad));
}

View File

@@ -25,97 +25,97 @@ struct Circle
Vector2f pos;
Value rad;
// --------------------------------------------------------------------------------------------
Circle() noexcept;
Circle(Value r) noexcept;
Circle(const Vector2f & p) noexcept;
Circle(const Vector2f & p, Value r) noexcept;
Circle(Value x, Value y, Value r) noexcept;
Circle();
Circle(Value r);
Circle(const Vector2f & p);
Circle(const Vector2f & p, Value r);
Circle(Value x, Value y, Value r);
// --------------------------------------------------------------------------------------------
Circle(const Circle & c) noexcept;
Circle(Circle && c) noexcept;
Circle(const Circle & c);
Circle(Circle && c);
// --------------------------------------------------------------------------------------------
~Circle();
// --------------------------------------------------------------------------------------------
Circle & operator = (const Circle & c) noexcept;
Circle & operator = (Circle && c) noexcept;
Circle & operator = (const Circle & c);
Circle & operator = (Circle && c);
// --------------------------------------------------------------------------------------------
Circle & operator = (Value r) noexcept;
Circle & operator = (const Vector2f & p) noexcept;
Circle & operator = (Value r);
Circle & operator = (const Vector2f & p);
// --------------------------------------------------------------------------------------------
Circle & operator += (const Circle & c) noexcept;
Circle & operator -= (const Circle & c) noexcept;
Circle & operator *= (const Circle & c) noexcept;
Circle & operator /= (const Circle & c) noexcept;
Circle & operator %= (const Circle & c) noexcept;
Circle & operator += (const Circle & c);
Circle & operator -= (const Circle & c);
Circle & operator *= (const Circle & c);
Circle & operator /= (const Circle & c);
Circle & operator %= (const Circle & c);
// --------------------------------------------------------------------------------------------
Circle & operator += (Value r) noexcept;
Circle & operator -= (Value r) noexcept;
Circle & operator *= (Value r) noexcept;
Circle & operator /= (Value r) noexcept;
Circle & operator %= (Value r) noexcept;
Circle & operator += (Value r);
Circle & operator -= (Value r);
Circle & operator *= (Value r);
Circle & operator /= (Value r);
Circle & operator %= (Value r);
// --------------------------------------------------------------------------------------------
Circle & operator += (const Vector2f & p) noexcept;
Circle & operator -= (const Vector2f & p) noexcept;
Circle & operator *= (const Vector2f & p) noexcept;
Circle & operator /= (const Vector2f & p) noexcept;
Circle & operator %= (const Vector2f & p) noexcept;
Circle & operator += (const Vector2f & p);
Circle & operator -= (const Vector2f & p);
Circle & operator *= (const Vector2f & p);
Circle & operator /= (const Vector2f & p);
Circle & operator %= (const Vector2f & p);
// --------------------------------------------------------------------------------------------
Circle & operator ++ () noexcept;
Circle & operator -- () noexcept;
Circle & operator ++ ();
Circle & operator -- ();
// --------------------------------------------------------------------------------------------
Circle operator ++ (int) noexcept;
Circle operator -- (int) noexcept;
Circle operator ++ (int);
Circle operator -- (int);
// --------------------------------------------------------------------------------------------
Circle operator + (const Circle & c) const noexcept;
Circle operator - (const Circle & c) const noexcept;
Circle operator * (const Circle & c) const noexcept;
Circle operator / (const Circle & c) const noexcept;
Circle operator % (const Circle & c) const noexcept;
Circle operator + (const Circle & c) const;
Circle operator - (const Circle & c) const;
Circle operator * (const Circle & c) const;
Circle operator / (const Circle & c) const;
Circle operator % (const Circle & c) const;
// --------------------------------------------------------------------------------------------
Circle operator + (Value r) const noexcept;
Circle operator - (Value r) const noexcept;
Circle operator * (Value r) const noexcept;
Circle operator / (Value r) const noexcept;
Circle operator % (Value r) const noexcept;
Circle operator + (Value r) const;
Circle operator - (Value r) const;
Circle operator * (Value r) const;
Circle operator / (Value r) const;
Circle operator % (Value r) const;
// --------------------------------------------------------------------------------------------
Circle operator + (const Vector2f & p) const noexcept;
Circle operator - (const Vector2f & p) const noexcept;
Circle operator * (const Vector2f & p) const noexcept;
Circle operator / (const Vector2f & p) const noexcept;
Circle operator % (const Vector2f & p) const noexcept;
Circle operator + (const Vector2f & p) const;
Circle operator - (const Vector2f & p) const;
Circle operator * (const Vector2f & p) const;
Circle operator / (const Vector2f & p) const;
Circle operator % (const Vector2f & p) const;
// --------------------------------------------------------------------------------------------
Circle operator + () const noexcept;
Circle operator - () const noexcept;
Circle operator + () const;
Circle operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Circle & c) const noexcept;
bool operator != (const Circle & c) const noexcept;
bool operator < (const Circle & c) const noexcept;
bool operator > (const Circle & c) const noexcept;
bool operator <= (const Circle & c) const noexcept;
bool operator >= (const Circle & c) const noexcept;
bool operator == (const Circle & c) const;
bool operator != (const Circle & c) const;
bool operator < (const Circle & c) const;
bool operator > (const Circle & c) const;
bool operator <= (const Circle & c) const;
bool operator >= (const Circle & c) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Circle & c) const noexcept;
SQInteger Cmp(const Circle & c) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value nr) noexcept;
void Set(const Circle & nc) noexcept;
void Set(const Vector2f & np) noexcept;
void Set(const Vector2f & np, Value nr) noexcept;
void Set(Value nr);
void Set(const Circle & nc);
void Set(const Vector2f & np);
void Set(const Vector2f & np, Value nr);
// --------------------------------------------------------------------------------------------
void Set(Value nx, Value ny) noexcept;
void Set(Value nx, Value ny, Value nr) noexcept;
void Set(Value nx, Value ny);
void Set(Value nx, Value ny, Value nr);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max, bool r) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value rmin, Value rmax) noexcept;
void Generate();
void Generate(Value min, Value max, bool r);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value rmin, Value rmax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { pos.Clear(); rad = 0.0; }
void Clear() { pos.Clear(); rad = 0.0; }
// --------------------------------------------------------------------------------------------
Circle Abs() const noexcept;
Circle Abs() const;
};
} // Namespace:: SqMod

View File

@@ -15,52 +15,52 @@ const Color3 Color3::MAX = Color3(std::numeric_limits<Color3::Value>::max());
SQChar Color3::Delim = ',';
// ------------------------------------------------------------------------------------------------
Color3::Color3() noexcept
Color3::Color3()
: r(0), g(0), b(0)
{
}
Color3::Color3(Value s) noexcept
Color3::Color3(Value s)
: r(s), g(s), b(s)
{
}
Color3::Color3(Value rv, Value gv, Value bv) noexcept
Color3::Color3(Value rv, Value gv, Value bv)
: r(rv), g(gv), b(bv)
{
}
// ------------------------------------------------------------------------------------------------
Color3::Color3(const Color4 & c) noexcept
Color3::Color3(const Color4 & c)
: r(c.r), g(c.g), b(c.b)
{
}
// ------------------------------------------------------------------------------------------------
Color3::Color3(const SQChar * name) noexcept
Color3::Color3(const SQChar * name)
: Color3(GetColor(name))
{
}
Color3::Color3(const SQChar * str, SQChar delim) noexcept
Color3::Color3(const SQChar * str, SQChar delim)
: Color3(GetColor3(str, delim))
{
}
// ------------------------------------------------------------------------------------------------
Color3::Color3(const Color3 & c) noexcept
Color3::Color3(const Color3 & c)
: r(c.r), g(c.g), b(c.b)
{
}
Color3::Color3(Color3 && c) noexcept
Color3::Color3(Color3 && c)
: r(c.r), g(c.g), b(c.b)
{
@@ -73,7 +73,7 @@ Color3::~Color3()
}
// ------------------------------------------------------------------------------------------------
Color3 & Color3::operator = (const Color3 & c) noexcept
Color3 & Color3::operator = (const Color3 & c)
{
r = c.r;
g = c.g;
@@ -81,7 +81,7 @@ Color3 & Color3::operator = (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator = (Color3 && c) noexcept
Color3 & Color3::operator = (Color3 && c)
{
r = c.r;
g = c.g;
@@ -90,7 +90,7 @@ Color3 & Color3::operator = (Color3 && c) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 & Color3::operator = (Value s) noexcept
Color3 & Color3::operator = (Value s)
{
r = s;
g = s;
@@ -98,13 +98,13 @@ Color3 & Color3::operator = (Value s) noexcept
return *this;
}
Color3 & Color3::operator = (const SQChar * name) noexcept
Color3 & Color3::operator = (const SQChar * name)
{
Set(GetColor(name));
return *this;
}
Color3 & Color3::operator = (const Color4 & c) noexcept
Color3 & Color3::operator = (const Color4 & c)
{
r = c.r;
g = c.g;
@@ -113,7 +113,7 @@ Color3 & Color3::operator = (const Color4 & c) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 & Color3::operator += (const Color3 & c) noexcept
Color3 & Color3::operator += (const Color3 & c)
{
r += c.r;
g += c.g;
@@ -121,7 +121,7 @@ Color3 & Color3::operator += (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator -= (const Color3 & c) noexcept
Color3 & Color3::operator -= (const Color3 & c)
{
r -= c.r;
g -= c.g;
@@ -129,7 +129,7 @@ Color3 & Color3::operator -= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator *= (const Color3 & c) noexcept
Color3 & Color3::operator *= (const Color3 & c)
{
r *= c.r;
g *= c.g;
@@ -137,7 +137,7 @@ Color3 & Color3::operator *= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator /= (const Color3 & c) noexcept
Color3 & Color3::operator /= (const Color3 & c)
{
r /= c.r;
g /= c.g;
@@ -145,7 +145,7 @@ Color3 & Color3::operator /= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator %= (const Color3 & c) noexcept
Color3 & Color3::operator %= (const Color3 & c)
{
r %= c.r;
g %= c.g;
@@ -153,7 +153,7 @@ Color3 & Color3::operator %= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator &= (const Color3 & c) noexcept
Color3 & Color3::operator &= (const Color3 & c)
{
r &= c.r;
g &= c.g;
@@ -161,7 +161,7 @@ Color3 & Color3::operator &= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator |= (const Color3 & c) noexcept
Color3 & Color3::operator |= (const Color3 & c)
{
r |= c.r;
g |= c.g;
@@ -169,7 +169,7 @@ Color3 & Color3::operator |= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator ^= (const Color3 & c) noexcept
Color3 & Color3::operator ^= (const Color3 & c)
{
r ^= c.r;
g ^= c.g;
@@ -177,7 +177,7 @@ Color3 & Color3::operator ^= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator <<= (const Color3 & c) noexcept
Color3 & Color3::operator <<= (const Color3 & c)
{
r <<= c.r;
g <<= c.g;
@@ -185,7 +185,7 @@ Color3 & Color3::operator <<= (const Color3 & c) noexcept
return *this;
}
Color3 & Color3::operator >>= (const Color3 & c) noexcept
Color3 & Color3::operator >>= (const Color3 & c)
{
r >>= c.r;
g >>= c.g;
@@ -194,7 +194,7 @@ Color3 & Color3::operator >>= (const Color3 & c) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 & Color3::operator += (Value s) noexcept
Color3 & Color3::operator += (Value s)
{
r += s;
g += s;
@@ -202,7 +202,7 @@ Color3 & Color3::operator += (Value s) noexcept
return *this;
}
Color3 & Color3::operator -= (Value s) noexcept
Color3 & Color3::operator -= (Value s)
{
r -= s;
g -= s;
@@ -210,7 +210,7 @@ Color3 & Color3::operator -= (Value s) noexcept
return *this;
}
Color3 & Color3::operator *= (Value s) noexcept
Color3 & Color3::operator *= (Value s)
{
r *= s;
g *= s;
@@ -218,7 +218,7 @@ Color3 & Color3::operator *= (Value s) noexcept
return *this;
}
Color3 & Color3::operator /= (Value s) noexcept
Color3 & Color3::operator /= (Value s)
{
r /= s;
g /= s;
@@ -226,7 +226,7 @@ Color3 & Color3::operator /= (Value s) noexcept
return *this;
}
Color3 & Color3::operator %= (Value s) noexcept
Color3 & Color3::operator %= (Value s)
{
r %= s;
g %= s;
@@ -234,7 +234,7 @@ Color3 & Color3::operator %= (Value s) noexcept
return *this;
}
Color3 & Color3::operator &= (Value s) noexcept
Color3 & Color3::operator &= (Value s)
{
r &= s;
g &= s;
@@ -242,7 +242,7 @@ Color3 & Color3::operator &= (Value s) noexcept
return *this;
}
Color3 & Color3::operator |= (Value s) noexcept
Color3 & Color3::operator |= (Value s)
{
r |= s;
g |= s;
@@ -250,7 +250,7 @@ Color3 & Color3::operator |= (Value s) noexcept
return *this;
}
Color3 & Color3::operator ^= (Value s) noexcept
Color3 & Color3::operator ^= (Value s)
{
r ^= s;
g ^= s;
@@ -258,7 +258,7 @@ Color3 & Color3::operator ^= (Value s) noexcept
return *this;
}
Color3 & Color3::operator <<= (Value s) noexcept
Color3 & Color3::operator <<= (Value s)
{
r <<= s;
g <<= s;
@@ -266,7 +266,7 @@ Color3 & Color3::operator <<= (Value s) noexcept
return *this;
}
Color3 & Color3::operator >>= (Value s) noexcept
Color3 & Color3::operator >>= (Value s)
{
r >>= s;
g >>= s;
@@ -275,7 +275,7 @@ Color3 & Color3::operator >>= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 & Color3::operator ++ () noexcept
Color3 & Color3::operator ++ ()
{
++r;
++g;
@@ -283,7 +283,7 @@ Color3 & Color3::operator ++ () noexcept
return *this;
}
Color3 & Color3::operator -- () noexcept
Color3 & Color3::operator -- ()
{
--r;
--g;
@@ -292,7 +292,7 @@ Color3 & Color3::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 Color3::operator ++ (int) noexcept
Color3 Color3::operator ++ (int)
{
Color3 state(*this);
++r;
@@ -301,7 +301,7 @@ Color3 Color3::operator ++ (int) noexcept
return state;
}
Color3 Color3::operator -- (int) noexcept
Color3 Color3::operator -- (int)
{
Color3 state(*this);
--r;
@@ -311,176 +311,176 @@ Color3 Color3::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 Color3::operator + (const Color3 & c) const noexcept
Color3 Color3::operator + (const Color3 & c) const
{
return Color3(r + c.r, g + c.g, b + c.b);
}
Color3 Color3::operator - (const Color3 & c) const noexcept
Color3 Color3::operator - (const Color3 & c) const
{
return Color3(r - c.r, g - c.g, b - c.b);
}
Color3 Color3::operator * (const Color3 & c) const noexcept
Color3 Color3::operator * (const Color3 & c) const
{
return Color3(r * c.r, g * c.g, b * c.b);
}
Color3 Color3::operator / (const Color3 & c) const noexcept
Color3 Color3::operator / (const Color3 & c) const
{
return Color3(r / c.r, g / c.g, b / c.b);
}
Color3 Color3::operator % (const Color3 & c) const noexcept
Color3 Color3::operator % (const Color3 & c) const
{
return Color3(r % c.r, g % c.g, b % c.b);
}
Color3 Color3::operator & (const Color3 & c) const noexcept
Color3 Color3::operator & (const Color3 & c) const
{
return Color3(r & c.r, g & c.g, b & c.b);
}
Color3 Color3::operator | (const Color3 & c) const noexcept
Color3 Color3::operator | (const Color3 & c) const
{
return Color3(r | c.r, g | c.g, b | c.b);
}
Color3 Color3::operator ^ (const Color3 & c) const noexcept
Color3 Color3::operator ^ (const Color3 & c) const
{
return Color3(r ^ c.r, g ^ c.g, b ^ c.b);
}
Color3 Color3::operator << (const Color3 & c) const noexcept
Color3 Color3::operator << (const Color3 & c) const
{
return Color3(r << c.r, g << c.g, b << c.b);
}
Color3 Color3::operator >> (const Color3 & c) const noexcept
Color3 Color3::operator >> (const Color3 & c) const
{
return Color3(r >> c.r, g >> c.g, b >> c.b);
}
// ------------------------------------------------------------------------------------------------
Color3 Color3::operator + (Value s) const noexcept
Color3 Color3::operator + (Value s) const
{
return Color3(r + s, g + s, b + s);
}
Color3 Color3::operator - (Value s) const noexcept
Color3 Color3::operator - (Value s) const
{
return Color3(r - s, g - s, b - s);
}
Color3 Color3::operator * (Value s) const noexcept
Color3 Color3::operator * (Value s) const
{
return Color3(r * s, g * s, b * s);
}
Color3 Color3::operator / (Value s) const noexcept
Color3 Color3::operator / (Value s) const
{
return Color3(r / s, g / s, b / s);
}
Color3 Color3::operator % (Value s) const noexcept
Color3 Color3::operator % (Value s) const
{
return Color3(r % s, g % s, b % s);
}
Color3 Color3::operator & (Value s) const noexcept
Color3 Color3::operator & (Value s) const
{
return Color3(r & s, g & s, b & s);
}
Color3 Color3::operator | (Value s) const noexcept
Color3 Color3::operator | (Value s) const
{
return Color3(r | s, g | s, b | s);
}
Color3 Color3::operator ^ (Value s) const noexcept
Color3 Color3::operator ^ (Value s) const
{
return Color3(r ^ s, g ^ s, b ^ s);
}
Color3 Color3::operator << (Value s) const noexcept
Color3 Color3::operator << (Value s) const
{
return Color3(r << s, g << s, b << s);
}
Color3 Color3::operator >> (Value s) const noexcept
Color3 Color3::operator >> (Value s) const
{
return Color3(r >> s, g >> s, b >> s);
}
// ------------------------------------------------------------------------------------------------
Color3 Color3::operator + () const noexcept
Color3 Color3::operator + () const
{
return Color3(r, g, b);
}
Color3 Color3::operator - () const noexcept
Color3 Color3::operator - () const
{
return Color3(0, 0, 0);
}
// ------------------------------------------------------------------------------------------------
Color3 Color3::operator ~ () const noexcept
Color3 Color3::operator ~ () const
{
return Color3(~r, ~g, ~b);
}
// ------------------------------------------------------------------------------------------------
bool Color3::operator == (const Color3 & c) const noexcept
bool Color3::operator == (const Color3 & c) const
{
return (r == c.r) && (g == c.g) && (b == c.b);
}
bool Color3::operator != (const Color3 & c) const noexcept
bool Color3::operator != (const Color3 & c) const
{
return (r != c.r) && (g != c.g) && (b != c.b);
}
bool Color3::operator < (const Color3 & c) const noexcept
bool Color3::operator < (const Color3 & c) const
{
return (r < c.r) && (g < c.g) && (b < c.b);
}
bool Color3::operator > (const Color3 & c) const noexcept
bool Color3::operator > (const Color3 & c) const
{
return (r > c.r) && (g > c.g) && (b > c.b);
}
bool Color3::operator <= (const Color3 & c) const noexcept
bool Color3::operator <= (const Color3 & c) const
{
return (r <= c.r) && (g <= c.g) && (b <= c.b);
}
bool Color3::operator >= (const Color3 & c) const noexcept
bool Color3::operator >= (const Color3 & c) const
{
return (r >= c.r) && (g >= c.g) && (b >= c.b);
}
// ------------------------------------------------------------------------------------------------
SQInteger Color3::Cmp(const Color3 & c) const noexcept
SQInteger Color3::Cmp(const Color3 & c) const
{
return *this == c ? 0 : (*this > c ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Color3::ToString() const noexcept
const SQChar * Color3::ToString() const
{
return ToStringF("%u,%u,%u", r, g, b);
}
// ------------------------------------------------------------------------------------------------
void Color3::Set(Value ns) noexcept
void Color3::Set(Value ns)
{
r = ns;
g = ns;
b = ns;
}
void Color3::Set(Value nr, Value ng, Value nb) noexcept
void Color3::Set(Value nr, Value ng, Value nb)
{
r = nr;
g = ng;
@@ -488,14 +488,14 @@ void Color3::Set(Value nr, Value ng, Value nb) noexcept
}
// ------------------------------------------------------------------------------------------------
void Color3::Set(const Color3 & c) noexcept
void Color3::Set(const Color3 & c)
{
r = c.r;
g = c.g;
b = c.b;
}
void Color3::Set(const Color4 & c) noexcept
void Color3::Set(const Color4 & c)
{
r = c.r;
g = c.g;
@@ -503,24 +503,24 @@ void Color3::Set(const Color4 & c) noexcept
}
// ------------------------------------------------------------------------------------------------
void Color3::Set(const SQChar * str, SQChar delim) noexcept
void Color3::Set(const SQChar * str, SQChar delim)
{
Set(GetColor3(str, delim));
}
// ------------------------------------------------------------------------------------------------
void Color3::SetCol(const SQChar * name) noexcept
void Color3::SetCol(const SQChar * name)
{
Set(GetColor(name));
}
// ------------------------------------------------------------------------------------------------
SQUint32 Color3::GetRGB() const noexcept
SQUint32 Color3::GetRGB() const
{
return static_cast<SQUint32>(r << 16 | g << 8 | b);
}
void Color3::SetRGB(SQUint32 p) noexcept
void Color3::SetRGB(SQUint32 p)
{
r = static_cast<Value>((p >> 16) & 0xFF);
g = static_cast<Value>((p >> 8) & 0xFF);
@@ -528,12 +528,12 @@ void Color3::SetRGB(SQUint32 p) noexcept
}
// ------------------------------------------------------------------------------------------------
SQUint32 Color3::GetRGBA() const noexcept
SQUint32 Color3::GetRGBA() const
{
return static_cast<SQUint32>(r << 24 | g << 16 | b << 8 | 0x00);
}
void Color3::SetRGBA(SQUint32 p) noexcept
void Color3::SetRGBA(SQUint32 p)
{
r = static_cast<Value>((p >> 24) & 0xFF);
g = static_cast<Value>((p >> 16) & 0xFF);
@@ -541,12 +541,12 @@ void Color3::SetRGBA(SQUint32 p) noexcept
}
// ------------------------------------------------------------------------------------------------
SQUint32 Color3::GetARGB() const noexcept
SQUint32 Color3::GetARGB() const
{
return static_cast<SQUint32>(0x00 << 24 | r << 16 | g << 8 | b);
}
void Color3::SetARGB(SQUint32 p) noexcept
void Color3::SetARGB(SQUint32 p)
{
r = static_cast<Value>((p >> 16) & 0xFF);
g = static_cast<Value>((p >> 8) & 0xFF);
@@ -554,14 +554,14 @@ void Color3::SetARGB(SQUint32 p) noexcept
}
// ------------------------------------------------------------------------------------------------
void Color3::Generate() noexcept
void Color3::Generate()
{
r = RandomVal<Value>::Get();
g = RandomVal<Value>::Get();
b = RandomVal<Value>::Get();
}
void Color3::Generate(Value min, Value max) noexcept
void Color3::Generate(Value min, Value max)
{
if (max < min)
{
@@ -575,7 +575,7 @@ void Color3::Generate(Value min, Value max) noexcept
}
}
void Color3::Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax) noexcept
void Color3::Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax)
{
if (rmax < rmin || gmax < gmin || bmax < bmin)
{
@@ -590,13 +590,13 @@ void Color3::Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin
}
// ------------------------------------------------------------------------------------------------
void Color3::Random() noexcept
void Color3::Random()
{
Set(GetRandomColor());
}
// ------------------------------------------------------------------------------------------------
void Color3::Inverse() noexcept
void Color3::Inverse()
{
r = static_cast<Value>(~r);
g = static_cast<Value>(~g);

View File

@@ -23,121 +23,121 @@ struct Color3
// --------------------------------------------------------------------------------------------
Value r, g, b;
// --------------------------------------------------------------------------------------------
Color3() noexcept;
Color3(Value s) noexcept;
Color3(Value r, Value g, Value b) noexcept;
Color3();
Color3(Value s);
Color3(Value r, Value g, Value b);
// --------------------------------------------------------------------------------------------
Color3(const Color4 & c) noexcept;
Color3(const Color4 & c);
// --------------------------------------------------------------------------------------------
Color3(const SQChar * name) noexcept;
Color3(const SQChar * str, SQChar delim) noexcept;
Color3(const SQChar * name);
Color3(const SQChar * str, SQChar delim);
// --------------------------------------------------------------------------------------------
Color3(const Color3 & c) noexcept;
Color3(Color3 && c) noexcept;
Color3(const Color3 & c);
Color3(Color3 && c);
// --------------------------------------------------------------------------------------------
~Color3();
// --------------------------------------------------------------------------------------------
Color3 & operator = (const Color3 & c) noexcept;
Color3 & operator = (Color3 && c) noexcept;
Color3 & operator = (const Color3 & c);
Color3 & operator = (Color3 && c);
// --------------------------------------------------------------------------------------------
Color3 & operator = (Value s) noexcept;
Color3 & operator = (const SQChar * name) noexcept;
Color3 & operator = (const Color4 & c) noexcept;
Color3 & operator = (Value s);
Color3 & operator = (const SQChar * name);
Color3 & operator = (const Color4 & c);
// --------------------------------------------------------------------------------------------
Color3 & operator += (const Color3 & c) noexcept;
Color3 & operator -= (const Color3 & c) noexcept;
Color3 & operator *= (const Color3 & c) noexcept;
Color3 & operator /= (const Color3 & c) noexcept;
Color3 & operator %= (const Color3 & c) noexcept;
Color3 & operator &= (const Color3 & c) noexcept;
Color3 & operator |= (const Color3 & c) noexcept;
Color3 & operator ^= (const Color3 & c) noexcept;
Color3 & operator <<= (const Color3 & c) noexcept;
Color3 & operator >>= (const Color3 & c) noexcept;
Color3 & operator += (const Color3 & c);
Color3 & operator -= (const Color3 & c);
Color3 & operator *= (const Color3 & c);
Color3 & operator /= (const Color3 & c);
Color3 & operator %= (const Color3 & c);
Color3 & operator &= (const Color3 & c);
Color3 & operator |= (const Color3 & c);
Color3 & operator ^= (const Color3 & c);
Color3 & operator <<= (const Color3 & c);
Color3 & operator >>= (const Color3 & c);
// --------------------------------------------------------------------------------------------
Color3 & operator += (Value s) noexcept;
Color3 & operator -= (Value s) noexcept;
Color3 & operator *= (Value s) noexcept;
Color3 & operator /= (Value s) noexcept;
Color3 & operator %= (Value s) noexcept;
Color3 & operator &= (Value s) noexcept;
Color3 & operator |= (Value s) noexcept;
Color3 & operator ^= (Value s) noexcept;
Color3 & operator <<= (Value s) noexcept;
Color3 & operator >>= (Value s) noexcept;
Color3 & operator += (Value s);
Color3 & operator -= (Value s);
Color3 & operator *= (Value s);
Color3 & operator /= (Value s);
Color3 & operator %= (Value s);
Color3 & operator &= (Value s);
Color3 & operator |= (Value s);
Color3 & operator ^= (Value s);
Color3 & operator <<= (Value s);
Color3 & operator >>= (Value s);
// --------------------------------------------------------------------------------------------
Color3 & operator ++ () noexcept;
Color3 & operator -- () noexcept;
Color3 & operator ++ ();
Color3 & operator -- ();
// --------------------------------------------------------------------------------------------
Color3 operator ++ (int) noexcept;
Color3 operator -- (int) noexcept;
Color3 operator ++ (int);
Color3 operator -- (int);
// --------------------------------------------------------------------------------------------
Color3 operator + (const Color3 & c) const noexcept;
Color3 operator - (const Color3 & c) const noexcept;
Color3 operator * (const Color3 & c) const noexcept;
Color3 operator / (const Color3 & c) const noexcept;
Color3 operator % (const Color3 & c) const noexcept;
Color3 operator & (const Color3 & c) const noexcept;
Color3 operator | (const Color3 & c) const noexcept;
Color3 operator ^ (const Color3 & c) const noexcept;
Color3 operator << (const Color3 & c) const noexcept;
Color3 operator >> (const Color3 & c) const noexcept;
Color3 operator + (const Color3 & c) const;
Color3 operator - (const Color3 & c) const;
Color3 operator * (const Color3 & c) const;
Color3 operator / (const Color3 & c) const;
Color3 operator % (const Color3 & c) const;
Color3 operator & (const Color3 & c) const;
Color3 operator | (const Color3 & c) const;
Color3 operator ^ (const Color3 & c) const;
Color3 operator << (const Color3 & c) const;
Color3 operator >> (const Color3 & c) const;
// --------------------------------------------------------------------------------------------
Color3 operator + (Value s) const noexcept;
Color3 operator - (Value s) const noexcept;
Color3 operator * (Value s) const noexcept;
Color3 operator / (Value s) const noexcept;
Color3 operator % (Value s) const noexcept;
Color3 operator & (Value s) const noexcept;
Color3 operator | (Value s) const noexcept;
Color3 operator ^ (Value s) const noexcept;
Color3 operator << (Value s) const noexcept;
Color3 operator >> (Value s) const noexcept;
Color3 operator + (Value s) const;
Color3 operator - (Value s) const;
Color3 operator * (Value s) const;
Color3 operator / (Value s) const;
Color3 operator % (Value s) const;
Color3 operator & (Value s) const;
Color3 operator | (Value s) const;
Color3 operator ^ (Value s) const;
Color3 operator << (Value s) const;
Color3 operator >> (Value s) const;
// --------------------------------------------------------------------------------------------
Color3 operator + () const noexcept;
Color3 operator - () const noexcept;
Color3 operator + () const;
Color3 operator - () const;
// --------------------------------------------------------------------------------------------
Color3 operator ~ () const noexcept;
Color3 operator ~ () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Color3 & c) const noexcept;
bool operator != (const Color3 & c) const noexcept;
bool operator < (const Color3 & c) const noexcept;
bool operator > (const Color3 & c) const noexcept;
bool operator <= (const Color3 & c) const noexcept;
bool operator >= (const Color3 & c) const noexcept;
bool operator == (const Color3 & c) const;
bool operator != (const Color3 & c) const;
bool operator < (const Color3 & c) const;
bool operator > (const Color3 & c) const;
bool operator <= (const Color3 & c) const;
bool operator >= (const Color3 & c) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Color3 & c) const noexcept;
SQInteger Cmp(const Color3 & c) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nr, Value ng, Value nb) noexcept;
void Set(Value ns);
void Set(Value nr, Value ng, Value nb);
// --------------------------------------------------------------------------------------------
void Set(const Color3 & c) noexcept;
void Set(const Color4 & c) noexcept;
void Set(const Color3 & c);
void Set(const Color4 & c);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * str, SQChar delim) noexcept;
void Set(const SQChar * str, SQChar delim);
// --------------------------------------------------------------------------------------------
void SetCol(const SQChar * name) noexcept;
void SetCol(const SQChar * name);
// --------------------------------------------------------------------------------------------
SQUint32 GetRGB() const noexcept;
void SetRGB(SQUint32 p) noexcept;
SQUint32 GetRGB() const;
void SetRGB(SQUint32 p);
// --------------------------------------------------------------------------------------------
SQUint32 GetRGBA() const noexcept;
void SetRGBA(SQUint32 p) noexcept;
SQUint32 GetRGBA() const;
void SetRGBA(SQUint32 p);
// --------------------------------------------------------------------------------------------
SQUint32 GetARGB() const noexcept;
void SetARGB(SQUint32 p) noexcept;
SQUint32 GetARGB() const;
void SetARGB(SQUint32 p);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { r = 0, g = 0, b = 0; }
void Clear() { r = 0, g = 0, b = 0; }
// --------------------------------------------------------------------------------------------
void Random() noexcept;
void Random();
// --------------------------------------------------------------------------------------------
void Inverse() noexcept;
void Inverse();
};
} // Namespace:: SqMod

View File

@@ -15,58 +15,58 @@ const Color4 Color4::MAX = Color4(std::numeric_limits<Color4::Value>::max());
SQChar Color4::Delim = ',';
// ------------------------------------------------------------------------------------------------
Color4::Color4() noexcept
Color4::Color4()
: r(0), g(0), b(0), a(0)
{
}
Color4::Color4(Value s) noexcept
Color4::Color4(Value s)
: r(s), g(s), b(s), a(s)
{
}
Color4::Color4(Value rv, Value gv, Value bv) noexcept
Color4::Color4(Value rv, Value gv, Value bv)
: r(rv), g(gv), b(bv), a(0)
{
}
Color4::Color4(Value rv, Value gv, Value bv, Value av) noexcept
Color4::Color4(Value rv, Value gv, Value bv, Value av)
: r(rv), g(gv), b(bv), a(av)
{
}
// ------------------------------------------------------------------------------------------------
Color4::Color4(const Color3 & c) noexcept
Color4::Color4(const Color3 & c)
: r(c.r), g(c.g), b(c.b), a(0)
{
}
// ------------------------------------------------------------------------------------------------
Color4::Color4(const SQChar * name) noexcept
Color4::Color4(const SQChar * name)
: Color4(GetColor(name))
{
}
Color4::Color4(const SQChar * str, SQChar delim) noexcept
Color4::Color4(const SQChar * str, SQChar delim)
: Color4(GetColor4(str, delim))
{
}
// ------------------------------------------------------------------------------------------------
Color4::Color4(const Color4 & c) noexcept
Color4::Color4(const Color4 & c)
: r(c.r), g(c.g), b(c.b), a(c.a)
{
}
Color4::Color4(Color4 && c) noexcept
Color4::Color4(Color4 && c)
: r(c.r), g(c.g), b(c.b), a(c.a)
{
@@ -79,7 +79,7 @@ Color4::~Color4()
}
// ------------------------------------------------------------------------------------------------
Color4 & Color4::operator = (const Color4 & c) noexcept
Color4 & Color4::operator = (const Color4 & c)
{
r = c.r;
g = c.g;
@@ -88,7 +88,7 @@ Color4 & Color4::operator = (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator = (Color4 && c) noexcept
Color4 & Color4::operator = (Color4 && c)
{
r = c.r;
g = c.g;
@@ -98,7 +98,7 @@ Color4 & Color4::operator = (Color4 && c) noexcept
}
// ------------------------------------------------------------------------------------------------
Color4 & Color4::operator = (Value s) noexcept
Color4 & Color4::operator = (Value s)
{
r = s;
g = s;
@@ -107,13 +107,13 @@ Color4 & Color4::operator = (Value s) noexcept
return *this;
}
Color4 & Color4::operator = (const SQChar * name) noexcept
Color4 & Color4::operator = (const SQChar * name)
{
Set(GetColor(name));
return *this;
}
Color4 & Color4::operator = (const Color3 & c) noexcept
Color4 & Color4::operator = (const Color3 & c)
{
r = c.r;
g = c.g;
@@ -122,7 +122,7 @@ Color4 & Color4::operator = (const Color3 & c) noexcept
}
// ------------------------------------------------------------------------------------------------
Color4 & Color4::operator += (const Color4 & c) noexcept
Color4 & Color4::operator += (const Color4 & c)
{
r += c.r;
g += c.g;
@@ -131,7 +131,7 @@ Color4 & Color4::operator += (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator -= (const Color4 & c) noexcept
Color4 & Color4::operator -= (const Color4 & c)
{
r -= c.r;
g -= c.g;
@@ -140,7 +140,7 @@ Color4 & Color4::operator -= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator *= (const Color4 & c) noexcept
Color4 & Color4::operator *= (const Color4 & c)
{
r *= c.r;
g *= c.g;
@@ -149,7 +149,7 @@ Color4 & Color4::operator *= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator /= (const Color4 & c) noexcept
Color4 & Color4::operator /= (const Color4 & c)
{
r /= c.r;
g /= c.g;
@@ -158,7 +158,7 @@ Color4 & Color4::operator /= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator %= (const Color4 & c) noexcept
Color4 & Color4::operator %= (const Color4 & c)
{
r %= c.r;
g %= c.g;
@@ -167,7 +167,7 @@ Color4 & Color4::operator %= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator &= (const Color4 & c) noexcept
Color4 & Color4::operator &= (const Color4 & c)
{
r &= c.r;
g &= c.g;
@@ -176,7 +176,7 @@ Color4 & Color4::operator &= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator |= (const Color4 & c) noexcept
Color4 & Color4::operator |= (const Color4 & c)
{
r |= c.r;
g |= c.g;
@@ -185,7 +185,7 @@ Color4 & Color4::operator |= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator ^= (const Color4 & c) noexcept
Color4 & Color4::operator ^= (const Color4 & c)
{
r ^= c.r;
g ^= c.g;
@@ -194,7 +194,7 @@ Color4 & Color4::operator ^= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator <<= (const Color4 & c) noexcept
Color4 & Color4::operator <<= (const Color4 & c)
{
r <<= c.r;
g <<= c.g;
@@ -203,7 +203,7 @@ Color4 & Color4::operator <<= (const Color4 & c) noexcept
return *this;
}
Color4 & Color4::operator >>= (const Color4 & c) noexcept
Color4 & Color4::operator >>= (const Color4 & c)
{
r >>= c.r;
g >>= c.g;
@@ -213,7 +213,7 @@ Color4 & Color4::operator >>= (const Color4 & c) noexcept
}
// ------------------------------------------------------------------------------------------------
Color4 & Color4::operator += (Value s) noexcept
Color4 & Color4::operator += (Value s)
{
r += s;
g += s;
@@ -222,7 +222,7 @@ Color4 & Color4::operator += (Value s) noexcept
return *this;
}
Color4 & Color4::operator -= (Value s) noexcept
Color4 & Color4::operator -= (Value s)
{
r -= s;
g -= s;
@@ -231,7 +231,7 @@ Color4 & Color4::operator -= (Value s) noexcept
return *this;
}
Color4 & Color4::operator *= (Value s) noexcept
Color4 & Color4::operator *= (Value s)
{
r *= s;
g *= s;
@@ -240,7 +240,7 @@ Color4 & Color4::operator *= (Value s) noexcept
return *this;
}
Color4 & Color4::operator /= (Value s) noexcept
Color4 & Color4::operator /= (Value s)
{
r /= s;
g /= s;
@@ -249,7 +249,7 @@ Color4 & Color4::operator /= (Value s) noexcept
return *this;
}
Color4 & Color4::operator %= (Value s) noexcept
Color4 & Color4::operator %= (Value s)
{
r %= s;
g %= s;
@@ -258,7 +258,7 @@ Color4 & Color4::operator %= (Value s) noexcept
return *this;
}
Color4 & Color4::operator &= (Value s) noexcept
Color4 & Color4::operator &= (Value s)
{
r &= s;
g &= s;
@@ -267,7 +267,7 @@ Color4 & Color4::operator &= (Value s) noexcept
return *this;
}
Color4 & Color4::operator |= (Value s) noexcept
Color4 & Color4::operator |= (Value s)
{
r |= s;
g |= s;
@@ -276,7 +276,7 @@ Color4 & Color4::operator |= (Value s) noexcept
return *this;
}
Color4 & Color4::operator ^= (Value s) noexcept
Color4 & Color4::operator ^= (Value s)
{
r ^= s;
g ^= s;
@@ -285,7 +285,7 @@ Color4 & Color4::operator ^= (Value s) noexcept
return *this;
}
Color4 & Color4::operator <<= (Value s) noexcept
Color4 & Color4::operator <<= (Value s)
{
r <<= s;
g <<= s;
@@ -294,7 +294,7 @@ Color4 & Color4::operator <<= (Value s) noexcept
return *this;
}
Color4 & Color4::operator >>= (Value s) noexcept
Color4 & Color4::operator >>= (Value s)
{
r >>= s;
g >>= s;
@@ -304,7 +304,7 @@ Color4 & Color4::operator >>= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Color4 & Color4::operator ++ () noexcept
Color4 & Color4::operator ++ ()
{
++r;
++g;
@@ -313,7 +313,7 @@ Color4 & Color4::operator ++ () noexcept
return *this;
}
Color4 & Color4::operator -- () noexcept
Color4 & Color4::operator -- ()
{
--r;
--g;
@@ -323,7 +323,7 @@ Color4 & Color4::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Color4 Color4::operator ++ (int) noexcept
Color4 Color4::operator ++ (int)
{
Color4 state(*this);
++r;
@@ -333,7 +333,7 @@ Color4 Color4::operator ++ (int) noexcept
return state;
}
Color4 Color4::operator -- (int) noexcept
Color4 Color4::operator -- (int)
{
Color4 state(*this);
--r;
@@ -344,169 +344,169 @@ Color4 Color4::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Color4 Color4::operator + (const Color4 & c) const noexcept
Color4 Color4::operator + (const Color4 & c) const
{
return Color4(r + c.r, g + c.g, b + c.b, a + c.a);
}
Color4 Color4::operator - (const Color4 & c) const noexcept
Color4 Color4::operator - (const Color4 & c) const
{
return Color4(r - c.r, g - c.g, b - c.b, a - c.a);
}
Color4 Color4::operator * (const Color4 & c) const noexcept
Color4 Color4::operator * (const Color4 & c) const
{
return Color4(r * c.r, g * c.g, b * c.b, a * c.a);
}
Color4 Color4::operator / (const Color4 & c) const noexcept
Color4 Color4::operator / (const Color4 & c) const
{
return Color4(r / c.r, g / c.g, b / c.b, a / c.a);
}
Color4 Color4::operator % (const Color4 & c) const noexcept
Color4 Color4::operator % (const Color4 & c) const
{
return Color4(r % c.r, g % c.g, b % c.b, a % c.a);
}
Color4 Color4::operator & (const Color4 & c) const noexcept
Color4 Color4::operator & (const Color4 & c) const
{
return Color4(r & c.r, g & c.g, b & c.b, a & c.a);
}
Color4 Color4::operator | (const Color4 & c) const noexcept
Color4 Color4::operator | (const Color4 & c) const
{
return Color4(r | c.r, g | c.g, b | c.b, a | c.a);
}
Color4 Color4::operator ^ (const Color4 & c) const noexcept
Color4 Color4::operator ^ (const Color4 & c) const
{
return Color4(r ^ c.r, g ^ c.g, b ^ c.b, a ^ c.a);
}
Color4 Color4::operator << (const Color4 & c) const noexcept
Color4 Color4::operator << (const Color4 & c) const
{
return Color4(r << c.r, g << c.g, b << c.b, a << c.a);
}
Color4 Color4::operator >> (const Color4 & c) const noexcept
Color4 Color4::operator >> (const Color4 & c) const
{
return Color4(r >> c.r, g >> c.g, b >> c.b, a >> c.a);
}
// ------------------------------------------------------------------------------------------------
Color4 Color4::operator + (Value s) const noexcept
Color4 Color4::operator + (Value s) const
{
return Color4(r + s, g + s, b + s, a + s);
}
Color4 Color4::operator - (Value s) const noexcept
Color4 Color4::operator - (Value s) const
{
return Color4(r - s, g - s, b - s, a - s);
}
Color4 Color4::operator * (Value s) const noexcept
Color4 Color4::operator * (Value s) const
{
return Color4(r * s, g * s, b * s, a * s);
}
Color4 Color4::operator / (Value s) const noexcept
Color4 Color4::operator / (Value s) const
{
return Color4(r / s, g / s, b / s, a / s);
}
Color4 Color4::operator % (Value s) const noexcept
Color4 Color4::operator % (Value s) const
{
return Color4(r % s, g % s, b % s, a % s);
}
Color4 Color4::operator & (Value s) const noexcept
Color4 Color4::operator & (Value s) const
{
return Color4(r & s, g & s, b & s, a & s);
}
Color4 Color4::operator | (Value s) const noexcept
Color4 Color4::operator | (Value s) const
{
return Color4(r | s, g | s, b | s, a | s);
}
Color4 Color4::operator ^ (Value s) const noexcept
Color4 Color4::operator ^ (Value s) const
{
return Color4(r ^ s, g ^ s, b ^ s, a ^ s);
}
Color4 Color4::operator << (Value s) const noexcept
Color4 Color4::operator << (Value s) const
{
return Color4(r << s, g << s, b << s, a << s);
}
Color4 Color4::operator >> (Value s) const noexcept
Color4 Color4::operator >> (Value s) const
{
return Color4(r >> s, g >> s, b >> s, a >> s);
}
// ------------------------------------------------------------------------------------------------
Color4 Color4::operator + () const noexcept
Color4 Color4::operator + () const
{
return Color4(r, g, b, a);
}
Color4 Color4::operator - () const noexcept
Color4 Color4::operator - () const
{
return Color4(0, 0, 0, 0);
}
// ------------------------------------------------------------------------------------------------
Color4 Color4::operator ~ () const noexcept
Color4 Color4::operator ~ () const
{
return Color4(~r, ~g, ~b, ~a);
}
// ------------------------------------------------------------------------------------------------
bool Color4::operator == (const Color4 & c) const noexcept
bool Color4::operator == (const Color4 & c) const
{
return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
}
bool Color4::operator != (const Color4 & c) const noexcept
bool Color4::operator != (const Color4 & c) const
{
return (r != c.r) && (g != c.g) && (b != c.b) && (a != c.a);
}
bool Color4::operator < (const Color4 & c) const noexcept
bool Color4::operator < (const Color4 & c) const
{
return (r < c.r) && (g < c.g) && (b < c.b) && (a < c.a);
}
bool Color4::operator > (const Color4 & c) const noexcept
bool Color4::operator > (const Color4 & c) const
{
return (r > c.r) && (g > c.g) && (b > c.b) && (a > c.a);
}
bool Color4::operator <= (const Color4 & c) const noexcept
bool Color4::operator <= (const Color4 & c) const
{
return (r <= c.r) && (g <= c.g) && (b <= c.b) && (a <= c.a);
}
bool Color4::operator >= (const Color4 & c) const noexcept
bool Color4::operator >= (const Color4 & c) const
{
return (r >= c.r) && (g >= c.g) && (b >= c.b) && (a >= c.a);
}
// ------------------------------------------------------------------------------------------------
SQInteger Color4::Cmp(const Color4 & c) const noexcept
SQInteger Color4::Cmp(const Color4 & c) const
{
return *this == c ? 0 : (*this > c ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Color4::ToString() const noexcept
const SQChar * Color4::ToString() const
{
return ToStringF("%u,%u,%u,%u", r, g, b, a);
}
// ------------------------------------------------------------------------------------------------
void Color4::Set(Value ns) noexcept
void Color4::Set(Value ns)
{
r = ns;
g = ns;
@@ -514,14 +514,14 @@ void Color4::Set(Value ns) noexcept
a = ns;
}
void Color4::Set(Value nr, Value ng, Value nb) noexcept
void Color4::Set(Value nr, Value ng, Value nb)
{
r = nr;
g = ng;
b = nb;
}
void Color4::Set(Value nr, Value ng, Value nb, Value na) noexcept
void Color4::Set(Value nr, Value ng, Value nb, Value na)
{
r = nr;
g = ng;
@@ -530,7 +530,7 @@ void Color4::Set(Value nr, Value ng, Value nb, Value na) noexcept
}
// ------------------------------------------------------------------------------------------------
void Color4::Set(const Color4 & c) noexcept
void Color4::Set(const Color4 & c)
{
r = c.r;
g = c.g;
@@ -538,7 +538,7 @@ void Color4::Set(const Color4 & c) noexcept
a = c.a;
}
void Color4::Set(const Color3 & c) noexcept
void Color4::Set(const Color3 & c)
{
r = c.r;
g = c.g;
@@ -547,24 +547,24 @@ void Color4::Set(const Color3 & c) noexcept
}
// ------------------------------------------------------------------------------------------------
void Color4::Set(const SQChar * str, SQChar delim) noexcept
void Color4::Set(const SQChar * str, SQChar delim)
{
Set(GetColor4(str, delim));
}
// ------------------------------------------------------------------------------------------------
void Color4::SetCol(const SQChar * name) noexcept
void Color4::SetCol(const SQChar * name)
{
Set(GetColor(name));
}
// ------------------------------------------------------------------------------------------------
SQUint32 Color4::GetRGB() const noexcept
SQUint32 Color4::GetRGB() const
{
return static_cast<SQUint32>(r << 16 | g << 8 | b);
}
void Color4::SetRGB(SQUint32 p) noexcept
void Color4::SetRGB(SQUint32 p)
{
r = static_cast<Value>((p >> 16) & 0xFF);
g = static_cast<Value>((p >> 8) & 0xFF);
@@ -572,12 +572,12 @@ void Color4::SetRGB(SQUint32 p) noexcept
}
// ------------------------------------------------------------------------------------------------
SQUint32 Color4::GetRGBA() const noexcept
SQUint32 Color4::GetRGBA() const
{
return static_cast<SQUint32>(r << 24 | g << 16 | b << 8 | a);
}
void Color4::SetRGBA(SQUint32 p) noexcept
void Color4::SetRGBA(SQUint32 p)
{
r = static_cast<Value>((p >> 24) & 0xFF);
g = static_cast<Value>((p >> 16) & 0xFF);
@@ -586,12 +586,12 @@ void Color4::SetRGBA(SQUint32 p) noexcept
}
// ------------------------------------------------------------------------------------------------
SQUint32 Color4::GetARGB() const noexcept
SQUint32 Color4::GetARGB() const
{
return static_cast<SQUint32>(a << 24 | r << 16 | g << 8 | b);
}
void Color4::SetARGB(SQUint32 p) noexcept
void Color4::SetARGB(SQUint32 p)
{
a = static_cast<Value>((p >> 24) & 0xFF);
r = static_cast<Value>((p >> 16) & 0xFF);
@@ -600,7 +600,7 @@ void Color4::SetARGB(SQUint32 p) noexcept
}
// ------------------------------------------------------------------------------------------------
void Color4::Generate() noexcept
void Color4::Generate()
{
r = RandomVal<Value>::Get();
g = RandomVal<Value>::Get();
@@ -608,7 +608,7 @@ void Color4::Generate() noexcept
a = RandomVal<Value>::Get();
}
void Color4::Generate(Value min, Value max) noexcept
void Color4::Generate(Value min, Value max)
{
if (max < min)
{
@@ -623,7 +623,7 @@ void Color4::Generate(Value min, Value max) noexcept
}
}
void Color4::Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax, Value amin, Value amax) noexcept
void Color4::Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax, Value amin, Value amax)
{
if (rmax < rmin || gmax < gmin || bmax < bmin || amax < amin)
{
@@ -639,13 +639,13 @@ void Color4::Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin
}
// ------------------------------------------------------------------------------------------------
void Color4::Random() noexcept
void Color4::Random()
{
Set(GetRandomColor());
}
// ------------------------------------------------------------------------------------------------
void Color4::Inverse() noexcept
void Color4::Inverse()
{
r = static_cast<Value>(~r);
g = static_cast<Value>(~g);

View File

@@ -23,123 +23,123 @@ struct Color4
// --------------------------------------------------------------------------------------------
Value r, g, b, a;
// --------------------------------------------------------------------------------------------
Color4() noexcept;
Color4(Value s) noexcept;
Color4(Value r, Value g, Value b) noexcept;
Color4(Value r, Value g, Value b, Value a) noexcept;
Color4();
Color4(Value s);
Color4(Value r, Value g, Value b);
Color4(Value r, Value g, Value b, Value a);
// --------------------------------------------------------------------------------------------
Color4(const Color3 & c) noexcept;
Color4(const Color3 & c);
// --------------------------------------------------------------------------------------------
Color4(const SQChar * name) noexcept;
Color4(const SQChar * str, SQChar delim) noexcept;
Color4(const SQChar * name);
Color4(const SQChar * str, SQChar delim);
// --------------------------------------------------------------------------------------------
Color4(const Color4 & c) noexcept;
Color4(Color4 && c) noexcept;
Color4(const Color4 & c);
Color4(Color4 && c);
// --------------------------------------------------------------------------------------------
~Color4();
// --------------------------------------------------------------------------------------------
Color4 & operator = (const Color4 & c) noexcept;
Color4 & operator = (Color4 && c) noexcept;
Color4 & operator = (const Color4 & c);
Color4 & operator = (Color4 && c);
// --------------------------------------------------------------------------------------------
Color4 & operator = (Value s) noexcept;
Color4 & operator = (const SQChar * name) noexcept;
Color4 & operator = (const Color3 & c) noexcept;
Color4 & operator = (Value s);
Color4 & operator = (const SQChar * name);
Color4 & operator = (const Color3 & c);
// --------------------------------------------------------------------------------------------
Color4 & operator += (const Color4 & c) noexcept;
Color4 & operator -= (const Color4 & c) noexcept;
Color4 & operator *= (const Color4 & c) noexcept;
Color4 & operator /= (const Color4 & c) noexcept;
Color4 & operator %= (const Color4 & c) noexcept;
Color4 & operator &= (const Color4 & c) noexcept;
Color4 & operator |= (const Color4 & c) noexcept;
Color4 & operator ^= (const Color4 & c) noexcept;
Color4 & operator <<= (const Color4 & c) noexcept;
Color4 & operator >>= (const Color4 & c) noexcept;
Color4 & operator += (const Color4 & c);
Color4 & operator -= (const Color4 & c);
Color4 & operator *= (const Color4 & c);
Color4 & operator /= (const Color4 & c);
Color4 & operator %= (const Color4 & c);
Color4 & operator &= (const Color4 & c);
Color4 & operator |= (const Color4 & c);
Color4 & operator ^= (const Color4 & c);
Color4 & operator <<= (const Color4 & c);
Color4 & operator >>= (const Color4 & c);
// --------------------------------------------------------------------------------------------
Color4 & operator += (Value s) noexcept;
Color4 & operator -= (Value s) noexcept;
Color4 & operator *= (Value s) noexcept;
Color4 & operator /= (Value s) noexcept;
Color4 & operator %= (Value s) noexcept;
Color4 & operator &= (Value s) noexcept;
Color4 & operator |= (Value s) noexcept;
Color4 & operator ^= (Value s) noexcept;
Color4 & operator <<= (Value s) noexcept;
Color4 & operator >>= (Value s) noexcept;
Color4 & operator += (Value s);
Color4 & operator -= (Value s);
Color4 & operator *= (Value s);
Color4 & operator /= (Value s);
Color4 & operator %= (Value s);
Color4 & operator &= (Value s);
Color4 & operator |= (Value s);
Color4 & operator ^= (Value s);
Color4 & operator <<= (Value s);
Color4 & operator >>= (Value s);
// --------------------------------------------------------------------------------------------
Color4 & operator ++ () noexcept;
Color4 & operator -- () noexcept;
Color4 & operator ++ ();
Color4 & operator -- ();
// --------------------------------------------------------------------------------------------
Color4 operator ++ (int) noexcept;
Color4 operator -- (int) noexcept;
Color4 operator ++ (int);
Color4 operator -- (int);
// --------------------------------------------------------------------------------------------
Color4 operator + (const Color4 & c) const noexcept;
Color4 operator - (const Color4 & c) const noexcept;
Color4 operator * (const Color4 & c) const noexcept;
Color4 operator / (const Color4 & c) const noexcept;
Color4 operator % (const Color4 & c) const noexcept;
Color4 operator & (const Color4 & c) const noexcept;
Color4 operator | (const Color4 & c) const noexcept;
Color4 operator ^ (const Color4 & c) const noexcept;
Color4 operator << (const Color4 & c) const noexcept;
Color4 operator >> (const Color4 & c) const noexcept;
Color4 operator + (const Color4 & c) const;
Color4 operator - (const Color4 & c) const;
Color4 operator * (const Color4 & c) const;
Color4 operator / (const Color4 & c) const;
Color4 operator % (const Color4 & c) const;
Color4 operator & (const Color4 & c) const;
Color4 operator | (const Color4 & c) const;
Color4 operator ^ (const Color4 & c) const;
Color4 operator << (const Color4 & c) const;
Color4 operator >> (const Color4 & c) const;
// --------------------------------------------------------------------------------------------
Color4 operator + (Value s) const noexcept;
Color4 operator - (Value s) const noexcept;
Color4 operator * (Value s) const noexcept;
Color4 operator / (Value s) const noexcept;
Color4 operator % (Value s) const noexcept;
Color4 operator & (Value s) const noexcept;
Color4 operator | (Value s) const noexcept;
Color4 operator ^ (Value s) const noexcept;
Color4 operator << (Value s) const noexcept;
Color4 operator >> (Value s) const noexcept;
Color4 operator + (Value s) const;
Color4 operator - (Value s) const;
Color4 operator * (Value s) const;
Color4 operator / (Value s) const;
Color4 operator % (Value s) const;
Color4 operator & (Value s) const;
Color4 operator | (Value s) const;
Color4 operator ^ (Value s) const;
Color4 operator << (Value s) const;
Color4 operator >> (Value s) const;
// --------------------------------------------------------------------------------------------
Color4 operator + () const noexcept;
Color4 operator - () const noexcept;
Color4 operator + () const;
Color4 operator - () const;
// --------------------------------------------------------------------------------------------
Color4 operator ~ () const noexcept;
Color4 operator ~ () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Color4 & c) const noexcept;
bool operator != (const Color4 & c) const noexcept;
bool operator < (const Color4 & c) const noexcept;
bool operator > (const Color4 & c) const noexcept;
bool operator <= (const Color4 & c) const noexcept;
bool operator >= (const Color4 & c) const noexcept;
bool operator == (const Color4 & c) const;
bool operator != (const Color4 & c) const;
bool operator < (const Color4 & c) const;
bool operator > (const Color4 & c) const;
bool operator <= (const Color4 & c) const;
bool operator >= (const Color4 & c) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Color4 & c) const noexcept;
SQInteger Cmp(const Color4 & c) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nr, Value ng, Value nb) noexcept;
void Set(Value nr, Value ng, Value nb, Value na) noexcept;
void Set(Value ns);
void Set(Value nr, Value ng, Value nb);
void Set(Value nr, Value ng, Value nb, Value na);
// --------------------------------------------------------------------------------------------
void Set(const Color4 & c) noexcept;
void Set(const Color3 & c) noexcept;
void Set(const Color4 & c);
void Set(const Color3 & c);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * name, SQChar delim) noexcept;
void Set(const SQChar * name, SQChar delim);
// --------------------------------------------------------------------------------------------
void SetCol(const SQChar * name) noexcept;
void SetCol(const SQChar * name);
// --------------------------------------------------------------------------------------------
SQUint32 GetRGB() const noexcept;
void SetRGB(SQUint32 p) noexcept;
SQUint32 GetRGB() const;
void SetRGB(SQUint32 p);
// --------------------------------------------------------------------------------------------
SQUint32 GetRGBA() const noexcept;
void SetRGBA(SQUint32 p) noexcept;
SQUint32 GetRGBA() const;
void SetRGBA(SQUint32 p);
// --------------------------------------------------------------------------------------------
SQUint32 GetARGB() const noexcept;
void SetARGB(SQUint32 p) noexcept;
SQUint32 GetARGB() const;
void SetARGB(SQUint32 p);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax, Value amin, Value amax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax, Value amin, Value amax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { r = 0, g = 0, b = 0, a = 0; }
void Clear() { r = 0, g = 0, b = 0, a = 0; }
// --------------------------------------------------------------------------------------------
void Random() noexcept;
void Random();
// --------------------------------------------------------------------------------------------
void Inverse() noexcept;
void Inverse();
};
} // Namespace:: SqMod

View File

@@ -16,58 +16,58 @@ const Quaternion Quaternion::MAX = Quaternion(std::numeric_limits<Quaternion::Va
SQChar Quaternion::Delim = ',';
// ------------------------------------------------------------------------------------------------
Quaternion::Quaternion() noexcept
Quaternion::Quaternion()
: x(0.0), y(0.0), z(0.0), w(0.0)
{
}
Quaternion::Quaternion(Value s) noexcept
Quaternion::Quaternion(Value s)
: x(s), y(s), z(s), w(s)
{
}
Quaternion::Quaternion(Value xv, Value yv, Value zv) noexcept
Quaternion::Quaternion(Value xv, Value yv, Value zv)
: x(xv), y(yv), z(zv), w(0.0)
{
}
Quaternion::Quaternion(Value xv, Value yv, Value zv, Value wv) noexcept
Quaternion::Quaternion(Value xv, Value yv, Value zv, Value wv)
: x(xv), y(yv), z(zv), w(wv)
{
}
// ------------------------------------------------------------------------------------------------
Quaternion::Quaternion(const Vector3 & v) noexcept
Quaternion::Quaternion(const Vector3 & v)
: x(v.x), y(v.y), z(v.z), w(0.0)
{
}
Quaternion::Quaternion(const Vector4 & v) noexcept
Quaternion::Quaternion(const Vector4 & v)
: x(v.x), y(v.y), z(v.z), w(v.w)
{
}
// ------------------------------------------------------------------------------------------------
Quaternion::Quaternion(const SQChar * values, SQChar delim) noexcept
Quaternion::Quaternion(const SQChar * values, SQChar delim)
: Quaternion(GetQuaternion(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
Quaternion::Quaternion(const Quaternion & q) noexcept
Quaternion::Quaternion(const Quaternion & q)
: x(q.x), y(q.y), z(q.z), w(q.w)
{
}
Quaternion::Quaternion(Quaternion && q) noexcept
Quaternion::Quaternion(Quaternion && q)
: x(q.x), y(q.y), z(q.z), w(q.w)
{
@@ -80,7 +80,7 @@ Quaternion::~Quaternion()
}
// ------------------------------------------------------------------------------------------------
Quaternion & Quaternion::operator = (const Quaternion & q) noexcept
Quaternion & Quaternion::operator = (const Quaternion & q)
{
x = q.x;
y = q.y;
@@ -89,7 +89,7 @@ Quaternion & Quaternion::operator = (const Quaternion & q) noexcept
return *this;
}
Quaternion & Quaternion::operator = (Quaternion && q) noexcept
Quaternion & Quaternion::operator = (Quaternion && q)
{
x = q.x;
y = q.y;
@@ -99,7 +99,7 @@ Quaternion & Quaternion::operator = (Quaternion && q) noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion & Quaternion::operator = (Value s) noexcept
Quaternion & Quaternion::operator = (Value s)
{
x = s;
y = s;
@@ -108,7 +108,7 @@ Quaternion & Quaternion::operator = (Value s) noexcept
return *this;
}
Quaternion & Quaternion::operator = (const Vector3 & q) noexcept
Quaternion & Quaternion::operator = (const Vector3 & q)
{
x = q.x;
y = q.y;
@@ -117,7 +117,7 @@ Quaternion & Quaternion::operator = (const Vector3 & q) noexcept
return *this;
}
Quaternion & Quaternion::operator = (const Vector4 & q) noexcept
Quaternion & Quaternion::operator = (const Vector4 & q)
{
x = q.x;
y = q.y;
@@ -127,7 +127,7 @@ Quaternion & Quaternion::operator = (const Vector4 & q) noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion & Quaternion::operator += (const Quaternion & q) noexcept
Quaternion & Quaternion::operator += (const Quaternion & q)
{
x += q.x;
y += q.y;
@@ -136,7 +136,7 @@ Quaternion & Quaternion::operator += (const Quaternion & q) noexcept
return *this;
}
Quaternion & Quaternion::operator -= (const Quaternion & q) noexcept
Quaternion & Quaternion::operator -= (const Quaternion & q)
{
x -= q.x;
y -= q.y;
@@ -145,7 +145,7 @@ Quaternion & Quaternion::operator -= (const Quaternion & q) noexcept
return *this;
}
Quaternion & Quaternion::operator *= (const Quaternion & q) noexcept
Quaternion & Quaternion::operator *= (const Quaternion & q)
{
x *= q.x;
y *= q.y;
@@ -154,7 +154,7 @@ Quaternion & Quaternion::operator *= (const Quaternion & q) noexcept
return *this;
}
Quaternion & Quaternion::operator /= (const Quaternion & q) noexcept
Quaternion & Quaternion::operator /= (const Quaternion & q)
{
x /= q.x;
y /= q.y;
@@ -163,7 +163,7 @@ Quaternion & Quaternion::operator /= (const Quaternion & q) noexcept
return *this;
}
Quaternion & Quaternion::operator %= (const Quaternion & q) noexcept
Quaternion & Quaternion::operator %= (const Quaternion & q)
{
x = std::fmod(x, q.x);
y = std::fmod(y, q.y);
@@ -173,7 +173,7 @@ Quaternion & Quaternion::operator %= (const Quaternion & q) noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion & Quaternion::operator += (Value s) noexcept
Quaternion & Quaternion::operator += (Value s)
{
x += s;
y += s;
@@ -182,7 +182,7 @@ Quaternion & Quaternion::operator += (Value s) noexcept
return *this;
}
Quaternion & Quaternion::operator -= (Value s) noexcept
Quaternion & Quaternion::operator -= (Value s)
{
x -= s;
y -= s;
@@ -191,7 +191,7 @@ Quaternion & Quaternion::operator -= (Value s) noexcept
return *this;
}
Quaternion & Quaternion::operator *= (Value s) noexcept
Quaternion & Quaternion::operator *= (Value s)
{
x *= s;
y *= s;
@@ -200,7 +200,7 @@ Quaternion & Quaternion::operator *= (Value s) noexcept
return *this;
}
Quaternion & Quaternion::operator /= (Value s) noexcept
Quaternion & Quaternion::operator /= (Value s)
{
x /= s;
y /= s;
@@ -209,7 +209,7 @@ Quaternion & Quaternion::operator /= (Value s) noexcept
return *this;
}
Quaternion & Quaternion::operator %= (Value s) noexcept
Quaternion & Quaternion::operator %= (Value s)
{
x = std::fmod(x, s);
y = std::fmod(y, s);
@@ -219,7 +219,7 @@ Quaternion & Quaternion::operator %= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion & Quaternion::operator ++ () noexcept
Quaternion & Quaternion::operator ++ ()
{
++x;
++y;
@@ -228,7 +228,7 @@ Quaternion & Quaternion::operator ++ () noexcept
return *this;
}
Quaternion & Quaternion::operator -- () noexcept
Quaternion & Quaternion::operator -- ()
{
--x;
--y;
@@ -238,7 +238,7 @@ Quaternion & Quaternion::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator ++ (int) noexcept
Quaternion Quaternion::operator ++ (int)
{
Quaternion state(*this);
++x;
@@ -248,7 +248,7 @@ Quaternion Quaternion::operator ++ (int) noexcept
return state;
}
Quaternion Quaternion::operator -- (int) noexcept
Quaternion Quaternion::operator -- (int)
{
Quaternion state(*this);
--x;
@@ -259,116 +259,116 @@ Quaternion Quaternion::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator + (const Quaternion & q) const noexcept
Quaternion Quaternion::operator + (const Quaternion & q) const
{
return Quaternion(x + q.x, y + q.y, z + q.z, w + q.w);
}
Quaternion Quaternion::operator + (Value s) const noexcept
Quaternion Quaternion::operator + (Value s) const
{
return Quaternion(x + s, y + s, z + s, w + s);
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator - (const Quaternion & q) const noexcept
Quaternion Quaternion::operator - (const Quaternion & q) const
{
return Quaternion(x - q.x, y - q.y, z - q.z, w - q.w);
}
Quaternion Quaternion::operator - (Value s) const noexcept
Quaternion Quaternion::operator - (Value s) const
{
return Quaternion(x - s, y - s, z - s, w - s);
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator * (const Quaternion & q) const noexcept
Quaternion Quaternion::operator * (const Quaternion & q) const
{
return Quaternion(x * q.x, y * q.y, z * q.z, w * q.w);
}
Quaternion Quaternion::operator * (Value s) const noexcept
Quaternion Quaternion::operator * (Value s) const
{
return Quaternion(x * s, y * s, z * s, w * s);
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator / (const Quaternion & q) const noexcept
Quaternion Quaternion::operator / (const Quaternion & q) const
{
return Quaternion(x / q.x, y / q.y, z / q.z, w / q.w);
}
Quaternion Quaternion::operator / (Value s) const noexcept
Quaternion Quaternion::operator / (Value s) const
{
return Quaternion(x / s, y / s, z / s, w / s);
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator % (const Quaternion & q) const noexcept
Quaternion Quaternion::operator % (const Quaternion & q) const
{
return Quaternion(std::fmod(x, q.x), std::fmod(y, q.y), std::fmod(z, q.z), std::fmod(w, q.w));
}
Quaternion Quaternion::operator % (Value s) const noexcept
Quaternion Quaternion::operator % (Value s) const
{
return Quaternion(std::fmod(x, s), std::fmod(y, s), std::fmod(z, s), std::fmod(w, s));
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::operator + () const noexcept
Quaternion Quaternion::operator + () const
{
return Quaternion(std::fabs(x), std::fabs(y), std::fabs(z), std::fabs(w));
}
Quaternion Quaternion::operator - () const noexcept
Quaternion Quaternion::operator - () const
{
return Quaternion(-x, -y, -z, -w);
}
// ------------------------------------------------------------------------------------------------
bool Quaternion::operator == (const Quaternion & q) const noexcept
bool Quaternion::operator == (const Quaternion & q) const
{
return EpsEq(x, q.x) && EpsEq(y, q.y) && EpsEq(z, q.z) && EpsEq(w, q.w);
}
bool Quaternion::operator != (const Quaternion & q) const noexcept
bool Quaternion::operator != (const Quaternion & q) const
{
return !EpsEq(x, q.x) && !EpsEq(y, q.y) && !EpsEq(z, q.z) && !EpsEq(w, q.w);
}
bool Quaternion::operator < (const Quaternion & q) const noexcept
bool Quaternion::operator < (const Quaternion & q) const
{
return std::isless(x, q.x) && std::isless(y, q.y) && std::isless(z, q.z) && std::isless(w, q.w);
}
bool Quaternion::operator > (const Quaternion & q) const noexcept
bool Quaternion::operator > (const Quaternion & q) const
{
return std::isgreater(x, q.x) && std::isgreater(y, q.y) && std::isgreater(z, q.z) && std::isgreater(w, q.w);
}
bool Quaternion::operator <= (const Quaternion & q) const noexcept
bool Quaternion::operator <= (const Quaternion & q) const
{
return std::islessequal(x, q.x) && std::islessequal(y, q.y) && std::islessequal(z, q.z) && std::islessequal(w, q.w);
}
bool Quaternion::operator >= (const Quaternion & q) const noexcept
bool Quaternion::operator >= (const Quaternion & q) const
{
return std::isgreaterequal(x, q.x) && std::isgreaterequal(y, q.y) && std::isgreaterequal(z, q.z) && std::isgreaterequal(w, q.w);
}
// ------------------------------------------------------------------------------------------------
SQInteger Quaternion::Cmp(const Quaternion & q) const noexcept
SQInteger Quaternion::Cmp(const Quaternion & q) const
{
return *this == q ? 0 : (*this > q ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Quaternion::ToString() const noexcept
const SQChar * Quaternion::ToString() const
{
return ToStringF("%f,%f,%f,%f", x, y, z, w);
}
// ------------------------------------------------------------------------------------------------
void Quaternion::Set(Value ns) noexcept
void Quaternion::Set(Value ns)
{
x = ns;
y = ns;
@@ -376,14 +376,14 @@ void Quaternion::Set(Value ns) noexcept
w = ns;
}
void Quaternion::Set(Value nx, Value ny, Value nz) noexcept
void Quaternion::Set(Value nx, Value ny, Value nz)
{
x = nx;
y = ny;
z = nz;
}
void Quaternion::Set(Value nx, Value ny, Value nz, Value nw) noexcept
void Quaternion::Set(Value nx, Value ny, Value nz, Value nw)
{
x = nx;
y = ny;
@@ -392,7 +392,7 @@ void Quaternion::Set(Value nx, Value ny, Value nz, Value nw) noexcept
}
// ------------------------------------------------------------------------------------------------
void Quaternion::Set(const Quaternion & q) noexcept
void Quaternion::Set(const Quaternion & q)
{
x = q.x;
y = q.y;
@@ -400,7 +400,7 @@ void Quaternion::Set(const Quaternion & q) noexcept
w = q.w;
}
void Quaternion::Set(const Vector3 & v) noexcept
void Quaternion::Set(const Vector3 & v)
{
x = v.x;
y = v.y;
@@ -408,7 +408,7 @@ void Quaternion::Set(const Vector3 & v) noexcept
w = 0.0;
}
void Quaternion::Set(const Vector4 & v) noexcept
void Quaternion::Set(const Vector4 & v)
{
x = v.x;
y = v.y;
@@ -417,13 +417,13 @@ void Quaternion::Set(const Vector4 & v) noexcept
}
// ------------------------------------------------------------------------------------------------
void Quaternion::Set(const SQChar * values, SQChar delim) noexcept
void Quaternion::Set(const SQChar * values, SQChar delim)
{
Set(GetQuaternion(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Quaternion::Generate() noexcept
void Quaternion::Generate()
{
x = RandomVal<Value>::Get();
y = RandomVal<Value>::Get();
@@ -431,7 +431,7 @@ void Quaternion::Generate() noexcept
w = RandomVal<Value>::Get();
}
void Quaternion::Generate(Value min, Value max) noexcept
void Quaternion::Generate(Value min, Value max)
{
if (max < min)
{
@@ -446,7 +446,7 @@ void Quaternion::Generate(Value min, Value max) noexcept
}
}
void Quaternion::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax) noexcept
void Quaternion::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax)
{
if (std::isless(xmax, xmin) || std::isless(ymax, ymin) || std::isless(zmax, zmin) || std::isless(wmax, wmin))
{
@@ -462,7 +462,7 @@ void Quaternion::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value
}
// ------------------------------------------------------------------------------------------------
Quaternion Quaternion::Abs() const noexcept
Quaternion Quaternion::Abs() const
{
return Quaternion(std::fabs(x), std::fabs(y), std::fabs(z), std::fabs(w));
}

View File

@@ -23,89 +23,89 @@ struct Quaternion
// --------------------------------------------------------------------------------------------
Value x, y, z, w;
// --------------------------------------------------------------------------------------------
Quaternion() noexcept;
Quaternion(Value s) noexcept;
Quaternion(Value xv, Value yv, Value zv) noexcept;
Quaternion(Value xv, Value yv, Value zv, Value wv) noexcept;
Quaternion();
Quaternion(Value s);
Quaternion(Value xv, Value yv, Value zv);
Quaternion(Value xv, Value yv, Value zv, Value wv);
// --------------------------------------------------------------------------------------------
Quaternion(const Vector3 & v) noexcept;
Quaternion(const Vector4 & v) noexcept;
Quaternion(const Vector3 & v);
Quaternion(const Vector4 & v);
// --------------------------------------------------------------------------------------------
Quaternion(const SQChar * values, SQChar delim) noexcept;
Quaternion(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
Quaternion(const Quaternion & q) noexcept;
Quaternion(Quaternion && q) noexcept;
Quaternion(const Quaternion & q);
Quaternion(Quaternion && q);
// --------------------------------------------------------------------------------------------
~Quaternion();
// --------------------------------------------------------------------------------------------
Quaternion & operator = (const Quaternion & q) noexcept;
Quaternion & operator = (Quaternion && q) noexcept;
Quaternion & operator = (const Quaternion & q);
Quaternion & operator = (Quaternion && q);
// --------------------------------------------------------------------------------------------
Quaternion & operator = (Value s) noexcept;
Quaternion & operator = (const Vector3 & q) noexcept;
Quaternion & operator = (const Vector4 & q) noexcept;
Quaternion & operator = (Value s);
Quaternion & operator = (const Vector3 & q);
Quaternion & operator = (const Vector4 & q);
// --------------------------------------------------------------------------------------------
Quaternion & operator += (const Quaternion & q) noexcept;
Quaternion & operator -= (const Quaternion & q) noexcept;
Quaternion & operator *= (const Quaternion & q) noexcept;
Quaternion & operator /= (const Quaternion & q) noexcept;
Quaternion & operator %= (const Quaternion & q) noexcept;
Quaternion & operator += (const Quaternion & q);
Quaternion & operator -= (const Quaternion & q);
Quaternion & operator *= (const Quaternion & q);
Quaternion & operator /= (const Quaternion & q);
Quaternion & operator %= (const Quaternion & q);
// --------------------------------------------------------------------------------------------
Quaternion & operator += (Value s) noexcept;
Quaternion & operator -= (Value s) noexcept;
Quaternion & operator *= (Value s) noexcept;
Quaternion & operator /= (Value s) noexcept;
Quaternion & operator %= (Value s) noexcept;
Quaternion & operator += (Value s);
Quaternion & operator -= (Value s);
Quaternion & operator *= (Value s);
Quaternion & operator /= (Value s);
Quaternion & operator %= (Value s);
// --------------------------------------------------------------------------------------------
Quaternion & operator ++ () noexcept;
Quaternion & operator -- () noexcept;
Quaternion & operator ++ ();
Quaternion & operator -- ();
// --------------------------------------------------------------------------------------------
Quaternion operator ++ (int) noexcept;
Quaternion operator -- (int) noexcept;
Quaternion operator ++ (int);
Quaternion operator -- (int);
// --------------------------------------------------------------------------------------------
Quaternion operator + (const Quaternion & q) const noexcept;
Quaternion operator - (const Quaternion & q) const noexcept;
Quaternion operator * (const Quaternion & q) const noexcept;
Quaternion operator / (const Quaternion & q) const noexcept;
Quaternion operator % (const Quaternion & q) const noexcept;
Quaternion operator + (const Quaternion & q) const;
Quaternion operator - (const Quaternion & q) const;
Quaternion operator * (const Quaternion & q) const;
Quaternion operator / (const Quaternion & q) const;
Quaternion operator % (const Quaternion & q) const;
// --------------------------------------------------------------------------------------------
Quaternion operator + (Value s) const noexcept;
Quaternion operator - (Value s) const noexcept;
Quaternion operator * (Value s) const noexcept;
Quaternion operator / (Value s) const noexcept;
Quaternion operator % (Value s) const noexcept;
Quaternion operator + (Value s) const;
Quaternion operator - (Value s) const;
Quaternion operator * (Value s) const;
Quaternion operator / (Value s) const;
Quaternion operator % (Value s) const;
// --------------------------------------------------------------------------------------------
Quaternion operator + () const noexcept;
Quaternion operator - () const noexcept;
Quaternion operator + () const;
Quaternion operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Quaternion & q) const noexcept;
bool operator != (const Quaternion & q) const noexcept;
bool operator < (const Quaternion & q) const noexcept;
bool operator > (const Quaternion & q) const noexcept;
bool operator <= (const Quaternion & q) const noexcept;
bool operator >= (const Quaternion & q) const noexcept;
bool operator == (const Quaternion & q) const;
bool operator != (const Quaternion & q) const;
bool operator < (const Quaternion & q) const;
bool operator > (const Quaternion & q) const;
bool operator <= (const Quaternion & q) const;
bool operator >= (const Quaternion & q) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Quaternion & q) const noexcept;
SQInteger Cmp(const Quaternion & q) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny, Value nz) noexcept;
void Set(Value nx, Value ny, Value nz, Value nw) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny, Value nz);
void Set(Value nx, Value ny, Value nz, Value nw);
// --------------------------------------------------------------------------------------------
void Set(const Quaternion & q) noexcept;
void Set(const Vector3 & v) noexcept;
void Set(const Vector4 & v) noexcept;
void Set(const Quaternion & q);
void Set(const Vector3 & v);
void Set(const Vector4 & v);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { x = 0.0, y = 0.0, z = 0.0, w = 0.0; }
void Clear() { x = 0.0, y = 0.0, z = 0.0, w = 0.0; }
// --------------------------------------------------------------------------------------------
Quaternion Abs() const noexcept;
Quaternion Abs() const;
};
} // Namespace:: SqMod

View File

@@ -198,7 +198,7 @@ static const std::vector<Color3> SQ_Color_List
};
// ------------------------------------------------------------------------------------------------
void LogDbg(const char * fmt, ...) noexcept
void LogDbg(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -206,7 +206,7 @@ void LogDbg(const char * fmt, ...) noexcept
va_end(args);
}
void LogMsg(const char * fmt, ...) noexcept
void LogMsg(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -214,7 +214,7 @@ void LogMsg(const char * fmt, ...) noexcept
va_end(args);
}
void LogScs(const char * fmt, ...) noexcept
void LogScs(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -222,7 +222,7 @@ void LogScs(const char * fmt, ...) noexcept
va_end(args);
}
void LogInf(const char * fmt, ...) noexcept
void LogInf(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -230,7 +230,7 @@ void LogInf(const char * fmt, ...) noexcept
va_end(args);
}
void LogWrn(const char * fmt, ...) noexcept
void LogWrn(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -238,7 +238,7 @@ void LogWrn(const char * fmt, ...) noexcept
va_end(args);
}
void LogErr(const char * fmt, ...) noexcept
void LogErr(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -246,7 +246,7 @@ void LogErr(const char * fmt, ...) noexcept
va_end(args);
}
void LogFtl(const char * fmt, ...) noexcept
void LogFtl(const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -255,7 +255,7 @@ void LogFtl(const char * fmt, ...) noexcept
}
// ------------------------------------------------------------------------------------------------
const SQChar * ToStringF(const char * fmt, ...) noexcept
const SQChar * ToStringF(const char * fmt, ...)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -290,7 +290,7 @@ const SQChar * ToStringF(const char * fmt, ...) noexcept
}
// ------------------------------------------------------------------------------------------------
const SQChar * InsertStr(const SQChar * f, const std::vector< const SQChar * > & a) noexcept
const SQChar * InsertStr(const SQChar * f, const std::vector< const SQChar * > & a)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -366,13 +366,13 @@ const SQChar * InsertStr(const SQChar * f, const std::vector< const SQChar * > &
}
// Utility for the <InsertStr> function
const SQChar * InsStr(const SQChar * f) noexcept
const SQChar * InsStr(const SQChar * f)
{
return InsertStr(f, std::vector< const SQChar * >());
}
// ------------------------------------------------------------------------------------------------
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -412,7 +412,7 @@ const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
return buf;
}
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o) noexcept
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -453,7 +453,7 @@ const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o) noexc
}
// ------------------------------------------------------------------------------------------------
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -493,7 +493,7 @@ const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
return buf;
}
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o) noexcept
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -534,7 +534,7 @@ const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o) noex
}
// ------------------------------------------------------------------------------------------------
const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w)
{
// Acquire a buffer from the buffer pool
Core::Buffer vbuf = _Core->PullBuffer();
@@ -575,146 +575,146 @@ const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
}
// ------------------------------------------------------------------------------------------------
void InitMTRG32() noexcept
void InitMTRG32()
{
RG32_MT19937.reset(new std::mt19937(static_cast<unsigned>(std::time(0))));
}
// ------------------------------------------------------------------------------------------------
void InitMTRG64() noexcept
void InitMTRG64()
{
RG64_MT19937.reset(new std::mt19937_64(static_cast<unsigned>(std::time(0))));
}
// ------------------------------------------------------------------------------------------------
Int8 GetRandomInt8() noexcept
Int8 GetRandomInt8()
{
return Int8_Dist(*RG32_MT19937);
}
Int8 GetRandomInt8(Int8 min, Int8 max) noexcept
Int8 GetRandomInt8(Int8 min, Int8 max)
{
std::uniform_int_distribution<Int8> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Uint8 GetRandomUint8() noexcept
Uint8 GetRandomUint8()
{
return UInt8_Dist(*RG32_MT19937);
}
Uint8 GetRandomUint8(Uint8 min, Uint8 max) noexcept
Uint8 GetRandomUint8(Uint8 min, Uint8 max)
{
std::uniform_int_distribution<Uint8> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Int16 GetRandomInt16() noexcept
Int16 GetRandomInt16()
{
return Int16_Dist(*RG32_MT19937);
}
Int16 GetRandomInt16(Int16 min, Int16 max) noexcept
Int16 GetRandomInt16(Int16 min, Int16 max)
{
std::uniform_int_distribution<Int16> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Uint16 GetRandomUint16() noexcept
Uint16 GetRandomUint16()
{
return UInt16_Dist(*RG32_MT19937);
}
Uint16 GetRandomUint16(Uint16 min, Uint16 max) noexcept
Uint16 GetRandomUint16(Uint16 min, Uint16 max)
{
std::uniform_int_distribution<Uint16> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Int32 GetRandomInt32() noexcept
Int32 GetRandomInt32()
{
return Int32_Dist(*RG32_MT19937);
}
Int32 GetRandomInt32(Int32 min, Int32 max) noexcept
Int32 GetRandomInt32(Int32 min, Int32 max)
{
std::uniform_int_distribution<Int32> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Uint32 GetRandomUint32() noexcept
Uint32 GetRandomUint32()
{
return UInt32_Dist(*RG32_MT19937);
}
Uint32 GetRandomUint32(Uint32 min, Uint32 max) noexcept
Uint32 GetRandomUint32(Uint32 min, Uint32 max)
{
std::uniform_int_distribution<Uint32> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Int64 GetRandomInt64() noexcept
Int64 GetRandomInt64()
{
return Int64_Dist(*RG64_MT19937);
}
Int64 GetRandomInt64(Int64 min, Int64 max) noexcept
Int64 GetRandomInt64(Int64 min, Int64 max)
{
std::uniform_int_distribution<Int64> dist(min, max);
return dist(*RG64_MT19937);
}
// ------------------------------------------------------------------------------------------------
Uint64 GetRandomUint64() noexcept
Uint64 GetRandomUint64()
{
return UInt64_Dist(*RG64_MT19937);
}
Uint64 GetRandomUint64(Uint64 min, Uint64 max) noexcept
Uint64 GetRandomUint64(Uint64 min, Uint64 max)
{
std::uniform_int_distribution<Uint64> dist(min, max);
return dist(*RG64_MT19937);
}
// ------------------------------------------------------------------------------------------------
Float32 GetRandomFloat32() noexcept
Float32 GetRandomFloat32()
{
return Float32_Dist(*RG32_MT19937);
}
Float32 GetRandomFloat32(Float32 min, Float32 max) noexcept
Float32 GetRandomFloat32(Float32 min, Float32 max)
{
std::uniform_real_distribution<Float32> dist(min, max);
return dist(*RG32_MT19937);
}
// ------------------------------------------------------------------------------------------------
Float64 GetRandomFloat64() noexcept
Float64 GetRandomFloat64()
{
return Float64_Dist(*RG64_MT19937);
}
Float64 GetRandomFloat64(Float64 min, Float64 max) noexcept
Float64 GetRandomFloat64(Float64 min, Float64 max)
{
std::uniform_real_distribution<Float64> dist(min, max);
return dist(*RG64_MT19937);
}
// ------------------------------------------------------------------------------------------------
String GetRandomString(String::size_type len) noexcept
String GetRandomString(String::size_type len)
{
String str(len, 0);
std::generate(str.begin(), str.end(), [&] () -> String::value_type { return String_Dist(*RG32_MT19937); });
return std::move(str);
}
String GetRandomString(String::size_type len, String::value_type min, String::value_type max) noexcept
String GetRandomString(String::size_type len, String::value_type min, String::value_type max)
{
String str(len, 0);
std::uniform_int_distribution<String::value_type> dist(min, max);
@@ -723,19 +723,19 @@ String GetRandomString(String::size_type len, String::value_type min, String::va
}
// ------------------------------------------------------------------------------------------------
bool GetRandomBool() noexcept
bool GetRandomBool()
{
return Int8_Dist(*RG32_MT19937) > 0 ? true : false;
}
// ------------------------------------------------------------------------------------------------
const Color3 & GetRandomColor() noexcept
const Color3 & GetRandomColor()
{
return SQ_Color_List.at(GetRandomUint32(0, SQ_Color_List.size()-1));
}
// --------------------------------------------------------------------------------------------
bool SToB(const SQChar * str) noexcept
bool SToB(const SQChar * str)
{
return (strcmp(str, "true") == 0 || \
strcmp(str, "yes") == 0 || \
@@ -744,7 +744,7 @@ bool SToB(const SQChar * str) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 GetColor(const SQChar * name) noexcept
Color3 GetColor(const SQChar * name)
{
// See if we actually have something to search for
if(std::strlen(name) <= 0)
@@ -1355,7 +1355,7 @@ Color3 GetColor(const SQChar * name) noexcept
}
// ------------------------------------------------------------------------------------------------
AABB GetAABB(const SQChar * str, SQChar delim) noexcept
AABB GetAABB(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f , %f , %f , %f , %f ");
static AABB box;
@@ -1390,7 +1390,7 @@ AABB GetAABB(const SQChar * str, SQChar delim) noexcept
}
// ------------------------------------------------------------------------------------------------
Circle GetCircle(const SQChar * str, SQChar delim) noexcept
Circle GetCircle(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f , %f ");
static Circle circle;
@@ -1419,7 +1419,7 @@ Circle GetCircle(const SQChar * str, SQChar delim) noexcept
}
// ------------------------------------------------------------------------------------------------
Color3 GetColor3(const SQChar * str, SQChar delim) noexcept
Color3 GetColor3(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %u , %u , %u ");
SQUint32 r = 0, g = 0, b = 0;
@@ -1445,7 +1445,7 @@ Color3 GetColor3(const SQChar * str, SQChar delim) noexcept
return Color3(static_cast<Color3::Value>(r), static_cast<Color3::Value>(g), static_cast<Color3::Value>(b));
}
Color4 GetColor4(const SQChar * str, SQChar delim) noexcept
Color4 GetColor4(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %u , %u , %u , %u ");
SQUint32 r = 0, g = 0, b = 0, a = 0;
@@ -1474,7 +1474,7 @@ Color4 GetColor4(const SQChar * str, SQChar delim) noexcept
}
// ------------------------------------------------------------------------------------------------
Quaternion GetQuaternion(const SQChar * str, SQChar delim) noexcept
Quaternion GetQuaternion(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f , %f , %f ");
static Quaternion quat;
@@ -1504,7 +1504,7 @@ Quaternion GetQuaternion(const SQChar * str, SQChar delim) noexcept
return quat;
}
Sphere GetSphere(const SQChar * str, SQChar delim) noexcept
Sphere GetSphere(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f , %f , %f ");
static Sphere sphere;
@@ -1535,7 +1535,7 @@ Sphere GetSphere(const SQChar * str, SQChar delim) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f GetVector2f(const SQChar * str, SQChar delim) noexcept
Vector2f GetVector2f(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f ");
static Vector2f vec;
@@ -1561,7 +1561,7 @@ Vector2f GetVector2f(const SQChar * str, SQChar delim) noexcept
return vec;
}
Vector2i GetVector2i(const SQChar * str, SQChar delim) noexcept
Vector2i GetVector2i(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %d , %d ");
static Vector2i vec;
@@ -1587,7 +1587,7 @@ Vector2i GetVector2i(const SQChar * str, SQChar delim) noexcept
return vec;
}
Vector2u GetVector2u(const SQChar * str, SQChar delim) noexcept
Vector2u GetVector2u(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %u , %u ");
static Vector2u vec;
@@ -1614,7 +1614,7 @@ Vector2u GetVector2u(const SQChar * str, SQChar delim) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 GetVector3(const SQChar * str, SQChar delim) noexcept
Vector3 GetVector3(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f , %f ");
static Vector3 vec;
@@ -1642,7 +1642,7 @@ Vector3 GetVector3(const SQChar * str, SQChar delim) noexcept
return vec;
}
Vector4 GetVector4(const SQChar * str, SQChar delim) noexcept
Vector4 GetVector4(const SQChar * str, SQChar delim)
{
static SQChar fs[] = _SC(" %f , %f , %f , %f ");
static Vector4 vec;
@@ -1673,7 +1673,7 @@ Vector4 GetVector4(const SQChar * str, SQChar delim) noexcept
}
// ------------------------------------------------------------------------------------------------
template < typename T > T StrToInt(const SQChar * str) noexcept
template < typename T > T StrToInt(const SQChar * str)
{
try
{
@@ -1691,7 +1691,7 @@ template < typename T > T StrToInt(const SQChar * str) noexcept
}
// ------------------------------------------------------------------------------------------------
template < typename T > T StrToInt(const SQChar * str, SQInt32 base) noexcept
template < typename T > T StrToInt(const SQChar * str, SQInt32 base)
{
try
{
@@ -1709,7 +1709,7 @@ template < typename T > T StrToInt(const SQChar * str, SQInt32 base) noexcept
}
// ------------------------------------------------------------------------------------------------
template < typename T > T StrToReal(const SQChar * str) noexcept
template < typename T > T StrToReal(const SQChar * str)
{
try
{
@@ -1727,12 +1727,12 @@ template < typename T > T StrToReal(const SQChar * str) noexcept
}
// ------------------------------------------------------------------------------------------------
template < typename T > T RandomValue() noexcept
template < typename T > T RandomValue()
{
return RandomVal< T >::Get();
}
template < typename T > T RandomValue(T min, T max) noexcept
template < typename T > T RandomValue(T min, T max)
{
return RandomVal< T >::Get(min, max);
}

View File

@@ -44,17 +44,17 @@ const Float64 RADTODEG64 = 180.0 / PI64;
/* ------------------------------------------------------------------------------------------------
* ...
*/
template< typename T > inline bool EpsEq(const T a, const T b) noexcept
template< typename T > inline bool EpsEq(const T a, const T b)
{
return abs(a - b) <= std::numeric_limits<T>::epsilon();
}
template <> inline bool EpsEq(const Float32 a, const Float32 b) noexcept
template <> inline bool EpsEq(const Float32 a, const Float32 b)
{
return fabs(a - b) <= 0.000001f;
}
template <> inline bool EpsEq(const Float64 a, const Float64 b) noexcept
template <> inline bool EpsEq(const Float64 a, const Float64 b)
{
return fabs(a - b) <= 0.000000001d;
}
@@ -62,17 +62,17 @@ template <> inline bool EpsEq(const Float64 a, const Float64 b) noexcept
/* ------------------------------------------------------------------------------------------------
* ...
*/
template< typename T > inline T Clamp(T val, T min, T max) noexcept
template< typename T > inline T Clamp(T val, T min, T max)
{
return val < min ? min : (val > max ? max : val);
}
template<> inline Float32 Clamp(const Float32 val, const Float32 min, const Float32 max) noexcept
template<> inline Float32 Clamp(const Float32 val, const Float32 min, const Float32 max)
{
return std::isless(val, min) ? min : (std::isgreater(val, max) ? max : val);
}
template<> inline Float64 Clamp(const Float64 val, const Float64 min, const Float64 max) noexcept
template<> inline Float64 Clamp(const Float64 val, const Float64 min, const Float64 max)
{
return std::isless(val, min) ? min : (std::isgreater(val, max) ? max : val);
}
@@ -80,95 +80,95 @@ template<> inline Float64 Clamp(const Float64 val, const Float64 min, const Floa
/* ------------------------------------------------------------------------------------------------
* Simple functions to quickly forward logging messages without including the logging system
*/
void LogDbg(const char * fmt, ...) noexcept;
void LogMsg(const char * fmt, ...) noexcept;
void LogScs(const char * fmt, ...) noexcept;
void LogInf(const char * fmt, ...) noexcept;
void LogWrn(const char * fmt, ...) noexcept;
void LogErr(const char * fmt, ...) noexcept;
void LogFtl(const char * fmt, ...) noexcept;
void LogDbg(const char * fmt, ...);
void LogMsg(const char * fmt, ...);
void LogScs(const char * fmt, ...);
void LogInf(const char * fmt, ...);
void LogWrn(const char * fmt, ...);
void LogErr(const char * fmt, ...);
void LogFtl(const char * fmt, ...);
/* ------------------------------------------------------------------------------------------------
* ...
*/
const SQChar * ToStringF(const char * fmt, ...) noexcept;
const SQChar * ToStringF(const char * fmt, ...);
/* ------------------------------------------------------------------------------------------------
* ...
*/
void InitMTRG64() noexcept;
void InitMTRG64() noexcept;
void InitMTRG64();
void InitMTRG64();
/* ------------------------------------------------------------------------------------------------
* ...
*/
Int8 GetRandomInt8() noexcept;
Int8 GetRandomInt8(Int8 min, Int8 max) noexcept;
Int8 GetRandomInt8();
Int8 GetRandomInt8(Int8 min, Int8 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Uint8 GetRandomUint8() noexcept;
Uint8 GetRandomUint8(Uint8 min, Uint8 max) noexcept;
Uint8 GetRandomUint8();
Uint8 GetRandomUint8(Uint8 min, Uint8 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Int16 GetRandomInt16() noexcept;
Int16 GetRandomInt16(Int16 min, Int16 max) noexcept;
Int16 GetRandomInt16();
Int16 GetRandomInt16(Int16 min, Int16 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Uint16 GetRandomUint16() noexcept;
Uint16 GetRandomUint16(Uint16 min, Uint16 max) noexcept;
Uint16 GetRandomUint16();
Uint16 GetRandomUint16(Uint16 min, Uint16 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Int32 GetRandomInt32() noexcept;
Int32 GetRandomInt32(Int32 min, Int32 max) noexcept;
Int32 GetRandomInt32();
Int32 GetRandomInt32(Int32 min, Int32 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Uint32 GetRandomUint32() noexcept;
Uint32 GetRandomUint32(Uint32 min, Uint32 max) noexcept;
Uint32 GetRandomUint32();
Uint32 GetRandomUint32(Uint32 min, Uint32 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Int64 GetRandomInt64() noexcept;
Int64 GetRandomInt64(Int64 min, Int64 max) noexcept;
Int64 GetRandomInt64();
Int64 GetRandomInt64(Int64 min, Int64 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Uint64 GetRandomUint64() noexcept;
Uint64 GetRandomUint64(Uint64 min, Uint64 max) noexcept;
Uint64 GetRandomUint64();
Uint64 GetRandomUint64(Uint64 min, Uint64 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Float32 GetRandomFloat32() noexcept;
Float32 GetRandomFloat32(Float32 min, Float32 max) noexcept;
Float32 GetRandomFloat32();
Float32 GetRandomFloat32(Float32 min, Float32 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Float64 GetRandomFloat64() noexcept;
Float64 GetRandomFloat64(Float64 min, Float64 max) noexcept;
Float64 GetRandomFloat64();
Float64 GetRandomFloat64(Float64 min, Float64 max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
String GetRandomString(String::size_type len) noexcept;
String GetRandomString(String::size_type len, String::value_type min, String::value_type max) noexcept;
String GetRandomString(String::size_type len);
String GetRandomString(String::size_type len, String::value_type min, String::value_type max);
/* ------------------------------------------------------------------------------------------------
* ...
*/
bool GetRandomBool() noexcept;
bool GetRandomBool();
/* ------------------------------------------------------------------------------------------------
* ...
@@ -181,14 +181,14 @@ template <typename T> struct RandomVal
*/
template <> struct RandomVal<Int8>
{
static inline Int8 Get() noexcept { return GetRandomInt8(); }
static inline Int8 Get(Int8 min, Int8 max) noexcept { return GetRandomInt8(min, max); }
static inline Int8 Get() { return GetRandomInt8(); }
static inline Int8 Get(Int8 min, Int8 max) { return GetRandomInt8(min, max); }
};
template <> struct RandomVal<Uint8>
{
static inline Uint8 Get() noexcept { return GetRandomUint8(); }
static inline Uint8 Get(Uint8 min, Uint8 max) noexcept { return GetRandomUint8(min, max); }
static inline Uint8 Get() { return GetRandomUint8(); }
static inline Uint8 Get(Uint8 min, Uint8 max) { return GetRandomUint8(min, max); }
};
/* ------------------------------------------------------------------------------------------------
@@ -196,14 +196,14 @@ template <> struct RandomVal<Uint8>
*/
template <> struct RandomVal<Int16>
{
static inline Int16 Get() noexcept { return GetRandomInt16(); }
static inline Int16 Get(Int16 min, Int16 max) noexcept { return GetRandomInt16(min, max); }
static inline Int16 Get() { return GetRandomInt16(); }
static inline Int16 Get(Int16 min, Int16 max) { return GetRandomInt16(min, max); }
};
template <> struct RandomVal<Uint16>
{
static inline Uint16 Get() noexcept { return GetRandomUint16(); }
static inline Uint16 Get(Uint16 min, Uint16 max) noexcept { return GetRandomUint16(min, max); }
static inline Uint16 Get() { return GetRandomUint16(); }
static inline Uint16 Get(Uint16 min, Uint16 max) { return GetRandomUint16(min, max); }
};
/* ------------------------------------------------------------------------------------------------
@@ -211,14 +211,14 @@ template <> struct RandomVal<Uint16>
*/
template <> struct RandomVal<Int32>
{
static inline Int32 Get() noexcept { return GetRandomInt32(); }
static inline Int32 Get(Int32 min, Int32 max) noexcept { return GetRandomInt32(min, max); }
static inline Int32 Get() { return GetRandomInt32(); }
static inline Int32 Get(Int32 min, Int32 max) { return GetRandomInt32(min, max); }
};
template <> struct RandomVal<Uint32>
{
static inline Uint32 Get() noexcept { return GetRandomUint32(); }
static inline Uint32 Get(Uint32 min, Uint32 max) noexcept { return GetRandomUint32(min, max); }
static inline Uint32 Get() { return GetRandomUint32(); }
static inline Uint32 Get(Uint32 min, Uint32 max) { return GetRandomUint32(min, max); }
};
/* ------------------------------------------------------------------------------------------------
@@ -226,14 +226,14 @@ template <> struct RandomVal<Uint32>
*/
template <> struct RandomVal<Int64>
{
static inline Int64 Get() noexcept { return GetRandomInt64(); }
static inline Int64 Get(Int64 min, Int64 max) noexcept { return GetRandomInt64(min, max); }
static inline Int64 Get() { return GetRandomInt64(); }
static inline Int64 Get(Int64 min, Int64 max) { return GetRandomInt64(min, max); }
};
template <> struct RandomVal<Uint64>
{
static inline Uint64 Get() noexcept { return GetRandomUint64(); }
static inline Uint64 Get(Uint64 min, Uint64 max) noexcept { return GetRandomUint64(min, max); }
static inline Uint64 Get() { return GetRandomUint64(); }
static inline Uint64 Get(Uint64 min, Uint64 max) { return GetRandomUint64(min, max); }
};
/* ------------------------------------------------------------------------------------------------
@@ -241,14 +241,14 @@ template <> struct RandomVal<Uint64>
*/
template <> struct RandomVal<Float32>
{
static inline Float32 Get() noexcept { return GetRandomFloat32(); }
static inline Float32 Get(Float32 min, Float32 max) noexcept { return GetRandomFloat32(min, max); }
static inline Float32 Get() { return GetRandomFloat32(); }
static inline Float32 Get(Float32 min, Float32 max) { return GetRandomFloat32(min, max); }
};
template <> struct RandomVal<Float64>
{
static inline Float64 Get() noexcept { return GetRandomFloat64(); }
static inline Float64 Get(Float64 min, Float64 max) noexcept { return GetRandomFloat64(min, max); }
static inline Float64 Get() { return GetRandomFloat64(); }
static inline Float64 Get(Float64 min, Float64 max) { return GetRandomFloat64(min, max); }
};
/* ------------------------------------------------------------------------------------------------
@@ -256,8 +256,8 @@ template <> struct RandomVal<Float64>
*/
template <> struct RandomVal<String>
{
static inline String Get(String::size_type len) noexcept { return GetRandomString(len); }
static inline String Get(String::size_type len, String::value_type min, String::value_type max) noexcept
static inline String Get(String::size_type len) { return GetRandomString(len); }
static inline String Get(String::size_type len, String::value_type min, String::value_type max)
{ return GetRandomString(len, min, max); }
};
@@ -266,18 +266,18 @@ template <> struct RandomVal<String>
*/
template <> struct RandomVal<bool>
{
static inline bool Get() noexcept { return GetRandomBool(); }
static inline bool Get() { return GetRandomBool(); }
};
/* ------------------------------------------------------------------------------------------------
* ...
*/
const Color3 & GetRandomColor() noexcept;
const Color3 & GetRandomColor();
/* ------------------------------------------------------------------------------------------------
* Simple function to check whether the specified string can be considered as a boolean value
*/
bool SToB(const SQChar * str) noexcept;
bool SToB(const SQChar * str);
/* ------------------------------------------------------------------------------------------------
* Utility used to unify the string converstion functions under one name.
@@ -302,95 +302,95 @@ template <> struct SToF < double > { static constexpr auto Fn = static_cast< dou
template <> struct SToF < long double > { static constexpr auto Fn = static_cast< long double(*)(const String &, std::size_t*) >(std::stold); };
// ------------------------------------------------------------------------------------------------
template < typename T > inline String NToS(T n) noexcept { return std::to_string(n); }
template < typename T > inline const SQChar * NToCS(T n) noexcept { return std::to_string(n).c_str(); }
template < typename T > inline String NToS(T n) { return std::to_string(n); }
template < typename T > inline const SQChar * NToCS(T n) { return std::to_string(n).c_str(); }
/* ------------------------------------------------------------------------------------------------
* ...
*/
Color3 GetColor(const SQChar * name) noexcept;
Color3 GetColor(const SQChar * name);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Circle GetCircle(const SQChar * str, SQChar delim) noexcept;
Circle GetCircle(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
AABB GetAABB(const SQChar * str, SQChar delim) noexcept;
AABB GetAABB(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Color3 GetColor3(const SQChar * str, SQChar delim) noexcept;
Color3 GetColor3(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Color4 GetColor4(const SQChar * str, SQChar delim) noexcept;
Color4 GetColor4(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Quaternion GetQuaternion(const SQChar * str, SQChar delim) noexcept;
Quaternion GetQuaternion(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Sphere GetSphere(const SQChar * str, SQChar delim) noexcept;
Sphere GetSphere(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Vector2f GetVector2f(const SQChar * str, SQChar delim) noexcept;
Vector2f GetVector2f(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Vector2i GetVector2i(const SQChar * str, SQChar delim) noexcept;
Vector2i GetVector2i(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Vector2u GetVector2u(const SQChar * str, SQChar delim) noexcept;
Vector2u GetVector2u(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Vector3 GetVector3(const SQChar * str, SQChar delim) noexcept;
Vector3 GetVector3(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* ...
*/
Vector4 GetVector4(const SQChar * str, SQChar delim) noexcept;
Vector4 GetVector4(const SQChar * str, SQChar delim);
/* ------------------------------------------------------------------------------------------------
* Fake deleter meant for classes that should not be deleted by smart pointers
*/
template <typename T> struct FakeDeleter
{
void operator () (T * /* ptr */) const noexcept { /* Ignored... */ }
void operator () (T * /* ptr */) const { /* Ignored... */ }
};
/* ------------------------------------------------------------------------------------------------
* Utility used to generate a string with an arbitrary text surrounded by a specific character
*/
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w = 72) noexcept;
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w = 72, SQUint32 o = 0) noexcept;
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w = 72) noexcept;
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w = 72, SQUint32 o = 0) noexcept;
const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w = 72) noexcept;
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w = 72);
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w = 72, SQUint32 o = 0);
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w = 72);
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w = 72, SQUint32 o = 0);
const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w = 72);
/* ------------------------------------------------------------------------------------------------
* Function used insert arbitrary text at certain positions within a string
*/
const SQChar * InsertStr(const SQChar * f, const std::vector< const SQChar * > & a) noexcept;
const SQChar * InsertStr(const SQChar * f, const std::vector< const SQChar * > & a);
// Utility for the <InsertStr> function
const SQChar * InsStr(const SQChar * f) noexcept;
const SQChar * InsStr(const SQChar * f);
template < typename... Args > const SQChar * InsStr(const SQChar * f, Args... args) noexcept
template < typename... Args > const SQChar * InsStr(const SQChar * f, Args... args)
{
return InsertStr(f, {{args...}});
}

View File

@@ -14,44 +14,44 @@ const Sphere Sphere::MAX = Sphere(std::numeric_limits<Sphere::Value>::max());
SQChar Sphere::Delim = ',';
// ------------------------------------------------------------------------------------------------
Sphere::Sphere() noexcept
Sphere::Sphere()
: pos(0.0, 0.0, 0.0), rad(0.0)
{
}
Sphere::Sphere(Value r) noexcept
Sphere::Sphere(Value r)
: pos(0.0, 0.0, 0.0), rad(r)
{
}
Sphere::Sphere(const Vector3 & p) noexcept
Sphere::Sphere(const Vector3 & p)
: pos(p), rad(0.0)
{
}
Sphere::Sphere(const Vector3 & p, Value r) noexcept
Sphere::Sphere(const Vector3 & p, Value r)
: pos(p), rad(r)
{
}
Sphere::Sphere(Value x, Value y, Value z, Value r) noexcept
Sphere::Sphere(Value x, Value y, Value z, Value r)
: pos(x, y, z), rad(r)
{
}
// ------------------------------------------------------------------------------------------------
Sphere::Sphere(const Sphere & s) noexcept
Sphere::Sphere(const Sphere & s)
: pos(s.pos), rad(s.rad)
{
}
Sphere::Sphere(Sphere && s) noexcept
Sphere::Sphere(Sphere && s)
: pos(s.pos), rad(s.rad)
{
@@ -64,14 +64,14 @@ Sphere::~Sphere()
}
// ------------------------------------------------------------------------------------------------
Sphere & Sphere::operator = (const Sphere & s) noexcept
Sphere & Sphere::operator = (const Sphere & s)
{
pos = s.pos;
rad = s.rad;
return *this;
}
Sphere & Sphere::operator = (Sphere && s) noexcept
Sphere & Sphere::operator = (Sphere && s)
{
pos = s.pos;
rad = s.rad;
@@ -79,48 +79,48 @@ Sphere & Sphere::operator = (Sphere && s) noexcept
}
// ------------------------------------------------------------------------------------------------
Sphere & Sphere::operator = (Value r) noexcept
Sphere & Sphere::operator = (Value r)
{
rad = r;
return *this;
}
Sphere & Sphere::operator = (const Vector3 & p) noexcept
Sphere & Sphere::operator = (const Vector3 & p)
{
pos = p;
return *this;
}
// ------------------------------------------------------------------------------------------------
Sphere & Sphere::operator += (const Sphere & s) noexcept
Sphere & Sphere::operator += (const Sphere & s)
{
pos += s.pos;
rad += s.rad;
return *this;
}
Sphere & Sphere::operator -= (const Sphere & s) noexcept
Sphere & Sphere::operator -= (const Sphere & s)
{
pos -= s.pos;
rad -= s.rad;
return *this;
}
Sphere & Sphere::operator *= (const Sphere & s) noexcept
Sphere & Sphere::operator *= (const Sphere & s)
{
pos *= s.pos;
rad *= s.rad;
return *this;
}
Sphere & Sphere::operator /= (const Sphere & s) noexcept
Sphere & Sphere::operator /= (const Sphere & s)
{
pos /= s.pos;
rad /= s.rad;
return *this;
}
Sphere & Sphere::operator %= (const Sphere & s) noexcept
Sphere & Sphere::operator %= (const Sphere & s)
{
pos %= s.pos;
rad = std::fmod(rad, s.rad);
@@ -129,76 +129,76 @@ Sphere & Sphere::operator %= (const Sphere & s) noexcept
}
// ------------------------------------------------------------------------------------------------
Sphere & Sphere::operator += (Value r) noexcept
Sphere & Sphere::operator += (Value r)
{
rad += r;
return *this;
}
Sphere & Sphere::operator -= (Value r) noexcept
Sphere & Sphere::operator -= (Value r)
{
rad -= r;
return *this;
}
Sphere & Sphere::operator *= (Value r) noexcept
Sphere & Sphere::operator *= (Value r)
{
rad *= r;
return *this;
}
Sphere & Sphere::operator /= (Value r) noexcept
Sphere & Sphere::operator /= (Value r)
{
rad /= r;
return *this;
}
Sphere & Sphere::operator %= (Value r) noexcept
Sphere & Sphere::operator %= (Value r)
{
rad = std::fmod(rad, r);
return *this;
}
// ------------------------------------------------------------------------------------------------
Sphere & Sphere::operator += (const Vector3 & p) noexcept
Sphere & Sphere::operator += (const Vector3 & p)
{
pos += p;
return *this;
}
Sphere & Sphere::operator -= (const Vector3 & p) noexcept
Sphere & Sphere::operator -= (const Vector3 & p)
{
pos -= p;
return *this;
}
Sphere & Sphere::operator *= (const Vector3 & p) noexcept
Sphere & Sphere::operator *= (const Vector3 & p)
{
pos *= p;
return *this;
}
Sphere & Sphere::operator /= (const Vector3 & p) noexcept
Sphere & Sphere::operator /= (const Vector3 & p)
{
pos /= p;
return *this;
}
Sphere & Sphere::operator %= (const Vector3 & p) noexcept
Sphere & Sphere::operator %= (const Vector3 & p)
{
pos %= p;
return *this;
}
// ------------------------------------------------------------------------------------------------
Sphere & Sphere::operator ++ () noexcept
Sphere & Sphere::operator ++ ()
{
++pos;
++rad;
return *this;
}
Sphere & Sphere::operator -- () noexcept
Sphere & Sphere::operator -- ()
{
--pos;
--rad;
@@ -206,7 +206,7 @@ Sphere & Sphere::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Sphere Sphere::operator ++ (int) noexcept
Sphere Sphere::operator ++ (int)
{
Sphere state(*this);
++pos;
@@ -214,7 +214,7 @@ Sphere Sphere::operator ++ (int) noexcept
return state;
}
Sphere Sphere::operator -- (int) noexcept
Sphere Sphere::operator -- (int)
{
Sphere state(*this);
--pos;
@@ -223,186 +223,186 @@ Sphere Sphere::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Sphere Sphere::operator + (const Sphere & s) const noexcept
Sphere Sphere::operator + (const Sphere & s) const
{
return Sphere(pos + s.pos, rad + s.rad);
}
Sphere Sphere::operator - (const Sphere & s) const noexcept
Sphere Sphere::operator - (const Sphere & s) const
{
return Sphere(pos - s.pos, rad - s.rad);
}
Sphere Sphere::operator * (const Sphere & s) const noexcept
Sphere Sphere::operator * (const Sphere & s) const
{
return Sphere(pos * s.pos, rad * s.rad);
}
Sphere Sphere::operator / (const Sphere & s) const noexcept
Sphere Sphere::operator / (const Sphere & s) const
{
return Sphere(pos / s.pos, rad / s.rad);
}
Sphere Sphere::operator % (const Sphere & s) const noexcept
Sphere Sphere::operator % (const Sphere & s) const
{
return Sphere(pos % s.pos, std::fmod(rad, s.rad));
}
// ------------------------------------------------------------------------------------------------
Sphere Sphere::operator + (Value r) const noexcept
Sphere Sphere::operator + (Value r) const
{
return Sphere(rad + r);
}
Sphere Sphere::operator - (Value r) const noexcept
Sphere Sphere::operator - (Value r) const
{
return Sphere(rad - r);
}
Sphere Sphere::operator * (Value r) const noexcept
Sphere Sphere::operator * (Value r) const
{
return Sphere(rad * r);
}
Sphere Sphere::operator / (Value r) const noexcept
Sphere Sphere::operator / (Value r) const
{
return Sphere(rad / r);
}
Sphere Sphere::operator % (Value r) const noexcept
Sphere Sphere::operator % (Value r) const
{
return Sphere(std::fmod(rad, r));
}
// ------------------------------------------------------------------------------------------------
Sphere Sphere::operator + (const Vector3 & p) const noexcept
Sphere Sphere::operator + (const Vector3 & p) const
{
return Sphere(pos + p);
}
Sphere Sphere::operator - (const Vector3 & p) const noexcept
Sphere Sphere::operator - (const Vector3 & p) const
{
return Sphere(pos - p);
}
Sphere Sphere::operator * (const Vector3 & p) const noexcept
Sphere Sphere::operator * (const Vector3 & p) const
{
return Sphere(pos * p);
}
Sphere Sphere::operator / (const Vector3 & p) const noexcept
Sphere Sphere::operator / (const Vector3 & p) const
{
return Sphere(pos / p);
}
Sphere Sphere::operator % (const Vector3 & p) const noexcept
Sphere Sphere::operator % (const Vector3 & p) const
{
return Sphere(pos % p);
}
// ------------------------------------------------------------------------------------------------
Sphere Sphere::operator + () const noexcept
Sphere Sphere::operator + () const
{
return Sphere(pos.Abs(), std::fabs(rad));
}
Sphere Sphere::operator - () const noexcept
Sphere Sphere::operator - () const
{
return Sphere(-pos, -rad);
}
// ------------------------------------------------------------------------------------------------
bool Sphere::operator == (const Sphere & s) const noexcept
bool Sphere::operator == (const Sphere & s) const
{
return (rad == s.rad) && (pos == s.pos);
}
bool Sphere::operator != (const Sphere & s) const noexcept
bool Sphere::operator != (const Sphere & s) const
{
return (rad != s.rad) && (pos != s.pos);
}
bool Sphere::operator < (const Sphere & s) const noexcept
bool Sphere::operator < (const Sphere & s) const
{
return (rad < s.rad) && (pos < s.pos);
}
bool Sphere::operator > (const Sphere & s) const noexcept
bool Sphere::operator > (const Sphere & s) const
{
return (rad > s.rad) && (pos > s.pos);
}
bool Sphere::operator <= (const Sphere & s) const noexcept
bool Sphere::operator <= (const Sphere & s) const
{
return (rad <= s.rad) && (pos <= s.pos);
}
bool Sphere::operator >= (const Sphere & s) const noexcept
bool Sphere::operator >= (const Sphere & s) const
{
return (rad >= s.rad) && (pos >= s.pos);
}
// ------------------------------------------------------------------------------------------------
SQInteger Sphere::Cmp(const Sphere & s) const noexcept
SQInteger Sphere::Cmp(const Sphere & s) const
{
return *this == s ? 0 : (*this > s ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Sphere::ToString() const noexcept
const SQChar * Sphere::ToString() const
{
return ToStringF("%f,%f,%f,%f", pos.x, pos.y, pos.z, rad);
}
// ------------------------------------------------------------------------------------------------
void Sphere::Set(Value nr) noexcept
void Sphere::Set(Value nr)
{
rad = nr;
}
void Sphere::Set(const Sphere & ns) noexcept
void Sphere::Set(const Sphere & ns)
{
pos = ns.pos;
rad = ns.rad;
}
void Sphere::Set(const Vector3 & np) noexcept
void Sphere::Set(const Vector3 & np)
{
pos = np;
}
void Sphere::Set(const Vector3 & np, Value nr) noexcept
void Sphere::Set(const Vector3 & np, Value nr)
{
pos = np;
rad = nr;
}
// ------------------------------------------------------------------------------------------------
void Sphere::Set(Value nx, Value ny, Value nz) noexcept
void Sphere::Set(Value nx, Value ny, Value nz)
{
pos.Set(nx, ny, nz);
}
void Sphere::Set(Value nx, Value ny, Value nz, Value nr) noexcept
void Sphere::Set(Value nx, Value ny, Value nz, Value nr)
{
pos.Set(nx, ny, nz);
rad = nr;
}
// ------------------------------------------------------------------------------------------------
void Sphere::Set(const SQChar * values, SQChar delim) noexcept
void Sphere::Set(const SQChar * values, SQChar delim)
{
Set(GetSphere(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Sphere::Generate() noexcept
void Sphere::Generate()
{
pos.Generate();
rad = RandomVal<Value>::Get();
}
void Sphere::Generate(Value min, Value max, bool r) noexcept
void Sphere::Generate(Value min, Value max, bool r)
{
if (max < min)
{
@@ -418,12 +418,12 @@ void Sphere::Generate(Value min, Value max, bool r) noexcept
}
}
void Sphere::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax) noexcept
void Sphere::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax)
{
pos.Generate(xmin, xmax, ymin, ymax, zmin, zmax);
}
void Sphere::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value rmin, Value rmax) noexcept
void Sphere::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value rmin, Value rmax)
{
if (std::isless(rmax, rmin))
{
@@ -437,7 +437,7 @@ void Sphere::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin
}
// ------------------------------------------------------------------------------------------------
Sphere Sphere::Abs() const noexcept
Sphere Sphere::Abs() const
{
return Sphere(pos.Abs(), std::fabs(rad));
}

View File

@@ -25,97 +25,97 @@ struct Sphere
Vector3 pos;
Value rad;
// --------------------------------------------------------------------------------------------
Sphere() noexcept;
Sphere(Value r) noexcept;
Sphere(const Vector3 & p) noexcept;
Sphere(const Vector3 & p, Value r) noexcept;
Sphere(Value x, Value y, Value z, Value r) noexcept;
Sphere();
Sphere(Value r);
Sphere(const Vector3 & p);
Sphere(const Vector3 & p, Value r);
Sphere(Value x, Value y, Value z, Value r);
// --------------------------------------------------------------------------------------------
Sphere(const Sphere & s) noexcept;
Sphere(Sphere && s) noexcept;
Sphere(const Sphere & s);
Sphere(Sphere && s);
// --------------------------------------------------------------------------------------------
~Sphere();
// --------------------------------------------------------------------------------------------
Sphere & operator = (const Sphere & s) noexcept;
Sphere & operator = (Sphere && s) noexcept;
Sphere & operator = (const Sphere & s);
Sphere & operator = (Sphere && s);
// --------------------------------------------------------------------------------------------
Sphere & operator = (Value r) noexcept;
Sphere & operator = (const Vector3 & p) noexcept;
Sphere & operator = (Value r);
Sphere & operator = (const Vector3 & p);
// --------------------------------------------------------------------------------------------
Sphere & operator += (const Sphere & s) noexcept;
Sphere & operator -= (const Sphere & s) noexcept;
Sphere & operator *= (const Sphere & s) noexcept;
Sphere & operator /= (const Sphere & s) noexcept;
Sphere & operator %= (const Sphere & s) noexcept;
Sphere & operator += (const Sphere & s);
Sphere & operator -= (const Sphere & s);
Sphere & operator *= (const Sphere & s);
Sphere & operator /= (const Sphere & s);
Sphere & operator %= (const Sphere & s);
// --------------------------------------------------------------------------------------------
Sphere & operator += (Value r) noexcept;
Sphere & operator -= (Value r) noexcept;
Sphere & operator *= (Value r) noexcept;
Sphere & operator /= (Value r) noexcept;
Sphere & operator %= (Value r) noexcept;
Sphere & operator += (Value r);
Sphere & operator -= (Value r);
Sphere & operator *= (Value r);
Sphere & operator /= (Value r);
Sphere & operator %= (Value r);
// --------------------------------------------------------------------------------------------
Sphere & operator += (const Vector3 & p) noexcept;
Sphere & operator -= (const Vector3 & p) noexcept;
Sphere & operator *= (const Vector3 & p) noexcept;
Sphere & operator /= (const Vector3 & p) noexcept;
Sphere & operator %= (const Vector3 & p) noexcept;
Sphere & operator += (const Vector3 & p);
Sphere & operator -= (const Vector3 & p);
Sphere & operator *= (const Vector3 & p);
Sphere & operator /= (const Vector3 & p);
Sphere & operator %= (const Vector3 & p);
// --------------------------------------------------------------------------------------------
Sphere & operator ++ () noexcept;
Sphere & operator -- () noexcept;
Sphere & operator ++ ();
Sphere & operator -- ();
// --------------------------------------------------------------------------------------------
Sphere operator ++ (int) noexcept;
Sphere operator -- (int) noexcept;
Sphere operator ++ (int);
Sphere operator -- (int);
// --------------------------------------------------------------------------------------------
Sphere operator + (const Sphere & s) const noexcept;
Sphere operator - (const Sphere & s) const noexcept;
Sphere operator * (const Sphere & s) const noexcept;
Sphere operator / (const Sphere & s) const noexcept;
Sphere operator % (const Sphere & s) const noexcept;
Sphere operator + (const Sphere & s) const;
Sphere operator - (const Sphere & s) const;
Sphere operator * (const Sphere & s) const;
Sphere operator / (const Sphere & s) const;
Sphere operator % (const Sphere & s) const;
// --------------------------------------------------------------------------------------------
Sphere operator + (Value r) const noexcept;
Sphere operator - (Value r) const noexcept;
Sphere operator * (Value r) const noexcept;
Sphere operator / (Value r) const noexcept;
Sphere operator % (Value r) const noexcept;
Sphere operator + (Value r) const;
Sphere operator - (Value r) const;
Sphere operator * (Value r) const;
Sphere operator / (Value r) const;
Sphere operator % (Value r) const;
// --------------------------------------------------------------------------------------------
Sphere operator + (const Vector3 & p) const noexcept;
Sphere operator - (const Vector3 & p) const noexcept;
Sphere operator * (const Vector3 & p) const noexcept;
Sphere operator / (const Vector3 & p) const noexcept;
Sphere operator % (const Vector3 & p) const noexcept;
Sphere operator + (const Vector3 & p) const;
Sphere operator - (const Vector3 & p) const;
Sphere operator * (const Vector3 & p) const;
Sphere operator / (const Vector3 & p) const;
Sphere operator % (const Vector3 & p) const;
// --------------------------------------------------------------------------------------------
Sphere operator + () const noexcept;
Sphere operator - () const noexcept;
Sphere operator + () const;
Sphere operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Sphere & s) const noexcept;
bool operator != (const Sphere & s) const noexcept;
bool operator < (const Sphere & s) const noexcept;
bool operator > (const Sphere & s) const noexcept;
bool operator <= (const Sphere & s) const noexcept;
bool operator >= (const Sphere & s) const noexcept;
bool operator == (const Sphere & s) const;
bool operator != (const Sphere & s) const;
bool operator < (const Sphere & s) const;
bool operator > (const Sphere & s) const;
bool operator <= (const Sphere & s) const;
bool operator >= (const Sphere & s) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Sphere & s) const noexcept;
SQInteger Cmp(const Sphere & s) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value nr) noexcept;
void Set(const Sphere & ns) noexcept;
void Set(const Vector3 & np) noexcept;
void Set(const Vector3 & np, Value nr) noexcept;
void Set(Value nr);
void Set(const Sphere & ns);
void Set(const Vector3 & np);
void Set(const Vector3 & np, Value nr);
// --------------------------------------------------------------------------------------------
void Set(Value nx, Value ny, Value nz) noexcept;
void Set(Value nx, Value ny, Value nz, Value nr) noexcept;
void Set(Value nx, Value ny, Value nz);
void Set(Value nx, Value ny, Value nz, Value nr);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max, bool r) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value rmin, Value rmax) noexcept;
void Generate();
void Generate(Value min, Value max, bool r);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value rmin, Value rmax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { pos.Clear(); rad = 0.0; }
void Clear() { pos.Clear(); rad = 0.0; }
// --------------------------------------------------------------------------------------------
Sphere Abs() const noexcept;
Sphere Abs() const;
};
} // Namespace:: SqMod

View File

@@ -16,52 +16,52 @@ const Vector2f Vector2f::MAX = Vector2f(std::numeric_limits<Vector2f::Value>::ma
SQChar Vector2f::Delim = ',';
// ------------------------------------------------------------------------------------------------
Vector2f::Vector2f() noexcept
Vector2f::Vector2f()
: x(0.0), y(0.0)
{
}
Vector2f::Vector2f(Value s) noexcept
Vector2f::Vector2f(Value s)
: x(s), y(s)
{
}
Vector2f::Vector2f(Value xv, Value yv) noexcept
Vector2f::Vector2f(Value xv, Value yv)
: x(xv), y(yv)
{
}
// ------------------------------------------------------------------------------------------------
Vector2f::Vector2f(const Vector2i & v) noexcept
Vector2f::Vector2f(const Vector2i & v)
: x(static_cast<Value>(v.x)), y(static_cast<Value>(v.y))
{
}
Vector2f::Vector2f(const Vector2u & v) noexcept
Vector2f::Vector2f(const Vector2u & v)
: x(static_cast<Value>(v.x)), y(static_cast<Value>(v.y))
{
}
// ------------------------------------------------------------------------------------------------
Vector2f::Vector2f(const SQChar * values, SQChar delim) noexcept
Vector2f::Vector2f(const SQChar * values, SQChar delim)
: Vector2f(GetVector2f(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
Vector2f::Vector2f(const Vector2f & v) noexcept
Vector2f::Vector2f(const Vector2f & v)
: x(v.x), y(v.y)
{
}
Vector2f::Vector2f(Vector2f && v) noexcept
Vector2f::Vector2f(Vector2f && v)
: x(v.x), y(v.y)
{
@@ -74,14 +74,14 @@ Vector2f::~Vector2f()
}
// ------------------------------------------------------------------------------------------------
Vector2f & Vector2f::operator = (const Vector2f & v) noexcept
Vector2f & Vector2f::operator = (const Vector2f & v)
{
x = v.x;
y = v.y;
return *this;
}
Vector2f & Vector2f::operator = (Vector2f && v) noexcept
Vector2f & Vector2f::operator = (Vector2f && v)
{
x = v.x;
y = v.y;
@@ -89,27 +89,27 @@ Vector2f & Vector2f::operator = (Vector2f && v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f & Vector2f::operator = (Value s) noexcept
Vector2f & Vector2f::operator = (Value s)
{
x = s;
y = s;
return *this;
}
Vector2f & Vector2f::operator = (const SQChar * values) noexcept
Vector2f & Vector2f::operator = (const SQChar * values)
{
Set(GetVector2f(values, Delim));
return *this;
}
Vector2f & Vector2f::operator = (const Vector2i & v) noexcept
Vector2f & Vector2f::operator = (const Vector2i & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
return *this;
}
Vector2f & Vector2f::operator = (const Vector2u & v) noexcept
Vector2f & Vector2f::operator = (const Vector2u & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
@@ -117,35 +117,35 @@ Vector2f & Vector2f::operator = (const Vector2u & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f & Vector2f::operator += (const Vector2f & v) noexcept
Vector2f & Vector2f::operator += (const Vector2f & v)
{
x += v.x;
y += v.y;
return *this;
}
Vector2f & Vector2f::operator -= (const Vector2f & v) noexcept
Vector2f & Vector2f::operator -= (const Vector2f & v)
{
x -= v.x;
y -= v.y;
return *this;
}
Vector2f & Vector2f::operator *= (const Vector2f & v) noexcept
Vector2f & Vector2f::operator *= (const Vector2f & v)
{
x *= v.x;
y *= v.y;
return *this;
}
Vector2f & Vector2f::operator /= (const Vector2f & v) noexcept
Vector2f & Vector2f::operator /= (const Vector2f & v)
{
x /= v.x;
y /= v.y;
return *this;
}
Vector2f & Vector2f::operator %= (const Vector2f & v) noexcept
Vector2f & Vector2f::operator %= (const Vector2f & v)
{
x = std::fmod(x, v.x);
y = std::fmod(y, v.y);
@@ -153,35 +153,35 @@ Vector2f & Vector2f::operator %= (const Vector2f & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f & Vector2f::operator += (Value s) noexcept
Vector2f & Vector2f::operator += (Value s)
{
x += s;
y += s;
return *this;
}
Vector2f & Vector2f::operator -= (Value s) noexcept
Vector2f & Vector2f::operator -= (Value s)
{
x -= s;
y -= s;
return *this;
}
Vector2f & Vector2f::operator *= (Value s) noexcept
Vector2f & Vector2f::operator *= (Value s)
{
x *= s;
y *= s;
return *this;
}
Vector2f & Vector2f::operator /= (Value s) noexcept
Vector2f & Vector2f::operator /= (Value s)
{
x /= s;
y /= s;
return *this;
}
Vector2f & Vector2f::operator %= (Value s) noexcept
Vector2f & Vector2f::operator %= (Value s)
{
x = std::fmod(x, s);
y = std::fmod(y, s);
@@ -189,14 +189,14 @@ Vector2f & Vector2f::operator %= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f & Vector2f::operator ++ () noexcept
Vector2f & Vector2f::operator ++ ()
{
++x;
++y;
return *this;
}
Vector2f & Vector2f::operator -- () noexcept
Vector2f & Vector2f::operator -- ()
{
--x;
--y;
@@ -204,7 +204,7 @@ Vector2f & Vector2f::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f Vector2f::operator ++ (int) noexcept
Vector2f Vector2f::operator ++ (int)
{
Vector2f state(*this);
++x;
@@ -212,7 +212,7 @@ Vector2f Vector2f::operator ++ (int) noexcept
return state;
}
Vector2f Vector2f::operator -- (int) noexcept
Vector2f Vector2f::operator -- (int)
{
Vector2f state(*this);
--x;
@@ -221,157 +221,157 @@ Vector2f Vector2f::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f Vector2f::operator + (const Vector2f & v) const noexcept
Vector2f Vector2f::operator + (const Vector2f & v) const
{
return Vector2f(x + v.x, y + v.y);
}
Vector2f Vector2f::operator - (const Vector2f & v) const noexcept
Vector2f Vector2f::operator - (const Vector2f & v) const
{
return Vector2f(x - v.x, y - v.y);
}
Vector2f Vector2f::operator * (const Vector2f & v) const noexcept
Vector2f Vector2f::operator * (const Vector2f & v) const
{
return Vector2f(x * v.x, y * v.y);
}
Vector2f Vector2f::operator / (const Vector2f & v) const noexcept
Vector2f Vector2f::operator / (const Vector2f & v) const
{
return Vector2f(x / v.x, y / v.y);
}
Vector2f Vector2f::operator % (const Vector2f & v) const noexcept
Vector2f Vector2f::operator % (const Vector2f & v) const
{
return Vector2f(std::fmod(x, v.x), std::fmod(y, v.y));
}
// ------------------------------------------------------------------------------------------------
Vector2f Vector2f::operator + (Value s) const noexcept
Vector2f Vector2f::operator + (Value s) const
{
return Vector2f(x + s, y + s);
}
Vector2f Vector2f::operator - (Value s) const noexcept
Vector2f Vector2f::operator - (Value s) const
{
return Vector2f(x - s, y - s);
}
Vector2f Vector2f::operator * (Value s) const noexcept
Vector2f Vector2f::operator * (Value s) const
{
return Vector2f(x * s, y * s);
}
Vector2f Vector2f::operator / (Value s) const noexcept
Vector2f Vector2f::operator / (Value s) const
{
return Vector2f(x / s, y / s);
}
Vector2f Vector2f::operator % (Value s) const noexcept
Vector2f Vector2f::operator % (Value s) const
{
return Vector2f(std::fmod(x, s), std::fmod(y, s));
}
// ------------------------------------------------------------------------------------------------
Vector2f Vector2f::operator + () const noexcept
Vector2f Vector2f::operator + () const
{
return Vector2f(std::fabs(x), std::fabs(y));
}
Vector2f Vector2f::operator - () const noexcept
Vector2f Vector2f::operator - () const
{
return Vector2f(-x, -y);
}
// ------------------------------------------------------------------------------------------------
bool Vector2f::operator == (const Vector2f & v) const noexcept
bool Vector2f::operator == (const Vector2f & v) const
{
return EpsEq(x, v.x) && EpsEq(y, v.y);
}
bool Vector2f::operator != (const Vector2f & v) const noexcept
bool Vector2f::operator != (const Vector2f & v) const
{
return !EpsEq(x, v.x) && !EpsEq(y, v.y);
}
bool Vector2f::operator < (const Vector2f & v) const noexcept
bool Vector2f::operator < (const Vector2f & v) const
{
return std::isless(x, v.x) && std::isless(y, v.y);
}
bool Vector2f::operator > (const Vector2f & v) const noexcept
bool Vector2f::operator > (const Vector2f & v) const
{
return std::isgreater(x, v.x) && std::isgreater(y, v.y);
}
bool Vector2f::operator <= (const Vector2f & v) const noexcept
bool Vector2f::operator <= (const Vector2f & v) const
{
return std::islessequal(x, v.x) && std::islessequal(y, v.y);
}
bool Vector2f::operator >= (const Vector2f & v) const noexcept
bool Vector2f::operator >= (const Vector2f & v) const
{
return std::isgreaterequal(x, v.x) && std::isgreaterequal(y, v.y);
}
// ------------------------------------------------------------------------------------------------
SQInteger Vector2f::Cmp(const Vector2f & v) const noexcept
SQInteger Vector2f::Cmp(const Vector2f & v) const
{
return *this == v ? 0 : (*this > v ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Vector2f::ToString() const noexcept
const SQChar * Vector2f::ToString() const
{
return ToStringF("%f,%f", x, y);
}
// ------------------------------------------------------------------------------------------------
void Vector2f::Set(Value ns) noexcept
void Vector2f::Set(Value ns)
{
x = ns;
y = ns;
}
void Vector2f::Set(Value nx, Value ny) noexcept
void Vector2f::Set(Value nx, Value ny)
{
x = nx;
y = ny;
}
// ------------------------------------------------------------------------------------------------
void Vector2f::Set(const Vector2f & v) noexcept
void Vector2f::Set(const Vector2f & v)
{
x = v.x;
y = v.y;
}
void Vector2f::Set(const Vector2i & v) noexcept
void Vector2f::Set(const Vector2i & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
}
void Vector2f::Set(const Vector2u & v) noexcept
void Vector2f::Set(const Vector2u & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
}
// ------------------------------------------------------------------------------------------------
void Vector2f::Set(const SQChar * values, SQChar delim) noexcept
void Vector2f::Set(const SQChar * values, SQChar delim)
{
Set(GetVector2f(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Vector2f::Generate() noexcept
void Vector2f::Generate()
{
x = RandomVal<Value>::Get();
y = RandomVal<Value>::Get();
}
void Vector2f::Generate(Value min, Value max) noexcept
void Vector2f::Generate(Value min, Value max)
{
if (max < min)
{
@@ -384,7 +384,7 @@ void Vector2f::Generate(Value min, Value max) noexcept
}
}
void Vector2f::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
void Vector2f::Generate(Value xmin, Value xmax, Value ymin, Value ymax)
{
if (xmax < xmin || ymax < ymin)
{
@@ -398,7 +398,7 @@ void Vector2f::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2f Vector2f::Abs() const noexcept
Vector2f Vector2f::Abs() const
{
return Vector2f(std::fabs(x), std::fabs(y));
}

View File

@@ -23,88 +23,88 @@ struct Vector2f
// --------------------------------------------------------------------------------------------
Value x, y;
// --------------------------------------------------------------------------------------------
Vector2f() noexcept;
Vector2f(Value s) noexcept;
Vector2f(Value xv, Value yv) noexcept;
Vector2f();
Vector2f(Value s);
Vector2f(Value xv, Value yv);
// --------------------------------------------------------------------------------------------
Vector2f(const Vector2i & v) noexcept;
Vector2f(const Vector2u & v) noexcept;
Vector2f(const Vector2i & v);
Vector2f(const Vector2u & v);
// --------------------------------------------------------------------------------------------
Vector2f(const SQChar * values, SQChar delim) noexcept;
Vector2f(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
Vector2f(const Vector2f & v) noexcept;
Vector2f(Vector2f && v) noexcept;
Vector2f(const Vector2f & v);
Vector2f(Vector2f && v);
// --------------------------------------------------------------------------------------------
~Vector2f();
// --------------------------------------------------------------------------------------------
Vector2f & operator = (const Vector2f & v) noexcept;
Vector2f & operator = (Vector2f && v) noexcept;
Vector2f & operator = (const Vector2f & v);
Vector2f & operator = (Vector2f && v);
// --------------------------------------------------------------------------------------------
Vector2f & operator = (Value s) noexcept;
Vector2f & operator = (const SQChar * values) noexcept;
Vector2f & operator = (const Vector2i & v) noexcept;
Vector2f & operator = (const Vector2u & v) noexcept;
Vector2f & operator = (Value s);
Vector2f & operator = (const SQChar * values);
Vector2f & operator = (const Vector2i & v);
Vector2f & operator = (const Vector2u & v);
// --------------------------------------------------------------------------------------------
Vector2f & operator += (const Vector2f & v) noexcept;
Vector2f & operator -= (const Vector2f & v) noexcept;
Vector2f & operator *= (const Vector2f & v) noexcept;
Vector2f & operator /= (const Vector2f & v) noexcept;
Vector2f & operator %= (const Vector2f & v) noexcept;
Vector2f & operator += (const Vector2f & v);
Vector2f & operator -= (const Vector2f & v);
Vector2f & operator *= (const Vector2f & v);
Vector2f & operator /= (const Vector2f & v);
Vector2f & operator %= (const Vector2f & v);
// --------------------------------------------------------------------------------------------
Vector2f & operator += (Value s) noexcept;
Vector2f & operator -= (Value s) noexcept;
Vector2f & operator *= (Value s) noexcept;
Vector2f & operator /= (Value s) noexcept;
Vector2f & operator %= (Value s) noexcept;
Vector2f & operator += (Value s);
Vector2f & operator -= (Value s);
Vector2f & operator *= (Value s);
Vector2f & operator /= (Value s);
Vector2f & operator %= (Value s);
// --------------------------------------------------------------------------------------------
Vector2f & operator ++ () noexcept;
Vector2f & operator -- () noexcept;
Vector2f & operator ++ ();
Vector2f & operator -- ();
// --------------------------------------------------------------------------------------------
Vector2f operator ++ (int) noexcept;
Vector2f operator -- (int) noexcept;
Vector2f operator ++ (int);
Vector2f operator -- (int);
// --------------------------------------------------------------------------------------------
Vector2f operator + (const Vector2f & v) const noexcept;
Vector2f operator - (const Vector2f & v) const noexcept;
Vector2f operator * (const Vector2f & v) const noexcept;
Vector2f operator / (const Vector2f & v) const noexcept;
Vector2f operator % (const Vector2f & v) const noexcept;
Vector2f operator + (const Vector2f & v) const;
Vector2f operator - (const Vector2f & v) const;
Vector2f operator * (const Vector2f & v) const;
Vector2f operator / (const Vector2f & v) const;
Vector2f operator % (const Vector2f & v) const;
// --------------------------------------------------------------------------------------------
Vector2f operator + (Value s) const noexcept;
Vector2f operator - (Value s) const noexcept;
Vector2f operator * (Value s) const noexcept;
Vector2f operator / (Value s) const noexcept;
Vector2f operator % (Value s) const noexcept;
Vector2f operator + (Value s) const;
Vector2f operator - (Value s) const;
Vector2f operator * (Value s) const;
Vector2f operator / (Value s) const;
Vector2f operator % (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2f operator + () const noexcept;
Vector2f operator - () const noexcept;
Vector2f operator + () const;
Vector2f operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Vector2f & v) const noexcept;
bool operator != (const Vector2f & v) const noexcept;
bool operator < (const Vector2f & v) const noexcept;
bool operator > (const Vector2f & v) const noexcept;
bool operator <= (const Vector2f & v) const noexcept;
bool operator >= (const Vector2f & v) const noexcept;
bool operator == (const Vector2f & v) const;
bool operator != (const Vector2f & v) const;
bool operator < (const Vector2f & v) const;
bool operator > (const Vector2f & v) const;
bool operator <= (const Vector2f & v) const;
bool operator >= (const Vector2f & v) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector2f & v) const noexcept;
SQInteger Cmp(const Vector2f & v) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny);
// --------------------------------------------------------------------------------------------
void Set(const Vector2f & v) noexcept;
void Set(const Vector2i & v) noexcept;
void Set(const Vector2u & v) noexcept;
void Set(const Vector2f & v);
void Set(const Vector2i & v);
void Set(const Vector2u & v);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { x = 0.0, y = 0.0; }
void Clear() { x = 0.0, y = 0.0; }
// --------------------------------------------------------------------------------------------
Vector2f Abs() const noexcept;
Vector2f Abs() const;
};
} // Namespace:: SqMod

View File

@@ -16,52 +16,52 @@ const Vector2i Vector2i::MAX = Vector2i(std::numeric_limits<Vector2i::Value>::ma
SQChar Vector2i::Delim = ',';
// ------------------------------------------------------------------------------------------------
Vector2i::Vector2i() noexcept
Vector2i::Vector2i()
: x(0), y(0)
{
}
Vector2i::Vector2i(Value s) noexcept
Vector2i::Vector2i(Value s)
: x(s), y(s)
{
}
Vector2i::Vector2i(Value xv, Value yv) noexcept
Vector2i::Vector2i(Value xv, Value yv)
: x(xv), y(yv)
{
}
// ------------------------------------------------------------------------------------------------
Vector2i::Vector2i(const Vector2u & v) noexcept
Vector2i::Vector2i(const Vector2u & v)
: x(static_cast<Value>(v.x)), y(static_cast<Value>(v.y))
{
}
Vector2i::Vector2i(const Vector2f & v) noexcept
Vector2i::Vector2i(const Vector2f & v)
: x(static_cast<Value>(v.x)), y(static_cast<Value>(v.y))
{
}
// ------------------------------------------------------------------------------------------------
Vector2i::Vector2i(const SQChar * values, SQChar delim) noexcept
Vector2i::Vector2i(const SQChar * values, SQChar delim)
: Vector2i(GetVector2i(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
Vector2i::Vector2i(const Vector2i & v) noexcept
Vector2i::Vector2i(const Vector2i & v)
: x(v.x), y(v.y)
{
}
Vector2i::Vector2i(Vector2i && v) noexcept
Vector2i::Vector2i(Vector2i && v)
: x(v.x), y(v.y)
{
@@ -74,14 +74,14 @@ Vector2i::~Vector2i()
}
// ------------------------------------------------------------------------------------------------
Vector2i & Vector2i::operator = (const Vector2i & v) noexcept
Vector2i & Vector2i::operator = (const Vector2i & v)
{
x = v.x;
y = v.y;
return *this;
}
Vector2i & Vector2i::operator = (Vector2i && v) noexcept
Vector2i & Vector2i::operator = (Vector2i && v)
{
x = v.x;
y = v.y;
@@ -89,27 +89,27 @@ Vector2i & Vector2i::operator = (Vector2i && v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i & Vector2i::operator = (Value s) noexcept
Vector2i & Vector2i::operator = (Value s)
{
x = s;
y = s;
return *this;
}
Vector2i & Vector2i::operator = (const SQChar * values) noexcept
Vector2i & Vector2i::operator = (const SQChar * values)
{
Set(GetVector2i(values, Delim));
return *this;
}
Vector2i & Vector2i::operator = (const Vector2u & v) noexcept
Vector2i & Vector2i::operator = (const Vector2u & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
return *this;
}
Vector2i & Vector2i::operator = (const Vector2f & v) noexcept
Vector2i & Vector2i::operator = (const Vector2f & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
@@ -117,70 +117,70 @@ Vector2i & Vector2i::operator = (const Vector2f & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i & Vector2i::operator += (const Vector2i & v) noexcept
Vector2i & Vector2i::operator += (const Vector2i & v)
{
x += v.x;
y += v.y;
return *this;
}
Vector2i & Vector2i::operator -= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator -= (const Vector2i & v)
{
x -= v.x;
y -= v.y;
return *this;
}
Vector2i & Vector2i::operator *= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator *= (const Vector2i & v)
{
x *= v.x;
y *= v.y;
return *this;
}
Vector2i & Vector2i::operator /= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator /= (const Vector2i & v)
{
x /= v.x;
y /= v.y;
return *this;
}
Vector2i & Vector2i::operator %= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator %= (const Vector2i & v)
{
x %= v.x;
y %= v.y;
return *this;
}
Vector2i & Vector2i::operator &= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator &= (const Vector2i & v)
{
x &= v.x;
y &= v.y;
return *this;
}
Vector2i & Vector2i::operator |= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator |= (const Vector2i & v)
{
x |= v.x;
y |= v.y;
return *this;
}
Vector2i & Vector2i::operator ^= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator ^= (const Vector2i & v)
{
x ^= v.x;
y ^= v.y;
return *this;
}
Vector2i & Vector2i::operator <<= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator <<= (const Vector2i & v)
{
x <<= v.x;
y <<= v.y;
return *this;
}
Vector2i & Vector2i::operator >>= (const Vector2i & v) noexcept
Vector2i & Vector2i::operator >>= (const Vector2i & v)
{
x >>= v.x;
y >>= v.y;
@@ -188,70 +188,70 @@ Vector2i & Vector2i::operator >>= (const Vector2i & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i & Vector2i::operator += (Value s) noexcept
Vector2i & Vector2i::operator += (Value s)
{
x += s;
y += s;
return *this;
}
Vector2i & Vector2i::operator -= (Value s) noexcept
Vector2i & Vector2i::operator -= (Value s)
{
x -= s;
y -= s;
return *this;
}
Vector2i & Vector2i::operator *= (Value s) noexcept
Vector2i & Vector2i::operator *= (Value s)
{
x *= s;
y *= s;
return *this;
}
Vector2i & Vector2i::operator /= (Value s) noexcept
Vector2i & Vector2i::operator /= (Value s)
{
x /= s;
y /= s;
return *this;
}
Vector2i & Vector2i::operator %= (Value s) noexcept
Vector2i & Vector2i::operator %= (Value s)
{
x %= s;
y %= s;
return *this;
}
Vector2i & Vector2i::operator &= (Value s) noexcept
Vector2i & Vector2i::operator &= (Value s)
{
x &= s;
y &= s;
return *this;
}
Vector2i & Vector2i::operator |= (Value s) noexcept
Vector2i & Vector2i::operator |= (Value s)
{
x |= s;
y |= s;
return *this;
}
Vector2i & Vector2i::operator ^= (Value s) noexcept
Vector2i & Vector2i::operator ^= (Value s)
{
x += s;
y += s;
return *this;
}
Vector2i & Vector2i::operator <<= (Value s) noexcept
Vector2i & Vector2i::operator <<= (Value s)
{
x <<= s;
y <<= s;
return *this;
}
Vector2i & Vector2i::operator >>= (Value s) noexcept
Vector2i & Vector2i::operator >>= (Value s)
{
x >>= s;
y >>= s;
@@ -259,14 +259,14 @@ Vector2i & Vector2i::operator >>= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i & Vector2i::operator ++ () noexcept
Vector2i & Vector2i::operator ++ ()
{
++x;
++y;
return *this;
}
Vector2i & Vector2i::operator -- () noexcept
Vector2i & Vector2i::operator -- ()
{
--x;
--y;
@@ -274,7 +274,7 @@ Vector2i & Vector2i::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i Vector2i::operator ++ (int) noexcept
Vector2i Vector2i::operator ++ (int)
{
Vector2i state(*this);
++x;
@@ -282,7 +282,7 @@ Vector2i Vector2i::operator ++ (int) noexcept
return state;
}
Vector2i Vector2i::operator -- (int) noexcept
Vector2i Vector2i::operator -- (int)
{
Vector2i state(*this);
--x;
@@ -291,213 +291,213 @@ Vector2i Vector2i::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i Vector2i::operator + (const Vector2i & v) const noexcept
Vector2i Vector2i::operator + (const Vector2i & v) const
{
return Vector2i(x + v.x, y + v.y);
}
Vector2i Vector2i::operator - (const Vector2i & v) const noexcept
Vector2i Vector2i::operator - (const Vector2i & v) const
{
return Vector2i(x - v.x, y - v.y);
}
Vector2i Vector2i::operator * (const Vector2i & v) const noexcept
Vector2i Vector2i::operator * (const Vector2i & v) const
{
return Vector2i(x * v.x, y * v.y);
}
Vector2i Vector2i::operator / (const Vector2i & v) const noexcept
Vector2i Vector2i::operator / (const Vector2i & v) const
{
return Vector2i(x / v.x, y / v.y);
}
Vector2i Vector2i::operator % (const Vector2i & v) const noexcept
Vector2i Vector2i::operator % (const Vector2i & v) const
{
return Vector2i(x % v.x, y % v.y);
}
Vector2i Vector2i::operator & (const Vector2i & v) const noexcept
Vector2i Vector2i::operator & (const Vector2i & v) const
{
return Vector2i(x & v.x, y & v.y);
}
Vector2i Vector2i::operator | (const Vector2i & v) const noexcept
Vector2i Vector2i::operator | (const Vector2i & v) const
{
return Vector2i(x | v.x, y | v.y);
}
Vector2i Vector2i::operator ^ (const Vector2i & v) const noexcept
Vector2i Vector2i::operator ^ (const Vector2i & v) const
{
return Vector2i(x ^ v.x, y ^ v.y);
}
Vector2i Vector2i::operator << (const Vector2i & v) const noexcept
Vector2i Vector2i::operator << (const Vector2i & v) const
{
return Vector2i(x << v.x, y << v.y);
}
Vector2i Vector2i::operator >> (const Vector2i & v) const noexcept
Vector2i Vector2i::operator >> (const Vector2i & v) const
{
return Vector2i(x >> v.x, y >> v.y);
}
// ------------------------------------------------------------------------------------------------
Vector2i Vector2i::operator + (Value s) const noexcept
Vector2i Vector2i::operator + (Value s) const
{
return Vector2i(x + s, y + s);
}
Vector2i Vector2i::operator - (Value s) const noexcept
Vector2i Vector2i::operator - (Value s) const
{
return Vector2i(x - s, y - s);
}
Vector2i Vector2i::operator * (Value s) const noexcept
Vector2i Vector2i::operator * (Value s) const
{
return Vector2i(x * s, y * s);
}
Vector2i Vector2i::operator / (Value s) const noexcept
Vector2i Vector2i::operator / (Value s) const
{
return Vector2i(x / s, y / s);
}
Vector2i Vector2i::operator % (Value s) const noexcept
Vector2i Vector2i::operator % (Value s) const
{
return Vector2i(x % s, y % s);
}
Vector2i Vector2i::operator & (Value s) const noexcept
Vector2i Vector2i::operator & (Value s) const
{
return Vector2i(x & s, y & s);
}
Vector2i Vector2i::operator | (Value s) const noexcept
Vector2i Vector2i::operator | (Value s) const
{
return Vector2i(x | s, y | s);
}
Vector2i Vector2i::operator ^ (Value s) const noexcept
Vector2i Vector2i::operator ^ (Value s) const
{
return Vector2i(x ^ s, y ^ s);
}
Vector2i Vector2i::operator << (Value s) const noexcept
Vector2i Vector2i::operator << (Value s) const
{
return Vector2i(x < s, y < s);
}
Vector2i Vector2i::operator >> (Value s) const noexcept
Vector2i Vector2i::operator >> (Value s) const
{
return Vector2i(x >> s, y >> s);
}
// ------------------------------------------------------------------------------------------------
Vector2i Vector2i::operator + () const noexcept
Vector2i Vector2i::operator + () const
{
return Vector2i(std::abs(x), std::abs(y));
}
Vector2i Vector2i::operator - () const noexcept
Vector2i Vector2i::operator - () const
{
return Vector2i(-x, -y);
}
// ------------------------------------------------------------------------------------------------
Vector2i Vector2i::operator ~ () const noexcept
Vector2i Vector2i::operator ~ () const
{
return Vector2i(~x, ~y);
}
// ------------------------------------------------------------------------------------------------
bool Vector2i::operator == (const Vector2i & v) const noexcept
bool Vector2i::operator == (const Vector2i & v) const
{
return (x == v.x) && (y == v.y);
}
bool Vector2i::operator != (const Vector2i & v) const noexcept
bool Vector2i::operator != (const Vector2i & v) const
{
return (x != v.x) && (y != v.y);
}
bool Vector2i::operator < (const Vector2i & v) const noexcept
bool Vector2i::operator < (const Vector2i & v) const
{
return (x < v.x) && (y < v.y);
}
bool Vector2i::operator > (const Vector2i & v) const noexcept
bool Vector2i::operator > (const Vector2i & v) const
{
return (x > v.x) && (y > v.y);
}
bool Vector2i::operator <= (const Vector2i & v) const noexcept
bool Vector2i::operator <= (const Vector2i & v) const
{
return (x <= v.x) && (y <= v.y);
}
bool Vector2i::operator >= (const Vector2i & v) const noexcept
bool Vector2i::operator >= (const Vector2i & v) const
{
return (x >= v.x) && (y >= v.y);
}
// ------------------------------------------------------------------------------------------------
SQInteger Vector2i::Cmp(const Vector2i & v) const noexcept
SQInteger Vector2i::Cmp(const Vector2i & v) const
{
return *this == v ? 0 : (*this > v ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Vector2i::ToString() const noexcept
const SQChar * Vector2i::ToString() const
{
return ToStringF("%d,%d", x, y);
}
// ------------------------------------------------------------------------------------------------
void Vector2i::Set(Value ns) noexcept
void Vector2i::Set(Value ns)
{
x = ns;
y = ns;
}
void Vector2i::Set(Value nx, Value ny) noexcept
void Vector2i::Set(Value nx, Value ny)
{
x = nx;
y = ny;
}
// ------------------------------------------------------------------------------------------------
void Vector2i::Set(const Vector2i & v) noexcept
void Vector2i::Set(const Vector2i & v)
{
x = v.x;
y = v.y;
}
void Vector2i::Set(const Vector2u & v) noexcept
void Vector2i::Set(const Vector2u & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
}
void Vector2i::Set(const Vector2f & v) noexcept
void Vector2i::Set(const Vector2f & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
}
// ------------------------------------------------------------------------------------------------
void Vector2i::Set(const SQChar * values, SQChar delim) noexcept
void Vector2i::Set(const SQChar * values, SQChar delim)
{
Set(GetVector2i(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Vector2i::Generate() noexcept
void Vector2i::Generate()
{
x = RandomVal<Value>::Get();
y = RandomVal<Value>::Get();
}
void Vector2i::Generate(Value min, Value max) noexcept
void Vector2i::Generate(Value min, Value max)
{
if (max < min)
{
@@ -510,7 +510,7 @@ void Vector2i::Generate(Value min, Value max) noexcept
}
}
void Vector2i::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
void Vector2i::Generate(Value xmin, Value xmax, Value ymin, Value ymax)
{
if (xmax < xmin || ymax < ymin)
{
@@ -524,7 +524,7 @@ void Vector2i::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2i Vector2i::Abs() const noexcept
Vector2i Vector2i::Abs() const
{
return Vector2i(std::abs(x), std::abs(y));
}

View File

@@ -23,110 +23,110 @@ struct Vector2i
// --------------------------------------------------------------------------------------------
Value x, y;
// --------------------------------------------------------------------------------------------
Vector2i() noexcept;
Vector2i(Value s) noexcept;
Vector2i(Value xv, Value yv) noexcept;
Vector2i();
Vector2i(Value s);
Vector2i(Value xv, Value yv);
// --------------------------------------------------------------------------------------------
Vector2i(const Vector2u & v) noexcept;
Vector2i(const Vector2f & v) noexcept;
Vector2i(const Vector2u & v);
Vector2i(const Vector2f & v);
// --------------------------------------------------------------------------------------------
Vector2i(const SQChar * values, SQChar delim) noexcept;
Vector2i(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
Vector2i(const Vector2i & v) noexcept;
Vector2i(Vector2i && v) noexcept;
Vector2i(const Vector2i & v);
Vector2i(Vector2i && v);
// --------------------------------------------------------------------------------------------
~Vector2i();
// --------------------------------------------------------------------------------------------
Vector2i & operator = (const Vector2i & v) noexcept;
Vector2i & operator = (Vector2i && v) noexcept;
Vector2i & operator = (const Vector2i & v);
Vector2i & operator = (Vector2i && v);
// --------------------------------------------------------------------------------------------
Vector2i & operator = (Value s) noexcept;
Vector2i & operator = (const SQChar * values) noexcept;
Vector2i & operator = (const Vector2u & v) noexcept;
Vector2i & operator = (const Vector2f & v) noexcept;
Vector2i & operator = (Value s);
Vector2i & operator = (const SQChar * values);
Vector2i & operator = (const Vector2u & v);
Vector2i & operator = (const Vector2f & v);
// --------------------------------------------------------------------------------------------
Vector2i & operator += (const Vector2i & v) noexcept;
Vector2i & operator -= (const Vector2i & v) noexcept;
Vector2i & operator *= (const Vector2i & v) noexcept;
Vector2i & operator /= (const Vector2i & v) noexcept;
Vector2i & operator %= (const Vector2i & v) noexcept;
Vector2i & operator &= (const Vector2i & v) noexcept;
Vector2i & operator |= (const Vector2i & v) noexcept;
Vector2i & operator ^= (const Vector2i & v) noexcept;
Vector2i & operator <<= (const Vector2i & v) noexcept;
Vector2i & operator >>= (const Vector2i & v) noexcept;
Vector2i & operator += (const Vector2i & v);
Vector2i & operator -= (const Vector2i & v);
Vector2i & operator *= (const Vector2i & v);
Vector2i & operator /= (const Vector2i & v);
Vector2i & operator %= (const Vector2i & v);
Vector2i & operator &= (const Vector2i & v);
Vector2i & operator |= (const Vector2i & v);
Vector2i & operator ^= (const Vector2i & v);
Vector2i & operator <<= (const Vector2i & v);
Vector2i & operator >>= (const Vector2i & v);
// --------------------------------------------------------------------------------------------
Vector2i & operator += (Value s) noexcept;
Vector2i & operator -= (Value s) noexcept;
Vector2i & operator *= (Value s) noexcept;
Vector2i & operator /= (Value s) noexcept;
Vector2i & operator %= (Value s) noexcept;
Vector2i & operator &= (Value s) noexcept;
Vector2i & operator |= (Value s) noexcept;
Vector2i & operator ^= (Value s) noexcept;
Vector2i & operator <<= (Value s) noexcept;
Vector2i & operator >>= (Value s) noexcept;
Vector2i & operator += (Value s);
Vector2i & operator -= (Value s);
Vector2i & operator *= (Value s);
Vector2i & operator /= (Value s);
Vector2i & operator %= (Value s);
Vector2i & operator &= (Value s);
Vector2i & operator |= (Value s);
Vector2i & operator ^= (Value s);
Vector2i & operator <<= (Value s);
Vector2i & operator >>= (Value s);
// --------------------------------------------------------------------------------------------
Vector2i & operator ++ () noexcept;
Vector2i & operator -- () noexcept;
Vector2i & operator ++ ();
Vector2i & operator -- ();
// --------------------------------------------------------------------------------------------
Vector2i operator ++ (int) noexcept;
Vector2i operator -- (int) noexcept;
Vector2i operator ++ (int);
Vector2i operator -- (int);
// --------------------------------------------------------------------------------------------
Vector2i operator + (const Vector2i & v) const noexcept;
Vector2i operator - (const Vector2i & v) const noexcept;
Vector2i operator * (const Vector2i & v) const noexcept;
Vector2i operator / (const Vector2i & v) const noexcept;
Vector2i operator % (const Vector2i & v) const noexcept;
Vector2i operator & (const Vector2i & v) const noexcept;
Vector2i operator | (const Vector2i & v) const noexcept;
Vector2i operator ^ (const Vector2i & v) const noexcept;
Vector2i operator << (const Vector2i & v) const noexcept;
Vector2i operator >> (const Vector2i & v) const noexcept;
Vector2i operator + (const Vector2i & v) const;
Vector2i operator - (const Vector2i & v) const;
Vector2i operator * (const Vector2i & v) const;
Vector2i operator / (const Vector2i & v) const;
Vector2i operator % (const Vector2i & v) const;
Vector2i operator & (const Vector2i & v) const;
Vector2i operator | (const Vector2i & v) const;
Vector2i operator ^ (const Vector2i & v) const;
Vector2i operator << (const Vector2i & v) const;
Vector2i operator >> (const Vector2i & v) const;
// --------------------------------------------------------------------------------------------
Vector2i operator + (Value s) const noexcept;
Vector2i operator - (Value s) const noexcept;
Vector2i operator * (Value s) const noexcept;
Vector2i operator / (Value s) const noexcept;
Vector2i operator % (Value s) const noexcept;
Vector2i operator & (Value s) const noexcept;
Vector2i operator | (Value s) const noexcept;
Vector2i operator ^ (Value s) const noexcept;
Vector2i operator << (Value s) const noexcept;
Vector2i operator >> (Value s) const noexcept;
Vector2i operator + (Value s) const;
Vector2i operator - (Value s) const;
Vector2i operator * (Value s) const;
Vector2i operator / (Value s) const;
Vector2i operator % (Value s) const;
Vector2i operator & (Value s) const;
Vector2i operator | (Value s) const;
Vector2i operator ^ (Value s) const;
Vector2i operator << (Value s) const;
Vector2i operator >> (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2i operator + () const noexcept;
Vector2i operator - () const noexcept;
Vector2i operator + () const;
Vector2i operator - () const;
// --------------------------------------------------------------------------------------------
Vector2i operator ~ () const noexcept;
Vector2i operator ~ () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Vector2i & v) const noexcept;
bool operator != (const Vector2i & v) const noexcept;
bool operator < (const Vector2i & v) const noexcept;
bool operator > (const Vector2i & v) const noexcept;
bool operator <= (const Vector2i & v) const noexcept;
bool operator >= (const Vector2i & v) const noexcept;
bool operator == (const Vector2i & v) const;
bool operator != (const Vector2i & v) const;
bool operator < (const Vector2i & v) const;
bool operator > (const Vector2i & v) const;
bool operator <= (const Vector2i & v) const;
bool operator >= (const Vector2i & v) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector2i & v) const noexcept;
SQInteger Cmp(const Vector2i & v) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny);
// --------------------------------------------------------------------------------------------
void Set(const Vector2i & v) noexcept;
void Set(const Vector2u & v) noexcept;
void Set(const Vector2f & v) noexcept;
void Set(const Vector2i & v);
void Set(const Vector2u & v);
void Set(const Vector2f & v);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { x = 0, y = 0; }
void Clear() { x = 0, y = 0; }
// --------------------------------------------------------------------------------------------
Vector2i Abs() const noexcept;
Vector2i Abs() const;
};
} // Namespace:: SqMod

View File

@@ -16,52 +16,52 @@ const Vector2u Vector2u::MAX = Vector2u(std::numeric_limits<Vector2u::Value>::ma
SQChar Vector2u::Delim = ',';
// ------------------------------------------------------------------------------------------------
Vector2u::Vector2u() noexcept
Vector2u::Vector2u()
: x(0), y(0)
{
}
Vector2u::Vector2u(Value s) noexcept
Vector2u::Vector2u(Value s)
: x(s), y(s)
{
}
Vector2u::Vector2u(Value xv, Value yv) noexcept
Vector2u::Vector2u(Value xv, Value yv)
: x(xv), y(yv)
{
}
// ------------------------------------------------------------------------------------------------
Vector2u::Vector2u(const Vector2i & v) noexcept
Vector2u::Vector2u(const Vector2i & v)
: x(static_cast<Value>(v.x)), y(static_cast<Value>(v.y))
{
}
Vector2u::Vector2u(const Vector2f & v) noexcept
Vector2u::Vector2u(const Vector2f & v)
: x(static_cast<Value>(v.x)), y(static_cast<Value>(v.y))
{
}
// ------------------------------------------------------------------------------------------------
Vector2u::Vector2u(const SQChar * values, SQChar delim) noexcept
Vector2u::Vector2u(const SQChar * values, SQChar delim)
: Vector2u(GetVector2u(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
Vector2u::Vector2u(const Vector2u & v) noexcept
Vector2u::Vector2u(const Vector2u & v)
: x(v.x), y(v.y)
{
}
Vector2u::Vector2u(Vector2u && v) noexcept
Vector2u::Vector2u(Vector2u && v)
: x(v.x), y(v.y)
{
@@ -74,14 +74,14 @@ Vector2u::~Vector2u()
}
// ------------------------------------------------------------------------------------------------
Vector2u & Vector2u::operator = (const Vector2u & v) noexcept
Vector2u & Vector2u::operator = (const Vector2u & v)
{
x = v.x;
y = v.y;
return *this;
}
Vector2u & Vector2u::operator = (Vector2u && v) noexcept
Vector2u & Vector2u::operator = (Vector2u && v)
{
x = v.x;
y = v.y;
@@ -89,27 +89,27 @@ Vector2u & Vector2u::operator = (Vector2u && v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u & Vector2u::operator = (Value s) noexcept
Vector2u & Vector2u::operator = (Value s)
{
x = s;
y = s;
return *this;
}
Vector2u & Vector2u::operator = (const SQChar * values) noexcept
Vector2u & Vector2u::operator = (const SQChar * values)
{
Set(GetVector2i(values, Delim));
return *this;
}
Vector2u & Vector2u::operator = (const Vector2i & v) noexcept
Vector2u & Vector2u::operator = (const Vector2i & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
return *this;
}
Vector2u & Vector2u::operator = (const Vector2f & v) noexcept
Vector2u & Vector2u::operator = (const Vector2f & v)
{
x = static_cast<Value>(v.x);
y = static_cast<Value>(v.y);
@@ -117,70 +117,70 @@ Vector2u & Vector2u::operator = (const Vector2f & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u & Vector2u::operator += (const Vector2u & v) noexcept
Vector2u & Vector2u::operator += (const Vector2u & v)
{
x += v.x;
y += v.y;
return *this;
}
Vector2u & Vector2u::operator -= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator -= (const Vector2u & v)
{
x -= v.x;
y -= v.y;
return *this;
}
Vector2u & Vector2u::operator *= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator *= (const Vector2u & v)
{
x *= v.x;
y *= v.y;
return *this;
}
Vector2u & Vector2u::operator /= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator /= (const Vector2u & v)
{
x /= v.x;
y /= v.y;
return *this;
}
Vector2u & Vector2u::operator %= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator %= (const Vector2u & v)
{
x %= v.x;
y %= v.y;
return *this;
}
Vector2u & Vector2u::operator &= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator &= (const Vector2u & v)
{
x &= v.x;
y &= v.y;
return *this;
}
Vector2u & Vector2u::operator |= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator |= (const Vector2u & v)
{
x |= v.x;
y |= v.y;
return *this;
}
Vector2u & Vector2u::operator ^= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator ^= (const Vector2u & v)
{
x ^= v.x;
y ^= v.y;
return *this;
}
Vector2u & Vector2u::operator <<= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator <<= (const Vector2u & v)
{
x <<= v.x;
y <<= v.y;
return *this;
}
Vector2u & Vector2u::operator >>= (const Vector2u & v) noexcept
Vector2u & Vector2u::operator >>= (const Vector2u & v)
{
x >>= v.x;
y >>= v.y;
@@ -188,70 +188,70 @@ Vector2u & Vector2u::operator >>= (const Vector2u & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u & Vector2u::operator += (Value s) noexcept
Vector2u & Vector2u::operator += (Value s)
{
x += s;
y += s;
return *this;
}
Vector2u & Vector2u::operator -= (Value s) noexcept
Vector2u & Vector2u::operator -= (Value s)
{
x -= s;
y -= s;
return *this;
}
Vector2u & Vector2u::operator *= (Value s) noexcept
Vector2u & Vector2u::operator *= (Value s)
{
x *= s;
y *= s;
return *this;
}
Vector2u & Vector2u::operator /= (Value s) noexcept
Vector2u & Vector2u::operator /= (Value s)
{
x /= s;
y /= s;
return *this;
}
Vector2u & Vector2u::operator %= (Value s) noexcept
Vector2u & Vector2u::operator %= (Value s)
{
x %= s;
y %= s;
return *this;
}
Vector2u & Vector2u::operator &= (Value s) noexcept
Vector2u & Vector2u::operator &= (Value s)
{
x &= s;
y &= s;
return *this;
}
Vector2u & Vector2u::operator |= (Value s) noexcept
Vector2u & Vector2u::operator |= (Value s)
{
x |= s;
y |= s;
return *this;
}
Vector2u & Vector2u::operator ^= (Value s) noexcept
Vector2u & Vector2u::operator ^= (Value s)
{
x ^= s;
y ^= s;
return *this;
}
Vector2u & Vector2u::operator <<= (Value s) noexcept
Vector2u & Vector2u::operator <<= (Value s)
{
x <<= s;
y <<= s;
return *this;
}
Vector2u & Vector2u::operator >>= (Value s) noexcept
Vector2u & Vector2u::operator >>= (Value s)
{
x >>= s;
y >>= s;
@@ -259,14 +259,14 @@ Vector2u & Vector2u::operator >>= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u & Vector2u::operator ++ () noexcept
Vector2u & Vector2u::operator ++ ()
{
++x;
++y;
return *this;
}
Vector2u & Vector2u::operator -- () noexcept
Vector2u & Vector2u::operator -- ()
{
--x;
--y;
@@ -274,7 +274,7 @@ Vector2u & Vector2u::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u Vector2u::operator ++ (int) noexcept
Vector2u Vector2u::operator ++ (int)
{
Vector2i state(*this);
++x;
@@ -282,7 +282,7 @@ Vector2u Vector2u::operator ++ (int) noexcept
return state;
}
Vector2u Vector2u::operator -- (int) noexcept
Vector2u Vector2u::operator -- (int)
{
Vector2i state(*this);
--x;
@@ -291,213 +291,213 @@ Vector2u Vector2u::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u Vector2u::operator + (const Vector2u & v) const noexcept
Vector2u Vector2u::operator + (const Vector2u & v) const
{
return Vector2i(x + v.x, y + v.y);
}
Vector2u Vector2u::operator - (const Vector2u & v) const noexcept
Vector2u Vector2u::operator - (const Vector2u & v) const
{
return Vector2i(x - v.x, y - v.y);
}
Vector2u Vector2u::operator * (const Vector2u & v) const noexcept
Vector2u Vector2u::operator * (const Vector2u & v) const
{
return Vector2i(x * v.x, y * v.y);
}
Vector2u Vector2u::operator / (const Vector2u & v) const noexcept
Vector2u Vector2u::operator / (const Vector2u & v) const
{
return Vector2i(x / v.x, y / v.y);
}
Vector2u Vector2u::operator % (const Vector2u & v) const noexcept
Vector2u Vector2u::operator % (const Vector2u & v) const
{
return Vector2i(x % v.x, y % v.y);
}
Vector2u Vector2u::operator & (const Vector2u & v) const noexcept
Vector2u Vector2u::operator & (const Vector2u & v) const
{
return Vector2i(x & v.x, y & v.y);
}
Vector2u Vector2u::operator | (const Vector2u & v) const noexcept
Vector2u Vector2u::operator | (const Vector2u & v) const
{
return Vector2i(x | v.x, y | v.y);
}
Vector2u Vector2u::operator ^ (const Vector2u & v) const noexcept
Vector2u Vector2u::operator ^ (const Vector2u & v) const
{
return Vector2i(x ^ v.x, y ^ v.y);
}
Vector2u Vector2u::operator << (const Vector2u & v) const noexcept
Vector2u Vector2u::operator << (const Vector2u & v) const
{
return Vector2i(x << v.x, y << v.y);
}
Vector2u Vector2u::operator >> (const Vector2u & v) const noexcept
Vector2u Vector2u::operator >> (const Vector2u & v) const
{
return Vector2i(x >> v.x, y >> v.y);
}
// ------------------------------------------------------------------------------------------------
Vector2u Vector2u::operator + (Value s) const noexcept
Vector2u Vector2u::operator + (Value s) const
{
return Vector2i(x + s, y + s);
}
Vector2u Vector2u::operator - (Value s) const noexcept
Vector2u Vector2u::operator - (Value s) const
{
return Vector2i(x - s, y - s);
}
Vector2u Vector2u::operator * (Value s) const noexcept
Vector2u Vector2u::operator * (Value s) const
{
return Vector2i(x - s, y - s);
}
Vector2u Vector2u::operator / (Value s) const noexcept
Vector2u Vector2u::operator / (Value s) const
{
return Vector2i(x / s, y / s);
}
Vector2u Vector2u::operator % (Value s) const noexcept
Vector2u Vector2u::operator % (Value s) const
{
return Vector2i(x % s, y % s);
}
Vector2u Vector2u::operator & (Value s) const noexcept
Vector2u Vector2u::operator & (Value s) const
{
return Vector2i(x & s, y & s);
}
Vector2u Vector2u::operator | (Value s) const noexcept
Vector2u Vector2u::operator | (Value s) const
{
return Vector2i(x | s, y | s);
}
Vector2u Vector2u::operator ^ (Value s) const noexcept
Vector2u Vector2u::operator ^ (Value s) const
{
return Vector2i(x ^ s, y ^ s);
}
Vector2u Vector2u::operator << (Value s) const noexcept
Vector2u Vector2u::operator << (Value s) const
{
return Vector2i(x << s, y << s);
}
Vector2u Vector2u::operator >> (Value s) const noexcept
Vector2u Vector2u::operator >> (Value s) const
{
return Vector2i(x >> s, y >> s);
}
// ------------------------------------------------------------------------------------------------
Vector2u Vector2u::operator + () const noexcept
Vector2u Vector2u::operator + () const
{
return Vector2i(x, y);
}
Vector2u Vector2u::operator - () const noexcept
Vector2u Vector2u::operator - () const
{
return Vector2i(0, 0);
}
// ------------------------------------------------------------------------------------------------
Vector2u Vector2u::operator ~ () const noexcept
Vector2u Vector2u::operator ~ () const
{
return Vector2i(~x, ~y);
}
// ------------------------------------------------------------------------------------------------
bool Vector2u::operator == (const Vector2u & v) const noexcept
bool Vector2u::operator == (const Vector2u & v) const
{
return (x == v.x) && (y == v.y);
}
bool Vector2u::operator != (const Vector2u & v) const noexcept
bool Vector2u::operator != (const Vector2u & v) const
{
return (x != v.x) && (y != v.y);
}
bool Vector2u::operator < (const Vector2u & v) const noexcept
bool Vector2u::operator < (const Vector2u & v) const
{
return (x < v.x) && (y < v.y);
}
bool Vector2u::operator > (const Vector2u & v) const noexcept
bool Vector2u::operator > (const Vector2u & v) const
{
return (x > v.x) && (y > v.y);
}
bool Vector2u::operator <= (const Vector2u & v) const noexcept
bool Vector2u::operator <= (const Vector2u & v) const
{
return (x <= v.x) && (y <= v.y);
}
bool Vector2u::operator >= (const Vector2u & v) const noexcept
bool Vector2u::operator >= (const Vector2u & v) const
{
return (x >= v.x) && (y >= v.y);
}
// ------------------------------------------------------------------------------------------------
SQInteger Vector2u::Cmp(const Vector2u & v) const noexcept
SQInteger Vector2u::Cmp(const Vector2u & v) const
{
return *this == v ? 0 : (*this > v ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Vector2u::ToString() const noexcept
const SQChar * Vector2u::ToString() const
{
return ToStringF("%u,%u", x, y);
}
// ------------------------------------------------------------------------------------------------
void Vector2u::Set(Value ns) noexcept
void Vector2u::Set(Value ns)
{
x = ns;
y = ns;
}
void Vector2u::Set(Value nx, Value ny) noexcept
void Vector2u::Set(Value nx, Value ny)
{
x = nx;
y = ny;
}
// ------------------------------------------------------------------------------------------------
void Vector2u::Set(const Vector2u & v) noexcept
void Vector2u::Set(const Vector2u & v)
{
x = v.x;
y = v.y;
}
void Vector2u::Set(const Vector2i & v) noexcept
void Vector2u::Set(const Vector2i & v)
{
x = static_cast<SQInt32>(v.x);
y = static_cast<SQInt32>(v.y);
}
void Vector2u::Set(const Vector2f & v) noexcept
void Vector2u::Set(const Vector2f & v)
{
x = static_cast<SQInt32>(v.x);
y = static_cast<SQInt32>(v.y);
}
// ------------------------------------------------------------------------------------------------
void Vector2u::Set(const SQChar * values, SQChar delim) noexcept
void Vector2u::Set(const SQChar * values, SQChar delim)
{
Set(GetVector2i(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Vector2u::Generate() noexcept
void Vector2u::Generate()
{
x = RandomVal<Value>::Get();
y = RandomVal<Value>::Get();
}
void Vector2u::Generate(Value min, Value max) noexcept
void Vector2u::Generate(Value min, Value max)
{
if (max < min)
{
@@ -510,7 +510,7 @@ void Vector2u::Generate(Value min, Value max) noexcept
}
}
void Vector2u::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
void Vector2u::Generate(Value xmin, Value xmax, Value ymin, Value ymax)
{
if (xmax < xmin || ymax < ymin)
{
@@ -524,7 +524,7 @@ void Vector2u::Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector2u Vector2u::Abs() const noexcept
Vector2u Vector2u::Abs() const
{
return Vector2i(x, y);
}

View File

@@ -23,118 +23,118 @@ struct Vector2u
// --------------------------------------------------------------------------------------------
Value x, y;
// --------------------------------------------------------------------------------------------
Vector2u() noexcept;
Vector2u(Value s) noexcept;
Vector2u(Value xv, Value yv) noexcept;
Vector2u();
Vector2u(Value s);
Vector2u(Value xv, Value yv);
// --------------------------------------------------------------------------------------------
Vector2u(const Vector2i & v) noexcept;
Vector2u(const Vector2f & v) noexcept;
Vector2u(const Vector2i & v);
Vector2u(const Vector2f & v);
// --------------------------------------------------------------------------------------------
Vector2u(const SQChar * values, SQChar delim) noexcept;
Vector2u(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
Vector2u(const Vector2u & v) noexcept;
Vector2u(Vector2u && v) noexcept;
Vector2u(const Vector2u & v);
Vector2u(Vector2u && v);
// --------------------------------------------------------------------------------------------
~Vector2u();
// --------------------------------------------------------------------------------------------
Vector2u & operator = (const Vector2u & v) noexcept;
Vector2u & operator = (Vector2u && v) noexcept;
Vector2u & operator = (const Vector2u & v);
Vector2u & operator = (Vector2u && v);
// --------------------------------------------------------------------------------------------
Vector2u & operator = (Value s) noexcept;
Vector2u & operator = (const SQChar * values) noexcept;
Vector2u & operator = (const Vector2i & v) noexcept;
Vector2u & operator = (const Vector2f & v) noexcept;
Vector2u & operator = (Value s);
Vector2u & operator = (const SQChar * values);
Vector2u & operator = (const Vector2i & v);
Vector2u & operator = (const Vector2f & v);
// --------------------------------------------------------------------------------------------
Vector2u & operator += (const Vector2u & v) noexcept;
Vector2u & operator -= (const Vector2u & v) noexcept;
Vector2u & operator *= (const Vector2u & v) noexcept;
Vector2u & operator /= (const Vector2u & v) noexcept;
Vector2u & operator %= (const Vector2u & v) noexcept;
Vector2u & operator &= (const Vector2u & v) noexcept;
Vector2u & operator |= (const Vector2u & v) noexcept;
Vector2u & operator ^= (const Vector2u & v) noexcept;
Vector2u & operator <<= (const Vector2u & v) noexcept;
Vector2u & operator >>= (const Vector2u & v) noexcept;
Vector2u & operator += (const Vector2u & v);
Vector2u & operator -= (const Vector2u & v);
Vector2u & operator *= (const Vector2u & v);
Vector2u & operator /= (const Vector2u & v);
Vector2u & operator %= (const Vector2u & v);
Vector2u & operator &= (const Vector2u & v);
Vector2u & operator |= (const Vector2u & v);
Vector2u & operator ^= (const Vector2u & v);
Vector2u & operator <<= (const Vector2u & v);
Vector2u & operator >>= (const Vector2u & v);
// --------------------------------------------------------------------------------------------
Vector2u & operator += (Value s) noexcept;
Vector2u & operator -= (Value s) noexcept;
Vector2u & operator *= (Value s) noexcept;
Vector2u & operator /= (Value s) noexcept;
Vector2u & operator %= (Value s) noexcept;
Vector2u & operator &= (Value s) noexcept;
Vector2u & operator |= (Value s) noexcept;
Vector2u & operator ^= (Value s) noexcept;
Vector2u & operator <<= (Value s) noexcept;
Vector2u & operator >>= (Value s) noexcept;
Vector2u & operator += (Value s);
Vector2u & operator -= (Value s);
Vector2u & operator *= (Value s);
Vector2u & operator /= (Value s);
Vector2u & operator %= (Value s);
Vector2u & operator &= (Value s);
Vector2u & operator |= (Value s);
Vector2u & operator ^= (Value s);
Vector2u & operator <<= (Value s);
Vector2u & operator >>= (Value s);
// --------------------------------------------------------------------------------------------
Vector2u & operator ++ () noexcept;
Vector2u & operator -- () noexcept;
Vector2u & operator ++ ();
Vector2u & operator -- ();
// --------------------------------------------------------------------------------------------
Vector2u operator ++ (int) noexcept;
Vector2u operator -- (int) noexcept;
Vector2u operator ++ (int);
Vector2u operator -- (int);
// --------------------------------------------------------------------------------------------
Vector2u operator + (const Vector2u & v) const noexcept;
Vector2u operator + (Value s) const noexcept;
Vector2u operator + (const Vector2u & v) const;
Vector2u operator + (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator - (const Vector2u & v) const noexcept;
Vector2u operator - (Value s) const noexcept;
Vector2u operator - (const Vector2u & v) const;
Vector2u operator - (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator * (const Vector2u & v) const noexcept;
Vector2u operator * (Value s) const noexcept;
Vector2u operator * (const Vector2u & v) const;
Vector2u operator * (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator / (const Vector2u & v) const noexcept;
Vector2u operator / (Value s) const noexcept;
Vector2u operator / (const Vector2u & v) const;
Vector2u operator / (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator % (const Vector2u & v) const noexcept;
Vector2u operator % (Value s) const noexcept;
Vector2u operator % (const Vector2u & v) const;
Vector2u operator % (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator & (const Vector2u & v) const noexcept;
Vector2u operator & (Value s) const noexcept;
Vector2u operator & (const Vector2u & v) const;
Vector2u operator & (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator | (const Vector2u & v) const noexcept;
Vector2u operator | (Value s) const noexcept;
Vector2u operator | (const Vector2u & v) const;
Vector2u operator | (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator ^ (const Vector2u & v) const noexcept;
Vector2u operator ^ (Value s) const noexcept;
Vector2u operator ^ (const Vector2u & v) const;
Vector2u operator ^ (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator << (const Vector2u & v) const noexcept;
Vector2u operator << (Value s) const noexcept;
Vector2u operator << (const Vector2u & v) const;
Vector2u operator << (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator >> (const Vector2u & v) const noexcept;
Vector2u operator >> (Value s) const noexcept;
Vector2u operator >> (const Vector2u & v) const;
Vector2u operator >> (Value s) const;
// --------------------------------------------------------------------------------------------
Vector2u operator + () const noexcept;
Vector2u operator - () const noexcept;
Vector2u operator + () const;
Vector2u operator - () const;
// --------------------------------------------------------------------------------------------
Vector2u operator ~ () const noexcept;
Vector2u operator ~ () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Vector2u & v) const noexcept;
bool operator != (const Vector2u & v) const noexcept;
bool operator < (const Vector2u & v) const noexcept;
bool operator > (const Vector2u & v) const noexcept;
bool operator <= (const Vector2u & v) const noexcept;
bool operator >= (const Vector2u & v) const noexcept;
bool operator == (const Vector2u & v) const;
bool operator != (const Vector2u & v) const;
bool operator < (const Vector2u & v) const;
bool operator > (const Vector2u & v) const;
bool operator <= (const Vector2u & v) const;
bool operator >= (const Vector2u & v) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector2u & v) const noexcept;
SQInteger Cmp(const Vector2u & v) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny);
// --------------------------------------------------------------------------------------------
void Set(const Vector2u & v) noexcept;
void Set(const Vector2i & v) noexcept;
void Set(const Vector2f & v) noexcept;
void Set(const Vector2u & v);
void Set(const Vector2i & v);
void Set(const Vector2f & v);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { x = 0, y = 0; }
void Clear() { x = 0, y = 0; }
// --------------------------------------------------------------------------------------------
Vector2u Abs() const noexcept;
Vector2u Abs() const;
};
} // Namespace:: SqMod

View File

@@ -16,52 +16,52 @@ const Vector3 Vector3::MAX = Vector3(std::numeric_limits<Vector3::Value>::max())
SQChar Vector3::Delim = ',';
// ------------------------------------------------------------------------------------------------
Vector3::Vector3() noexcept
Vector3::Vector3()
: x(0.0), y(0.0), z(0.0)
{
}
Vector3::Vector3(Value s) noexcept
Vector3::Vector3(Value s)
: x(s), y(s), z(s)
{
}
Vector3::Vector3(Value xv, Value yv, Value zv) noexcept
Vector3::Vector3(Value xv, Value yv, Value zv)
: x(xv), y(yv), z(zv)
{
}
// ------------------------------------------------------------------------------------------------
Vector3::Vector3(const Vector4 & v) noexcept
Vector3::Vector3(const Vector4 & v)
: x(v.x), y(v.y), z(v.z)
{
}
Vector3::Vector3(const Quaternion & q) noexcept
Vector3::Vector3(const Quaternion & q)
: x(q.x), y(q.y), z(q.z)
{
}
// ------------------------------------------------------------------------------------------------
Vector3::Vector3(const SQChar * values, char delim) noexcept
Vector3::Vector3(const SQChar * values, char delim)
: Vector3(GetVector3(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
Vector3::Vector3(const Vector3 & v) noexcept
Vector3::Vector3(const Vector3 & v)
: x(v.x), y(v.y), z(v.z)
{
}
Vector3::Vector3(Vector3 && v) noexcept
Vector3::Vector3(Vector3 && v)
: x(v.x), y(v.y), z(v.z)
{
@@ -74,7 +74,7 @@ Vector3::~Vector3()
}
// ------------------------------------------------------------------------------------------------
Vector3 & Vector3::operator = (const Vector3 & v) noexcept
Vector3 & Vector3::operator = (const Vector3 & v)
{
x = v.x;
y = v.y;
@@ -82,7 +82,7 @@ Vector3 & Vector3::operator = (const Vector3 & v) noexcept
return *this;
}
Vector3 & Vector3::operator = (Vector3 && v) noexcept
Vector3 & Vector3::operator = (Vector3 && v)
{
x = v.x;
y = v.y;
@@ -91,7 +91,7 @@ Vector3 & Vector3::operator = (Vector3 && v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 & Vector3::operator = (Value s) noexcept
Vector3 & Vector3::operator = (Value s)
{
x = s;
y = s;
@@ -99,7 +99,7 @@ Vector3 & Vector3::operator = (Value s) noexcept
return *this;
}
Vector3 & Vector3::operator = (const Vector4 & v) noexcept
Vector3 & Vector3::operator = (const Vector4 & v)
{
x = v.x;
y = v.y;
@@ -107,7 +107,7 @@ Vector3 & Vector3::operator = (const Vector4 & v) noexcept
return *this;
}
Vector3 & Vector3::operator = (const Quaternion & q) noexcept
Vector3 & Vector3::operator = (const Quaternion & q)
{
x = q.x;
y = q.y;
@@ -116,7 +116,7 @@ Vector3 & Vector3::operator = (const Quaternion & q) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 & Vector3::operator += (const Vector3 & v) noexcept
Vector3 & Vector3::operator += (const Vector3 & v)
{
x += v.x;
y += v.y;
@@ -124,7 +124,7 @@ Vector3 & Vector3::operator += (const Vector3 & v) noexcept
return *this;
}
Vector3 & Vector3::operator -= (const Vector3 & v) noexcept
Vector3 & Vector3::operator -= (const Vector3 & v)
{
x -= v.x;
y -= v.y;
@@ -132,7 +132,7 @@ Vector3 & Vector3::operator -= (const Vector3 & v) noexcept
return *this;
}
Vector3 & Vector3::operator *= (const Vector3 & v) noexcept
Vector3 & Vector3::operator *= (const Vector3 & v)
{
x *= v.x;
y *= v.y;
@@ -140,7 +140,7 @@ Vector3 & Vector3::operator *= (const Vector3 & v) noexcept
return *this;
}
Vector3 & Vector3::operator /= (const Vector3 & v) noexcept
Vector3 & Vector3::operator /= (const Vector3 & v)
{
x /= v.x;
y /= v.y;
@@ -148,7 +148,7 @@ Vector3 & Vector3::operator /= (const Vector3 & v) noexcept
return *this;
}
Vector3 & Vector3::operator %= (const Vector3 & v) noexcept
Vector3 & Vector3::operator %= (const Vector3 & v)
{
x = std::fmod(x, v.x);
y = std::fmod(y, v.y);
@@ -157,7 +157,7 @@ Vector3 & Vector3::operator %= (const Vector3 & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 & Vector3::operator += (Value s) noexcept
Vector3 & Vector3::operator += (Value s)
{
x += s;
y += s;
@@ -165,7 +165,7 @@ Vector3 & Vector3::operator += (Value s) noexcept
return *this;
}
Vector3 & Vector3::operator -= (Value s) noexcept
Vector3 & Vector3::operator -= (Value s)
{
x -= s;
y -= s;
@@ -173,7 +173,7 @@ Vector3 & Vector3::operator -= (Value s) noexcept
return *this;
}
Vector3 & Vector3::operator *= (Value s) noexcept
Vector3 & Vector3::operator *= (Value s)
{
x *= s;
y *= s;
@@ -181,7 +181,7 @@ Vector3 & Vector3::operator *= (Value s) noexcept
return *this;
}
Vector3 & Vector3::operator /= (Value s) noexcept
Vector3 & Vector3::operator /= (Value s)
{
x /= s;
y /= s;
@@ -189,7 +189,7 @@ Vector3 & Vector3::operator /= (Value s) noexcept
return *this;
}
Vector3 & Vector3::operator %= (Value s) noexcept
Vector3 & Vector3::operator %= (Value s)
{
x = std::fmod(x, s);
y = std::fmod(y, s);
@@ -198,7 +198,7 @@ Vector3 & Vector3::operator %= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 & Vector3::operator ++ () noexcept
Vector3 & Vector3::operator ++ ()
{
++x;
++y;
@@ -206,7 +206,7 @@ Vector3 & Vector3::operator ++ () noexcept
return *this;
}
Vector3 & Vector3::operator -- () noexcept
Vector3 & Vector3::operator -- ()
{
--x;
--y;
@@ -215,7 +215,7 @@ Vector3 & Vector3::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 Vector3::operator ++ (int) noexcept
Vector3 Vector3::operator ++ (int)
{
Vector3 state(*this);
++x;
@@ -224,7 +224,7 @@ Vector3 Vector3::operator ++ (int) noexcept
return state;
}
Vector3 Vector3::operator -- (int) noexcept
Vector3 Vector3::operator -- (int)
{
Vector3 state(*this);
--x;
@@ -234,120 +234,120 @@ Vector3 Vector3::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector3 Vector3::operator + (const Vector3 & v) const noexcept
Vector3 Vector3::operator + (const Vector3 & v) const
{
return Vector3(x + v.x, y + v.y, z + v.z);
}
Vector3 Vector3::operator - (const Vector3 & v) const noexcept
Vector3 Vector3::operator - (const Vector3 & v) const
{
return Vector3(x - v.x, y - v.y, z - v.z);
}
Vector3 Vector3::operator * (const Vector3 & v) const noexcept
Vector3 Vector3::operator * (const Vector3 & v) const
{
return Vector3(x * v.x, y * v.y, z * v.z);
}
Vector3 Vector3::operator / (const Vector3 & v) const noexcept
Vector3 Vector3::operator / (const Vector3 & v) const
{
return Vector3(x / v.x, y / v.y, z / v.z);
}
Vector3 Vector3::operator % (const Vector3 & v) const noexcept
Vector3 Vector3::operator % (const Vector3 & v) const
{
return Vector3(std::fmod(x, v.x), std::fmod(y, v.y), std::fmod(z, v.z));
}
// ------------------------------------------------------------------------------------------------
Vector3 Vector3::operator + (Value s) const noexcept
Vector3 Vector3::operator + (Value s) const
{
return Vector3(x + s, y + s, z + s);
}
Vector3 Vector3::operator - (Value s) const noexcept
Vector3 Vector3::operator - (Value s) const
{
return Vector3(x - s, y - s, z - s);
}
Vector3 Vector3::operator * (Value s) const noexcept
Vector3 Vector3::operator * (Value s) const
{
return Vector3(x * s, y * s, z * s);
}
Vector3 Vector3::operator / (Value s) const noexcept
Vector3 Vector3::operator / (Value s) const
{
return Vector3(x / s, y / s, z / s);
}
Vector3 Vector3::operator % (Value s) const noexcept
Vector3 Vector3::operator % (Value s) const
{
return Vector3(std::fmod(x, s), std::fmod(y, s), std::fmod(z, s));
}
// ------------------------------------------------------------------------------------------------
Vector3 Vector3::operator + () const noexcept
Vector3 Vector3::operator + () const
{
return Vector3(std::fabs(x), std::fabs(y), std::fabs(z));
}
Vector3 Vector3::operator - () const noexcept
Vector3 Vector3::operator - () const
{
return Vector3(-x, -y, -z);
}
// ------------------------------------------------------------------------------------------------
bool Vector3::operator == (const Vector3 & v) const noexcept
bool Vector3::operator == (const Vector3 & v) const
{
return EpsEq(x, v.x) && EpsEq(y, v.y) && EpsEq(z, v.z);
}
bool Vector3::operator != (const Vector3 & v) const noexcept
bool Vector3::operator != (const Vector3 & v) const
{
return !EpsEq(x, v.x) && !EpsEq(y, v.y) && !EpsEq(z, v.z);
}
bool Vector3::operator < (const Vector3 & v) const noexcept
bool Vector3::operator < (const Vector3 & v) const
{
return std::isless(x, v.x) && std::isless(y, v.y) && std::isless(z, v.z);
}
bool Vector3::operator > (const Vector3 & v) const noexcept
bool Vector3::operator > (const Vector3 & v) const
{
return std::isgreater(x, v.x) && std::isgreater(y, v.y) && std::isgreater(z, v.z);
}
bool Vector3::operator <= (const Vector3 & v) const noexcept
bool Vector3::operator <= (const Vector3 & v) const
{
return std::islessequal(x, v.x) && std::islessequal(y, v.y) && std::islessequal(z, v.z);
}
bool Vector3::operator >= (const Vector3 & v) const noexcept
bool Vector3::operator >= (const Vector3 & v) const
{
return std::isgreaterequal(x, v.x) && std::isgreaterequal(y, v.y) && std::isgreaterequal(z, v.z);
}
// ------------------------------------------------------------------------------------------------
SQInteger Vector3::Cmp(const Vector3 & v) const noexcept
SQInteger Vector3::Cmp(const Vector3 & v) const
{
return *this == v ? 0 : (*this > v ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Vector3::ToString() const noexcept
const SQChar * Vector3::ToString() const
{
return ToStringF("%f,%f,%f", x, y, z);
}
// ------------------------------------------------------------------------------------------------
void Vector3::Set(Value ns) noexcept
void Vector3::Set(Value ns)
{
x = ns;
y = ns;
z = ns;
}
void Vector3::Set(Value nx, Value ny, Value nz) noexcept
void Vector3::Set(Value nx, Value ny, Value nz)
{
x = nx;
y = ny;
@@ -355,21 +355,21 @@ void Vector3::Set(Value nx, Value ny, Value nz) noexcept
}
// ------------------------------------------------------------------------------------------------
void Vector3::Set(const Vector3 & v) noexcept
void Vector3::Set(const Vector3 & v)
{
x = v.x;
y = v.y;
z = v.z;
}
void Vector3::Set(const Vector4 & v) noexcept
void Vector3::Set(const Vector4 & v)
{
x = v.x;
y = v.y;
z = v.z;
}
void Vector3::Set(const Quaternion & q) noexcept
void Vector3::Set(const Quaternion & q)
{
x = q.x;
y = q.y;
@@ -377,20 +377,20 @@ void Vector3::Set(const Quaternion & q) noexcept
}
// ------------------------------------------------------------------------------------------------
void Vector3::Set(const SQChar * values, char delim) noexcept
void Vector3::Set(const SQChar * values, char delim)
{
Set(GetVector3(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Vector3::Generate() noexcept
void Vector3::Generate()
{
x = RandomVal<Value>::Get();
y = RandomVal<Value>::Get();
z = RandomVal<Value>::Get();
}
void Vector3::Generate(Value min, Value max) noexcept
void Vector3::Generate(Value min, Value max)
{
if (max < min)
{
@@ -404,7 +404,7 @@ void Vector3::Generate(Value min, Value max) noexcept
}
}
void Vector3::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax) noexcept
void Vector3::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax)
{
if (std::isless(xmax, xmin) || std::isless(ymax, ymin) || std::isless(zmax, zmin))
{
@@ -419,7 +419,7 @@ void Vector3::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmi
}
// ------------------------------------------------------------------------------------------------
Vector3 Vector3::Abs() const noexcept
Vector3 Vector3::Abs() const
{
return Vector3(std::fabs(x), std::fabs(y), std::fabs(z));
}

View File

@@ -23,87 +23,87 @@ struct Vector3
// --------------------------------------------------------------------------------------------
Value x, y, z;
// --------------------------------------------------------------------------------------------
Vector3() noexcept;
Vector3(Value s) noexcept;
Vector3(Value xv, Value yv, Value zv) noexcept;
Vector3();
Vector3(Value s);
Vector3(Value xv, Value yv, Value zv);
// --------------------------------------------------------------------------------------------
Vector3(const Vector4 & v) noexcept;
Vector3(const Quaternion & q) noexcept;
Vector3(const Vector4 & v);
Vector3(const Quaternion & q);
// --------------------------------------------------------------------------------------------
Vector3(const SQChar * values, char delim) noexcept;
Vector3(const SQChar * values, char delim);
// --------------------------------------------------------------------------------------------
Vector3(const Vector3 & v) noexcept;
Vector3(Vector3 && v) noexcept;
Vector3(const Vector3 & v);
Vector3(Vector3 && v);
// --------------------------------------------------------------------------------------------
~Vector3();
// --------------------------------------------------------------------------------------------
Vector3 & operator = (const Vector3 & v) noexcept;
Vector3 & operator = (Vector3 && v) noexcept;
Vector3 & operator = (const Vector3 & v);
Vector3 & operator = (Vector3 && v);
// --------------------------------------------------------------------------------------------
Vector3 & operator = (Value s) noexcept;
Vector3 & operator = (const Vector4 & v) noexcept;
Vector3 & operator = (const Quaternion & q) noexcept;
Vector3 & operator = (Value s);
Vector3 & operator = (const Vector4 & v);
Vector3 & operator = (const Quaternion & q);
// --------------------------------------------------------------------------------------------
Vector3 & operator += (const Vector3 & v) noexcept;
Vector3 & operator -= (const Vector3 & v) noexcept;
Vector3 & operator *= (const Vector3 & v) noexcept;
Vector3 & operator /= (const Vector3 & v) noexcept;
Vector3 & operator %= (const Vector3 & v) noexcept;
Vector3 & operator += (const Vector3 & v);
Vector3 & operator -= (const Vector3 & v);
Vector3 & operator *= (const Vector3 & v);
Vector3 & operator /= (const Vector3 & v);
Vector3 & operator %= (const Vector3 & v);
// --------------------------------------------------------------------------------------------
Vector3 & operator += (Value s) noexcept;
Vector3 & operator -= (Value s) noexcept;
Vector3 & operator *= (Value s) noexcept;
Vector3 & operator /= (Value s) noexcept;
Vector3 & operator %= (Value s) noexcept;
Vector3 & operator += (Value s);
Vector3 & operator -= (Value s);
Vector3 & operator *= (Value s);
Vector3 & operator /= (Value s);
Vector3 & operator %= (Value s);
// --------------------------------------------------------------------------------------------
Vector3 & operator ++ () noexcept;
Vector3 & operator -- () noexcept;
Vector3 & operator ++ ();
Vector3 & operator -- ();
// --------------------------------------------------------------------------------------------
Vector3 operator ++ (int) noexcept;
Vector3 operator -- (int) noexcept;
Vector3 operator ++ (int);
Vector3 operator -- (int);
// --------------------------------------------------------------------------------------------
Vector3 operator + (const Vector3 & v) const noexcept;
Vector3 operator - (const Vector3 & v) const noexcept;
Vector3 operator * (const Vector3 & v) const noexcept;
Vector3 operator / (const Vector3 & v) const noexcept;
Vector3 operator % (const Vector3 & v) const noexcept;
Vector3 operator + (const Vector3 & v) const;
Vector3 operator - (const Vector3 & v) const;
Vector3 operator * (const Vector3 & v) const;
Vector3 operator / (const Vector3 & v) const;
Vector3 operator % (const Vector3 & v) const;
// --------------------------------------------------------------------------------------------
Vector3 operator + (Value s) const noexcept;
Vector3 operator - (Value s) const noexcept;
Vector3 operator * (Value s) const noexcept;
Vector3 operator / (Value s) const noexcept;
Vector3 operator % (Value s) const noexcept;
Vector3 operator + (Value s) const;
Vector3 operator - (Value s) const;
Vector3 operator * (Value s) const;
Vector3 operator / (Value s) const;
Vector3 operator % (Value s) const;
// --------------------------------------------------------------------------------------------
Vector3 operator + () const noexcept;
Vector3 operator - () const noexcept;
Vector3 operator + () const;
Vector3 operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Vector3 & v) const noexcept;
bool operator != (const Vector3 & v) const noexcept;
bool operator < (const Vector3 & v) const noexcept;
bool operator > (const Vector3 & v) const noexcept;
bool operator <= (const Vector3 & v) const noexcept;
bool operator >= (const Vector3 & v) const noexcept;
bool operator == (const Vector3 & v) const;
bool operator != (const Vector3 & v) const;
bool operator < (const Vector3 & v) const;
bool operator > (const Vector3 & v) const;
bool operator <= (const Vector3 & v) const;
bool operator >= (const Vector3 & v) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector3 & v) const noexcept;
SQInteger Cmp(const Vector3 & v) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny, Value nz) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny, Value nz);
// --------------------------------------------------------------------------------------------
void Set(const Vector3 & v) noexcept;
void Set(const Vector4 & v) noexcept;
void Set(const Quaternion & q) noexcept;
void Set(const Vector3 & v);
void Set(const Vector4 & v);
void Set(const Quaternion & q);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, char delim) noexcept;
void Set(const SQChar * values, char delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { x = 0.0, y = 0.0, z = 0.0; }
void Clear() { x = 0.0, y = 0.0, z = 0.0; }
// --------------------------------------------------------------------------------------------
Vector3 Abs() const noexcept;
Vector3 Abs() const;
};
} // Namespace:: SqMod

View File

@@ -16,58 +16,58 @@ const Vector4 Vector4::MAX = Vector4(std::numeric_limits<Vector4::Value>::max())
SQChar Vector4::Delim = ',';
// ------------------------------------------------------------------------------------------------
Vector4::Vector4() noexcept
Vector4::Vector4()
: x(0.0), y(0.0), z(0.0), w(0.0)
{
}
Vector4::Vector4(Value s) noexcept
Vector4::Vector4(Value s)
: x(s), y(s), z(s), w(s)
{
}
Vector4::Vector4(Value xv, Value yv, Value zv) noexcept
Vector4::Vector4(Value xv, Value yv, Value zv)
: x(xv), y(yv), z(zv), w(0.0)
{
}
Vector4::Vector4(Value xv, Value yv, Value zv, Value wv) noexcept
Vector4::Vector4(Value xv, Value yv, Value zv, Value wv)
: x(xv), y(yv), z(zv), w(wv)
{
}
// ------------------------------------------------------------------------------------------------
Vector4::Vector4(const Vector3 & v) noexcept
Vector4::Vector4(const Vector3 & v)
: x(v.x), y(v.y), z(v.z), w(0.0)
{
}
Vector4::Vector4(const Quaternion & q) noexcept
Vector4::Vector4(const Quaternion & q)
: x(q.x), y(q.y), z(q.z), w(q.w)
{
}
// ------------------------------------------------------------------------------------------------
Vector4::Vector4(const SQChar * values, SQChar delim) noexcept
Vector4::Vector4(const SQChar * values, SQChar delim)
: Vector4(GetVector4(values, delim))
{
}
// ------------------------------------------------------------------------------------------------
Vector4::Vector4(const Vector4 & v) noexcept
Vector4::Vector4(const Vector4 & v)
: x(v.x), y(v.y), z(v.z), w(v.w)
{
}
Vector4::Vector4(Vector4 && v) noexcept
Vector4::Vector4(Vector4 && v)
: x(v.x), y(v.y), z(v.z), w(v.w)
{
@@ -80,7 +80,7 @@ Vector4::~Vector4()
}
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator = (const Vector4 & v) noexcept
Vector4 & Vector4::operator = (const Vector4 & v)
{
x = v.x;
y = v.y;
@@ -89,7 +89,7 @@ Vector4 & Vector4::operator = (const Vector4 & v) noexcept
return *this;
}
Vector4 & Vector4::operator = (Vector4 && v) noexcept
Vector4 & Vector4::operator = (Vector4 && v)
{
x = v.x;
y = v.y;
@@ -99,7 +99,7 @@ Vector4 & Vector4::operator = (Vector4 && v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator = (Value s) noexcept
Vector4 & Vector4::operator = (Value s)
{
x = s;
y = s;
@@ -108,7 +108,7 @@ Vector4 & Vector4::operator = (Value s) noexcept
return *this;
}
Vector4 & Vector4::operator = (const Vector3 & v) noexcept
Vector4 & Vector4::operator = (const Vector3 & v)
{
x = v.x;
y = v.y;
@@ -117,7 +117,7 @@ Vector4 & Vector4::operator = (const Vector3 & v) noexcept
return *this;
}
Vector4 & Vector4::operator = (const Quaternion & q) noexcept
Vector4 & Vector4::operator = (const Quaternion & q)
{
x = q.x;
y = q.y;
@@ -127,7 +127,7 @@ Vector4 & Vector4::operator = (const Quaternion & q) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator += (const Vector4 & v) noexcept
Vector4 & Vector4::operator += (const Vector4 & v)
{
x += v.x;
y += v.y;
@@ -136,7 +136,7 @@ Vector4 & Vector4::operator += (const Vector4 & v) noexcept
return *this;
}
Vector4 & Vector4::operator -= (const Vector4 & v) noexcept
Vector4 & Vector4::operator -= (const Vector4 & v)
{
x -= v.x;
y -= v.y;
@@ -145,7 +145,7 @@ Vector4 & Vector4::operator -= (const Vector4 & v) noexcept
return *this;
}
Vector4 & Vector4::operator *= (const Vector4 & v) noexcept
Vector4 & Vector4::operator *= (const Vector4 & v)
{
x *= v.x;
y *= v.y;
@@ -154,7 +154,7 @@ Vector4 & Vector4::operator *= (const Vector4 & v) noexcept
return *this;
}
Vector4 & Vector4::operator /= (const Vector4 & v) noexcept
Vector4 & Vector4::operator /= (const Vector4 & v)
{
x /= v.x;
y /= v.y;
@@ -163,7 +163,7 @@ Vector4 & Vector4::operator /= (const Vector4 & v) noexcept
return *this;
}
Vector4 & Vector4::operator %= (const Vector4 & v) noexcept
Vector4 & Vector4::operator %= (const Vector4 & v)
{
x = std::fmod(x, v.x);
y = std::fmod(y, v.y);
@@ -173,7 +173,7 @@ Vector4 & Vector4::operator %= (const Vector4 & v) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator += (Value s) noexcept
Vector4 & Vector4::operator += (Value s)
{
x += s;
y += s;
@@ -182,7 +182,7 @@ Vector4 & Vector4::operator += (Value s) noexcept
return *this;
}
Vector4 & Vector4::operator -= (Value s) noexcept
Vector4 & Vector4::operator -= (Value s)
{
x -= s;
y -= s;
@@ -191,7 +191,7 @@ Vector4 & Vector4::operator -= (Value s) noexcept
return *this;
}
Vector4 & Vector4::operator *= (Value s) noexcept
Vector4 & Vector4::operator *= (Value s)
{
x *= s;
y *= s;
@@ -200,7 +200,7 @@ Vector4 & Vector4::operator *= (Value s) noexcept
return *this;
}
Vector4 & Vector4::operator /= (Value s) noexcept
Vector4 & Vector4::operator /= (Value s)
{
x /= s;
y /= s;
@@ -209,7 +209,7 @@ Vector4 & Vector4::operator /= (Value s) noexcept
return *this;
}
Vector4 & Vector4::operator %= (Value s) noexcept
Vector4 & Vector4::operator %= (Value s)
{
x = std::fmod(x, s);
y = std::fmod(y, s);
@@ -219,7 +219,7 @@ Vector4 & Vector4::operator %= (Value s) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator ++ () noexcept
Vector4 & Vector4::operator ++ ()
{
++x;
++y;
@@ -228,7 +228,7 @@ Vector4 & Vector4::operator ++ () noexcept
return *this;
}
Vector4 & Vector4::operator -- () noexcept
Vector4 & Vector4::operator -- ()
{
--x;
--y;
@@ -238,7 +238,7 @@ Vector4 & Vector4::operator -- () noexcept
}
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator ++ (int) noexcept
Vector4 Vector4::operator ++ (int)
{
Vector4 state(*this);
++x;
@@ -248,7 +248,7 @@ Vector4 Vector4::operator ++ (int) noexcept
return state;
}
Vector4 Vector4::operator -- (int) noexcept
Vector4 Vector4::operator -- (int)
{
Vector4 state(*this);
--x;
@@ -259,113 +259,113 @@ Vector4 Vector4::operator -- (int) noexcept
}
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator + (const Vector4 & v) const noexcept
Vector4 Vector4::operator + (const Vector4 & v) const
{
return Vector4(x + v.x, y + v.y, z + v.z, w + v.w);
}
Vector4 Vector4::operator - (const Vector4 & v) const noexcept
Vector4 Vector4::operator - (const Vector4 & v) const
{
return Vector4(x - v.x, y - v.y, z - v.z, w - v.w);
}
Vector4 Vector4::operator * (const Vector4 & v) const noexcept
Vector4 Vector4::operator * (const Vector4 & v) const
{
return Vector4(x * v.x, y * v.y, z * v.z, w * v.w);
}
Vector4 Vector4::operator / (const Vector4 & v) const noexcept
Vector4 Vector4::operator / (const Vector4 & v) const
{
return Vector4(x / v.x, y / v.y, z / v.z, w / v.w);
}
Vector4 Vector4::operator % (const Vector4 & v) const noexcept
Vector4 Vector4::operator % (const Vector4 & v) const
{
return Vector4(std::fmod(x, v.x), std::fmod(y, v.y), std::fmod(z, v.z), std::fmod(w, v.w));
}
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator + (Value s) const noexcept
Vector4 Vector4::operator + (Value s) const
{
return Vector4(x + s, y + s, z + s, w + s);
}
Vector4 Vector4::operator - (Value s) const noexcept
Vector4 Vector4::operator - (Value s) const
{
return Vector4(x - s, y - s, z - s, w - s);
}
Vector4 Vector4::operator * (Value s) const noexcept
Vector4 Vector4::operator * (Value s) const
{
return Vector4(x * s, y * s, z * s, w * s);
}
Vector4 Vector4::operator / (Value s) const noexcept
Vector4 Vector4::operator / (Value s) const
{
return Vector4(x / s, y / s, z / s, w / s);
}
Vector4 Vector4::operator % (Value s) const noexcept
Vector4 Vector4::operator % (Value s) const
{
return Vector4(std::fmod(x, s), std::fmod(y, s), std::fmod(z, s), std::fmod(w, s));
}
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator + () const noexcept
Vector4 Vector4::operator + () const
{
return Vector4(std::fabs(x), std::fabs(y), std::fabs(z), std::fabs(w));
}
Vector4 Vector4::operator - () const noexcept
Vector4 Vector4::operator - () const
{
return Vector4(-x, -y, -z, -w);
}
// ------------------------------------------------------------------------------------------------
bool Vector4::operator == (const Vector4 & v) const noexcept
bool Vector4::operator == (const Vector4 & v) const
{
return EpsEq(x, v.x) && EpsEq(y, v.y) && EpsEq(z, v.z) && EpsEq(w, v.w);
}
bool Vector4::operator != (const Vector4 & v) const noexcept
bool Vector4::operator != (const Vector4 & v) const
{
return !EpsEq(x, v.x) && !EpsEq(y, v.y) && !EpsEq(z, v.z) && !EpsEq(w, v.w);
}
bool Vector4::operator < (const Vector4 & v) const noexcept
bool Vector4::operator < (const Vector4 & v) const
{
return std::isless(x, v.x) && std::isless(y, v.y) && std::isless(z, v.z) && std::isless(w, v.w);
}
bool Vector4::operator > (const Vector4 & v) const noexcept
bool Vector4::operator > (const Vector4 & v) const
{
return std::isgreater(x, v.x) && std::isgreater(y, v.y) && std::isgreater(z, v.z) && std::isgreater(w, v.w);
}
bool Vector4::operator <= (const Vector4 & v) const noexcept
bool Vector4::operator <= (const Vector4 & v) const
{
return std::islessequal(x, v.x) && std::islessequal(y, v.y) && std::islessequal(z, v.z) && std::islessequal(w, v.w);
}
bool Vector4::operator >= (const Vector4 & v) const noexcept
bool Vector4::operator >= (const Vector4 & v) const
{
return std::isgreaterequal(x, v.x) && std::isgreaterequal(y, v.y) && std::isgreaterequal(z, v.z) && std::isgreaterequal(w, v.w);
}
// ------------------------------------------------------------------------------------------------
SQInteger Vector4::Cmp(const Vector4 & v) const noexcept
SQInteger Vector4::Cmp(const Vector4 & v) const
{
return *this == v ? 0 : (*this > v ? 1 : -1);
}
// ------------------------------------------------------------------------------------------------
const SQChar * Vector4::ToString() const noexcept
const SQChar * Vector4::ToString() const
{
return ToStringF("%f,%f,%f,%f", x, y, z, w);
}
// ------------------------------------------------------------------------------------------------
void Vector4::Set(Value ns) noexcept
void Vector4::Set(Value ns)
{
x = ns;
y = ns;
@@ -373,14 +373,14 @@ void Vector4::Set(Value ns) noexcept
w = ns;
}
void Vector4::Set(Value nx, Value ny, Value nz) noexcept
void Vector4::Set(Value nx, Value ny, Value nz)
{
x = nx;
y = ny;
z = nz;
}
void Vector4::Set(Value nx, Value ny, Value nz, Value nw) noexcept
void Vector4::Set(Value nx, Value ny, Value nz, Value nw)
{
x = nx;
y = ny;
@@ -389,7 +389,7 @@ void Vector4::Set(Value nx, Value ny, Value nz, Value nw) noexcept
}
// ------------------------------------------------------------------------------------------------
void Vector4::Set(const Vector4 & v) noexcept
void Vector4::Set(const Vector4 & v)
{
x = v.x;
y = v.y;
@@ -397,7 +397,7 @@ void Vector4::Set(const Vector4 & v) noexcept
w = v.w;
}
void Vector4::Set(const Vector3 & v) noexcept
void Vector4::Set(const Vector3 & v)
{
x = v.x;
y = v.y;
@@ -405,7 +405,7 @@ void Vector4::Set(const Vector3 & v) noexcept
w = 0.0;
}
void Vector4::Set(const Quaternion & q) noexcept
void Vector4::Set(const Quaternion & q)
{
x = q.x;
y = q.y;
@@ -414,13 +414,13 @@ void Vector4::Set(const Quaternion & q) noexcept
}
// ------------------------------------------------------------------------------------------------
void Vector4::Set(const SQChar * values, SQChar delim) noexcept
void Vector4::Set(const SQChar * values, SQChar delim)
{
Set(GetVector4(values, delim));
}
// ------------------------------------------------------------------------------------------------
void Vector4::Generate() noexcept
void Vector4::Generate()
{
x = RandomVal<Value>::Get();
y = RandomVal<Value>::Get();
@@ -428,7 +428,7 @@ void Vector4::Generate() noexcept
w = RandomVal<Value>::Get();
}
void Vector4::Generate(Value min, Value max) noexcept
void Vector4::Generate(Value min, Value max)
{
if (max < min)
{
@@ -443,7 +443,7 @@ void Vector4::Generate(Value min, Value max) noexcept
}
}
void Vector4::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax) noexcept
void Vector4::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax)
{
if (std::isless(xmax, xmin) || std::isless(ymax, ymin) || std::isless(zmax, zmin) || std::isless(wmax, wmin))
{
@@ -459,7 +459,7 @@ void Vector4::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmi
}
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::Abs() const noexcept
Vector4 Vector4::Abs() const
{
return Vector4(std::fabs(x), std::fabs(y), std::fabs(z), std::fabs(w));
}

View File

@@ -23,89 +23,89 @@ struct Vector4
// --------------------------------------------------------------------------------------------
Value x, y, z, w;
// --------------------------------------------------------------------------------------------
Vector4() noexcept;
Vector4(Value s) noexcept;
Vector4(Value xv, Value yv, Value zv) noexcept;
Vector4(Value xv, Value yv, Value zv, Value wv) noexcept;
Vector4();
Vector4(Value s);
Vector4(Value xv, Value yv, Value zv);
Vector4(Value xv, Value yv, Value zv, Value wv);
// --------------------------------------------------------------------------------------------
Vector4(const Vector3 & v) noexcept;
Vector4(const Quaternion & q) noexcept;
Vector4(const Vector3 & v);
Vector4(const Quaternion & q);
// --------------------------------------------------------------------------------------------
Vector4(const SQChar * values, SQChar delim) noexcept;
Vector4(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
Vector4(const Vector4 & v) noexcept;
Vector4(Vector4 && v) noexcept;
Vector4(const Vector4 & v);
Vector4(Vector4 && v);
// --------------------------------------------------------------------------------------------
~Vector4();
// --------------------------------------------------------------------------------------------
Vector4 & operator = (const Vector4 & v) noexcept;
Vector4 & operator = (Vector4 && v) noexcept;
Vector4 & operator = (const Vector4 & v);
Vector4 & operator = (Vector4 && v);
// --------------------------------------------------------------------------------------------
Vector4 & operator = (Value s) noexcept;
Vector4 & operator = (const Vector3 & v) noexcept;
Vector4 & operator = (const Quaternion & q) noexcept;
Vector4 & operator = (Value s);
Vector4 & operator = (const Vector3 & v);
Vector4 & operator = (const Quaternion & q);
// --------------------------------------------------------------------------------------------
Vector4 & operator += (const Vector4 & v) noexcept;
Vector4 & operator -= (const Vector4 & v) noexcept;
Vector4 & operator *= (const Vector4 & v) noexcept;
Vector4 & operator /= (const Vector4 & v) noexcept;
Vector4 & operator %= (const Vector4 & v) noexcept;
Vector4 & operator += (const Vector4 & v);
Vector4 & operator -= (const Vector4 & v);
Vector4 & operator *= (const Vector4 & v);
Vector4 & operator /= (const Vector4 & v);
Vector4 & operator %= (const Vector4 & v);
// --------------------------------------------------------------------------------------------
Vector4 & operator += (Value s) noexcept;
Vector4 & operator -= (Value s) noexcept;
Vector4 & operator *= (Value s) noexcept;
Vector4 & operator /= (Value s) noexcept;
Vector4 & operator %= (Value s) noexcept;
Vector4 & operator += (Value s);
Vector4 & operator -= (Value s);
Vector4 & operator *= (Value s);
Vector4 & operator /= (Value s);
Vector4 & operator %= (Value s);
// --------------------------------------------------------------------------------------------
Vector4 & operator ++ () noexcept;
Vector4 & operator -- () noexcept;
Vector4 & operator ++ ();
Vector4 & operator -- ();
// --------------------------------------------------------------------------------------------
Vector4 operator ++ (int) noexcept;
Vector4 operator -- (int) noexcept;
Vector4 operator ++ (int);
Vector4 operator -- (int);
// --------------------------------------------------------------------------------------------
Vector4 operator + (const Vector4 & v) const noexcept;
Vector4 operator - (const Vector4 & v) const noexcept;
Vector4 operator * (const Vector4 & v) const noexcept;
Vector4 operator / (const Vector4 & v) const noexcept;
Vector4 operator % (const Vector4 & v) const noexcept;
Vector4 operator + (const Vector4 & v) const;
Vector4 operator - (const Vector4 & v) const;
Vector4 operator * (const Vector4 & v) const;
Vector4 operator / (const Vector4 & v) const;
Vector4 operator % (const Vector4 & v) const;
// --------------------------------------------------------------------------------------------
Vector4 operator + (Value s) const noexcept;
Vector4 operator - (Value s) const noexcept;
Vector4 operator * (Value s) const noexcept;
Vector4 operator / (Value s) const noexcept;
Vector4 operator % (Value s) const noexcept;
Vector4 operator + (Value s) const;
Vector4 operator - (Value s) const;
Vector4 operator * (Value s) const;
Vector4 operator / (Value s) const;
Vector4 operator % (Value s) const;
// --------------------------------------------------------------------------------------------
Vector4 operator + () const noexcept;
Vector4 operator - () const noexcept;
Vector4 operator + () const;
Vector4 operator - () const;
// --------------------------------------------------------------------------------------------
bool operator == (const Vector4 & v) const noexcept;
bool operator != (const Vector4 & v) const noexcept;
bool operator < (const Vector4 & v) const noexcept;
bool operator > (const Vector4 & v) const noexcept;
bool operator <= (const Vector4 & v) const noexcept;
bool operator >= (const Vector4 & v) const noexcept;
bool operator == (const Vector4 & v) const;
bool operator != (const Vector4 & v) const;
bool operator < (const Vector4 & v) const;
bool operator > (const Vector4 & v) const;
bool operator <= (const Vector4 & v) const;
bool operator >= (const Vector4 & v) const;
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector4 & v) const noexcept;
SQInteger Cmp(const Vector4 & v) const;
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const noexcept;
const SQChar * ToString() const;
// --------------------------------------------------------------------------------------------
void Set(Value ns) noexcept;
void Set(Value nx, Value ny, Value nz) noexcept;
void Set(Value nx, Value ny, Value nz, Value nw) noexcept;
void Set(Value ns);
void Set(Value nx, Value ny, Value nz);
void Set(Value nx, Value ny, Value nz, Value nw);
// --------------------------------------------------------------------------------------------
void Set(const Vector4 & v) noexcept;
void Set(const Vector3 & v) noexcept;
void Set(const Quaternion & q) noexcept;
void Set(const Vector4 & v);
void Set(const Vector3 & v);
void Set(const Quaternion & q);
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim) noexcept;
void Set(const SQChar * values, SQChar delim);
// --------------------------------------------------------------------------------------------
void Generate() noexcept;
void Generate(Value min, Value max) noexcept;
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax) noexcept;
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax);
// --------------------------------------------------------------------------------------------
void Clear() noexcept { x = 0.0, y = 0.0, z = 0.0, w = 0.0; }
void Clear() { x = 0.0, y = 0.0, z = 0.0, w = 0.0; }
// --------------------------------------------------------------------------------------------
Vector4 Abs() const noexcept;
Vector4 Abs() const;
};
} // Namespace:: SqMod