I get linking error while compiling that code, and I have a warning from Xcode:
Instantiation of variable 'quickhull::QuickHull::Epsilon' required here, but no definition is available
And here is the definition of the function:
namespace quickhull {
template<>
const float QuickHull<float>::Epsilon = 0.0001f;
template<>
const double QuickHull<double>::Epsilon = 0.0000001;
/*
* Implementation of the algorithm
*/
template<typename T>
ConvexHull<T> QuickHull<T>::getConvexHull(const std::vector<Vector3<T>>& pointCloud, bool CCW, bool useOriginalIndices, T epsilon) {
VertexDataSource<T> vertexDataSource(pointCloud);
return getConvexHull(vertexDataSource,CCW,useOriginalIndices,epsilon);
}
ConvexHull<FloatType> getConvexHull(const std::vector<Vector3<FloatType>>& pointCloud, bool CCW, bool useOriginalIndices, FloatType eps = Epsilon);
template<typename FloatType>
class QuickHull {
using vec3 = Vector3<FloatType>;
static const FloatType Epsilon;
ConvexHull<FloatType> getConvexHull(const VertexDataSource<FloatType>& pointCloud, bool CCW, bool useOriginalIndices, FloatType eps);
public:
// Computes convex hull for a given point cloud.
// Params:
// pointCloud: a vector of of 3D points
// CCW: whether the output mesh triangles should have CCW orientation
// useOriginalIndices: should the output mesh use same vertex indices as the original point cloud. If this is false,
// then we generate a new vertex buffer which contains only the vertices that are part of the convex hull.
// eps: minimum distance to a plane to consider a point being on positive of it (for a point cloud with scale 1)
ConvexHull<FloatType> getConvexHull(const std::vector<Vector3<FloatType>>& pointCloud, bool CCW, bool useOriginalIndices, FloatType eps = Epsilon);
}
The call
QuickHull<float> qh; // Could be double as well
hull = qh.getConvexHull(pointCloud, true, false);
Linking Error
"quickhull::QuickHull<float>::Epsilon", referenced from:
"quickhull::QuickHull<float>::getConvexHull(std::__1::vector<quickhull::Vector3<float>, std::__1::allocator<quickhull::Vector3<float> > > const&, bool, bool, float)", referenced from: