46 #include "DGtal/base/Common.h"
47 #include "DGtal/helpers/StdDefs.h"
48 #include "ConfigExamples.h"
50 #include "DGtal/geometry/curves/FreemanChain.h"
51 #include "DGtal/geometry/curves/GridCurve.h"
52 #include "DGtal/geometry/volumes/DigitalConvexity.h"
54 #include "DGtal/io/boards/Board2D.h"
59 using namespace DGtal;
64 int main(
int argc,
char** argv )
67 string S = examplesPath +
"samples/contourS.fc";
70 const Point lowerBound( -200, -200 );
71 const Point upperBound( 200, 200 );
73 fstream inputStream( S.c_str(), ios::in );
78 auto points = c.getPointsRange();
79 std::vector<Point> T( points.begin(), points.end() );
81 aBoard.
setUnit(Board2D::UCentimeter);
83 auto c_cover = dconv.
makeCellCover( T.begin(), T.end(), 1, 1 );
84 const float sx = -0.5;
85 const float sy = -0.5;
87 for (
size_t i = 0; i < T.size(); ++i )
88 for (
size_t j = i+2; j < T.size(); ++j )
93 auto triangle = dconv.
makeSimplex( { T[i], T[j], T[k] } );
96 aBoard.
drawLine( sx+(
float)T[i][0], sy+(float)T[i][1],
97 sx+(
float)T[j][0], sy+(float)T[j][1] );
98 aBoard.
drawLine( sx+(
float)T[i][0], sy+(float)T[i][1],
99 sx+(
float)T[k][0], sy+(float)T[k][1] );
100 aBoard.
drawLine( sx+(
float)T[k][0], sy+(float)T[k][1],
101 sx+(
float)T[j][0], sy+(float)T[j][1] );
109 aBoard.
saveEPS(
"myGridCurve.eps", Board2D::BoundingBox );
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
static bool isSimplexFullDimensional(PointIterator itB, PointIterator itE)
static LatticePolytope makeSimplex(PointIterator itB, PointIterator itE)
bool isFullySubconvex(const PointRange &Y, const LatticeSet &StarX) const
CellGeometry makeCellCover(PointIterator itB, PointIterator itE, Dimension i=0, Dimension k=KSpace::dimension) const
ConstIterator end() const
ConstIterator begin() const
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
bool initFromPointsRange(const TIterator &itb, const TIterator &ite)
void beginBlock(const std::string &keyword="")
Board & setPenColor(const DGtal::Color &color)
void drawLine(double x1, double y1, double x2, double y2, int depthValue=-1)
Board & setPenColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.