Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <complex>
- #include <iomanip>
- using namespace std;
- typedef complex<double> point;
- const int maxn = 200;
- const double pi = acos(-1);
- int n, n1, n2;
- point a, b, center;
- double r;
- point ans[maxn];
- void calc();
- void rot();
- int main() {
- ios :: sync_with_stdio(false);
- cin >> n >> n1 >> n2;
- n1--, n2--;
- double x, y;
- cin >> x >> y;
- a = point(x, y);
- cin >> x >> y;
- b = point(x, y);
- if (a == b) {
- for (int i = 0; i < n; i++)
- cout << real(a) << " " << imag(a) << '\n';
- return 0;
- }
- calc();
- a -= center;
- for (int i = 0; i < n; i++) {
- ans[n1] = a + center;
- rot();
- n1--;
- if (n1 < 0)
- n1 += n;
- }
- for (int i = 0; i < n; i++)
- cout << setprecision(6) << fixed << real(ans[i]) << " " << imag(ans[i]) << '\n';
- return 0;
- }
- void calc() {
- double dis = abs(b - a);
- double z = (2 * pi) / n;
- z *= (max(n2, n1) - min(n2, n1));
- z /= 2;
- r = dis / sin(z);
- r /= 2;
- z *= 2;
- //if (z > pi)
- // swap(a, b), c = true;
- z = (z - pi) / 2;
- double len = r / dis;
- center = (b - a) * point(len * cos(z), len * sin(z)) + a;
- }
- void rot() {
- double z = (2 * pi) / n;
- a = a * point(cos(z), sin(z));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement