61 #include "DGtal/shapes/Shapes.h"
62 #include "DGtal/io/boards/Board2D.h"
63 #include "DGtal/io/Color.h"
64 #include "DGtal/geometry/volumes/DigitalConvexity.h"
65 #include "DGtal/geometry/volumes/NeighborhoodConvexityAnalyzer.h"
66 #include "DGtal/helpers/Shortcuts.h"
67 #include "ConfigExamples.h"
73 using namespace DGtal;
87 const string & tableName,
90 out <<
"const bool " << tableName <<
"[ " << map.size() <<
" ] = { ";
91 for (
auto it = map.cbegin(), it_end = map.cend();
96 if ( it != it_end ) out <<
", ";
98 out <<
" };" << std::endl;
107 Point p1 = Point::diagonal( -1 );
108 Point p2 = Point::diagonal( 1 );
109 Point c = Point::diagonal( 0 );
112 Point q1 = Point::diagonal( -1 );
113 Point q2 = Point::diagonal( 4*16-1 );
114 Domain fullDomain( q1, q2 );
116 unsigned int cfg = 0;
117 for (
unsigned int y = 0; y < 16; ++y )
118 for (
unsigned int x = 0; x < 16; ++x, ++cfg )
120 bool simple = map[ cfg ];
121 Point base( x*4, y*4 );
122 unsigned int mask = 1;
126 Point q = base + (*it);
132 Color( 30, 128, 30 ) )
134 Color( 128, 30, 30 ) ) );
139 Color( 200, 255, 200 ) )
141 Color( 255, 200, 200 ) ) );
144 bool in_cfg = cfg & mask;
145 bool display = complement ? ( ! in_cfg ) : in_cfg;
151 Color( 10, 255, 10 ) )
153 Color( 255, 10, 10 ) ) );
159 Color( 245, 255, 245 ) )
161 Color( 255, 245, 245 ) ) );
170 int main(
int argc,
char** argv )
172 DConv dconv( Point::diagonal( -5 ), Point::diagonal( 5 ) );
179 Point p1 = Point::diagonal( -1 );
180 Point p2 = Point::diagonal( 1 );
181 Point c = Point::diagonal( 0 );
183 unsigned int cfg = 0;
185 K.
init( p1, p2,
true );
188 for (
unsigned int y = 0; y < 16; ++y )
189 for (
unsigned int x = 0; x < 16; ++x )
192 std::vector< Point > Xwith;
193 std::vector< Point > Xwithout;
195 unsigned int mask = 1;
201 image.setValue( p, cfg & mask );
211 table_with [ cfg ] = full_with;
212 table_without [ cfg ] = full_without;
213 table_cwith [ cfg ] = full_cwith;
214 table_cwithout[ cfg ] = full_cwithout;
220 for ( cfg = 0; cfg < 256; cfg++ )
221 table_regular[ cfg ] = table_with[ cfg ] && table_without[ 255 - cfg ];
222 ConfigMap table_collapsible( 256,
false );
223 for ( cfg = 0; cfg < 256; cfg++ )
224 table_collapsible[ cfg ] = table_with[ cfg ] && table_without[ cfg ]
231 board.
saveEPS(
"table-fcvx-with-center.eps" );
236 board.
saveEPS(
"table-fcvx-without-center.eps" );
241 board.
saveEPS(
"table-complementary-fcvx-with-center.eps" );
246 board.
saveEPS(
"table-complementary-fcvx-without-center.eps" );
251 board.
saveEPS(
"table-fcvx-regular.eps" );
256 board.
saveEPS(
"table-fcvx-collapsible.eps" );
260 ofstream out(
"table-fcvx.cpp" );
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
const ConstIterator & end() const
const ConstIterator & begin() const
std::string className() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: A class that models a neighborhood and that provides services to analyse the convexity properti...
bool isComplementaryFullyConvex(bool with_center)
bool isFullyConvex(bool with_center)
void setCenter(Point c, const PointPredicate &X)
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
void beginBlock(const std::string &keyword="")
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
NeighborhoodConvexityAnalyzer< KSpace, 1 > NCA1
DigitalConvexity< KSpace > DConv
int main(int argc, char **argv)
std::vector< bool > ConfigMap
void displaySimplicityTable(Board2D &board, const ConfigMap &map, bool complement, bool with)
void outputTableAsArray(ostream &out, const string &tableName, const ConfigMap &map)
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
void display(ostream &out, const AContainer &C)