给出两个点,找到过这两个点的等角螺线,并求出中间的螺线长
$c = \frac{b}{a}$
$p = a \times c^{\frac{\theta}{angle}}$
对弧线积分
#include <bits/stdc++.h>
using namespace std;
long double eps = 1e-;
struct Point {
long double x, y;
Point(long double _x = , long double _y = ) {
x = _x; y = _y;
}
Point operator - (const Point &b) {
return Point(x - b.x, y - b.y);
}
}a[];
long double Dot(Point &a, Point b) {
return a.x * b.x + a.y * b.y;
}
long double len(Point &a) {
return sqrt(Dot(a, a));
}
int cmp(long double x) {
if (fabs(x) < eps) return ; return eps > ? : -;
}
int main() {
for (int i = ; i <= ; ++ i) cin >> a[i].x >> a[i].y;
a[] = a[] - a[];
a[] = a[] - a[];
long double tmp = Dot(a[], a[]);
long double len1 = len(a[]), len2 = len(a[]);
if (cmp(tmp - len1 * len2) == ) {
long double ans = fabs(len1 - len2);
cout << fixed << setprecision() << ans << '\n';
return ;
}
auto sqr = [&](long double x) -> long double {
return x * x;
};
long double ang = acos(tmp / len1 / len2);
long double ans = ang * len1;
if (cmp(len1 - len2)) {
long double C = len2 / len1;
ans = (C - ) / log(C) * ans;
ans = ans * sqrt( + sqr(log(C) / ang));
}
cout << fixed << setprecision() << ans << '\n';
}