Go to the documentation of this file.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
00029
00032
00033 #pragma once
00034
00035 #include "../api_core.h"
00036 #include "vec3.h"
00037
00042 template<typename Type>
00043 class CL_Trianglex
00044 {
00045 public:
00047 CL_Vec2<Type> p;
00048
00049
00050 CL_Vec2<Type> q;
00051
00052
00053 CL_Vec2<Type> r;
00054
00055 CL_Trianglex() { }
00056 CL_Trianglex(const CL_Trianglex<Type> ©) { p = copy.p; q = copy.q; r = copy.r;}
00057 CL_Trianglex(const CL_Vec2<Type> &point_p, const CL_Vec2<Type> &point_q, const CL_Vec2<Type> &point_r) { p = point_p; q = point_q; r = point_r;}
00058
00061
00062 public:
00063
00068 bool point_inside(const CL_Vec2<Type> &point) const;
00069
00073
00074 public:
00075
00077 CL_Trianglex<Type> &operator = (const CL_Trianglex<Type>& copy) { p = copy.p; q = copy.q; r = copy.r; return *this; }
00078
00080 bool operator == (const CL_Trianglex<Type>& triangle) const {return ((p == triangle.p) && (q == triangle.q) && (r == triangle.r));}
00081
00083 bool operator != (const CL_Trianglex<Type>& triangle) const {return ((p != triangle.p) || (q != triangle.q) || (r != triangle.r));}
00085 };
00086
00090 class CL_Triangle : public CL_Trianglex<int>
00091 {
00092 public:
00093 CL_Triangle() { }
00094 CL_Triangle(const CL_Trianglex<int> ©) : CL_Trianglex<int>(copy) {}
00095 CL_Triangle(const CL_Vec2<int> &point_p, const CL_Vec2<int> &point_q, const CL_Vec2<int> &point_r) : CL_Trianglex<int>(point_p, point_q, point_r) {}
00096 };
00097
00101 class CL_Trianglef : public CL_Trianglex<float>
00102 {
00103 public:
00104 CL_Trianglef() { }
00105 CL_Trianglef(const CL_Trianglex<float> ©) : CL_Trianglex<float>(copy) {}
00106 CL_Trianglef(const CL_Vec2<float> &point_p, const CL_Vec2<float> &point_q, const CL_Vec2<float> &point_r) : CL_Trianglex<float>(point_p, point_q, point_r) {}
00107 };
00108
00112 class CL_Triangled : public CL_Trianglex<double>
00113 {
00114 public:
00115 CL_Triangled() { }
00116 CL_Triangled(const CL_Trianglex<double> ©) : CL_Trianglex<double>(copy) {}
00117 CL_Triangled(const CL_Vec2<double> &point_p, const CL_Vec2<double> &point_q, const CL_Vec2<double> &point_r) : CL_Trianglex<double>(point_p, point_q, point_r) {}
00118 };
00119
00121