minor documetnation

This commit is contained in:
Krishna Vedala 2020-05-28 14:23:52 -04:00
parent c43e76286d
commit 0994e6e028
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -85,7 +85,7 @@ bool PointInCircle(const std::vector<Point> &P, const Point &Center, double R) {
* \returns radius of the circle * \returns radius of the circle
*/ */
double circle(const std::vector<Point> &P) { double circle(const std::vector<Point> &P) {
double minR = INT8_MAX; double minR = INFINITY;
double R; double R;
Point C; Point C;
Point minC; Point minC;
@ -134,6 +134,7 @@ double circle(const std::vector<Point> &P) {
for (size_t i = 0; i < P.size() - 1; i++) for (size_t i = 0; i < P.size() - 1; i++)
// for every subsequent point in the list // for every subsequent point in the list
for (size_t j = i + 1; j < P.size(); j++) { for (size_t j = i + 1; j < P.size(); j++) {
// check for diameterically opposite points
C.x = (P[i].x + P[j].x) / 2; C.x = (P[i].x + P[j].x) / 2;
C.y = (P[i].y + P[j].y) / 2; C.y = (P[i].y + P[j].y) / 2;
R = LenghtLine(C, P[i]); R = LenghtLine(C, P[i]);
@ -182,12 +183,14 @@ void test2() {
* \n Circle with * \n Circle with
* \n radius 1.821078397711709 * \n radius 1.821078397711709
* \n centre at (2.142857142857143, 1.7857142857142856) * \n centre at (2.142857142857143, 1.7857142857142856)
* @todo This test fails
*/ */
void test3() { void test3() {
std::vector<Point> Pv; std::vector<Point> Pv;
Pv.push_back(Point(0.5, 1)); Pv.push_back(Point(0.5, 1));
Pv.push_back(Point(3.5, 3)); Pv.push_back(Point(3.5, 3));
Pv.push_back(Point(2.5, 0)); Pv.push_back(Point(2.5, 0));
Pv.push_back(Point(2, 1.5));
std::cout << circle(Pv) << std::endl; std::cout << circle(Pv) << std::endl;
} }