void mgnear::beziersBox( Box2d& box, int count, const Point2d* points, bool closed) { box.empty(); for (int i = 0; i + 3 < count; i += 3) { box.unionWith(computeCubicBox(points + i)); } if (closed && count > 3) { box.unionWith(computeCubicBox(points[count - 1], points[count - 1] * 2 - points[count - 2].asVector(), points[0] * 2 - points[1].asVector(), points[0])); } }
void mgnear::cubicSplinesBox( Box2d& box, int n, const Point2d* knots, const Vector2d* knotvs, bool closed, bool hermite) { int n2 = (closed && n > 1) ? n + 1 : n; float d = hermite ? 1.f/3.f : 1.f; box.empty(); for (int i = 0; i + 1 < n2; i++) { box.unionWith(computeCubicBox(knots[i], knots[i] + knotvs[i] * d, knots[(i + 1) % n] - knotvs[(i + 1) % n] * d, knots[(i + 1) % n])); } }