Renamed parameters for better understanding
Always disambiguate radians and degree!
This commit is contained in:
parent
43f114d237
commit
4bb8528f68
|
@ -28,7 +28,6 @@
|
||||||
#include <vcg/complex/algorithms/update/topology.h>
|
#include <vcg/complex/algorithms/update/topology.h>
|
||||||
#include <vcg/complex/algorithms/refine.h>
|
#include <vcg/complex/algorithms/refine.h>
|
||||||
#include <vcg/complex/algorithms/clean.h>
|
#include <vcg/complex/algorithms/clean.h>
|
||||||
#include <vcg/simplex/face/pos.h>
|
|
||||||
#include <vcg/complex/algorithms/voronoi_processing.h>
|
#include <vcg/complex/algorithms/voronoi_processing.h>
|
||||||
#include <vcg/complex/algorithms/point_sampling.h>
|
#include <vcg/complex/algorithms/point_sampling.h>
|
||||||
#include <vcg/complex/algorithms/crease_cut.h>
|
#include <vcg/complex/algorithms/crease_cut.h>
|
||||||
|
@ -135,10 +134,10 @@ public:
|
||||||
/// \brief Remesh the main function that remeshes a mesh preserving creases.
|
/// \brief Remesh the main function that remeshes a mesh preserving creases.
|
||||||
/// \param original the mesh
|
/// \param original the mesh
|
||||||
/// \param samplingRadius is the sampling ragius for remeshing
|
/// \param samplingRadius is the sampling ragius for remeshing
|
||||||
/// \param borderCreaseAngleThreshold is the angle treshold for preserving corner points on the mesh boundary
|
/// \param borderCreaseAngleDeg is the angle treshold for preserving corner points on the mesh boundary
|
||||||
/// \return the remeshed mesh
|
/// \return the remeshed mesh
|
||||||
///
|
///
|
||||||
static inline MeshPtr Remesh(Mesh & original, const ScalarType samplingRadius, const ScalarType borderCreaseAngleThreshold = 0.0)
|
static inline MeshPtr Remesh(Mesh & original, const ScalarType samplingRadius, const ScalarType borderCreaseAngleDeg = 0.0)
|
||||||
{
|
{
|
||||||
UpdateTopology<Mesh>::FaceFace(original);
|
UpdateTopology<Mesh>::FaceFace(original);
|
||||||
UpdateFlags<Mesh>::FaceBorderFromFF(original);
|
UpdateFlags<Mesh>::FaceBorderFromFF(original);
|
||||||
|
@ -156,7 +155,7 @@ public:
|
||||||
// for closed watertight mesh try to split
|
// for closed watertight mesh try to split
|
||||||
if (Clean<Mesh>::CountHoles(original) < 1)
|
if (Clean<Mesh>::CountHoles(original) < 1)
|
||||||
{
|
{
|
||||||
CreaseCut<Mesh>(original, vcg::math::ToRad(70.0));
|
CreaseCut<Mesh>(original, vcg::math::ToRad(borderCreaseAngleDeg));
|
||||||
Allocator<Mesh>::CompactEveryVector(original);
|
Allocator<Mesh>::CompactEveryVector(original);
|
||||||
UpdateTopology<Mesh>::FaceFace(original);
|
UpdateTopology<Mesh>::FaceFace(original);
|
||||||
UpdateFlags<Mesh>::FaceBorderFromFF(original);
|
UpdateFlags<Mesh>::FaceBorderFromFF(original);
|
||||||
|
@ -169,7 +168,7 @@ public:
|
||||||
// One CC
|
// One CC
|
||||||
std::vector<MeshPtr> ccs = splitCC(original);
|
std::vector<MeshPtr> ccs = splitCC(original);
|
||||||
if (ccs.empty())
|
if (ccs.empty())
|
||||||
return RemeshOneCC(original, samplingRadius, borderCreaseAngleThreshold);
|
return RemeshOneCC(original, samplingRadius, borderCreaseAngleDeg);
|
||||||
|
|
||||||
|
|
||||||
// Multiple CCs
|
// Multiple CCs
|
||||||
|
@ -177,7 +176,7 @@ public:
|
||||||
for (size_t i=0; i<ccs.size(); i++)
|
for (size_t i=0; i<ccs.size(); i++)
|
||||||
{
|
{
|
||||||
std::cout << "Remeshing component " << (i+1) << "/" << ccs.size() << std::endl;
|
std::cout << "Remeshing component " << (i+1) << "/" << ccs.size() << std::endl;
|
||||||
ccs[i] = RemeshOneCC(*ccs[i], samplingRadius, borderCreaseAngleThreshold, i);
|
ccs[i] = RemeshOneCC(*ccs[i], samplingRadius, borderCreaseAngleDeg, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshPtr ret = std::make_shared<Mesh>();
|
MeshPtr ret = std::make_shared<Mesh>();
|
||||||
|
@ -193,10 +192,10 @@ public:
|
||||||
/// \brief RemeshOneCC the function that remeshes a single connected component mesh preserving its boundary (consistently for eventually adjacent meshes).
|
/// \brief RemeshOneCC the function that remeshes a single connected component mesh preserving its boundary (consistently for eventually adjacent meshes).
|
||||||
/// \param original the mesh
|
/// \param original the mesh
|
||||||
/// \param samplingRadius is the sampling ragius for remeshing
|
/// \param samplingRadius is the sampling ragius for remeshing
|
||||||
/// \param borderCreaseAngleThreshold is the angle treshold for preserving corner points on the mesh boundary
|
/// \param borderCreaseAngleDeg is the angle treshold for preserving corner points on the mesh boundary
|
||||||
/// \return the remeshed mesh
|
/// \return the remeshed mesh
|
||||||
///
|
///
|
||||||
static inline MeshPtr RemeshOneCC(Mesh & original, const ScalarType samplingRadius, const ScalarType borderCreaseAngleThreshold = 0.0, int idx = 0)
|
static inline MeshPtr RemeshOneCC(Mesh & original, const ScalarType samplingRadius, const ScalarType borderCreaseAngleDeg = 0.0, int idx = 0)
|
||||||
{
|
{
|
||||||
RequireCompactness(original);
|
RequireCompactness(original);
|
||||||
RequirePerFaceFlags(original);
|
RequirePerFaceFlags(original);
|
||||||
|
@ -226,11 +225,11 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// eventually split on 'creases'
|
// eventually split on 'creases'
|
||||||
if (borderCreaseAngleThreshold > 0.0)
|
if (borderCreaseAngleDeg > 0.0)
|
||||||
{
|
{
|
||||||
UpdateFlags<EdgeMeshType>::VertexClearS(em);
|
UpdateFlags<EdgeMeshType>::VertexClearS(em);
|
||||||
UpdateFlags<EdgeMeshType>::VertexClearV(em);
|
UpdateFlags<EdgeMeshType>::VertexClearV(em);
|
||||||
Clean<EdgeMeshType>::SelectCreaseVertexOnEdgeMesh(em, vcg::math::ToRad(borderCreaseAngleThreshold));
|
Clean<EdgeMeshType>::SelectCreaseVertexOnEdgeMesh(em, vcg::math::ToRad(borderCreaseAngleDeg));
|
||||||
std::cout << Clean<EdgeMeshType>::SplitSelectedVertexOnEdgeMesh(em) << " splits" << std::endl;
|
std::cout << Clean<EdgeMeshType>::SplitSelectedVertexOnEdgeMesh(em) << " splits" << std::endl;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VORO
|
#ifdef DEBUG_VORO
|
||||||
|
|
Loading…
Reference in New Issue