sf::ConvexShape line(sf::Vector2f direction, const sf::Color& color, float thickness)
	{
		sf::Vector2f perpendicular = unitVector(perpendicularVector(direction)) * 0.5f * thickness;

		sf::ConvexShape line;
		line.setFillColor(color);
		line.setPointCount(4);
		line.setPoint(0, -perpendicular);
		line.setPoint(1,  perpendicular);
		line.setPoint(2, direction + perpendicular);
		line.setPoint(3, direction - perpendicular);
		
		return line;
	}
	Circle computeCircumcircle(const AdvancedTriangle& triangle)
	{
		assert(at(triangle, 0) != at(triangle, 1) && at(triangle, 0) != at(triangle, 2));
		
		// Compute midpoint of two sides
		sf::Vector2f p = 0.5f * (at(triangle, 0) + at(triangle, 1));
		sf::Vector2f q = 0.5f * (at(triangle, 0) + at(triangle, 2));
		
		// Compute perpendicular bisectors of the sides
		sf::Vector2f v = perpendicularVector(p - at(triangle, 0));
		sf::Vector2f w = perpendicularVector(q - at(triangle, 0));
	
		// Now we have the lines p + s*v and q + t*w with s and t being real numbers. The intersection is:
		sf::Vector2f intersection(
			v.x * (p.y * w.x + q.x * w.y - q.y * w.x) - p.x * v.y * w.x,
			w.y * (p.y * v.x + q.x * v.y - p.x * v.y) - q.y * v.y * w.x);
		intersection /= v.x * w.y - v.y * w.x;

		// Alternative to calculating intersection (slower):
		//	sf::Vector3f cross = crossProduct(v,w);
		//	sf::Vector2f intersection = p + v * dotProduct(crossProduct(q-p, w), cross) / squaredLength(cross);

		return Circle(intersection, squaredLength(intersection - at(triangle, 0)));
	}