32 inline bool IsEachVertexFarEnoughApart(Span<const Length2> vertices)
34 for (
auto i = decltype(
size(vertices)){1}; i <
size(vertices); ++i)
36 const auto delta = vertices[i-1] - vertices[i];
53 const auto count =
size(vertices);
59 m_vertices = vertices;
64 void ChainShapeConf::ResetNormals()
67 if (
size(m_vertices) > std::size_t{1})
71 for (
const auto& v: m_vertices)
78 m_normals.push_back(normal);
79 m_normals.push_back(-normal);
92 std::for_each(begin(m_vertices), end(m_vertices), [=](
Length2& v){
101 if (!
empty(m_vertices))
103 auto vprev = m_vertices.back();
104 m_vertices.emplace_back(vertex);
106 m_normals.push_back(normal);
107 m_normals.push_back(-normal);
111 m_vertices.emplace_back(vertex);
131 for (
auto i = decltype(vertexCount){1}; i < vertexCount; ++i)
135 mass +=
Mass{massData.mass};
139 const auto d = v - vprev;
142 area += b * h + circle_area;
149 if (vertexCount == 1)
177 const auto halfWidth =
GetX(dimensions) /
Real{2};
178 const auto halfHeight =
GetY(dimensions) /
Real{2};
180 const auto btmLeft =
Length2(-halfWidth, -halfHeight);
181 const auto btmRight =
Length2(+halfWidth, -halfHeight);
182 const auto topLeft =
Length2(-halfWidth, +halfHeight);
183 const auto topRight =
Length2(+halfWidth, +halfHeight);
189 conf.Add(conf.GetVertex(0));
198 const auto rangeX = arg.
ranges[0];
199 const auto rangeY = arg.
ranges[1];
201 conf.Add(
Length2{rangeX.GetMax(), rangeY.GetMin()});
202 conf.Add(
Length2{rangeX.GetMax(), rangeY.GetMax()});
203 conf.Add(
Length2{rangeX.GetMin(), rangeY.GetMax()});
204 conf.Add(
Length2{rangeX.GetMin(), rangeY.GetMin()});
205 conf.Add(conf.GetVertex(0));