@@ -66,22 +66,16 @@ function vtkGlyph3DMapper(publicAPI, model) {
6666 return idata . getPointData ( ) . getArray ( model . scaleArray ) ;
6767 } ;
6868
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 ( ) ;
8070
8171 publicAPI . buildArrays = ( ) => {
8272 // if the mtgime requires it, rebuild
8373 const idata = publicAPI . getInputData ( 0 ) ;
8474 const gdata = publicAPI . getInputData ( 1 ) ;
75+ if ( ! idata || ! gdata ) {
76+ vtkBoundingBox . reset ( model . bounds ) ;
77+ return ;
78+ }
8579 if (
8680 model . buildTime . getMTime ( ) < gdata . getMTime ( ) ||
8781 model . buildTime . getMTime ( ) < idata . getMTime ( ) ||
@@ -114,12 +108,7 @@ function vtkGlyph3DMapper(publicAPI, model) {
114108 // overall bounds while building the arrays
115109 const corners = [ ] ;
116110 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 ) ;
123112
124113 const tcorner = new Float64Array ( 3 ) ;
125114
@@ -225,24 +214,7 @@ function vtkGlyph3DMapper(publicAPI, model) {
225214 // update bounds
226215 for ( let p = 0 ; p < 8 ; ++ p ) {
227216 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 ) ;
246218 }
247219
248220 const n = new Float32Array ( nbuff , i * 36 , 9 ) ;
@@ -333,9 +305,6 @@ export function extend(publicAPI, model, initialValues = {}) {
333305 model . buildTime = { } ;
334306 macro . obj ( model . buildTime , { mtime : 0 } ) ;
335307
336- model . boundsTime = { } ;
337- macro . obj ( model . boundsTime , { mtime : 0 } ) ;
338-
339308 macro . setGet ( publicAPI , model , [
340309 'orient' ,
341310 'orientationMode' ,
0 commit comments