Skip to content

Commit f3f057d

Browse files
committed
datatype of vtkPoints changed to double + tests revised
1 parent 4a5069e commit f3f057d

File tree

11 files changed

+182
-277
lines changed

11 files changed

+182
-277
lines changed

Contact.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ Contact::Contact (vtkPolyData *newPdA, vtkPolyData *newPdB) : newPdA(newPdA), ne
125125
assert(newPdA->GetCellData()->GetScalars("OrigCellIds") != nullptr);
126126
assert(newPdB->GetCellData()->GetScalars("OrigCellIds") != nullptr);
127127

128-
pts = vtkSmartPointer<vtkPoints>::New();
129-
pts->SetDataTypeToDouble();
128+
pts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
130129

131130
lines = vtkSmartPointer<vtkPolyData>::New();
132131
lines->SetPoints(pts);

Merger.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void Merger::MergeGroup (const GroupType &group, PolysType &merged) {
172172
return;
173173
}
174174

175-
auto pts = vtkSmartPointer<vtkPoints>::New();
175+
auto pts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
176176

177177
IndexedPolysType indexedPolys;
178178

@@ -493,7 +493,7 @@ void Merger::MergeGroup (const GroupType &group, PolysType &merged) {
493493
pts->GetPoint(conn.i, ptA);
494494
pts->GetPoint(conn.j, ptB);
495495

496-
auto intersPts = vtkSmartPointer<vtkPoints>::New();
496+
auto intersPts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
497497

498498
auto c = bspTreeB->IntersectWithLine(ptA, ptB, 1e-5, intersPts, nullptr);
499499

Optimize.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ void PreventEqualCaptPoints::Find (vtkPolyData *pd, vtkPolyData *other, [[maybe_
8484
tree->SetDataSet(other);
8585
tree->BuildLocator();
8686

87-
auto pts = vtkSmartPointer<vtkPoints>::New();
87+
auto pts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
88+
8889
auto cells = vtkSmartPointer<vtkIdList>::New();
8990

9091
double pA[3], pB[3];
@@ -97,7 +98,7 @@ void PreventEqualCaptPoints::Find (vtkPolyData *pd, vtkPolyData *other, [[maybe_
9798
auto pdVerts = vtkSmartPointer<vtkPolyData>::New();
9899
pdVerts->Allocate(1);
99100

100-
auto ptsVerts = vtkSmartPointer<vtkPoints>::New();
101+
auto ptsVerts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
101102
#endif
102103

103104
std::map<vtkIdType, std::vector<SnapPoint>> pointSnaps;
@@ -291,7 +292,7 @@ void PreventEqualCaptPoints::Find (vtkPolyData *pd, vtkPolyData *other, [[maybe_
291292
const auto &snapA = snaps[0];
292293
const auto &snapB = snaps[1];
293294

294-
if (Point3d::GetDist(snapA.inter, snapB.inter) > 1e-10) {
295+
{
295296
Pair edge(snapA.edge);
296297

297298
if (edge.f > edge.g) {

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ from vtkbool.vtkbool import vtkPolyDataBooleanFilter
229229

230230
- *Contact failed with ...*
231231

232-
At least one cell has a bad shape. For a cell with more than three points: not all points lie on the plane defined by the calculated surface normal.
232+
tbd
233233

234234
- *Cannot prevent equal capture points.*
235235

236-
???
236+
tbd
237237

238238
- *There is no contact.*
239239

@@ -245,10 +245,7 @@ from vtkbool.vtkbool import vtkPolyDataBooleanFilter
245245

246246
- *Strips are invalid.*
247247

248-
There are two reasons for that kind of error:
249-
250-
1. at least two intersection lines intersect each other - the input, one of them, contains an assembly
251-
2. there are different intersection points with the same capturing point - normally a capturing point will be used by only one point of the intersection lines
248+
tbd
252249

253250
- *CutCells failed.*
254251

Utilities.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ bool PointInPoly (const Poly &poly, const Point3d &p) {
197197

198198
#ifdef DEBUG
199199
void WritePolys (const char *name, const PolysType &polys) {
200-
auto pts = vtkSmartPointer<vtkPoints>::New();
200+
auto pts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
201201

202202
auto pd = vtkSmartPointer<vtkPolyData>::New();
203203
pd->SetPoints(pts);
@@ -328,8 +328,7 @@ void ProjOnLine (vtkPolyData *pd, const Pair &line, const Point3d &p, std::share
328328
}
329329

330330
vtkSmartPointer<vtkPolyData> CreatePolyData (const PolysType &polys) {
331-
auto pts = vtkSmartPointer<vtkPoints>::New();
332-
pts->SetDataTypeToDouble();
331+
auto pts = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);
333332

334333
auto pd = vtkSmartPointer<vtkPolyData>::New();
335334
pd->SetPoints(pts);

testing/data/complex.vtk

Lines changed: 0 additions & 85 deletions
This file was deleted.

testing/data/merger.vtk

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# vtk DataFile Version 5.1
2+
vtk output
3+
ASCII
4+
DATASET POLYDATA
5+
POINTS 24 double
6+
-0.4 0 0.5 -0.4 0 -0.5 0 -0.4 0.5
7+
0 -0.4 -0.5 0.4 0 0.5 0.4 0 -0.5
8+
0 0.4 0.5 0 0.4 -0.5 -0.25 0 0.5
9+
-0.25 0 -0.5 -0.15 -0.1 0.5 -0.15 -0.1 -0.5
10+
-0.05 0 0.5 -0.05 0 -0.5 -0.15 0.1 0.5
11+
-0.15 0.1 -0.5 0.05 0 0.5 0.05 0 -0.5
12+
0.15 -0.1 0.5 0.15 -0.1 -0.5 0.25 0 0.5
13+
0.25 0 -0.5 0.15 0.1 0.5 0.15 0.1 -0.5
14+
15+
POLYGONS 17 84
16+
OFFSETS vtktypeint64
17+
0 9 18 27 36 40 44 48 52
18+
56 60 64 68 72 76 80 84
19+
CONNECTIVITY vtktypeint64
20+
0 2 4 20 18 16 12 10 8
21+
4 6 0 8 14 12 16 22 20
22+
5 3 1 9 11 13 17 19 21
23+
1 7 5 21 23 17 13 15 9
24+
0 1 3 2 2 3 5 4 4
25+
5 7 6 6 7 1 0 8 10
26+
11 9 10 12 13 11 12 14 15
27+
13 14 8 9 15 16 18 19 17
28+
18 20 21 19 20 22 23 21 22
29+
16 17 23

testing/generate_frieze.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def extrude(pts, h, z=0):
4545
_pts = vtkPoints()
4646
_pts.SetDataTypeToDouble()
4747

48-
[ (_pts.InsertNextPoint(pt[0], pt[1], z), cell.InsertNextId(i)) for i, pt in enumerate(pts) ]
48+
for pt in pts:
49+
cell.InsertNextId(_pts.InsertNextPoint(pt[0], pt[1], z))
4950

5051
pd = vtkPolyData()
5152
pd.Allocate(1)
@@ -402,7 +403,7 @@ def export(self, name):
402403
os.makedirs('einzeln', exist_ok=True)
403404
os.makedirs('stl', exist_ok=True)
404405

405-
cell_counts = [524, 98, 576, 264, 1274, 1866, 582, 98, 472, 194, 1048, 272, 56, 284, 284]
406+
cell_counts = [524, 98, 576, 264, 1274, 1867, 582, 98, 472, 194, 1048, 272, 56, 284, 284]
406407

407408
for i, cfg in enumerate(cfgs):
408409
print(f'~~ {i} ~~')

0 commit comments

Comments
 (0)