Skip to content

Commit 25a5ec6

Browse files
committed
refactoring
1 parent fa92c71 commit 25a5ec6

12 files changed

+162
-196
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2012-2023 Ronald Römer
1+
# Copyright 2012-2024 Ronald Römer
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ from vtkbool.vtkBool import vtkPolyDataBooleanFilter
202202

203203
## Errors and their meaning
204204

205-
- *First/Second input does not contain any supported cells.*
206-
207-
What it says. Look at the Features.
208-
209205
- *Bad shaped cells detected.*
210206

211207
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.
@@ -239,7 +235,7 @@ from vtkbool.vtkBool import vtkPolyDataBooleanFilter
239235

240236
## Copyright
241237

242-
2012-2023 Ronald Römer
238+
2012-2024 Ronald Römer
243239

244240
## License
245241

Utilities.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2012-2023 Ronald Römer
2+
Copyright 2012-2024 Ronald Römer
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ limitations under the License.
2727

2828
#include <vtkPolyDataWriter.h>
2929

30-
void ComputeNormal (vtkPoints *pts, double *n, vtkIdType num, const vtkIdType *poly) {
30+
double ComputeNormal (vtkPoints *pts, double *n, vtkIdType num, const vtkIdType *poly) {
3131
n[0] = 0; n[1] = 0; n[2] = 0;
3232

3333
if (num == 3) {
@@ -59,7 +59,7 @@ void ComputeNormal (vtkPoints *pts, double *n, vtkIdType num, const vtkIdType *p
5959
}
6060
}
6161

62-
vtkMath::Normalize(n);
62+
return vtkMath::Normalize(n);
6363
}
6464

6565
bool CheckNormal (vtkPoints *pts, vtkIdType num, const vtkIdType *poly, const double *n, double d) {
@@ -173,7 +173,7 @@ void BackTransform (const double *in, double *out, const Base &base) {
173173
out[2] = z;
174174
}
175175

176-
void ComputeNormal (const Poly &poly, double *n) {
176+
double ComputeNormal (const Poly &poly, double *n) {
177177
n[0] = 0; n[1] = 0; n[2] = 0;
178178

179179
Poly::const_iterator itrA, itrB;
@@ -193,7 +193,7 @@ void ComputeNormal (const Poly &poly, double *n) {
193193
n[2] += (ptA.x-ptB.x)*(ptA.y+ptB.y);
194194
}
195195

196-
vtkMath::Normalize(n);
196+
return vtkMath::Normalize(n);
197197
}
198198

199199
bool PointInPoly (const Poly &poly, const Point3d &p) {

Utilities.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2012-2023 Ronald Römer
2+
Copyright 2012-2024 Ronald Römer
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ limitations under the License.
3636
double GetAngle (const double *vA, const double *vB, const double *n);
3737

3838
/* VTK */
39-
void ComputeNormal (vtkPoints *pts, double *n, vtkIdType num, const vtkIdType *poly);
39+
double ComputeNormal (vtkPoints *pts, double *n, vtkIdType num, const vtkIdType *poly);
4040
bool CheckNormal (vtkPoints *pts, vtkIdType num, const vtkIdType *poly, const double *n, double d);
4141

4242
void FindPoints (vtkKdTreePointLocator *pl, const double *pt, vtkIdList *pts, double tol = 1e-6);
@@ -127,7 +127,7 @@ std::ostream& operator<< (typename std::enable_if<std::is_enum<T>::value, std::o
127127
typedef std::vector<Point3d> Poly;
128128
typedef std::vector<Poly> PolysType;
129129

130-
void ComputeNormal (const Poly &poly, double *n);
130+
double ComputeNormal (const Poly &poly, double *n);
131131
bool PointInPoly (const Poly &poly, const Point3d &p);
132132

133133
void WritePolys (const char *name, const PolysType &polys);

testing/generate_frieze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# *-* coding: UTF-8 *-*
33

4-
# Copyright 2012-2023 Ronald Römer
4+
# Copyright 2012-2024 Ronald Römer
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

testing/test_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# *-* coding: UTF-8 *-*
33

4-
# Copyright 2012-2023 Ronald Römer
4+
# Copyright 2012-2024 Ronald Römer
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

testing/test_merger.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2012-2023 Ronald Römer
2+
Copyright 2012-2024 Ronald Römer
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

testing/test_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# *-* coding: UTF-8 *-*
33

4-
# Copyright 2012-2023 Ronald Römer
4+
# Copyright 2012-2024 Ronald Römer
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

vtkPolyDataBooleanFilter.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2012-2023 Ronald Römer
2+
Copyright 2012-2024 Ronald Römer
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -1831,7 +1831,7 @@ void vtkPolyDataBooleanFilter::RestoreOrigPoints (vtkPolyData *pd, PolyStripsTyp
18311831
std::cout << "RestoreOrigPoints()" << std::endl;
18321832
#endif
18331833

1834-
pd->BuildLinks();
1834+
pd->DeleteLinks(); pd->BuildLinks();
18351835

18361836
vtkKdTreePointLocator *loc = vtkKdTreePointLocator::New();
18371837
loc->SetDataSet(pd);
@@ -1873,7 +1873,7 @@ void vtkPolyDataBooleanFilter::DisjoinPolys (vtkPolyData *pd, PolyStripsType &po
18731873
std::cout << "DisjoinPolys()" << std::endl;
18741874
#endif
18751875

1876-
pd->BuildLinks();
1876+
pd->DeleteLinks(); pd->BuildLinks();
18771877

18781878
vtkKdTreePointLocator *loc = vtkKdTreePointLocator::New();
18791879
loc->SetDataSet(pd);
@@ -2093,7 +2093,7 @@ void vtkPolyDataBooleanFilter::AddAdjacentPoints (vtkPolyData *pd, vtkIdTypeArra
20932093
std::cout << "AddAdjacentPoints()" << std::endl;
20942094
#endif
20952095

2096-
pd->BuildLinks();
2096+
pd->DeleteLinks(); pd->BuildLinks();
20972097

20982098
vtkIdTypeArray *origCellIds = vtkIdTypeArray::SafeDownCast(pd->GetCellData()->GetScalars("OrigCellIds"));
20992099

@@ -2282,9 +2282,9 @@ void vtkPolyDataBooleanFilter::MergePoints (vtkPolyData *pd, PolyStripsType &pol
22822282
#endif
22832283

22842284
pd->BuildCells();
2285-
pd->BuildLinks();
2285+
pd->DeleteLinks(); pd->BuildLinks();
22862286

2287-
contLines->BuildLinks();
2287+
contLines->DeleteLinks(); contLines->BuildLinks();
22882288

22892289
auto loc = vtkSmartPointer<vtkKdTreePointLocator>::New();
22902290
loc->SetDataSet(pd);
@@ -2739,8 +2739,8 @@ bool vtkPolyDataBooleanFilter::CombineRegions () {
27392739
plB->SetDataSet(pdB);
27402740
plB->BuildLocator();
27412741

2742-
pdA->BuildLinks();
2743-
pdB->BuildLinks();
2742+
pdA->DeleteLinks(); pdA->BuildLinks();
2743+
pdB->DeleteLinks(); pdB->BuildLinks();
27442744

27452745
vtkIdTypeArray *scalarsA = vtkIdTypeArray::SafeDownCast(pdA->GetPointData()->GetScalars());
27462746
vtkIdTypeArray *scalarsB = vtkIdTypeArray::SafeDownCast(pdB->GetPointData()->GetScalars());

vtkPolyDataBooleanFilter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2012-2023 Ronald Römer
2+
Copyright 2012-2024 Ronald Römer
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)