File indexing completed on 2025-11-30 09:40:27
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "actsvg/core.hpp"
0012
0013 namespace actsvg {
0014
0015 namespace display {
0016
0017
0018
0019
0020
0021
0022 static inline point2 annulusCircleIx(scalar O_x, scalar O_y, scalar r,
0023 scalar phi) {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 scalar m = std::tan(phi);
0035 point2 dir = {std::cos(phi), std::sin(phi)};
0036 scalar x1 = static_cast<scalar>(
0037 (O_x + O_y * m -
0038 std::sqrt(-std::pow(O_x, 2) * std::pow(m, 2) + 2 * O_x * O_y * m -
0039 std::pow(O_y, 2) + std::pow(m, 2) * std::pow(r, 2) +
0040 std::pow(r, 2))) /
0041 (std::pow(m, 2) + 1));
0042 scalar x2 = static_cast<scalar>(
0043 (O_x + O_y * m +
0044 std::sqrt(-std::pow(O_x, 2) * std::pow(m, 2) + 2 * O_x * O_y * m -
0045 std::pow(O_y, 2) + std::pow(m, 2) * std::pow(r, 2) +
0046 std::pow(r, 2))) /
0047 (std::pow(m, 2) + 1));
0048
0049 point2 v1 = {x1, m * x1};
0050 if (v1[0] * dir[0] + v1[1] * dir[1] > 0) {
0051 return v1;
0052 }
0053 return {x2, m * x2};
0054 };
0055
0056 }
0057 }