This documentation is automatically generated by online-judge-tools/verification-helper
#include "src/geometry/R2/class/point.hpp"
#pragma once
#include "src/geometry/R2/class/vector.hpp"
#include <vector>
namespace luz::R2 {
template < typename R >
using Point = Vector< R >;
template < typename R >
using Points = std::vector< Point< R > >;
} // namespace luz::R2
#line 2 "src/geometry/R2/class/point.hpp"
#line 2 "src/geometry/R2/class/vector.hpp"
#line 2 "src/geometry/R2/utility/equals.hpp"
#line 2 "src/geometry/R2/numbers/sign.hpp"
#line 2 "src/cpp-template/header/int-alias.hpp"
#include <cstdint>
namespace luz {
using i32 = std::int32_t;
using i64 = std::int64_t;
using i128 = __int128_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using u128 = __uint128_t;
} // namespace luz
#line 4 "src/geometry/R2/numbers/sign.hpp"
namespace luz::numbers::sign {
constexpr i32 negative = -1;
constexpr i32 zero = 0;
constexpr i32 positive = +1;
} // namespace luz::numbers::sign
#line 2 "src/geometry/R2/utility/sign.hpp"
#line 2 "src/geometry/R2/numbers/eps.hpp"
#include <cmath>
namespace luz::R2 {
long double &eps() {
static long double EPS = 1e-10;
return EPS;
}
void set_eps(long double EPS) {
eps() = EPS;
}
} // namespace luz::R2
#line 6 "src/geometry/R2/utility/sign.hpp"
namespace luz::R2 {
template < typename R >
i32 sign(R r) {
if (r < -eps()) return numbers::sign::negative;
if (r > +eps()) return numbers::sign::positive;
return numbers::sign::zero;
}
} // namespace luz::R2
#line 5 "src/geometry/R2/utility/equals.hpp"
namespace luz::R2 {
template < typename R >
bool equals(R r0, R r1) {
return sign(r1 - r0) == numbers::sign::zero;
}
} // namespace luz::R2
#line 2 "src/geometry/R2/utility/is-fp-exception.hpp"
#line 4 "src/geometry/R2/utility/is-fp-exception.hpp"
namespace luz::R2 {
template < typename R >
bool is_fp_exception(R r) {
return std::isinf(r) or std::isnan(r);
}
} // namespace luz::R2
#line 5 "src/geometry/R2/class/vector.hpp"
#include <cassert>
#include <vector>
namespace luz::R2 {
template < typename R >
class Vector {
R x_, y_;
public:
Vector(): x_(0), y_(0) {}
Vector(R x, R y): x_(x), y_(y) {
assert(not is_fp_exception(x_) and not is_fp_exception(y_));
}
R x() const {
return x_;
}
R y() const {
return y_;
}
friend bool equals(const Vector &v0, const Vector &v1) {
return equals(v0.x(), v1.x()) and equals(v0.y(), v1.y());
}
Vector &operator+=(const Vector &v) {
x_ += v.x_;
y_ += v.y_;
return *this;
}
Vector &operator-=(const Vector &v) {
x_ -= v.x_;
y_ -= v.y_;
return *this;
}
Vector operator+(const Vector &v) const {
return Vector(*this) += v;
}
Vector operator-(const Vector &v) const {
return Vector(*this) -= v;
}
Vector operator+() const {
return *this;
}
Vector operator-() const {
return Vector() - *this;
}
Vector &operator*=(const R r) {
x_ *= r;
y_ *= r;
return *this;
}
Vector &operator/=(const R r) {
x_ /= r;
y_ /= r;
return *this;
}
Vector operator*(const R r) const {
return Vector(*this) *= r;
}
Vector operator/(const R r) const {
return Vector(*this) /= r;
}
friend Vector operator*(const R r, const Vector &v) {
return Vector(v) *= r;
}
};
template < typename R >
using Vectors = std::vector< Vector< R > >;
} // namespace luz::R2
#line 4 "src/geometry/R2/class/point.hpp"
#line 6 "src/geometry/R2/class/point.hpp"
namespace luz::R2 {
template < typename R >
using Point = Vector< R >;
template < typename R >
using Points = std::vector< Point< R > >;
} // namespace luz::R2