line_ray.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Mark Page
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_core.h"
00035 
00036 template<typename Type>
00037 class CL_LineRay2x;
00038 
00039 template<typename Type>
00040 class CL_LineRay3x;
00041 
00042 template<typename Type>
00043 class CL_Vec2;
00044 
00045 template<typename Type>
00046 class CL_Vec3;
00047 
00048 class CL_Angle;
00049 
00055 template<typename Type>
00056 class CL_LineRay3x
00057 {
00058 public:
00060         CL_Vec3<Type> p;
00061 
00062         // \brief Direction of the ray
00063         CL_Vec3<Type> v;
00064 
00065         CL_LineRay3x() { }
00066         CL_LineRay3x(const CL_LineRay3x<Type> &copy) { p = copy.p; v = copy.v;}
00067         CL_LineRay3x(const CL_Vec3<Type> &point_p, const CL_Vec3<Type> &direction_v) { p = point_p; v = direction_v; }
00068 
00071 
00072 public:
00073 
00077 
00078 public:
00079 
00081         CL_LineRay3x<Type> &operator = (const CL_LineRay3x<Type>& copy) { p = copy.p; v = copy.v; return *this; }
00082 
00084         bool operator == (const CL_LineRay3x<Type>& line) const {return ((p == line.p) && (v == line.v));}
00085 
00087         bool operator != (const CL_LineRay3x<Type>& line) const {return ((p != line.p) || (v != line.v));}
00089 };
00090 
00096 template<typename Type>
00097 class CL_LineRay2x
00098 {
00099 public:
00101         CL_Vec2<Type> p;
00102 
00103         // \brief Direction of the ray
00104         CL_Vec2<Type> v;
00105 
00106         CL_LineRay2x() { }
00107         CL_LineRay2x(const CL_LineRay2x<Type> &copy) { p = copy.p; v = copy.v;}
00108         CL_LineRay2x(const CL_Vec2<Type> &point_p, const CL_Vec2<Type> &direction_v) { p = point_p; v = direction_v; }
00109 
00112 
00113 public:
00114 
00118 
00119 public:
00120 
00122         CL_LineRay2x<Type> &operator = (const CL_LineRay2x<Type>& copy) { p = copy.p; v = copy.v; return *this; }
00123 
00125         bool operator == (const CL_LineRay2x<Type>& line) const {return ((p == line.p) && (v == line.v));}
00126 
00128         bool operator != (const CL_LineRay2x<Type>& line) const {return ((p != line.p) || (v != line.v));}
00130 };
00131 
00136 class CL_LineRay2 : public CL_LineRay2x<int>
00137 {
00138 public:
00139         CL_LineRay2() : CL_LineRay2x<int>() {}
00140         CL_LineRay2(const CL_LineRay2x<int> &copy) : CL_LineRay2x<int>(copy) {}
00141         CL_LineRay2(const CL_Vec2<int> &point_p, const CL_Vec2<int> &direction_v) : CL_LineRay2x<int>(point_p, direction_v) {}
00142 
00143 };
00144 
00149 class CL_LineRay2f : public CL_LineRay2x<float>
00150 {
00151 public:
00152         CL_LineRay2f() : CL_LineRay2x<float>() {}
00153         CL_LineRay2f(const CL_LineRay2x<float> &copy) : CL_LineRay2x<float>(copy) {}
00154         CL_LineRay2f(const CL_Vec2<float> &point_p, const CL_Vec2<float> &direction_v) : CL_LineRay2x<float>(point_p, direction_v) {}
00155 
00156 };
00157 
00162 class CL_LineRay2d : public CL_LineRay2x<double>
00163 {
00164 public:
00165         CL_LineRay2d() : CL_LineRay2x<double>() {}
00166         CL_LineRay2d(const CL_LineRay2x<double> &copy) : CL_LineRay2x<double>(copy) {}
00167         CL_LineRay2d(const CL_Vec2<double> &point_p, const CL_Vec2<double> &direction_v) : CL_LineRay2x<double>(point_p, direction_v) {}
00168 
00169 };
00170 
00175 class CL_LineRay3 : public CL_LineRay3x<int>
00176 {
00177 public:
00178         CL_LineRay3() : CL_LineRay3x<int>() {}
00179         CL_LineRay3(const CL_LineRay3x<int> &copy) : CL_LineRay3x<int>(copy) {}
00180         CL_LineRay3(const CL_Vec3<int> &point_p, const CL_Vec3<int> &direction_v) : CL_LineRay3x<int>(point_p, direction_v) {}
00181 
00182 };
00183 
00188 class CL_LineRay3f : public CL_LineRay3x<float>
00189 {
00190 public:
00191         CL_LineRay3f() : CL_LineRay3x<float>() {}
00192         CL_LineRay3f(const CL_LineRay3x<float> &copy) : CL_LineRay3x<float>(copy) {}
00193         CL_LineRay3f(const CL_Vec3<float> &point_p, const CL_Vec3<float> &direction_v) : CL_LineRay3x<float>(point_p, direction_v) {}
00194 
00195 };
00196 
00201 class CL_LineRay3d : public CL_LineRay3x<double>
00202 {
00203 public:
00204         CL_LineRay3d() : CL_LineRay3x<double>() {}
00205         CL_LineRay3d(const CL_LineRay3x<double> &copy) : CL_LineRay3x<double>(copy) {}
00206         CL_LineRay3d(const CL_Vec3<double> &point_p, const CL_Vec3<double> &direction_v) : CL_LineRay3x<double>(point_p, direction_v) {}
00207 
00208 };
00209