@@ -45,7 +45,7 @@ impl Aabb {
4545
4646 /// Returns an AABB with the same geometry, with most-negative corner as `position` and non-negative `size`.
4747 #[ inline]
48- pub fn abs ( & self ) -> Self {
48+ pub fn abs ( self ) -> Self {
4949 Aabb {
5050 position : self . position + self . size . coord_min ( Vector3 :: ZERO ) ,
5151 size : self . size . abs ( ) ,
@@ -54,7 +54,7 @@ impl Aabb {
5454
5555 /// Whether `self` covers at least the entire area of `b` (and possibly more).
5656 #[ inline]
57- pub fn encloses ( & self , b : Aabb ) -> bool {
57+ pub fn encloses ( self , b : Aabb ) -> bool {
5858 let end = self . end ( ) ;
5959 let b_end = b. end ( ) ;
6060
@@ -71,16 +71,16 @@ impl Aabb {
7171 /// # Panics
7272 /// If `self.size` is negative.
7373 #[ inline]
74- pub fn expand ( & self , to : Vector3 ) -> Self {
75- self . merge ( & Aabb :: new ( to, Vector3 :: ZERO ) )
74+ pub fn expand ( self , to : Vector3 ) -> Self {
75+ self . merge ( Aabb :: new ( to, Vector3 :: ZERO ) )
7676 }
7777
7878 /// Returns a larger AABB that contains this AABB and `b`.
7979 ///
8080 /// # Panics
8181 /// If either `self.size` or `b.size` is negative.
8282 #[ inline]
83- pub fn merge ( & self , b : & Aabb ) -> Self {
83+ pub fn merge ( self , b : Aabb ) -> Self {
8484 self . assert_nonnegative ( ) ;
8585 b. assert_nonnegative ( ) ;
8686
@@ -95,21 +95,21 @@ impl Aabb {
9595 /// # Panics
9696 /// If `self.size` is negative.
9797 #[ inline]
98- pub fn volume ( & self ) -> real {
98+ pub fn volume ( self ) -> real {
9999 self . assert_nonnegative ( ) ;
100100 self . size . x * self . size . y * self . size . z
101101 }
102102
103103 /// Returns the center of the AABB, which is equal to `position + (size / 2)`.
104104 #[ inline]
105- pub fn center ( & self ) -> Vector3 {
105+ pub fn center ( self ) -> Vector3 {
106106 self . position + ( self . size / 2.0 )
107107 }
108108
109109 /// Returns a copy of the AABB grown by the specified `amount` on all sides.
110110 #[ inline]
111111 #[ must_use]
112- pub fn grow ( & self , amount : real ) -> Self {
112+ pub fn grow ( self , amount : real ) -> Self {
113113 let position = self . position - Vector3 :: new ( amount, amount, amount) ;
114114 let size = self . size + Vector3 :: new ( amount, amount, amount) * 2.0 ;
115115
@@ -122,7 +122,7 @@ impl Aabb {
122122 /// # Panics
123123 /// If `self.size` is negative.
124124 #[ inline]
125- pub fn has_point ( & self , point : Vector3 ) -> bool {
125+ pub fn has_point ( self , point : Vector3 ) -> bool {
126126 self . assert_nonnegative ( ) ;
127127
128128 let point = point - self . position ;
@@ -135,13 +135,13 @@ impl Aabb {
135135
136136 /// Returns `true` if the AABB has area, and `false` if the AABB is linear, empty, or has a negative size. See also `Aabb.area()`.
137137 #[ inline]
138- pub fn has_area ( & self ) -> bool {
138+ pub fn has_area ( self ) -> bool {
139139 ( ( self . size . x > 0.0 ) as u8 + ( self . size . y > 0.0 ) as u8 + ( self . size . z > 0.0 ) as u8 ) >= 2
140140 }
141141
142142 /// Returns true if the AABB has a volume, and false if the AABB is flat, linear, empty, or has a negative size.
143143 #[ inline]
144- pub fn has_volume ( & self ) -> bool {
144+ pub fn has_volume ( self ) -> bool {
145145 self . size . x > 0.0 && self . size . y > 0.0 && self . size . z > 0.0
146146 }
147147
@@ -150,14 +150,14 @@ impl Aabb {
150150 /// # Panics
151151 /// If `self.size` is negative.
152152 #[ inline]
153- pub fn intersection ( & self , b : & Aabb ) -> Option < Self > {
153+ pub fn intersection ( self , b : Aabb ) -> Option < Self > {
154154 self . assert_nonnegative ( ) ;
155155
156156 if !self . intersects ( b) {
157157 return None ;
158158 }
159159
160- let mut rect = * b;
160+ let mut rect = b;
161161 rect. position = rect. position . coord_max ( self . position ) ;
162162
163163 let end = self . end ( ) ;
@@ -169,13 +169,13 @@ impl Aabb {
169169
170170 /// Returns `true` if this AABB is finite, by calling `@GlobalScope.is_finite` on each component.
171171 #[ inline]
172- pub fn is_finite ( & self ) -> bool {
172+ pub fn is_finite ( self ) -> bool {
173173 self . position . is_finite ( ) && self . size . is_finite ( )
174174 }
175175
176176 /// The end of the `Aabb` calculated as `position + size`.
177177 #[ inline]
178- pub fn end ( & self ) -> Vector3 {
178+ pub fn end ( self ) -> Vector3 {
179179 self . position + self . size
180180 }
181181
@@ -189,7 +189,7 @@ impl Aabb {
189189
190190 /// Returns the normalized longest axis of the AABB.
191191 #[ inline]
192- pub fn longest_axis ( & self ) -> Option < Vector3 > {
192+ pub fn longest_axis ( self ) -> Option < Vector3 > {
193193 self . longest_axis_index ( ) . map ( |axis| match axis {
194194 Vector3Axis :: X => Vector3 :: RIGHT ,
195195 Vector3Axis :: Y => Vector3 :: UP ,
@@ -199,19 +199,19 @@ impl Aabb {
199199
200200 /// Returns the index of the longest axis of the AABB (according to Vector3's AXIS_* constants).
201201 #[ inline]
202- pub fn longest_axis_index ( & self ) -> Option < Vector3Axis > {
202+ pub fn longest_axis_index ( self ) -> Option < Vector3Axis > {
203203 self . size . max_axis ( )
204204 }
205205
206206 /// Returns the scalar length of the longest axis of the AABB.
207207 #[ inline]
208- pub fn longest_axis_size ( & self ) -> real {
208+ pub fn longest_axis_size ( self ) -> real {
209209 self . size . x . max ( self . size . y . max ( self . size . z ) )
210210 }
211211
212212 /// Returns the normalized shortest axis of the AABB.
213213 #[ inline]
214- pub fn shortest_axis ( & self ) -> Option < Vector3 > {
214+ pub fn shortest_axis ( self ) -> Option < Vector3 > {
215215 self . shortest_axis_index ( ) . map ( |axis| match axis {
216216 Vector3Axis :: X => Vector3 :: RIGHT ,
217217 Vector3Axis :: Y => Vector3 :: UP ,
@@ -221,19 +221,19 @@ impl Aabb {
221221
222222 /// Returns the index of the shortest axis of the AABB (according to Vector3::AXIS* enum).
223223 #[ inline]
224- pub fn shortest_axis_index ( & self ) -> Option < Vector3Axis > {
224+ pub fn shortest_axis_index ( self ) -> Option < Vector3Axis > {
225225 self . size . min_axis ( )
226226 }
227227
228228 /// Returns the scalar length of the shortest axis of the AABB.
229229 #[ inline]
230- pub fn shortest_axis_size ( & self ) -> real {
230+ pub fn shortest_axis_size ( self ) -> real {
231231 self . size . x . min ( self . size . y . min ( self . size . z ) )
232232 }
233233
234234 /// Returns the support point in a given direction. This is useful for collision detection algorithms.
235235 #[ inline]
236- pub fn support ( & self , dir : Vector3 ) -> Vector3 {
236+ pub fn support ( self , dir : Vector3 ) -> Vector3 {
237237 let half_extents = self . size * 0.5 ;
238238 let relative_center_point = self . position + half_extents;
239239
@@ -253,7 +253,7 @@ impl Aabb {
253253 ///
254254 /// _Godot equivalent: `AABB.intersects(AABB b, bool include_borders = true)`_
255255 #[ inline]
256- pub fn intersects ( & self , b : & Aabb ) -> bool {
256+ pub fn intersects ( self , b : Aabb ) -> bool {
257257 let end = self . end ( ) ;
258258 let end_b = b. end ( ) ;
259259
@@ -271,7 +271,7 @@ impl Aabb {
271271 ///
272272 /// _Godot equivalent: `AABB.intersects(AABB b, bool include_borders = false)`_
273273 #[ inline]
274- pub fn intersects_exclude_borders ( & self , & b: & Aabb ) -> bool {
274+ pub fn intersects_exclude_borders ( self , b : Aabb ) -> bool {
275275 let end = self . end ( ) ;
276276 let end_b = b. end ( ) ;
277277
@@ -285,7 +285,7 @@ impl Aabb {
285285
286286 /// Returns `true` if the AABB is on both sides of a plane.
287287 #[ inline]
288- pub fn intersects_plane ( & self , plane : & Plane ) -> bool {
288+ pub fn intersects_plane ( self , plane : Plane ) -> bool {
289289 // The set of the edges of the AABB.
290290 let points = [
291291 self . position ,
@@ -318,7 +318,7 @@ impl Aabb {
318318 /// # Panics
319319 /// If `self.size` is negative.
320320 #[ inline]
321- pub fn intersects_ray ( & self , from : Vector3 , dir : Vector3 ) -> bool {
321+ pub fn intersects_ray ( self , from : Vector3 , dir : Vector3 ) -> bool {
322322 self . assert_nonnegative ( ) ;
323323
324324 let tmin = ( self . position - from) / dir;
@@ -338,7 +338,7 @@ impl Aabb {
338338 /// # Panics
339339 /// If `self.size` is negative.
340340 #[ inline]
341- pub fn intersects_segment ( & self , from : Vector3 , to : Vector3 ) -> bool {
341+ pub fn intersects_segment ( self , from : Vector3 , to : Vector3 ) -> bool {
342342 self . assert_nonnegative ( ) ;
343343
344344 let segment_dir = to - from;
@@ -371,7 +371,7 @@ impl Aabb {
371371 ///
372372 /// Most functions will fail to give a correct result if the size is negative.
373373 #[ inline]
374- pub fn assert_nonnegative ( & self ) {
374+ pub fn assert_nonnegative ( self ) {
375375 assert ! (
376376 self . size. x >= 0.0 && self . size. y >= 0.0 && self . size. z >= 0.0 ,
377377 "size {:?} is negative" ,
@@ -467,27 +467,27 @@ mod test {
467467 } ;
468468
469469 // Check for intersection including border
470- assert ! ( aabb1. intersects( & aabb2) ) ;
471- assert ! ( aabb2. intersects( & aabb1) ) ;
470+ assert ! ( aabb1. intersects( aabb2) ) ;
471+ assert ! ( aabb2. intersects( aabb1) ) ;
472472
473473 // Check for non-intersection including border
474- assert ! ( !aabb1. intersects( & aabb3) ) ;
475- assert ! ( !aabb3. intersects( & aabb1) ) ;
474+ assert ! ( !aabb1. intersects( aabb3) ) ;
475+ assert ! ( !aabb3. intersects( aabb1) ) ;
476476
477477 // Check for intersection excluding border
478- assert ! ( aabb1. intersects_exclude_borders( & aabb2) ) ;
479- assert ! ( aabb2. intersects_exclude_borders( & aabb1) ) ;
478+ assert ! ( aabb1. intersects_exclude_borders( aabb2) ) ;
479+ assert ! ( aabb2. intersects_exclude_borders( aabb1) ) ;
480480
481481 // Check for non-intersection excluding border
482- assert ! ( !aabb1. intersects_exclude_borders( & aabb3) ) ;
483- assert ! ( !aabb3. intersects_exclude_borders( & aabb1) ) ;
482+ assert ! ( !aabb1. intersects_exclude_borders( aabb3) ) ;
483+ assert ! ( !aabb3. intersects_exclude_borders( aabb1) ) ;
484484
485485 // Check for non-intersection excluding border
486- assert ! ( !aabb1. intersects_exclude_borders( & aabb4) ) ;
487- assert ! ( !aabb4. intersects_exclude_borders( & aabb1) ) ;
486+ assert ! ( !aabb1. intersects_exclude_borders( aabb4) ) ;
487+ assert ! ( !aabb4. intersects_exclude_borders( aabb1) ) ;
488488
489489 // Check for intersection with same AABB including border
490- assert ! ( aabb1. intersects( & aabb1) ) ;
490+ assert ! ( aabb1. intersects( aabb1) ) ;
491491 }
492492
493493 #[ test]
@@ -515,17 +515,17 @@ mod test {
515515
516516 // Test cases
517517 assert_eq ! (
518- aabb1. intersection( & aabb2) ,
518+ aabb1. intersection( aabb2) ,
519519 Some ( Aabb {
520520 position: Vector3 :: new( 1.0 , 1.0 , 1.0 ) ,
521521 size: Vector3 :: new( 1.0 , 1.0 , 1.0 ) ,
522522 } )
523523 ) ;
524524
525- assert_eq ! ( aabb1. intersection( & aabb3) , None ) ;
525+ assert_eq ! ( aabb1. intersection( aabb3) , None ) ;
526526
527527 assert_eq ! (
528- aabb1. intersection( & aabb4) ,
528+ aabb1. intersection( aabb4) ,
529529 Some ( Aabb {
530530 position: Vector3 :: new( 0.0 , 0.0 , 0.0 ) ,
531531 size: Vector3 :: new( 0.0 , 0.0 , 0.0 ) ,
@@ -620,10 +620,10 @@ mod test {
620620 } ;
621621
622622 // Test cases
623- assert ! ( aabb. intersects_plane( & plane_inside) ) ;
624- assert ! ( !aabb. intersects_plane( & plane_outside) ) ;
625- assert ! ( aabb. intersects_plane( & plane_intersect) ) ;
626- assert ! ( !aabb. intersects_plane( & plane_parallel) ) ;
623+ assert ! ( aabb. intersects_plane( plane_inside) ) ;
624+ assert ! ( !aabb. intersects_plane( plane_outside) ) ;
625+ assert ! ( aabb. intersects_plane( plane_intersect) ) ;
626+ assert ! ( !aabb. intersects_plane( plane_parallel) ) ;
627627 }
628628
629629 #[ test]
0 commit comments