line_ray.h Source File - ClanLib SDK
Description: line_ray.h Source File

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>
55 class LineRay3x
56 {
57 public:
59 Vec3<Type> p;
60
61 // \brief Direction of the ray
62 Vec3<Type> v;
63
64 LineRay3x() : p(), v() {}
65 LineRay3x(const LineRay3x<Type> &copy) = default;
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) = default;
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>
83 class LineRay2x
84 {
85 public:
87 Vec2<Type> p;
88
89 // \brief Direction of the ray
90 Vec2<Type> v;
91
92 LineRay2x() : p(), v() {}
93 LineRay2x(const LineRay2x<Type> &copy) = default;
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) = default;
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}
clan::Angle
Angle class.
Definition angle.h:60
clan::LineRay2::LineRay2
LineRay2(const LineRay2x< int > &copy)
Definition line_ray.h:113
clan::LineRay2::LineRay2
LineRay2(const Vec2< int > &point_p, const Vec2< int > &direction_v)
Definition line_ray.h:114
clan::LineRay2::LineRay2
LineRay2()
Definition line_ray.h:112
clan::LineRay2d::LineRay2d
LineRay2d()
Definition line_ray.h:134
clan::LineRay2d::LineRay2d
LineRay2d(const LineRay2x< double > &copy)
Definition line_ray.h:135
clan::LineRay2d::LineRay2d
LineRay2d(const Vec2< double > &point_p, const Vec2< double > &direction_v)
Definition line_ray.h:136
clan::LineRay2f::LineRay2f
LineRay2f(const LineRay2x< float > &copy)
Definition line_ray.h:124
clan::LineRay2f::LineRay2f
LineRay2f(const Vec2< float > &point_p, const Vec2< float > &direction_v)
Definition line_ray.h:125
clan::LineRay2f::LineRay2f
LineRay2f()
Definition line_ray.h:123
clan::LineRay2x
2D line ray
Definition line_ray.h:84
clan::LineRay2x::operator=
LineRay2x< Type > & operator=(const LineRay2x< Type > &copy)=default
= operator.
clan::LineRay2x::operator!=
bool operator!=(const LineRay2x< Type > &line) const
!= operator.
Definition line_ray.h:103
clan::LineRay2x::LineRay2x
LineRay2x(const LineRay2x< Type > &copy)=default
clan::LineRay2x::operator==
bool operator==(const LineRay2x< Type > &line) const
== operator.
Definition line_ray.h:100
clan::LineRay2x::v
Vec2< Type > v
Definition line_ray.h:90
clan::LineRay2x::LineRay2x
LineRay2x()
Definition line_ray.h:92
clan::LineRay2x::p
Vec2< Type > p
Start point on the line ray.
Definition line_ray.h:87
clan::LineRay2x::LineRay2x
LineRay2x(const Vec2< Type > &point_p, const Vec2< Type > &direction_v)
Definition line_ray.h:94
clan::LineRay3::LineRay3
LineRay3()
Definition line_ray.h:145
clan::LineRay3::LineRay3
LineRay3(const Vec3< int > &point_p, const Vec3< int > &direction_v)
Definition line_ray.h:147
clan::LineRay3::LineRay3
LineRay3(const LineRay3x< int > &copy)
Definition line_ray.h:146
clan::LineRay3d::LineRay3d
LineRay3d(const Vec3< double > &point_p, const Vec3< double > &direction_v)
Definition line_ray.h:169
clan::LineRay3d::LineRay3d
LineRay3d(const LineRay3x< double > &copy)
Definition line_ray.h:168
clan::LineRay3d::LineRay3d
LineRay3d()
Definition line_ray.h:167
clan::LineRay3f::LineRay3f
LineRay3f(const LineRay3x< float > &copy)
Definition line_ray.h:157
clan::LineRay3f::LineRay3f
LineRay3f(const Vec3< float > &point_p, const Vec3< float > &direction_v)
Definition line_ray.h:158
clan::LineRay3f::LineRay3f
LineRay3f()
Definition line_ray.h:156
clan::LineRay3x
3D line ray
Definition line_ray.h:56
clan::LineRay3x::LineRay3x
LineRay3x(const Vec3< Type > &point_p, const Vec3< Type > &direction_v)
Definition line_ray.h:66
clan::LineRay3x::LineRay3x
LineRay3x(const LineRay3x< Type > &copy)=default
clan::LineRay3x::LineRay3x
LineRay3x()
Definition line_ray.h:64
clan::LineRay3x::operator=
LineRay3x< Type > & operator=(const LineRay3x< Type > &copy)=default
= operator.
clan::LineRay3x::operator!=
bool operator!=(const LineRay3x< Type > &line) const
!= operator.
Definition line_ray.h:75
clan::LineRay3x::operator==
bool operator==(const LineRay3x< Type > &line) const
== operator.
Definition line_ray.h:72
clan::LineRay3x::v
Vec3< Type > v
Definition line_ray.h:62
clan::LineRay3x::p
Vec3< Type > p
Start point on the line ray.
Definition line_ray.h:59
clan::Vec2
2D vector
Definition vec2.h:76
clan::Vec3
3D vector
Definition vec3.h:75
clan::FillMode::line
@ line
Definition graphic_context.h:79
clan
Definition clanapp.h:36