-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurve.cpp
67 lines (59 loc) · 845 Bytes
/
curve.cpp
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
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <cmath>
#include <iostream>
#include <fstream>
using namespace std;
class Point
{
public:
float x;
float y;
Point () {
x = 0.0;
y = 0.0;
}
Point& operator=(Point const &rhs) {
this->x = rhs.x;
this->y = rhs.y;
return *this;
}
bool operator==(Point const &rhs) {
return this->x == rhs.x && this->y == rhs.y;
}
Point operator+(Point const &rhs) {
this->x += rhs.x;
this->y += rhs.y;
return *this;
}
};
class Curve
{
public:
int ptNum;
int id;
int type;
int res;
int k;
float r;
float g;
float b;
int stroke;
vector<Point> pts;
vector<float> knots;
Curve() {
id = -1;
type = -1;
ptNum = 0;
res = 10;
k = 3;
r = 0;
g = 0;
b = 0;
stroke = 1;
}
bool operator==(Curve const &rhs) {
return this->id == rhs.id;
}
};