5/////////////////////////////////////////////////
6template <typename Type>
7Line<Type>::Line (const sf::Vector2<Type>& begin, const sf::Vector2<Type>& end)
8 : tail (begin), head (end)
11/////////////////////////////////////////////////
12template <typename Type>
13sf::Vector2<Type> Line<Type>::direction () const
19/////////////////////////////////////////////////
20template <typename Type>
21Circle<Type>::Circle (const sf::Vector2<Type>& c, Type r)
22 : radius (r), center (c)
26/////////////////////////////////////////////////
27template<typename Type>
28constexpr sf::Vector2f centroid (const std::vector<sf::Vector2 <Type>>& vertices)
30 sf::Vector2f centroid;
31 float signedArea = 0.f;
33 for (uint32_t i = 0; i < vertices.size (); i++) {
34 auto current = sf::Vector2f (vertices[i]);
35 auto next = sf::Vector2f (vertices[(i + 1) % vertices.size()]);
36 auto a = (current.x * next.y) - (current.y * next.x);
38 centroid += (current + next) * a;
41 centroid /= (3.f * signedArea);