@@ -66,22 +66,16 @@ function vtkGlyph3DMapper(publicAPI, model) {
66
66
return idata . getPointData ( ) . getArray ( model . scaleArray ) ;
67
67
} ;
68
68
69
- publicAPI . getBounds = ( ) => {
70
- const idata = publicAPI . getInputData ( 0 ) ;
71
- const gdata = publicAPI . getInputData ( 1 ) ;
72
- if ( ! idata || ! gdata ) {
73
- return vtkMath . createUninitializedBounds ( ) ;
74
- }
75
-
76
- // first we build the arrays used for the glyphing
77
- publicAPI . buildArrays ( ) ;
78
- return model . bounds ;
79
- } ;
69
+ publicAPI . computeBounds = ( ) => publicAPI . buildArrays ( ) ;
80
70
81
71
publicAPI . buildArrays = ( ) => {
82
72
// if the mtgime requires it, rebuild
83
73
const idata = publicAPI . getInputData ( 0 ) ;
84
74
const gdata = publicAPI . getInputData ( 1 ) ;
75
+ if ( ! idata || ! gdata ) {
76
+ vtkBoundingBox . reset ( model . bounds ) ;
77
+ return ;
78
+ }
85
79
if (
86
80
model . buildTime . getMTime ( ) < gdata . getMTime ( ) ||
87
81
model . buildTime . getMTime ( ) < idata . getMTime ( ) ||
@@ -114,12 +108,7 @@ function vtkGlyph3DMapper(publicAPI, model) {
114
108
// overall bounds while building the arrays
115
109
const corners = [ ] ;
116
110
vtkBoundingBox . getCorners ( gbounds , corners ) ;
117
- model . bounds [ 0 ] = vtkBoundingBox . INIT_BOUNDS [ 0 ] ;
118
- model . bounds [ 1 ] = vtkBoundingBox . INIT_BOUNDS [ 1 ] ;
119
- model . bounds [ 2 ] = vtkBoundingBox . INIT_BOUNDS [ 2 ] ;
120
- model . bounds [ 3 ] = vtkBoundingBox . INIT_BOUNDS [ 3 ] ;
121
- model . bounds [ 4 ] = vtkBoundingBox . INIT_BOUNDS [ 4 ] ;
122
- model . bounds [ 5 ] = vtkBoundingBox . INIT_BOUNDS [ 5 ] ;
111
+ vtkBoundingBox . reset ( model . bounds ) ;
123
112
124
113
const tcorner = new Float64Array ( 3 ) ;
125
114
@@ -225,24 +214,7 @@ function vtkGlyph3DMapper(publicAPI, model) {
225
214
// update bounds
226
215
for ( let p = 0 ; p < 8 ; ++ p ) {
227
216
vec3 . transformMat4 ( tcorner , corners [ p ] , z ) ;
228
- if ( tcorner [ 0 ] < model . bounds [ 0 ] ) {
229
- model . bounds [ 0 ] = tcorner [ 0 ] ;
230
- }
231
- if ( tcorner [ 1 ] < model . bounds [ 2 ] ) {
232
- model . bounds [ 2 ] = tcorner [ 1 ] ;
233
- }
234
- if ( tcorner [ 2 ] < model . bounds [ 4 ] ) {
235
- model . bounds [ 4 ] = tcorner [ 2 ] ;
236
- }
237
- if ( tcorner [ 0 ] > model . bounds [ 1 ] ) {
238
- model . bounds [ 1 ] = tcorner [ 0 ] ;
239
- }
240
- if ( tcorner [ 1 ] > model . bounds [ 3 ] ) {
241
- model . bounds [ 3 ] = tcorner [ 1 ] ;
242
- }
243
- if ( tcorner [ 2 ] > model . bounds [ 5 ] ) {
244
- model . bounds [ 5 ] = tcorner [ 2 ] ;
245
- }
217
+ vtkBoundingBox . addPoint ( model . bounds , tcorner ) ;
246
218
}
247
219
248
220
const n = new Float32Array ( nbuff , i * 36 , 9 ) ;
@@ -333,9 +305,6 @@ export function extend(publicAPI, model, initialValues = {}) {
333
305
model . buildTime = { } ;
334
306
macro . obj ( model . buildTime , { mtime : 0 } ) ;
335
307
336
- model . boundsTime = { } ;
337
- macro . obj ( model . boundsTime , { mtime : 0 } ) ;
338
-
339
308
macro . setGet ( publicAPI , model , [
340
309
'orient' ,
341
310
'orientationMode' ,
0 commit comments