ClanLib  2.3.7
line_ray.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Mark Page
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_core.h"
35 
36 template<typename Type>
38 
39 template<typename Type>
41 
42 template<typename Type>
43 class CL_Vec2;
44 
45 template<typename Type>
46 class CL_Vec3;
47 
48 class CL_Angle;
49 
55 template<typename Type>
56 class CL_LineRay3x
57 {
58 public:
61 
62  // \brief Direction of the ray
64 
66  CL_LineRay3x(const CL_LineRay3x<Type> &copy) { p = copy.p; v = copy.v;}
67  CL_LineRay3x(const CL_Vec3<Type> &point_p, const CL_Vec3<Type> &direction_v) { p = point_p; v = direction_v; }
68 
71 
72 public:
73 
77 
78 public:
79 
81  CL_LineRay3x<Type> &operator = (const CL_LineRay3x<Type>& copy) { p = copy.p; v = copy.v; return *this; }
82 
84  bool operator == (const CL_LineRay3x<Type>& line) const {return ((p == line.p) && (v == line.v));}
85 
87  bool operator != (const CL_LineRay3x<Type>& line) const {return ((p != line.p) || (v != line.v));}
89 };
90 
96 template<typename Type>
97 class CL_LineRay2x
98 {
99 public:
102 
103  // \brief Direction of the ray
105 
107  CL_LineRay2x(const CL_LineRay2x<Type> &copy) { p = copy.p; v = copy.v;}
108  CL_LineRay2x(const CL_Vec2<Type> &point_p, const CL_Vec2<Type> &direction_v) { p = point_p; v = direction_v; }
109 
112 
113 public:
114 
118 
119 public:
120 
122  CL_LineRay2x<Type> &operator = (const CL_LineRay2x<Type>& copy) { p = copy.p; v = copy.v; return *this; }
123 
125  bool operator == (const CL_LineRay2x<Type>& line) const {return ((p == line.p) && (v == line.v));}
126 
128  bool operator != (const CL_LineRay2x<Type>& line) const {return ((p != line.p) || (v != line.v));}
130 };
131 
136 class CL_LineRay2 : public CL_LineRay2x<int>
137 {
138 public:
139  CL_LineRay2() : CL_LineRay2x<int>() {}
140  CL_LineRay2(const CL_LineRay2x<int> &copy) : CL_LineRay2x<int>(copy) {}
141  CL_LineRay2(const CL_Vec2<int> &point_p, const CL_Vec2<int> &direction_v) : CL_LineRay2x<int>(point_p, direction_v) {}
142 
143 };
144 
149 class CL_LineRay2f : public CL_LineRay2x<float>
150 {
151 public:
152  CL_LineRay2f() : CL_LineRay2x<float>() {}
153  CL_LineRay2f(const CL_LineRay2x<float> &copy) : CL_LineRay2x<float>(copy) {}
154  CL_LineRay2f(const CL_Vec2<float> &point_p, const CL_Vec2<float> &direction_v) : CL_LineRay2x<float>(point_p, direction_v) {}
155 
156 };
157 
162 class CL_LineRay2d : public CL_LineRay2x<double>
163 {
164 public:
165  CL_LineRay2d() : CL_LineRay2x<double>() {}
166  CL_LineRay2d(const CL_LineRay2x<double> &copy) : CL_LineRay2x<double>(copy) {}
167  CL_LineRay2d(const CL_Vec2<double> &point_p, const CL_Vec2<double> &direction_v) : CL_LineRay2x<double>(point_p, direction_v) {}
168 
169 };
170 
175 class CL_LineRay3 : public CL_LineRay3x<int>
176 {
177 public:
178  CL_LineRay3() : CL_LineRay3x<int>() {}
179  CL_LineRay3(const CL_LineRay3x<int> &copy) : CL_LineRay3x<int>(copy) {}
180  CL_LineRay3(const CL_Vec3<int> &point_p, const CL_Vec3<int> &direction_v) : CL_LineRay3x<int>(point_p, direction_v) {}
181 
182 };
183 
188 class CL_LineRay3f : public CL_LineRay3x<float>
189 {
190 public:
191  CL_LineRay3f() : CL_LineRay3x<float>() {}
192  CL_LineRay3f(const CL_LineRay3x<float> &copy) : CL_LineRay3x<float>(copy) {}
193  CL_LineRay3f(const CL_Vec3<float> &point_p, const CL_Vec3<float> &direction_v) : CL_LineRay3x<float>(point_p, direction_v) {}
194 
195 };
196 
201 class CL_LineRay3d : public CL_LineRay3x<double>
202 {
203 public:
204  CL_LineRay3d() : CL_LineRay3x<double>() {}
205  CL_LineRay3d(const CL_LineRay3x<double> &copy) : CL_LineRay3x<double>(copy) {}
206  CL_LineRay3d(const CL_Vec3<double> &point_p, const CL_Vec3<double> &direction_v) : CL_LineRay3x<double>(point_p, direction_v) {}
207 
208 };
209