point.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** 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
39namespace clan
40{
43
44 class Pointf;
45 class Pointd;
46
50 template<typename Type>
51 class Pointx : public Vec2<Type>
52 {
53 public:
54 Pointx() : Vec2<Type>() {}
55 Pointx(Type x, Type y) : Vec2<Type>(x, y) {}
56 Pointx(const Pointx<Type> &p) : Vec2<Type>(p.x, p.y) {}
57 Pointx(const Vec2<Type> &p) : Vec2<Type>(p.x, p.y) {}
58 };
59
61 class Point : public Pointx<int>
62 {
63 public:
64 Point() : Pointx<int>() {}
65 Point(int x, int y) : Pointx<int>(x, y) {}
66 Point(const Pointx<int> &p) : Pointx<int>(p.x, p.y) {}
67 Point(const Vec2<int> &p) : Pointx<int>(p.x, p.y) {}
68 };
69
71 class Pointf : public Pointx<float>
72 {
73 public:
74 Pointf() : Pointx<float>() {}
75 Pointf(float x, float y) : Pointx<float>(x, y) {}
76 Pointf(const Pointx<float> &p) : Pointx<float>(p.x, p.y) {}
77 Pointf(const Vec2<float> &p) : Pointx<float>(p.x, p.y) {}
78 };
79
81 class Pointd : public Pointx<double>
82 {
83 public:
84 Pointd() : Pointx<double>() {}
85 Pointd(double x, double y) : Pointx<double>(x, y) {}
86 Pointd(const Pointx<double> &p) : Pointx<double>(p.x, p.y) {}
87 Pointd(const Vec2<double> &p) : Pointx<double>(p.x, p.y) {}
88 };
89
91}
2D (x,y) point structure - Integer
Definition: point.h:62
Point(const Vec2< int > &p)
Definition: point.h:67
Point(const Pointx< int > &p)
Definition: point.h:66
Point()
Definition: point.h:64
Point(int x, int y)
Definition: point.h:65
2D (x,y) point structure - Double
Definition: point.h:82
Pointd()
Definition: point.h:84
Pointd(const Vec2< double > &p)
Definition: point.h:87
Pointd(double x, double y)
Definition: point.h:85
Pointd(const Pointx< double > &p)
Definition: point.h:86
2D (x,y) point structure - Float
Definition: point.h:72
Pointf(const Vec2< float > &p)
Definition: point.h:77
Pointf(float x, float y)
Definition: point.h:75
Pointf()
Definition: point.h:74
Pointf(const Pointx< float > &p)
Definition: point.h:76
2D (x,y) point structure.
Definition: point.h:52
Pointx(Type x, Type y)
Definition: point.h:55
Pointx(const Pointx< Type > &p)
Definition: point.h:56
Pointx(const Vec2< Type > &p)
Definition: point.h:57
Pointx()
Definition: point.h:54
2D vector
Definition: vec2.h:76
Type y
Definition: vec2.h:81
Type x
Definition: vec2.h:80
Definition: clanapp.h:36