00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032 #pragma once
00033
00034 #include "../api_core.h"
00035
00036 template<typename Type>
00037 class CL_Line2x;
00038
00039 template<typename Type>
00040 class CL_Line3x;
00041
00042 template<typename Type>
00043 class CL_Rectx;
00044
00045 template<typename Type>
00046 class CL_Vec2;
00047
00048 template<typename Type>
00049 class CL_Vec3;
00050
00051 class CL_Angle;
00052
00057 template<typename Type>
00058 class CL_Line3x
00059 {
00060 public:
00061 CL_Vec3<Type> p;
00062 CL_Vec3<Type> q;
00063
00064 CL_Line3x() { }
00065 CL_Line3x(const CL_Line3x<Type> ©) { p = copy.p; q = copy.q;}
00066 CL_Line3x(const CL_Vec3<Type> &point_p, const CL_Vec3<Type> &point_q) { p = point_p; q = point_q; }
00067
00070 public:
00077 CL_Vec3<Type> get_intersection( const CL_Line3x<Type> &second, bool &intersect, Type range = (Type) 0.5 ) const;
00078
00082 public:
00084 CL_Line3x<Type> &operator = (const CL_Line3x<Type>& copy) { p = copy.p; q = copy.q; return *this; }
00085
00087 bool operator == (const CL_Line3x<Type>& line) const {return ((p == line.p) && (q == line.q));}
00088
00090 bool operator != (const CL_Line3x<Type>& line) const {return ((p != line.p) || (q != line.q));}
00092 };
00093
00098 template<typename Type>
00099 class CL_Line2x
00100 {
00101 public:
00103 CL_Vec2<Type> p;
00104
00105
00106 CL_Vec2<Type> q;
00107
00108 CL_Line2x() { }
00109 CL_Line2x(const CL_Line2x<Type> ©) { p = copy.p; q = copy.q;}
00110 CL_Line2x(const CL_Vec2<Type> &point_p, const CL_Vec2<Type> &point_q) { p = point_p; q = point_q; }
00111 CL_Line2x(const CL_Vec2<Type> &point_p, Type gradient) { p = point_p; q.x = (Type) 1; q.y = gradient; }
00112
00115 public:
00121 CL_Vec2<Type> get_intersection( const CL_Line2x<Type> &second, bool &intersect ) const;
00122
00127 Type point_right_of_line( CL_Vec2<Type> point ) const {return (q.x - p.x) * (point.y - p.y) - (point.x - p.x) * (q.y - p.y);}
00128
00132
00133 public:
00134
00138 public:
00140 CL_Line2x<Type> &operator = (const CL_Line2x<Type>& copy) { p = copy.p; q = copy.q; return *this; }
00141
00143 bool operator == (const CL_Line2x<Type>& line) const {return ((p == line.p) && (q == line.q));}
00144
00146 bool operator != (const CL_Line2x<Type>& line) const {return ((p != line.p) || (q != line.q));}
00148 };
00149
00153 class CL_Line2 : public CL_Line2x<int>
00154 {
00155 public:
00156 CL_Line2() : CL_Line2x<int>() { }
00157 CL_Line2(const CL_Line2x<int> ©) : CL_Line2x<int>(copy) { }
00158 CL_Line2(const CL_Vec2<int> &point_p, const CL_Vec2<int> &point_q) : CL_Line2x<int>(point_p, point_q) { }
00159 CL_Line2(const CL_Vec2<int> &point_p, int gradient) : CL_Line2x<int>(point_p, gradient) { }
00160 };
00161
00165 class CL_Line2f : public CL_Line2x<float>
00166 {
00167 public:
00168 CL_Line2f() : CL_Line2x<float>() { }
00169 CL_Line2f(const CL_Line2x<float> ©) : CL_Line2x<float>(copy) { }
00170 CL_Line2f(const CL_Vec2<float> &point_p, const CL_Vec2<float> &point_q) : CL_Line2x<float>(point_p, point_q) { }
00171 CL_Line2f(const CL_Vec2<float> &point_p, float gradient) : CL_Line2x<float>(point_p, gradient) { }
00172 };
00173
00177 class CL_Line2d : public CL_Line2x<double>
00178 {
00179 public:
00180 CL_Line2d() : CL_Line2x<double>() { }
00181 CL_Line2d(const CL_Line2x<double> ©) : CL_Line2x<double>(copy) { }
00182 CL_Line2d(const CL_Vec2<double> &point_p, const CL_Vec2<double> &point_q) : CL_Line2x<double>(point_p, point_q) { }
00183 CL_Line2d(const CL_Vec2<double> &point_p, double gradient) : CL_Line2x<double>(point_p, gradient) { }
00184 };
00185
00189 class CL_Line3 : public CL_Line3x<int>
00190 {
00191 public:
00192 CL_Line3() : CL_Line3x<int>() { }
00193 CL_Line3(const CL_Line3x<int> ©) : CL_Line3x<int>(copy) { }
00194 CL_Line3(const CL_Vec3<int> &point_p, const CL_Vec3<int> &point_q) : CL_Line3x<int>(point_p, point_q) { }
00195 };
00196
00200 class CL_Line3f : public CL_Line3x<float>
00201 {
00202 public:
00203 CL_Line3f() : CL_Line3x<float>() { }
00204 CL_Line3f(const CL_Line3x<float> ©) : CL_Line3x<float>(copy) { }
00205 CL_Line3f(const CL_Vec3<float> &point_p, const CL_Vec3<float> &point_q) : CL_Line3x<float>(point_p, point_q) { }
00206 };
00207
00211 class CL_Line3d : public CL_Line3x<double>
00212 {
00213 public:
00214 CL_Line3d() : CL_Line3x<double>() { }
00215 CL_Line3d(const CL_Line3x<double> ©) : CL_Line3x<double>(copy) { }
00216 CL_Line3d(const CL_Vec3<double> &podouble_p, const CL_Vec3<double> &podouble_q) : CL_Line3x<double>(podouble_p, podouble_q) { }
00217 };
00218