Merge branch 'main' of http://101.34.228.45:3000/BigC/ArchitectureColoredPainting
commit
11bed6c706
|
@ -46,11 +46,10 @@ void ShortCutTree::monotonization(vector<PointVector>& inL, vector<LinePtr>& out
|
||||||
|
|
||||||
void ShortCutTree::generateShortCutsegmentement(ShortCutNode& nowTreeNode) {
|
void ShortCutTree::generateShortCutsegmentement(ShortCutNode& nowTreeNode) {
|
||||||
Point p = {0, 0};
|
Point p = {0, 0};
|
||||||
vector<int> v;
|
set<pair<int, int> > pointSet;
|
||||||
for (int & lineIndex : nowTreeNode.lineSet) {
|
for (int & lineIndex : nowTreeNode.lineSet) {
|
||||||
int type = allLine[lineIndex]->judgeBoundIntersection(nowTreeNode.bound.z(), nowTreeNode.bound.y(), nowTreeNode.bound.w(), false), lineIndexBegin, lineIndexEnd;
|
int type = allLine[lineIndex]->judgeBoundIntersection(nowTreeNode.bound.z(), nowTreeNode.bound.y(), nowTreeNode.bound.w(), false), lineIndexBegin, lineIndexEnd;
|
||||||
if (type >= 2) {
|
if (type >= 2) {
|
||||||
v.push_back(numLine);
|
|
||||||
if (type == 2) {
|
if (type == 2) {
|
||||||
p = allLine[lineIndex]->getEnd();
|
p = allLine[lineIndex]->getEnd();
|
||||||
}
|
}
|
||||||
|
@ -59,25 +58,33 @@ void ShortCutTree::generateShortCutsegmentement(ShortCutNode& nowTreeNode) {
|
||||||
}
|
}
|
||||||
lineIndexBegin = getPointIndex({ p.x, nowTreeNode.bound.w() });
|
lineIndexBegin = getPointIndex({ p.x, nowTreeNode.bound.w() });
|
||||||
lineIndexEnd = getPointIndex(p);
|
lineIndexEnd = getPointIndex(p);
|
||||||
lineIndexs.push_back(lineIndexBegin);
|
auto iter = pointSet.find({ lineIndexBegin, lineIndexEnd });
|
||||||
lineIndexs.push_back(lineIndexBegin);
|
if (iter != pointSet.end()) {
|
||||||
lineIndexs.push_back(lineIndexEnd);
|
pointSet.erase(iter);
|
||||||
lineIndexs.push_back(lineIndexEnd);
|
}
|
||||||
numLine++;
|
else {
|
||||||
|
pointSet.insert({ lineIndexBegin, lineIndexEnd });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nowTreeNode.windingIncrement != 0) {
|
if (nowTreeNode.windingIncrement != 0) {
|
||||||
v.push_back(numLine);
|
|
||||||
int lineIndexBegin = getPointIndex({ nowTreeNode.bound.z(), nowTreeNode.bound.y()});
|
int lineIndexBegin = getPointIndex({ nowTreeNode.bound.z(), nowTreeNode.bound.y()});
|
||||||
int lineIndexEnd = getPointIndex({ nowTreeNode.bound.z(), nowTreeNode.bound.w() });
|
int lineIndexEnd = getPointIndex({ nowTreeNode.bound.z(), nowTreeNode.bound.w() });
|
||||||
lineIndexs.push_back(lineIndexBegin);
|
auto iter = pointSet.find({ lineIndexBegin, lineIndexEnd });
|
||||||
lineIndexs.push_back(lineIndexBegin);
|
if (iter != pointSet.end()) {
|
||||||
lineIndexs.push_back(lineIndexEnd);
|
pointSet.erase(iter);
|
||||||
lineIndexs.push_back(lineIndexEnd);
|
|
||||||
numLine++;
|
|
||||||
}
|
}
|
||||||
for (int& lineIndex : v) {
|
else {
|
||||||
nowTreeNode.lineSet.push_back(lineIndex);
|
pointSet.insert({ lineIndexBegin, lineIndexEnd });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto& iter : pointSet) {
|
||||||
|
nowTreeNode.lineSet.push_back(numLine);
|
||||||
|
lineIndexs.push_back(iter.first);
|
||||||
|
lineIndexs.push_back(iter.first);
|
||||||
|
lineIndexs.push_back(iter.second);
|
||||||
|
lineIndexs.push_back(iter.second);
|
||||||
|
numLine++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
#include "StraightLine.h"
|
#include "StraightLine.h"
|
||||||
#include "BvhTree.h"
|
#include "BvhTree.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
using std::queue;
|
using std::queue;
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::for_each;
|
using std::for_each;
|
||||||
|
using std::set;
|
||||||
|
|
||||||
struct ShortCutNode {
|
struct ShortCutNode {
|
||||||
typedef vector<Point> vectorPoint;
|
typedef vector<Point> vectorPoint;
|
||||||
|
|
Loading…
Reference in New Issue