forked from falvaro/seshat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
online.h
146 lines (110 loc) · 3.28 KB
/
online.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*Copyright 2014 Francisco Alvaro
This file is part of SESHAT.
SESHAT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SESHAT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SESHAT. If not, see <http://www.gnu.org/licenses/>.
This file is a modification of the online features original software
covered by the following copyright and permission notice:
*/
/*
Copyright (C) 2006,2007 Moisés Pastor <mpastorg@dsic.upv.es>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <math.h>
#include <values.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
//Real point
class PointR {
// True if this is the last point of a stroke
bool point_pu;
public:
float x, y;
PointR(float _x, float _y) : x(_x), y(_y), point_pu(false) {
}
PointR & operator=(const PointR & p) {
x = p.x;
y = p.y;
point_pu = p.point_pu;
return *this;
}
bool operator==(const PointR & p) const {
return p.x == x && p.y == y;
}
bool operator!=(const PointR & p) const {
return p.x != x || p.y != y;
}
void setpu() {
point_pu = 1;
}
bool getpu() {
return point_pu;
}
};
//Integer point
class Point {
// True if this is the last point of a stroke
bool point_pu;
public:
int x, y;
Point(int _x, int _y) : x(_x), y(_y), point_pu(false) {
}
Point & operator=(const Point & p) {
x = p.x;
y = p.y;
point_pu = p.point_pu;
return *this;
}
bool operator==(const Point & p) const {
return p.x == x && p.y == y;
}
bool operator!=(const Point & p) const {
return p.x != x || p.y != y;
}
void setpu() {
point_pu = 1;
}
bool getpu() {
return point_pu;
}
};
class stroke {
public:
int n_points;
bool pen_down;
bool is_hat;
vector<Point> points;
stroke(int n_p = 0, bool pen_d = 0, bool is_ht = 0);
int F_XMIN();
int F_XMAX();
int F_XMED();
};
class sentence {
public:
int n_strokes;
vector<stroke> strokes;
sentence(int n_s);
sentence * anula_rep_points();
sentence * suaviza_traza(int cont_size = 2);
};