Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TCG_RECT_H
Toshihiro Shimizu 890ddd
#define TCG_RECT_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "point.h"
Toshihiro Shimizu 890ddd
#include "size.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// STD includes
Toshihiro Shimizu 890ddd
#include <limits></limits>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace tcg
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
//    Bidimensional Rect  class
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <typename t=""></typename>
Toshihiro Shimizu 890ddd
struct RectT {
Toshihiro Shimizu 890ddd
	T x0, y0,
Toshihiro Shimizu 890ddd
		x1, y1;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	RectT() : x0((std::numeric_limits<t>::max)()), y0(x0), x1(-x0), y1(x1) {}</t>
Toshihiro Shimizu 890ddd
	RectT(T x0_, T y0_, T x1_, T y1_)
Toshihiro Shimizu 890ddd
		: x0(x0_), y0(y0_), x1(x1_), y1(y1_) {}
Toshihiro Shimizu 890ddd
	RectT(const PointT<t> &p0, const PointT<t> &p1)</t></t>
Toshihiro Shimizu 890ddd
		: x0(p0.x), y0(p0.y), x1(p1.x), y1(p1.y) {}
Toshihiro Shimizu 890ddd
	RectT(const PointT<t> &p0, const SizeT<t> &size)</t></t>
Toshihiro Shimizu 890ddd
		: x0(p0.x), y0(p0.y), x1(p0.x + size.w), y1(p0.y + size.h) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool empty() const { return (x1 <= x0) || (y1 <= y0); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	PointT<t> p0() const { return PointT<t>(x0, y0); }</t></t>
Toshihiro Shimizu 890ddd
	PointT<t> p1() const { return PointT<t>(x1, y1); }</t></t>
Toshihiro Shimizu 890ddd
	PointT<t> center() const</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return PointT<t>((x0 + x1) / 2, (y0 + y1) / 2);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	T width() const { return x1 - x0; }
Toshihiro Shimizu 890ddd
	T height() const { return y1 - y0; }
Toshihiro Shimizu 890ddd
	SizeT<t> size() const { return SizeT<t>(width(), height()); }</t></t>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool operator==(const RectT &other) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return x0 == other.x0 && y0 == other.y0 && x1 == other.x1 && y1 == other.y1;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	bool operator!=(const RectT &other) const { return !operator==(other); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	RectT &operator+=(const PointT<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		x0 += p.x, y0 += p.y, x1 += p.x, y1 += p.y;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	RectT &operator-=(const PointT<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		x0 -= p.x, y0 -= p.y, x1 -= p.x, y1 -= p.y;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend RectT<t> operator+(const RectT<t> &r, const tcg::PointT<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r.x0 + p.x, r.y0 + p.y, r.x1 + p.x, r.y1 + p.y);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator-(const RectT<t> &r, const tcg::PointT<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r.x0 - p.x, r.y0 - p.y, r.x1 - p.x, r.y1 - p.y);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator+(const tcg::PointT<t> &p, const RectT<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(p.x + r.x0, p.y + r.y0, p.x + r.x1, p.y + r.y1);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator-(const tcg::PointT<t> &p, const RectT<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(p.x - r.x0, p.y - r.y0, p.x - r.x1, p.y - r.y1);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	template <typename k=""></typename>
Toshihiro Shimizu 890ddd
	RectT &operator*=(K k)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		x0 *= k, y0 *= k, x1 *= k, y1 *= k;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	template <typename k=""></typename>
Toshihiro Shimizu 890ddd
	friend RectT<t> operator*(const RectT<t> &r, K k)</t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r.x0 * k, r.y0 * k, r.x1 * k, r.y1 * k);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	template <typename k=""></typename>
Toshihiro Shimizu 890ddd
	friend RectT<t> operator*(K k, const RectT<t> &r)</t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(k * r.x0, k * r.y0, k * r.x1, k * r.y1);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	RectT &operator|=(const RectT &other)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (x0 > other.x0)
Toshihiro Shimizu 890ddd
			x0 = other.x0;
Toshihiro Shimizu 890ddd
		if (y0 > other.y0)
Toshihiro Shimizu 890ddd
			y0 = other.y0;
Toshihiro Shimizu 890ddd
		if (x1 < other.x1)
Toshihiro Shimizu 890ddd
			x1 = other.x1;
Toshihiro Shimizu 890ddd
		if (y1 < other.y1)
Toshihiro Shimizu 890ddd
			y1 = other.y1;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	RectT &operator&=(const RectT &other)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (x0 < other.x0)
Toshihiro Shimizu 890ddd
			x0 = other.x0;
Toshihiro Shimizu 890ddd
		if (y0 < other.y0)
Toshihiro Shimizu 890ddd
			y0 = other.y0;
Toshihiro Shimizu 890ddd
		if (x1 > other.x1)
Toshihiro Shimizu 890ddd
			x1 = other.x1;
Toshihiro Shimizu 890ddd
		if (y1 > other.y1)
Toshihiro Shimizu 890ddd
			y1 = other.y1;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	RectT &operator|=(const PointT<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return operator|=(RectT(p.x, p.y, p.x, p.y));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	RectT &operator&=(const PointT<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return operator&=(RectT(p.x, p.y, p.x, p.y));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend RectT<t> operator|(const RectT<t> &a, const RectT<t> &b)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(a) |= b;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator&(const RectT<t> &a, const RectT<t> &b)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(a) &= b;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend RectT<t> operator|(const RectT<t> &r, const PointT<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r) |= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator&(const RectT<t> &r, const PointT<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r) &= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator|(const PointT<t> &p, const RectT<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r) |= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend RectT<t> operator&(const PointT<t> &p, const RectT<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r) &= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef RectT<double> RectD;</double>
Toshihiro Shimizu 890ddd
typedef RectT<int> RectI;</int>
Toshihiro Shimizu 890ddd
typedef RectI Rect;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
//    Tridimensional Rect  class
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <typename t=""></typename>
Toshihiro Shimizu 890ddd
struct Rect3T {
Toshihiro Shimizu 890ddd
	T x0, y0, z0,
Toshihiro Shimizu 890ddd
		x1, y1, z1;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	Rect3T() : x0((std::numeric_limits<t>::max)()), y0(x0), z0(x0), x1(-x0), y1(x1), z1(x1) {}</t>
Toshihiro Shimizu 890ddd
	Rect3T(T x0_, T y0_, T z0_, T x1_, T y1_, T z1_)
Toshihiro Shimizu 890ddd
		: x0(x0_), y0(y0_), z0(z0_), x1(x1_), y1(y1_), z1(z1_) {}
Toshihiro Shimizu 890ddd
	Rect3T(const Point3T<t> &p0, const Point3T<t> &p1)</t></t>
Toshihiro Shimizu 890ddd
		: x0(p0.x), y0(p0.y), z0(p0.z) x1(p1.x), y1(p1.y), z1(p1.z) {}
Toshihiro Shimizu 890ddd
	Rect3T(const Point3T<t> &p0, const Size3T<t> &size)</t></t>
Toshihiro Shimizu 890ddd
		: x0(p0.x), y0(p0.y), z0(p0.z), x1(p0.x + size.w), y1(p0.y + size.h), z1(p0.z + size.d) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool empty() const { return (x1 <= x0) || (y1 <= y0) || (z1 <= z0); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Point3T<t> p0() const { return Point3T<t>(x0, y0, z0); }</t></t>
Toshihiro Shimizu 890ddd
	Point3T<t> p1() const { return Point3T<t>(x1, y1, z1); }</t></t>
Toshihiro Shimizu 890ddd
	Point3T<t> center() const</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Point3T<t>((x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2);</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	T width() const { return x1 - x0; }
Toshihiro Shimizu 890ddd
	T height() const { return y1 - y0; }
Toshihiro Shimizu 890ddd
	T depth() const { return z1 - z0; }
Toshihiro Shimizu 890ddd
	Size3T<t> size() const { return Size3T<t>(width(), height(), depth()); }</t></t>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool operator==(const Rect3T &other) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return x0 == other.x0 && y0 == other.y0 && z0 == other.z0 && x1 == other.x1 && y1 == other.y1 && z1 == other.z1;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	bool operator!=(const Rect3T &other) const { return !operator==(other); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Rect3T &operator+=(const Point3T<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		x0 += p.x, y0 += p.y, z0 += p.z, x1 += p.x, y1 += p.y, z1 += p.z;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	Rect3T &operator-=(const Point3T<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		x0 -= p.x, y0 -= p.y, z0 -= p.z, x1 -= p.x, y1 -= p.y, z1 -= p.z;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator+(const Rect3T<t> &r, const tcg::Point3T<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(r.x0 + p.x, r.y0 + p.y, r.z0 + p.z,</t>
Toshihiro Shimizu 890ddd
						 r.x1 + p.x, r.y1 + p.y, r.z1 + p.z);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator-(const Rect3T<t> &r, const tcg::Point3T<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(r.x0 - p.x, r.y0 - p.y, r.z0 - p.z,</t>
Toshihiro Shimizu 890ddd
						 r.x1 - p.x, r.y1 - p.y, r.z1 - p.z);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator+(const tcg::Point3T<t> &p, const Rect3T<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(p.x + r.x0, p.x + r.y0, p.x + r.z0,</t>
Toshihiro Shimizu 890ddd
						 p.x + r.x1 + p.x, r.y1, p.x + r.z1);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator-(const tcg::Point3T<t> &p, const Rect3T<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(p.x - r.x0, p.y - r.y0, p.z - r.z0,</t>
Toshihiro Shimizu 890ddd
						 p.x - r.x1, p.y - r.y1, p.z - r.z1);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	template <typename k=""></typename>
Toshihiro Shimizu 890ddd
	Rect3T &operator*=(K k)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		x0 *= k, y0 *= k, z0 *= k, x1 *= k, y1 *= k, z1 *= k;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	template <typename k=""></typename>
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator*(const Rect3T<t> &r, K k)</t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(r.x0 * k, r.y0 * k, r.z0 * k,</t>
Toshihiro Shimizu 890ddd
						r.x1 * k, r.y1 * k, r.z1 * k);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	template <typename k=""></typename>
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator*(K k, const Rect3T<t> &r)</t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return RectT<t>(k * r.x0, k * r.y0, k * r.z0,</t>
Toshihiro Shimizu 890ddd
						k * r.x1, k * r.y1, k * r.z1);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Rect3T &operator|=(const Rect3T &other)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (x0 > other.x0)
Toshihiro Shimizu 890ddd
			x0 = other.x0;
Toshihiro Shimizu 890ddd
		if (y0 > other.y0)
Toshihiro Shimizu 890ddd
			y0 = other.y0;
Toshihiro Shimizu 890ddd
		if (z0 > other.z0)
Toshihiro Shimizu 890ddd
			z0 = other.z0;
Toshihiro Shimizu 890ddd
		if (x1 < other.x1)
Toshihiro Shimizu 890ddd
			x1 = other.x1;
Toshihiro Shimizu 890ddd
		if (y1 < other.y1)
Toshihiro Shimizu 890ddd
			y1 = other.y1;
Toshihiro Shimizu 890ddd
		if (z1 < other.z1)
Toshihiro Shimizu 890ddd
			z1 = other.z1;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Rect3T &operator&=(const Rect3T &other)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (x0 < other.x0)
Toshihiro Shimizu 890ddd
			x0 = other.x0;
Toshihiro Shimizu 890ddd
		if (y0 < other.y0)
Toshihiro Shimizu 890ddd
			y0 = other.y0;
Toshihiro Shimizu 890ddd
		if (z0 < other.z0)
Toshihiro Shimizu 890ddd
			z0 = other.z0;
Toshihiro Shimizu 890ddd
		if (x1 > other.x1)
Toshihiro Shimizu 890ddd
			x1 = other.x1;
Toshihiro Shimizu 890ddd
		if (y1 > other.y1)
Toshihiro Shimizu 890ddd
			y1 = other.y1;
Toshihiro Shimizu 890ddd
		if (z1 > other.z1)
Toshihiro Shimizu 890ddd
			z1 = other.z1;
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Rect3T &operator|=(const Point3T<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return operator|=(RectT(p.x, p.y, p.z, p.x, p.y, p.z));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	Rect3T &operator&=(const Point3T<t> &p)</t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return operator&=(RectT(p.x, p.y, p.z, p.x, p.y, p.z));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator|(const Rect3T<t> &a, const Rect3T<t> &b)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(a) |= b;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator&(const Rect3T<t> &a, const Rect3T<t> &b)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(a) &= b;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator|(const Rect3T<t> &r, const Point3T<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(r) |= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator&(const Rect3T<t> &r, const Point3T<t> &p)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(r) &= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator|(const Point3T<t> &p, const Rect3T<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(r) |= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	friend Rect3T<t> operator&(const Point3T<t> &p, const Rect3T<t> &r)</t></t></t>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return Rect3T<t>(r) &= p;</t>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef Rect3T<double> Rect3D;</double>
Toshihiro Shimizu 890ddd
typedef Rect3T<int> Rect3I;</int>
Toshihiro Shimizu 890ddd
typedef RectI Rect;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} // namespace tcg
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // TCG_RECT_H