Improved documentation, templates a point3f as coordtype, added a function for returning the sampled vector

This commit is contained in:
Paolo Cignoni 2016-12-16 23:19:37 +01:00
parent 237ff6f591
commit 6e63061a5a
1 changed files with 19 additions and 9 deletions

View File

@ -106,6 +106,11 @@ private:
bool vectorOwner; bool vectorOwner;
public: public:
std::vector<CoordType> &SampleVec()
{
return *sampleVec;
}
void AddVert(const VertexType &p) void AddVert(const VertexType &p)
{ {
sampleVec->push_back(p.cP()); sampleVec->push_back(p.cP());
@ -839,7 +844,7 @@ static void EdgeMeshUniform(MeshType &m, VertexSampler &ps, float radius, bool c
/// \brief Sample all the border corner vertices /// \brief Sample all the border corner vertices
/// ///
/// It assumes that the border flag have been set over the mesh both for vertex and for faces. /// It assumes that the border flag have been set over the mesh both for vertex and for faces.
/// All the vertices on the border where the surface forms an angle smaller than the given threshold are sampled. /// All the vertices on the border where the edges of the boundary of the surface forms an angle smaller than the given threshold are sampled.
/// ///
static void VertexBorderCorner(MeshType & m, VertexSampler &ps, float angleRad) static void VertexBorderCorner(MeshType & m, VertexSampler &ps, float angleRad)
{ {
@ -1846,9 +1851,14 @@ static void PoissonDiskPruningByNumber(VertexSampler &ps, MeshType &m,
/// This is the main function that is used to build a poisson distribuition /// This is the main function that is used to build a poisson distribuition
/// starting from a dense sample cloud. /// starting from a dense sample cloud (the montecarloMesh) by 'pruning' it.
/// Trivial approach that puts all the samples in a hashed UG and randomly choose a sample /// it puts all the samples in a hashed UG and randomly choose a sample
/// and remove all the points in the sphere centered on the chosen sample /// and remove all the points in the sphere centered on the chosen sample
///
/// You can impose some constraint: all the vertices in the montecarloMesh
/// that are marked with a bool attribute called "fixed" are surely chosen
/// (if you also set the preGenFlag option)
///
static void PoissonDiskPruning(VertexSampler &ps, MeshType &montecarloMesh, static void PoissonDiskPruning(VertexSampler &ps, MeshType &montecarloMesh,
ScalarType diskRadius, PoissonDiskParam &pp) ScalarType diskRadius, PoissonDiskParam &pp)
{ {
@ -2256,12 +2266,12 @@ void PoissonPruning(MeshType &m, // the mesh that has to be pruned
/// \brief Low level wrapper for Poisson Disk Pruning /// \brief Low level wrapper for Poisson Disk Pruning
/// ///
/// This function simply takes a mesh and a radius and returns a vector /// This function simply takes a mesh containing a point cloud to be pruned and a radius
/// of vertex pointers listing the "surviving" points. /// It returns a vector of CoordType listing the "surviving" points.
// ///
template <class MeshType> template <class MeshType>
void PoissonPruning(MeshType &m, // the mesh that has to be pruned void PoissonPruning(MeshType &m, // the mesh that has to be pruned
std::vector<Point3f> &poissonSamples, // the vector that will contain the chosen set of points std::vector<typename MeshType::CoordType> &poissonSamples, // the vector that will contain the chosen set of points
float radius, unsigned int randSeed=0) float radius, unsigned int randSeed=0)
{ {
std::vector<typename MeshType::VertexPointer> poissonSamplesVP; std::vector<typename MeshType::VertexPointer> poissonSamplesVP;