point.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore 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 UICore may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Kenneth Gangstoe
28 ** Harry Storbacka
29 ** Mark Page
30 */
31 
32 #pragma once
33 
34 #include "vec2.h"
35 #include "angle.h"
36 #include "origin.h"
37 #include "size.h"
38 
39 namespace uicore
40 {
41  class Pointf;
42  class Pointd;
43 
47  template<typename Type>
48  class Pointx : public Vec2<Type>
49  {
50  public:
51  Pointx() : Vec2<Type>() {}
52  Pointx(Type x, Type y) : Vec2<Type>(x, y) {}
53  Pointx(const Pointx<Type> &p) : Vec2<Type>(p.x, p.y) {}
54  Pointx(const Vec2<Type> &p) : Vec2<Type>(p.x, p.y) {}
55  };
56 
58  class Point : public Pointx<int>
59  {
60  public:
61  Point() : Pointx<int>() {}
62  Point(int x, int y) : Pointx<int>(x, y) {}
63  Point(const Pointx<int> &p) : Pointx<int>(p.x, p.y) {}
64  Point(const Vec2<int> &p) : Pointx<int>(p.x, p.y) {}
65  };
66 
68  class Pointf : public Pointx<float>
69  {
70  public:
71  Pointf() : Pointx<float>() {}
72  Pointf(float x, float y) : Pointx<float>(x, y) {}
73  Pointf(const Pointx<float> &p) : Pointx<float>(p.x, p.y) {}
74  Pointf(const Vec2<float> &p) : Pointx<float>(p.x, p.y) {}
75  };
76 
78  class Pointd : public Pointx<double>
79  {
80  public:
81  Pointd() : Pointx<double>() {}
82  Pointd(double x, double y) : Pointx<double>(x, y) {}
83  Pointd(const Pointx<double> &p) : Pointx<double>(p.x, p.y) {}
84  Pointd(const Vec2<double> &p) : Pointx<double>(p.x, p.y) {}
85  };
86 }
Pointd(double x, double y)
Definition: point.h:82
2D vector
Definition: line.h:43
2D (x,y) point structure - Float
Definition: point.h:68
Type x
Definition: vec2.h:75
Point(int x, int y)
Definition: point.h:62
2D (x,y) point structure.
Definition: point.h:48
Pointx(Type x, Type y)
Definition: point.h:52
Pointd(const Pointx< double > &p)
Definition: point.h:83
Pointf(const Vec2< float > &p)
Definition: point.h:74
Pointf(const Pointx< float > &p)
Definition: point.h:73
Pointx(const Vec2< Type > &p)
Definition: point.h:54
2D (x,y) point structure - Integer
Definition: point.h:58
Type y
Definition: vec2.h:76
Pointd(const Vec2< double > &p)
Definition: point.h:84
2D (x,y) point structure - Double
Definition: point.h:78
Pointx()
Definition: point.h:51
Pointf()
Definition: point.h:71
Point(const Vec2< int > &p)
Definition: point.h:64
Pointf(float x, float y)
Definition: point.h:72
Pointx(const Pointx< Type > &p)
Definition: point.h:53
Pointd()
Definition: point.h:81
Point()
Definition: point.h:61
Definition: Application/application.h:35
Point(const Pointx< int > &p)
Definition: point.h:63