line_ray.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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
29#pragma once
30
31namespace clan
32{
35
36 template<typename Type>
37 class LineRay2x;
38
39 template<typename Type>
40 class LineRay3x;
41
42 template<typename Type>
43 class Vec2;
44
45 template<typename Type>
46 class Vec3;
47
48 class Angle;
49
54 template<typename Type>
56 {
57 public:
60
61 // \brief Direction of the ray
63
64 LineRay3x() : p(), v() {}
65 LineRay3x(const LineRay3x<Type> &copy) : p(copy.p), v(copy.v) {}
66 LineRay3x(const Vec3<Type> &point_p, const Vec3<Type> &direction_v) : p(point_p), v(direction_v) {}
67
69 LineRay3x<Type> &operator = (const LineRay3x<Type>& copy) { p = copy.p; v = copy.v; return *this; }
70
72 bool operator == (const LineRay3x<Type>& line) const { return ((p == line.p) && (v == line.v)); }
73
75 bool operator != (const LineRay3x<Type>& line) const { return ((p != line.p) || (v != line.v)); }
76 };
77
82 template<typename Type>
84 {
85 public:
88
89 // \brief Direction of the ray
91
92 LineRay2x() : p(), v() {}
93 LineRay2x(const LineRay2x<Type> &copy) : p(copy.p), v(copy.v) {}
94 LineRay2x(const Vec2<Type> &point_p, const Vec2<Type> &direction_v) : p(point_p), v(direction_v) {}
95
97 LineRay2x<Type> &operator = (const LineRay2x<Type>& copy) { p = copy.p; v = copy.v; return *this; }
98
100 bool operator == (const LineRay2x<Type>& line) const { return ((p == line.p) && (v == line.v)); }
101
103 bool operator != (const LineRay2x<Type>& line) const { return ((p != line.p) || (v != line.v)); }
104 };
105
109 class LineRay2 : public LineRay2x<int>
110 {
111 public:
112 LineRay2() : LineRay2x<int>() {}
113 LineRay2(const LineRay2x<int> &copy) : LineRay2x<int>(copy) {}
114 LineRay2(const Vec2<int> &point_p, const Vec2<int> &direction_v) : LineRay2x<int>(point_p, direction_v) {}
115 };
116
120 class LineRay2f : public LineRay2x<float>
121 {
122 public:
123 LineRay2f() : LineRay2x<float>() {}
124 LineRay2f(const LineRay2x<float> &copy) : LineRay2x<float>(copy) {}
125 LineRay2f(const Vec2<float> &point_p, const Vec2<float> &direction_v) : LineRay2x<float>(point_p, direction_v) {}
126 };
127
131 class LineRay2d : public LineRay2x<double>
132 {
133 public:
134 LineRay2d() : LineRay2x<double>() {}
135 LineRay2d(const LineRay2x<double> &copy) : LineRay2x<double>(copy) {}
136 LineRay2d(const Vec2<double> &point_p, const Vec2<double> &direction_v) : LineRay2x<double>(point_p, direction_v) {}
137 };
138
142 class LineRay3 : public LineRay3x<int>
143 {
144 public:
145 LineRay3() : LineRay3x<int>() {}
146 LineRay3(const LineRay3x<int> &copy) : LineRay3x<int>(copy) {}
147 LineRay3(const Vec3<int> &point_p, const Vec3<int> &direction_v) : LineRay3x<int>(point_p, direction_v) {}
148 };
149
153 class LineRay3f : public LineRay3x<float>
154 {
155 public:
156 LineRay3f() : LineRay3x<float>() {}
157 LineRay3f(const LineRay3x<float> &copy) : LineRay3x<float>(copy) {}
158 LineRay3f(const Vec3<float> &point_p, const Vec3<float> &direction_v) : LineRay3x<float>(point_p, direction_v) {}
159 };
160
164 class LineRay3d : public LineRay3x<double>
165 {
166 public:
167 LineRay3d() : LineRay3x<double>() {}
168 LineRay3d(const LineRay3x<double> &copy) : LineRay3x<double>(copy) {}
169 LineRay3d(const Vec3<double> &point_p, const Vec3<double> &direction_v) : LineRay3x<double>(point_p, direction_v) {}
170 };
171
173}
2D line ray - Integer
Definition line_ray.h:110
LineRay2(const LineRay2x< int > &copy)
Definition line_ray.h:113
LineRay2(const Vec2< int > &point_p, const Vec2< int > &direction_v)
Definition line_ray.h:114
LineRay2()
Definition line_ray.h:112
2D line ray - Double
Definition line_ray.h:132
LineRay2d()
Definition line_ray.h:134
LineRay2d(const LineRay2x< double > &copy)
Definition line_ray.h:135
LineRay2d(const Vec2< double > &point_p, const Vec2< double > &direction_v)
Definition line_ray.h:136
2D line ray - Float
Definition line_ray.h:121
LineRay2f(const LineRay2x< float > &copy)
Definition line_ray.h:124
LineRay2f(const Vec2< float > &point_p, const Vec2< float > &direction_v)
Definition line_ray.h:125
LineRay2f()
Definition line_ray.h:123
2D line ray
Definition line_ray.h:84
bool operator!=(const LineRay2x< Type > &line) const
!= operator.
Definition line_ray.h:103
LineRay2x(const LineRay2x< Type > &copy)
Definition line_ray.h:93
bool operator==(const LineRay2x< Type > &line) const
== operator.
Definition line_ray.h:100
Vec2< Type > v
Definition line_ray.h:90
LineRay2x()
Definition line_ray.h:92
LineRay2x< Type > & operator=(const LineRay2x< Type > &copy)
= operator.
Definition line_ray.h:97
Vec2< Type > p
Start point on the line ray.
Definition line_ray.h:87
LineRay2x(const Vec2< Type > &point_p, const Vec2< Type > &direction_v)
Definition line_ray.h:94
3D line ray - Integer
Definition line_ray.h:143
LineRay3()
Definition line_ray.h:145
LineRay3(const Vec3< int > &point_p, const Vec3< int > &direction_v)
Definition line_ray.h:147
LineRay3(const LineRay3x< int > &copy)
Definition line_ray.h:146
3D line ray - Double
Definition line_ray.h:165
LineRay3d(const Vec3< double > &point_p, const Vec3< double > &direction_v)
Definition line_ray.h:169
LineRay3d(const LineRay3x< double > &copy)
Definition line_ray.h:168
LineRay3d()
Definition line_ray.h:167
3D line ray - Float
Definition line_ray.h:154
LineRay3f(const LineRay3x< float > &copy)
Definition line_ray.h:157
LineRay3f(const Vec3< float > &point_p, const Vec3< float > &direction_v)
Definition line_ray.h:158
LineRay3f()
Definition line_ray.h:156
3D line ray
Definition line_ray.h:56
LineRay3x(const Vec3< Type > &point_p, const Vec3< Type > &direction_v)
Definition line_ray.h:66
LineRay3x(const LineRay3x< Type > &copy)
Definition line_ray.h:65
LineRay3x()
Definition line_ray.h:64
bool operator!=(const LineRay3x< Type > &line) const
!= operator.
Definition line_ray.h:75
bool operator==(const LineRay3x< Type > &line) const
== operator.
Definition line_ray.h:72
Vec3< Type > v
Definition line_ray.h:62
Vec3< Type > p
Start point on the line ray.
Definition line_ray.h:59
LineRay3x< Type > & operator=(const LineRay3x< Type > &copy)
= operator.
Definition line_ray.h:69
2D vector
Definition vec2.h:76
3D vector
Definition vec3.h:75
Definition clanapp.h:36