#ifndef MSP_GEOMETRY_SURFACEPOINT_H_
#define MSP_GEOMETRY_SURFACEPOINT_H_
+#include <algorithm>
#include <msp/linal/vector.h>
namespace Msp {
namespace Geometry {
+/**
+A point on the surface of a shape.
+*/
template<typename T, unsigned N>
struct SurfacePoint
{
LinAl::Vector<T, N> position;
LinAl::Vector<T, N> normal;
+ T distance;
+ bool entry;
};
+template<typename T, unsigned N>
+void sort_points(SurfacePoint<T, N> *points, unsigned size)
+{
+ for(unsigned i=0; i<size; ++i)
+ {
+ unsigned n = i;
+ for(unsigned j=i+1; j<size; ++j)
+ if(points[j].distance<points[n].distance)
+ n = j;
+ if(n!=i)
+ std::swap(points[i], points[n]);
+ }
+}
+
} // namespace Geometry
} // namespace Msp