52 lines
1.9 KiB
C++
Executable File
52 lines
1.9 KiB
C++
Executable File
#ifndef FLATPATTTERNTOPOLOGY_HPP
|
|
#define FLATPATTTERNTOPOLOGY_HPP
|
|
#include <boost/graph/adjacency_list.hpp>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <vcg/space/point2.h>
|
|
#include <vector>
|
|
|
|
using BoostGraph =
|
|
boost::adjacency_list<boost::hash_setS, boost::vecS, boost::undirectedS>;
|
|
using vertex_t = boost::graph_traits<BoostGraph>::vertex_descriptor;
|
|
|
|
class FlatPatternTopology {
|
|
|
|
public:
|
|
bool containsArticulationPoints(std::vector<int> &articulationPointsVi) const;
|
|
FlatPatternTopology(const std::vector<size_t> &numberOfNodesPerSlot,
|
|
const std::vector<vcg::Point2i> &edges);
|
|
static void
|
|
constructNodeToSlotMap(const std::vector<size_t> &numberOfNodesPerSlot,
|
|
std::unordered_map<size_t, size_t> &nodeToSlot);
|
|
static void constructSlotToNodeMap(
|
|
const std::unordered_map<size_t, size_t> &nodeToSlot,
|
|
std::unordered_map<size_t, std::unordered_set<size_t>> &slotToNode);
|
|
static void printGraph(const BoostGraph &g);
|
|
|
|
FlatPatternTopology();
|
|
BoostGraph constructRotationallySymmetricPattern(
|
|
const BoostGraph &pattern,
|
|
const std::unordered_map<size_t, std::unordered_set<size_t>> &slotToNodes,
|
|
const std::unordered_map<size_t, size_t> &nodeToSlot,
|
|
const std::unordered_map<size_t, size_t> &correspondingNode) const;
|
|
std::vector<size_t> numberOfNodesPerSlot;
|
|
std::unordered_map<size_t, size_t> nodeToSlot;
|
|
std::unordered_map<size_t, std::unordered_set<size_t>> slotToNode;
|
|
std::unordered_map<size_t, size_t> correspondingNode;
|
|
|
|
private:
|
|
std::vector<std::vector<bool>> isAdjacentTo;
|
|
BoostGraph pattern;
|
|
void constructCorresponginNodeMap();
|
|
/*
|
|
* Creates a pattern which is a copy of the input pattern but with added edges
|
|
* that result
|
|
* */
|
|
void constructNodeToSlotMap();
|
|
void constructSlotToNodeMap();
|
|
bool pathExists(int src, int dest) const;
|
|
};
|
|
|
|
#endif // FLATPATTTERNTOPOLOGY_HPP
|