37 return {
x + o.
x,
y + o.
y};
41 return {
x - o.
x,
y - o.
y};
45 return {
x * o.
x,
y * o.
y};
49 return {
x / o.
x,
y / o.
y};
72 double& operator[](
unsigned int index) {
80 std::array<double, 2> std() {
94 inline Point operator*(
double s,
const Point& v) {
95 return {s * v.
x, s * v.
y};
98 inline Point operator*(
const Point& v,
double s) {
99 return {s * v.x, s * v.y};
102 inline Point operator/(
const Point& v,
double s) {
103 return {v.x / s, v.y / s};
106 inline Point& operator*=(Point& v,
double s) {
111 inline Point& operator/=(Point& v,
double s) {
116 inline double dot(Point& a, Point& b) {
117 return a.x * b.x + a.y * b.y;
120 inline double length2(Point& p) {
121 return p.x * p.x + p.y * p.y;
125 inline double length2(Point&& p) {
126 return p.x * p.x + p.y * p.y;
129 inline double length(Point& p) {
130 if (p.x == 0.0 && p.y == 0.0)
133 return std::sqrt(p.x * p.x + p.y * p.y);
136 inline double length(Point&& p) {
137 if (p.x == 0.0 && p.y == 0.0)
140 return std::sqrt(p.x * p.x + p.y * p.y);
143 inline Point normalize(Point& a) {
144 return a / length(a);
147 inline Point normalize(Point&& a) {
148 return a / length(a);
double x
Definition: point.h:86
double data[2]
Definition: point.h:88
double y
Definition: point.h:86