33#include "DGtal/helpers/StdDefs.h"
34#include "DGtal/topology/helpers/Surfaces.h"
35#include "DGtal/topology/DigitalSurface.h"
36#include "DGtal/topology/SetOfSurfels.h"
37#include "DGtal/math/MPolynomial.h"
38#include "DGtal/shapes/GaussDigitizer.h"
39#include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.h"
40#include "DGtal/shapes/implicit/ImplicitFunctionDiff1LinearCellEmbedder.h"
41#include "DGtal/io/readers/MPolynomialReader.h"
42#include "DGtal/topology/SCellsFunctors.h"
43#include "DGtal/topology/helpers/BoundaryPredicate.h"
44#include "DGtal/topology/SetOfSurfels.h"
45#include "DGtal/io/viewers/PolyscopeViewer.h"
46#include "DGtal/io/colormaps/GradientColorMap.h"
47#include <boost/math/special_functions/fpclassify.hpp>
60 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <Polynomial> <Px> <Py> <Pz> <Qx> <Qy> <Qz> <step>" << std::endl;
61 std::cerr <<
"\t - displays the boundary of a shape defined implicitly by a 3-polynomial <Polynomial>." << std::endl;
62 std::cerr <<
"\t - P and Q defines the bounding box." << std::endl;
63 std::cerr <<
"\t - step is the grid step." << std::endl;
64 std::cerr <<
"\t - You may try x^3y+xz^3+y^3z+z^3+5z or (y^2+z^2-1)^2 +(x^2+y^2-1)^3 " << std::endl;
65 std::cerr <<
"\t - See http://www.freigeist.cc/gallery.html" << std::endl;
78int main(
int argc,
char** argv )
87 for (
unsigned int i = 0; i < 3; ++i )
89 p1[ i ] = atof( argv[ 2 + i ] );
90 p2[ i ] = atof( argv[ 5 + i ] );
92 double step = atof( argv[ 8 ] );
97 std::string poly_str = argv[ 1 ];
98 std::string::const_iterator iter
99 = reader.
read( P, poly_str.begin(), poly_str.end() );
100 if ( iter != poly_str.end() )
102 std::cerr <<
"ERROR: I read only <"
103 << poly_str.substr( 0, iter - poly_str.begin() )
104 <<
">, and I built P=" << P << std::endl;
118 bool space_ok =
K.init(
domain.lowerBound(),
123 trace.error() <<
"Error in the Khamisky space construction." << std::endl;
128 MySurfelAdjacency surfAdj(
true );
135 MySetOfSurfels theSetOfSurfels(
K, surfAdj );
154 for ( std::set< SCell >::iterator it = theSetOfSurfels.begin(), it_end = theSetOfSurfels.end();
162 if ( !boost::math::isnan( a ))
176 trace.info() <<
" Min = " << minCurv << std::endl;
177 trace.info() <<
" Max = " << maxCurv << std::endl;
181 unsigned int nbSurfels = 0;
183 for ( std::set<SCell>::iterator it = theSetOfSurfels.begin(),
184 it_end = theSetOfSurfels.end();
185 it != it_end; ++it, ++nbSurfels )
193 if ( boost::math::isnan( a ))
78int main(
int argc,
char** argv ) {
…}
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
RegularPointEmbedder< Space > PointEmbedder
void attach(ConstAlias< EuclideanShape > shape)
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
double meanCurvature(const RealPoint &aPoint) const
RealPoint nearestPoint(const RealPoint &aPoint, const double accuracy=0.0001, const int maxIter=20, const double gamma=0.5) const
std::set< SCell > SurfelSet
Aim: This class converts a string polynomial expression in a multivariate polynomial.
Iterator read(Polynomial &p, Iterator begin, Iterator end)
Aim: Represents a multivariate polynomial, i.e. an element of , where K is some ring or field.
void show() override
Starts the event loop and display of elements.
PointVector< dim, double > RealPoint
static void trackBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
MyDigitalSurface::SurfelSet SurfelSet
Z3i this namespace gathers the standard of types for 3D imagery.
KhalimskySpaceND< 3, Integer > KSpace
DGtal is the top-level namespace which contains all DGtal functions and types.
Attach a property to an element.
RealPointT::Coordinate Ring
MPolynomialReader< 3, Ring > Polynomial3Reader
GaussDigitizer< Space, ImplicitShape > DigitalShape
Space::RealPoint RealPointT
ImplicitPolynomial3Shape< Space > ImplicitShape
MPolynomial< 3, Ring > Polynomial3
DigitalShape::PointEmbedder DigitalEmbedder