iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tests/test-ImagePolyIter.C
/*! @file
@author Randolph Voorhies
@copyright GNU Public License (GPL v3)
@section License
@verbatim
// ////////////////////////////////////////////////////////////////////////
// The iLab Neuromorphic Robotics Toolkit (NRT) //
// Copyright 2010-2012 by the University of Southern California (USC) //
// and the iLab at USC. //
// //
// iLab - University of Southern California //
// Hedco Neurociences Building, Room HNB-10 //
// Los Angeles, Ca 90089-2520 - USA //
// //
// See http://ilab.usc.edu for information about this project. //
// ////////////////////////////////////////////////////////////////////////
// This file is part of The iLab Neuromorphic Robotics Toolkit. //
// //
// The iLab Neuromorphic Robotics Toolkit is free software: you can //
// redistribute it and/or modify it under the terms of the GNU General //
// Public License as published by the Free Software Foundation, either //
// version 3 of the License, or (at your option) any later version. //
// //
// The iLab Neuromorphic Robotics Toolkit 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 The iLab Neuromorphic Robotics Toolkit. If not, see //
// <http://www.gnu.org/licenses/>. //
// ////////////////////////////////////////////////////////////////////////
@endverbatim */
#include <type_traits>
using namespace nrt;
template <class T>
void printImage(Image<T> const img)
{
NRT_INFO("Image(" << img.width() << ", " << img.height() <<") = { ");
for (int y = 0; y < img.height(); ++y)
{
std::stringstream str; str << " {";
for (int x = 0; x < img.width(); ++x) str << " " << img.at(x, y) << " ";
NRT_INFO(str.str() << "}");
}
NRT_INFO("}");
}
int main(int argc, char const* argv[])
{
std::vector<nrt::Point2D<nrt::int32> > nVerts;
nVerts.push_back(nrt::Point2D<nrt::int32>(2,6));
nVerts.push_back(nrt::Point2D<nrt::int32>(12,3));
nVerts.push_back(nrt::Point2D<nrt::int32>(22,9));
nVerts.push_back(nrt::Point2D<nrt::int32>(19,20));
nVerts.push_back(nrt::Point2D<nrt::int32>(2,22));
nrt::Polygon<nrt::int32> convexPoly(nVerts);
int cnt=0;
for(auto itr=fim.const_convex_poly_begin(convexPoly);itr!=fim.const_convex_poly_end(convexPoly) && cnt<25*25;itr++,cnt++)
{
std::cout << itr.location() << ", ";
}
std::cout << std::endl;
assert(cnt< 25*25-1);
cnt=0;
for(auto itr=cim.convex_poly_begin(convexPoly);itr!=cim.convex_poly_end(convexPoly) && cnt<25*25;itr++,cnt++)
{
std::cout << itr.location() << ", ";
}
std::cout << std::endl;
return 0;
}