Skip to content

Commit a85b0ce

Browse files
committed
fix(vtktubefilter): correcting the discrepancy in the number of points and normals of vtkTubeFilter
The polyData returned by the vtkTubeFilter has different number of points and normals when the capping is on. The normals data is allocated more number of points depending on the numberOfSides attribute of vtkTubeFilter.
1 parent 6e82cca commit a85b0ce

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Sources/Filters/General/TubeFilter/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,7 @@ function vtkTubeFilter(publicAPI, model) {
661661
size: numNewPts * 3,
662662
numberOfComponents: 3,
663663
});
664-
let numNormals = 3 * numNewPts;
665-
if (model.capping) {
666-
numNormals = 3 * (numNewPts + 2 * model.numberOfSides);
667-
}
664+
const numNormals = 3 * numNewPts;
668665
const newNormalsData = new Float32Array(numNormals);
669666
const newNormals = vtkDataArray.newInstance({
670667
numberOfComponents: 3,

Sources/Filters/General/TubeFilter/test/testTubeFilter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ test('Test vtkTubeFilter execution', (t) => {
112112
'Make sure the output number of points is correct with capping.'
113113
);
114114
t.ok(
115-
tubeOutput2.getPointData().getNormals().getNumberOfTuples() === 24,
115+
tubeOutput2.getPointData().getNormals().getNumberOfTuples() === 18,
116116
'Make sure the output number of normals is correct with capping.'
117117
);
118118
t.end();

0 commit comments

Comments
 (0)