This documentation is automatically generated by online-judge-tools/verification-helper
#include "src/real-geometry/mapping/rotate.hpp"
#pragma once
#include "src/real-geometry/class/vector.hpp"
#include <cmath>
namespace geometry {
template< typename R >
vec2d<R> rotate(const R theta, const vec2d<R> &v) {
return {std::cos(theta) * v.x() + std::sin(-theta) * v.y(),
std::sin(theta) * v.x() + std::cos(-theta) * v.y()};
}
}
#line 2 "src/real-geometry/mapping/rotate.hpp"
#line 2 "src/real-geometry/class/vector.hpp"
#include <complex>
#include <iostream>
namespace geometry {
template< typename R >
class vec2d : public std::complex< R > {
using complex = std::complex< R >;
public:
using complex::complex;
vec2d(const complex &c): complex::complex(c) {}
const R x() const { return this->real(); }
const R y() const { return this->imag(); }
friend vec2d operator*(const vec2d &v, const R &k) {
return vec2d(v.x() * k, v.y() * k);
}
friend vec2d operator*(const R &k, const vec2d &v) {
return vec2d(v.x() * k, v.y() * k);
}
friend std::istream &operator>>(std::istream &is, vec2d &v) {
R x, y;
is >> x >> y;
v = vec2d(x, y);
return is;
}
};
}
#line 4 "src/real-geometry/mapping/rotate.hpp"
#include <cmath>
namespace geometry {
template< typename R >
vec2d<R> rotate(const R theta, const vec2d<R> &v) {
return {std::cos(theta) * v.x() + std::sin(-theta) * v.y(),
std::sin(theta) * v.x() + std::cos(-theta) * v.y()};
}
}