20 #ifndef PLAYRHO_COLLISION_DISTANCEPROXY_HPP
21 #define PLAYRHO_COLLISION_DISTANCEPROXY_HPP
70 #ifndef IMPLEMENT_DISTANCEPROXY_WITH_BUFFERS
71 m_vertices{copy.m_vertices},
72 m_normals{copy.m_normals},
74 m_count{copy.m_count},
75 m_vertexRadius{copy.m_vertexRadius}
77 #ifdef IMPLEMENT_DISTANCEPROXY_WITH_BUFFERS
78 const auto count = copy.m_count;
79 std::copy(copy.m_vertices, copy.m_vertices + count, m_vertices);
80 std::copy(copy.m_normals, copy.m_normals + count, m_normals);
106 #ifndef IMPLEMENT_DISTANCEPROXY_WITH_BUFFERS
107 m_vertices{vertices},
111 m_vertexRadius{vertexRadius}
113 assert(vertexRadius >= 0_m);
115 assert(count < 1 || vertices);
116 assert(count < 2 || normals);
117 #ifdef IMPLEMENT_DISTANCEPROXY_WITH_BUFFERS
120 std::copy(vertices, vertices + count, m_vertices);
124 std::copy(normals, normals + count, m_normals);
136 return {m_vertices, m_vertices + m_count};
142 return {m_normals, m_normals + m_count};
167 assert(index < m_count);
168 return *(m_vertices + index);
175 assert(index < m_count);
176 return *(m_normals + index);
180 #ifdef IMPLEMENT_DISTANCEPROXY_WITH_BUFFERS
184 const Length2* m_vertices =
nullptr;
185 const UnitVec* m_normals =
nullptr;
195 bool operator== (
const DistanceProxy& lhs,
const DistanceProxy& rhs) noexcept;
201 return !(lhs == rhs);
207 return arg.GetVertexRadius();
223 using VT =
typename T::value_type;
224 using OT = decltype(VT{} * 0_m);
227 auto maxValue = -std::numeric_limits<OT>::infinity();
229 for (
const auto& vertex: proxy.GetVertices())
231 const auto value =
Dot(vertex, dir);
232 if (maxValue < value)
259 #endif // PLAYRHO_COLLISION_DISTANCEPROXY_HPP