31 template <
typename Real>
33 std::vector<Vector2<Real>>&
points, std::vector<Vector2<Real>>& centers,
34 std::vector<Real>& radii);
37 template <
typename Real>
40 std::vector<Real>& radii)
42 if (numArcs < 2 || a == b)
52 points.resize(numArcs + 1);
53 centers.resize(numArcs);
54 radii.resize(numArcs);
57 Real a2 = a *
a, b2 = b *
b, ab = a *
b;
58 Real invB2mA2 = ((Real)1) / (b2 - a2);
63 points[numArcs] = { (Real)0, b };
71 Real invNumArcs = ((Real)1) / numArcs;
72 for (
int i = 1; i < numArcs; ++i)
76 Real weight1 =
static_cast<Real
>(i) * invNumArcs;
77 Real weight0 = (Real)1 - weight1;
78 Real curv = weight0 * curv0 + weight1 * curv1;
81 Real tmp = pow(ab / curv, (Real)2 / (Real)3);
82 points[i][0] = a * sqrt(fabs((tmp - a2) * invB2mA2));
83 points[i][1] = b * sqrt(fabs((tmp - b2) * invB2mA2));
98 centers[0] = circle.
center;
102 int last = numArcs - 1;
114 centers[last] = circle.
center;
115 radii[last] = circle.
radius;
118 for (
int iM = 0, i = 1, iP = 2; i < last; ++iM, ++i, ++iP)
120 Circumscribe(points[iM], points[i], points[iP], circle);
121 centers[i] = circle.
center;
GLboolean GLboolean GLboolean GLboolean a
GLfixed GLfixed GLint GLint GLfixed points
bool ApproximateEllipseByArcs(Real a, Real b, int numArcs, std::vector< Vector2< Real >> &points, std::vector< Vector2< Real >> ¢ers, std::vector< Real > &radii)
GLboolean GLboolean GLboolean b
bool Circumscribe(Vector2< Real > const &v0, Vector2< Real > const &v1, Vector2< Real > const &v2, Circle2< Real > &circle)