Skip to content

Commit 19fe579

Browse files
committed
fix Merger
1 parent 086abfc commit 19fe579

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Merger.cxx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Merger::Merger (vtkPolyData *pd, const PStrips &pStrips, const StripsType &strip
5757
double proj[2];
5858
Transform(pt, proj, base);
5959

60-
p.emplace_back(proj[0], proj[1], 0);
60+
p.emplace_back(proj[0], proj[1], 0, NOTSET, sp.ind);
6161
}
6262

6363
p.pop_back();
@@ -85,8 +85,6 @@ void Merger::Run () {
8585

8686
assert(origCellIds != nullptr);
8787

88-
const Base &base = pStrips.base;
89-
9088
std::vector<GroupType> groups(polys.size());
9189

9290
PolysType::const_iterator itrA, itrB;
@@ -140,18 +138,15 @@ void Merger::Run () {
140138
auto newCell = vtkSmartPointer<vtkIdList>::New();
141139

142140
for (auto &p : poly) {
143-
double in[] = {p.x, p.y},
144-
out[3];
145-
146-
BackTransform(in, out, base);
147-
148141
vtkIdType id = p.id;
149142

150143
if (id == NOTSET) {
151144
auto itr = newIds.find(p);
152145

153146
if (itr == newIds.end()) {
154-
id = pdPts->InsertNextPoint(out);
147+
auto &q = pStrips.pts.at(p.otherId);
148+
149+
id = pdPts->InsertNextPoint(q.pt);
155150
newIds.emplace(p, id);
156151
} else {
157152
id = itr->second;

Utilities.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ void WriteVTK (const char *name, vtkPolyData *pd);
4848
class Point3d {
4949
public:
5050
const double x, y, z;
51-
vtkIdType id;
51+
vtkIdType id, otherId;
5252

5353
Point3d () = delete;
54-
Point3d (const double x, const double y, const double z, vtkIdType id = NOTSET) : x(x), y(y), z(z), id(id) {}
54+
Point3d (const double x, const double y, const double z, vtkIdType id = NOTSET, vtkIdType otherId = NOTSET) : x(x), y(y), z(z), id(id), otherId(otherId) {}
5555
bool operator< (const Point3d &other) const {
5656
const long x1 = std::lround(x*1e5),
5757
y1 = std::lround(y*1e5),
@@ -70,7 +70,8 @@ class Point3d {
7070
out << "Point3d(x=" << p.x
7171
<< ", y=" << p.y
7272
<< ", z=" << p.z
73-
<< ", id=" << p.id << ")";
73+
<< ", id=" << p.id
74+
<< ", otherId=" << p.otherId << ")";
7475
return out;
7576
}
7677

0 commit comments

Comments
 (0)