TopologyGeneratorPaper.cpp
Go to the documentation of this file.
1 
19 #include "utility/MathHelper.hpp"
20 
21 namespace ISM
22 {
23 
24  std::vector<std::vector<bool>> TopologyGeneratorPaper::calculateNeighbours(const std::string &pattern,
25  std::vector<bool> from) {
26 
27  (void) pattern;
28 
29  std::vector<std::vector<bool>> neighbours;
30  std::vector<unsigned int> ones;
31  std::vector<unsigned int> zeros;
32 
33  for (unsigned int i = 0; i < from.size(); ++i)
34  {
35  if (from[i])
36  {
37  ones.push_back(i);
38  } else {
39  zeros.push_back(i);
40  }
41  }
42 
43  std::vector<bool> neighbour;
44  if (mRemoveRelations)
45  {
46  //Remove one relation
47  for (unsigned int i = 0; i < ones.size(); ++i)
48  {
49  neighbour = from;
50  neighbour[ones[i]] = 0;
51  neighbours.push_back(neighbour);
52  }
53  }
54 
55  for (unsigned int i = 0; i < zeros.size(); ++i)
56  {
57  //Add one relation
58  neighbour = from;
59  neighbour[zeros[i]] = 1;
60  neighbours.push_back(neighbour);
61 
62  if (mSwapRelations) {
63  //Swap one relation
64  for (unsigned int j = 0; j < ones.size(); ++j)
65  {
66  neighbour = from;
67  neighbour[zeros[i]] = 1;
68  neighbour[ones[j]] = 0;
69  neighbours.push_back(neighbour);
70  }
71  }
72  }
73 
74  return neighbours;
75 
76  }
77 
79  std::stringstream s;
80  s << "TopologyGenerator is TopologyGeneratorPaper.cpp: " << std::endl
81  << "- Generates relation topologies as described in the paper \"Automated Selection of Spatial "
82  << "Object Relations for Modeling and Recognizing Indoor Scenes with Hierarchical Implicit Shape Models \""
83  << std::endl;
84  return s.str();
85  }
86 
87 }
std::vector< std::vector< bool > > calculateNeighbours(const std::string &pattern, std::vector< bool > from)
this namespace contains all generally usable classes.


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:41