44 lines
821 B
C++
Executable File
44 lines
821 B
C++
Executable File
//
|
|
// Math.hpp
|
|
// amoeba
|
|
//
|
|
// Created by Timothy Prepscius on 12/30/16.
|
|
// Copyright © 2016 Timothy Prepscius. All rights reserved.
|
|
//
|
|
|
|
#include "Sphere3.hpp"
|
|
#include "GTE_convert.hpp"
|
|
|
|
#define GTE_NO_LOGGER
|
|
#include <Mathematics/MinimumVolumeSphere3.h>
|
|
#include <Mathematics/ContSphere3.h>
|
|
|
|
|
|
namespace tjp {
|
|
namespace core {
|
|
namespace math {
|
|
|
|
|
|
Sphere3r minimumBoundingSphere(const Vector<math::Vector3r> &translates_)
|
|
{
|
|
if (translates_.empty())
|
|
return Sphere3r::Zero;
|
|
|
|
std::vector<gte::Vector3<Real>> translates;
|
|
|
|
for (auto &p : translates_)
|
|
translates.push_back(gte_c(p));
|
|
|
|
gte::Sphere3<Real> sphere;
|
|
gte::MinimumVolumeSphere3<Real, Real> generator;
|
|
generator(static_cast<int>(translates.size()), translates.data(), sphere);
|
|
|
|
return gte_c(sphere);
|
|
}
|
|
|
|
|
|
} // namespace
|
|
} // namespace
|
|
} // namespace
|
|
|