@@ -70,29 +70,37 @@ THREE.extend( THREE.Frustum.prototype, {
7070
7171 } ,
7272
73- intersectsObject : function ( object ) {
73+ intersectsObject : function ( ) {
7474
75- // this method is expanded inlined for performance reasons.
76- var matrix = object . matrixWorld ;
77- var planes = this . planes ;
78- var center = matrix . getPosition ( ) ;
79- var negRadius = - object . geometry . boundingSphere . radius * matrix . getMaxScaleOnAxis ( ) ;
75+ var center = new THREE . Vector3 ( ) ;
8076
81- for ( var i = 0 ; i < 6 ; i ++ ) {
77+ return function ( object ) {
8278
83- var distance = planes [ i ] . distanceToPoint ( center ) ;
79+ // this method is expanded inlined for performance reasons.
8480
85- if ( distance < negRadius ) {
81+ var matrix = object . matrixWorld ;
82+ var planes = this . planes ;
83+ var negRadius = - object . geometry . boundingSphere . radius * matrix . getMaxScaleOnAxis ( ) ;
8684
87- return false ;
85+ center . getPositionFromMatrix ( matrix ) ;
86+
87+ for ( var i = 0 ; i < 6 ; i ++ ) {
88+
89+ var distance = planes [ i ] . distanceToPoint ( center ) ;
90+
91+ if ( distance < negRadius ) {
92+
93+ return false ;
94+
95+ }
8896
8997 }
9098
91- }
99+ return true ;
92100
93- return true ;
101+ } ;
94102
95- } ,
103+ } ( ) ,
96104
97105 intersectsSphere : function ( sphere ) {
98106
@@ -104,7 +112,7 @@ THREE.extend( THREE.Frustum.prototype, {
104112
105113 var distance = planes [ i ] . distanceToPoint ( center ) ;
106114
107- if ( distance < negRadius ) {
115+ if ( distance < negRadius ) {
108116
109117 return false ;
110118
@@ -122,7 +130,7 @@ THREE.extend( THREE.Frustum.prototype, {
122130
123131 for ( var i = 0 ; i < 6 ; i ++ ) {
124132
125- if ( planes [ i ] . distanceToPoint ( point ) < 0 ) {
133+ if ( planes [ i ] . distanceToPoint ( point ) < 0 ) {
126134
127135 return false ;
128136
@@ -140,4 +148,4 @@ THREE.extend( THREE.Frustum.prototype, {
140148
141149 }
142150
143- } ) ;
151+ } ) ;
0 commit comments