DGtal  0.9.3
testPreimage.cpp File Reference
#include <cstdio>
#include <cmath>
#include <fstream>
#include <vector>
#include <iostream>
#include <sstream>
#include <iterator>
#include "DGtal/base/Common.h"
#include "DGtal/base/Exceptions.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/kernel/domains/DomainPredicate.h"
#include "DGtal/kernel/domains/HyperRectDomain.h"
#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/geometry/curves/GridCurve.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/shapes/fromPoints/StraightLineFrom2Points.h"
#include "DGtal/geometry/tools/Preimage2D.h"
#include "ConfigTest.h"
Include dependency graph for testPreimage.cpp:

Go to the source code of this file.

int main ()

## Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Date
2010/07/02

This file is part of the DGtal library

Definition in file testPreimage.cpp.

## ◆ main()

 int main ( )

Definition at line 64 of file testPreimage.cpp.

65 {
66
67  std::string filename = testPath + "samples/DSS.dat";
68  std::ifstream instream; // input stream
69  instream.open (filename.c_str(), std::ifstream::in);
70
72  GridCurve<KSpace> c; //grid curve
73  c.initFromVectorStream(instream);
74
75
76  trace.beginBlock("Simple preimage test");
77
79  StraightLine aStraightLine; //instance of straight line
81
85
86  //preimage computation
87  Preimage2D thePreimage(it->first, it->second, aStraightLine);
88  ++it;
89  while ( (it != itEnd) &&
91  {
92  trace.info() << (it - r.rbegin()) << std::endl << thePreimage << std::endl;
93  ++it;
94  }
95
96  trace.endBlock();
97
98  return 0;
99 }
void beginBlock(const std::string &keyword="")
Aim: Computes the preimage of the 2D Euclidean shapes crossing a sequence of n straigth segments in O...
Definition: Preimage2D.h:93
Trace trace
Definition: Common.h:137
Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any ...
KhalimskySpaceND< 2, Integer > KSpace
Definition: StdDefs.h:77
This class adapts any bidirectional iterator so that operator++ calls operator-- and vice versa...
double endBlock()
ConstReverseIterator rbegin() const
ConstReverseIterator rend() const
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
bool initFromVectorStream(std::istream &in)
std::ostream & info()
IncidentPointsRange getIncidentPointsRange() const
Definition: GridCurve.h:486
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition: GridCurve.h:172
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...