65 lines
1.9 KiB
C++
Executable File
65 lines
1.9 KiB
C++
Executable File
#ifndef PATTERNEXPORTER_HPP
|
|
#define PATTERNEXPORTER_HPP
|
|
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <unordered_set>
|
|
#include <vcg/space/deprecated_point2.h>
|
|
#include <vcg/space/deprecated_point3.h>
|
|
#include <vector>
|
|
|
|
// enum PatternLabel {
|
|
// Valid = 0,
|
|
// MultipleCC,
|
|
// DanglingEdge,
|
|
// IntersectingEdges,
|
|
// ArticulationPoints
|
|
//};
|
|
namespace PatternIO {
|
|
using PatternName = int;
|
|
struct Pattern {
|
|
std::vector<vcg::Point2i> edges;
|
|
PatternName name{-1};
|
|
|
|
bool operator==(const Pattern &p) const { return name == p.name; }
|
|
};
|
|
struct PatternHashFunction {
|
|
std::size_t operator()(const Pattern &p) const {
|
|
return std::hash<int>()(p.name);
|
|
}
|
|
};
|
|
|
|
/*
|
|
* A set of planar patterns using the same nodes
|
|
* */
|
|
struct PatternSet {
|
|
std::vector<vcg::Point3d> nodes;
|
|
|
|
std::vector<Pattern> patterns;
|
|
};
|
|
|
|
void save(const std::string &filePath, const Pattern &pattern);
|
|
void save(const std::string &filePath, const PatternSet &patterns);
|
|
void load(const std::string &filePath, PatternSet &patternSet);
|
|
void save(const std::string &filePath,
|
|
const std::vector<vcg::Point3d> &vertices);
|
|
void write(std::ofstream &fileStream, const Pattern &pattern);
|
|
void write(std::ofstream &fileStream,
|
|
const std::vector<vcg::Point3d> &vertices);
|
|
void exportPLY(const std::string &patternSetFilePath,
|
|
const std::string &outputDirectoryPath, const int &startIndex,
|
|
const int &endIndex);
|
|
void exportPLY(const std::string &outputDirectoryPath,
|
|
const std::string &patternSetFilePath,
|
|
const PatternName &patternToExport);
|
|
void save(std::ofstream &fileStream, const Pattern &pattern);
|
|
void load(const std::string &filepath, std::vector<vcg::Point3d> &vertices,
|
|
std::vector<Pattern> &patterns, const int &startIndex,
|
|
const int &endIndex);
|
|
void exportPLY(const std::string &inputFilePath, const int &startIndex,
|
|
const int &indexStep);
|
|
|
|
} // namespace PatternIO
|
|
|
|
#endif // PATTERNEXPORTER_HPP
|