31#include "DGtal/base/Common.h"
32#include "ConfigTest.h"
33#include "DGtalCatch.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/helpers/Shortcuts.h"
36#include "DGtal/geometry/surfaces/ShroudsRegularization.h"
54 params(
"polynomial",
"goursat" )(
"gridstep", 1)(
"verbose", 0);
64 auto originalPos = shrouds_reg.
positions();
74 double energyInitK2 = shrouds_reg.
energy ( RegType::SQUARED_CURVATURE );
75 std::tie( loo, l2 ) = shrouds_reg.
regularize( RegType::SQUARED_CURVATURE,
77 double energyRegK2 = shrouds_reg.
energy ( RegType::SQUARED_CURVATURE );
82 REQUIRE( energyRegK2 < energyInitK2 );
86 auto regularizedPos = shrouds_reg.
positions();
88 auto polySurfPos = polySurf->positions();
89 for (
auto i = 0; i < regularizedPos.size(); i++ )
90 polySurfPos[ i ] = regularizedPos[ i ];
97 double energyInitArea= shrouds_reg.
energy ( RegType::AREA );
98 std::tie( loo, l2 ) = shrouds_reg.
regularize( RegType::AREA,
100 double energyRegArea = shrouds_reg.
energy ( RegType::AREA );
103 REQUIRE( energyRegArea < energyInitArea );
107 double energyInitSnk= shrouds_reg.
energy ( RegType::SNAKE );
108 std::tie( loo, l2 ) = shrouds_reg.
regularize( RegType::SNAKE,
110 double energyRegSnk = shrouds_reg.
energy ( RegType::SNAKE );
113 REQUIRE( energyRegSnk < energyInitSnk );
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
static CountedPtr< DigitizedImplicitShape3D > makeDigitizedImplicitShape3D(CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static CountedPtr< PolygonalSurface > makeDualPolygonalSurface(Surfel2Index &s2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
static Parameters defaultParameters()
static CountedPtr< IdxDigitalSurface > makeIdxDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static bool saveOBJ(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > digsurf, const TCellEmbedder &embedder, const RealVectors &normals, const Colors &diffuse_colors, std::string objfile, const Color &ambient_color=Color(32, 32, 32), const Color &diffuse_color=Color(200, 200, 255), const Color &specular_color=Color::White)
static CountedPtr< ImplicitShape3D > makeImplicitShape3D(const Parameters ¶ms=parametersImplicitShape3D())
Aim: Implements the Shrouds Regularization algorithm of Nielson et al .
Regularization
The enum class specifying the possible shrouds regularization.
std::pair< double, double > regularize(const Regularization reg=Regularization::SQUARED_CURVATURE, const double randomization=0.0, const double max_loo=0.0001, const int maxNb=100)
double energy(const Regularization reg=Regularization::SQUARED_CURVATURE)
RealPoints positions() const
DGtal is the top-level namespace which contains all DGtal functions and types.
TEST_CASE("Testing ShroudsRegularization")
REQUIRE(domain.isInside(aPoint))