36 auto weightedCenter = origin *
Kilogram;
38 const auto density = arg.density;
40 std::for_each(begin(arg.children), end(arg.children),
42 const auto dp = ch.GetDistanceProxy();
43 const auto md = playrho::d2::GetMassData(ch.GetVertexRadius(), density,
44 Span<const Length2>(begin(dp.GetVertices()), dp.GetVertexCount()));
45 mass += Mass{md.mass};
46 weightedCenter += md.center *
Mass{md.mass};
50 const auto center = (mass > 0_kg)? weightedCenter / mass: origin;
57 assert(!
empty(vertices) &&
size(vertices) < std::numeric_limits<VertexCounter>::max());
61 auto normals = std::vector<UnitVec>();
65 for (
auto i = decltype(count){0}; i < count; ++i)
68 const auto edge = vertices[nextIndex] - vertices[i];
77 return ConvexHull{vertices, normals, vertexRadius};
84 for (
const auto& v: vertices)
88 *
this = Get(newPoints, vertexRadius);
95 children.emplace_back(ConvexHull::Get(pointSet, vertexRadius));
101 std::for_each(begin(children), end(children), [=](
ConvexHull& child){