void MouseHandler::Build2DEllipse(string nameOfAlgo, IEllipsoidBuilder* builder, bool toDraw)
{
	Window* window = Window::Create();
	if (toDraw == true && (nameOfAlgo != Rublev && nameOfAlgo != Petunin)) toDraw = false;

	if (window->vertexes->size() < 3) return;
	Ellipsoid2D* el;

	vector<Point2D>* conv = NULL;
	if (nameOfAlgo == GeneticMatrix || nameOfAlgo == Khachiyan) conv = ConvHull(*window->vertexes);

	vector<Point2D> points;
	if (conv != NULL) points = (*conv);
	else points = *window->vertexes;

	if (toDraw) el = builder->Exec(points, window);
	else el = builder->Exec(points);

	DrawEvent* draw = new DrawEvent();
	draw->add(window->vertexes);
	if (el != NULL)
	{
		el->SetColor(Color(0.0f, 1.0f, 0.0f));
		draw->add(1, el);
	}
	window->AddNewDrawEvent(draw);
	delete draw; draw = NULL;

	WriteResultsToFile("Resources/Output Data.txt", nameOfAlgo, el);

	delete el; el = NULL;
}