# MEC
# Description
The MEC (Minimum Enclosing Circle) namespace provides functionality for calculating the minimum enclosing circle, used to determine the smallest circular area that encompasses a set of points.
# How to Use
#include "Noble.h"
// Create a set of points
std::vector<Vector> points;
points.push_back(Vector(100, 100));
points.push_back(Vector(200, 150));
points.push_back(Vector(150, 200));
// Get the minimum circle enclosing all points
MecCircle circle = MEC::GetMec(points);
// Use the center and radius of the obtained circle
Vector center = circle.Center;
float radius = circle.Radius;
# GetMec
MecCircle GetMec(std::vector<Vector> const& points)
Calculates the minimum circle enclosing all given points.
Parameter | Type | Description |
---|---|---|
points | std::vector<Vector> const& | Collection of points to be enclosed |
// Create a set of points
std::vector<Vector> points;
points.push_back(Vector(100, 100));
points.push_back(Vector(200, 150));
points.push_back(Vector(150, 200));
// Get the minimum circle enclosing all points
MecCircle circle = MEC::GetMec(points);
# Class:MecCircle
The structure definition for the minimum enclosing circle.
MecCircle circle(Vector(150, 150), 50.0f);
# MecCircle.Center
Vector Center
The center coordinate of the minimum enclosing circle.
MecCircle circle = MEC::GetMec(points);
Vector center = circle.Center;
# MecCircle.Radius
float Radius
The radius of the minimum enclosing circle.
MecCircle circle = MEC::GetMec(points);
float radius = circle.Radius;