This documentation is automatically generated by online-judge-tools/verification-helper
#include "geometry/product.hpp"#pragma once
#include "./base.hpp"
#include "./point.hpp"
namespace matumoto {
Real cross(const Point &a, const Point &b) {
return a.real() * b.imag() - a.imag() * b.real();
}
Real dot(const Point &a, const Point &b) {
return a.real() * b.real() + a.imag() * b.imag();
}
} // namespace matumoto#line 2 "geometry/product.hpp"
#line 2 "geometry/base.hpp"
#include <cmath>
namespace matumoto {
using namespace std;
using Real = double;
constexpr Real PI = M_PI;
constexpr Real EPS = 1e-9;
inline int sign(Real a) {
if (a < -EPS)
return -1;
if (a > +EPS)
return +1;
return 0;
}
inline bool equals(Real a, Real b) {
return sign(a - b) == 0;
}
} // namespace matumoto
#line 2 "geometry/point.hpp"
#line 4 "geometry/point.hpp"
#include <complex>
namespace matumoto {
using Point = complex<Real>;
istream &operator>>(istream &is, Point &p) {
Real x, y;
is >> x >> y;
p = Point(x, y);
return is;
}
ostream &operator<<(ostream &os, const Point &p) {
os << p.real() << " " << p.imag();
return os;
}
Point operator*(const Point &p, const Real &k) {
return Point(p.real() * k, p.imag() * k);
}
Point rotate_cw(const Real &radian, Point p, const Point &origin = Point(0, 0)) {
p -= origin;
Real r = cosl(radian) * p.real() + sinl(-radian) * p.imag();
Real i = sinl(radian) * p.real() + cosl(-radian) * p.imag();
p = Point(r, i);
p += origin;
return p;
}
Point rotate_ccw(const Real &radian, Point p, const Point &origin = Point(0, 0)) {
p -= origin;
Real r = cosl(radian) * p.real() + sinl(-radian) * p.real();
Real i = sinl(radian) * p.imag() + cosl(-radian) * p.imag();
p = Point(r, i);
p += origin;
return p;
}
bool equals(const Point &a, const Point &b) {
return equals(a.real(), b.real()) and equals(a.imag(), b.imag());
}
} // namespace matumoto
#line 5 "geometry/product.hpp"
namespace matumoto {
Real cross(const Point &a, const Point &b) {
return a.real() * b.imag() - a.imag() * b.real();
}
Real dot(const Point &a, const Point &b) {
return a.real() * b.real() + a.imag() * b.imag();
}
} // namespace matumoto