@@ -15,7 +15,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
15
15
use serde:: { Deserialize , Serialize } ;
16
16
17
17
/// Computes the geometric center of the given set of points.
18
- #[ inline( always ) ]
18
+ #[ inline]
19
19
fn point_cloud_2d_center ( points : & [ Vec2 ] ) -> Vec2 {
20
20
assert ! (
21
21
!points. is_empty( ) ,
@@ -56,7 +56,7 @@ pub struct Aabb2d {
56
56
57
57
impl Aabb2d {
58
58
/// Constructs an AABB from its center and half-size.
59
- #[ inline( always ) ]
59
+ #[ inline]
60
60
pub fn new ( center : Vec2 , half_size : Vec2 ) -> Self {
61
61
debug_assert ! ( half_size. x >= 0.0 && half_size. y >= 0.0 ) ;
62
62
Self {
@@ -71,7 +71,7 @@ impl Aabb2d {
71
71
/// # Panics
72
72
///
73
73
/// Panics if the given set of points is empty.
74
- #[ inline( always ) ]
74
+ #[ inline]
75
75
pub fn from_point_cloud ( isometry : impl Into < Isometry2d > , points : & [ Vec2 ] ) -> Aabb2d {
76
76
let isometry = isometry. into ( ) ;
77
77
@@ -93,7 +93,7 @@ impl Aabb2d {
93
93
}
94
94
95
95
/// Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`].
96
- #[ inline( always ) ]
96
+ #[ inline]
97
97
pub fn bounding_circle ( & self ) -> BoundingCircle {
98
98
let radius = self . min . distance ( self . max ) / 2.0 ;
99
99
BoundingCircle :: new ( self . center ( ) , radius)
@@ -103,7 +103,7 @@ impl Aabb2d {
103
103
///
104
104
/// If the point is outside the AABB, the returned point will be on the perimeter of the AABB.
105
105
/// Otherwise, it will be inside the AABB and returned as is.
106
- #[ inline( always ) ]
106
+ #[ inline]
107
107
pub fn closest_point ( & self , point : Vec2 ) -> Vec2 {
108
108
// Clamp point coordinates to the AABB
109
109
point. clamp ( self . min , self . max )
@@ -115,39 +115,39 @@ impl BoundingVolume for Aabb2d {
115
115
type Rotation = Rot2 ;
116
116
type HalfSize = Vec2 ;
117
117
118
- #[ inline( always ) ]
118
+ #[ inline]
119
119
fn center ( & self ) -> Self :: Translation {
120
120
( self . min + self . max ) / 2.
121
121
}
122
122
123
- #[ inline( always ) ]
123
+ #[ inline]
124
124
fn half_size ( & self ) -> Self :: HalfSize {
125
125
( self . max - self . min ) / 2.
126
126
}
127
127
128
- #[ inline( always ) ]
128
+ #[ inline]
129
129
fn visible_area ( & self ) -> f32 {
130
130
let b = ( self . max - self . min ) . max ( Vec2 :: ZERO ) ;
131
131
b. x * b. y
132
132
}
133
133
134
- #[ inline( always ) ]
134
+ #[ inline]
135
135
fn contains ( & self , other : & Self ) -> bool {
136
136
other. min . x >= self . min . x
137
137
&& other. min . y >= self . min . y
138
138
&& other. max . x <= self . max . x
139
139
&& other. max . y <= self . max . y
140
140
}
141
141
142
- #[ inline( always ) ]
142
+ #[ inline]
143
143
fn merge ( & self , other : & Self ) -> Self {
144
144
Self {
145
145
min : self . min . min ( other. min ) ,
146
146
max : self . max . max ( other. max ) ,
147
147
}
148
148
}
149
149
150
- #[ inline( always ) ]
150
+ #[ inline]
151
151
fn grow ( & self , amount : impl Into < Self :: HalfSize > ) -> Self {
152
152
let amount = amount. into ( ) ;
153
153
let b = Self {
@@ -158,7 +158,7 @@ impl BoundingVolume for Aabb2d {
158
158
b
159
159
}
160
160
161
- #[ inline( always ) ]
161
+ #[ inline]
162
162
fn shrink ( & self , amount : impl Into < Self :: HalfSize > ) -> Self {
163
163
let amount = amount. into ( ) ;
164
164
let b = Self {
@@ -169,7 +169,7 @@ impl BoundingVolume for Aabb2d {
169
169
b
170
170
}
171
171
172
- #[ inline( always ) ]
172
+ #[ inline]
173
173
fn scale_around_center ( & self , scale : impl Into < Self :: HalfSize > ) -> Self {
174
174
let scale = scale. into ( ) ;
175
175
let b = Self {
@@ -187,7 +187,7 @@ impl BoundingVolume for Aabb2d {
187
187
/// Note that the result may not be as tightly fitting as the original, and repeated rotations
188
188
/// can cause the AABB to grow indefinitely. Avoid applying multiple rotations to the same AABB,
189
189
/// and consider storing the original AABB and rotating that every time instead.
190
- #[ inline( always ) ]
190
+ #[ inline]
191
191
fn transformed_by (
192
192
mut self ,
193
193
translation : impl Into < Self :: Translation > ,
@@ -204,7 +204,7 @@ impl BoundingVolume for Aabb2d {
204
204
/// Note that the result may not be as tightly fitting as the original, and repeated rotations
205
205
/// can cause the AABB to grow indefinitely. Avoid applying multiple rotations to the same AABB,
206
206
/// and consider storing the original AABB and rotating that every time instead.
207
- #[ inline( always ) ]
207
+ #[ inline]
208
208
fn transform_by (
209
209
& mut self ,
210
210
translation : impl Into < Self :: Translation > ,
@@ -214,7 +214,7 @@ impl BoundingVolume for Aabb2d {
214
214
self . translate_by ( translation) ;
215
215
}
216
216
217
- #[ inline( always ) ]
217
+ #[ inline]
218
218
fn translate_by ( & mut self , translation : impl Into < Self :: Translation > ) {
219
219
let translation = translation. into ( ) ;
220
220
self . min += translation;
@@ -228,7 +228,7 @@ impl BoundingVolume for Aabb2d {
228
228
/// Note that the result may not be as tightly fitting as the original, and repeated rotations
229
229
/// can cause the AABB to grow indefinitely. Avoid applying multiple rotations to the same AABB,
230
230
/// and consider storing the original AABB and rotating that every time instead.
231
- #[ inline( always ) ]
231
+ #[ inline]
232
232
fn rotated_by ( mut self , rotation : impl Into < Self :: Rotation > ) -> Self {
233
233
self . rotate_by ( rotation) ;
234
234
self
@@ -241,7 +241,7 @@ impl BoundingVolume for Aabb2d {
241
241
/// Note that the result may not be as tightly fitting as the original, and repeated rotations
242
242
/// can cause the AABB to grow indefinitely. Avoid applying multiple rotations to the same AABB,
243
243
/// and consider storing the original AABB and rotating that every time instead.
244
- #[ inline( always ) ]
244
+ #[ inline]
245
245
fn rotate_by ( & mut self , rotation : impl Into < Self :: Rotation > ) {
246
246
let rot_mat = Mat2 :: from ( rotation. into ( ) ) ;
247
247
let half_size = rot_mat. abs ( ) * self . half_size ( ) ;
@@ -250,7 +250,7 @@ impl BoundingVolume for Aabb2d {
250
250
}
251
251
252
252
impl IntersectsVolume < Self > for Aabb2d {
253
- #[ inline( always ) ]
253
+ #[ inline]
254
254
fn intersects ( & self , other : & Self ) -> bool {
255
255
let x_overlaps = self . min . x <= other. max . x && self . max . x >= other. min . x ;
256
256
let y_overlaps = self . min . y <= other. max . y && self . max . y >= other. min . y ;
@@ -259,7 +259,7 @@ impl IntersectsVolume<Self> for Aabb2d {
259
259
}
260
260
261
261
impl IntersectsVolume < BoundingCircle > for Aabb2d {
262
- #[ inline( always ) ]
262
+ #[ inline]
263
263
fn intersects ( & self , circle : & BoundingCircle ) -> bool {
264
264
let closest_point = self . closest_point ( circle. center ) ;
265
265
let distance_squared = circle. center . distance_squared ( closest_point) ;
@@ -492,7 +492,7 @@ pub struct BoundingCircle {
492
492
493
493
impl BoundingCircle {
494
494
/// Constructs a bounding circle from its center and radius.
495
- #[ inline( always ) ]
495
+ #[ inline]
496
496
pub fn new ( center : Vec2 , radius : f32 ) -> Self {
497
497
debug_assert ! ( radius >= 0. ) ;
498
498
Self {
@@ -505,7 +505,7 @@ impl BoundingCircle {
505
505
/// transformed by the rotation and translation of the given isometry.
506
506
///
507
507
/// The bounding circle is not guaranteed to be the smallest possible.
508
- #[ inline( always ) ]
508
+ #[ inline]
509
509
pub fn from_point_cloud ( isometry : impl Into < Isometry2d > , points : & [ Vec2 ] ) -> BoundingCircle {
510
510
let isometry = isometry. into ( ) ;
511
511
@@ -524,13 +524,13 @@ impl BoundingCircle {
524
524
}
525
525
526
526
/// Get the radius of the bounding circle
527
- #[ inline( always ) ]
527
+ #[ inline]
528
528
pub fn radius ( & self ) -> f32 {
529
529
self . circle . radius
530
530
}
531
531
532
532
/// Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`].
533
- #[ inline( always ) ]
533
+ #[ inline]
534
534
pub fn aabb_2d ( & self ) -> Aabb2d {
535
535
Aabb2d {
536
536
min : self . center - Vec2 :: splat ( self . radius ( ) ) ,
@@ -542,7 +542,7 @@ impl BoundingCircle {
542
542
///
543
543
/// If the point is outside the circle, the returned point will be on the perimeter of the circle.
544
544
/// Otherwise, it will be inside the circle and returned as is.
545
- #[ inline( always ) ]
545
+ #[ inline]
546
546
pub fn closest_point ( & self , point : Vec2 ) -> Vec2 {
547
547
self . circle . closest_point ( point - self . center ) + self . center
548
548
}
@@ -553,28 +553,28 @@ impl BoundingVolume for BoundingCircle {
553
553
type Rotation = Rot2 ;
554
554
type HalfSize = f32 ;
555
555
556
- #[ inline( always ) ]
556
+ #[ inline]
557
557
fn center ( & self ) -> Self :: Translation {
558
558
self . center
559
559
}
560
560
561
- #[ inline( always ) ]
561
+ #[ inline]
562
562
fn half_size ( & self ) -> Self :: HalfSize {
563
563
self . radius ( )
564
564
}
565
565
566
- #[ inline( always ) ]
566
+ #[ inline]
567
567
fn visible_area ( & self ) -> f32 {
568
568
core:: f32:: consts:: PI * self . radius ( ) * self . radius ( )
569
569
}
570
570
571
- #[ inline( always ) ]
571
+ #[ inline]
572
572
fn contains ( & self , other : & Self ) -> bool {
573
573
let diff = self . radius ( ) - other. radius ( ) ;
574
574
self . center . distance_squared ( other. center ) <= ops:: copysign ( diff. squared ( ) , diff)
575
575
}
576
576
577
- #[ inline( always ) ]
577
+ #[ inline]
578
578
fn merge ( & self , other : & Self ) -> Self {
579
579
let diff = other. center - self . center ;
580
580
let length = diff. length ( ) ;
@@ -591,42 +591,42 @@ impl BoundingVolume for BoundingCircle {
591
591
)
592
592
}
593
593
594
- #[ inline( always ) ]
594
+ #[ inline]
595
595
fn grow ( & self , amount : impl Into < Self :: HalfSize > ) -> Self {
596
596
let amount = amount. into ( ) ;
597
597
debug_assert ! ( amount >= 0. ) ;
598
598
Self :: new ( self . center , self . radius ( ) + amount)
599
599
}
600
600
601
- #[ inline( always ) ]
601
+ #[ inline]
602
602
fn shrink ( & self , amount : impl Into < Self :: HalfSize > ) -> Self {
603
603
let amount = amount. into ( ) ;
604
604
debug_assert ! ( amount >= 0. ) ;
605
605
debug_assert ! ( self . radius( ) >= amount) ;
606
606
Self :: new ( self . center , self . radius ( ) - amount)
607
607
}
608
608
609
- #[ inline( always ) ]
609
+ #[ inline]
610
610
fn scale_around_center ( & self , scale : impl Into < Self :: HalfSize > ) -> Self {
611
611
let scale = scale. into ( ) ;
612
612
debug_assert ! ( scale >= 0. ) ;
613
613
Self :: new ( self . center , self . radius ( ) * scale)
614
614
}
615
615
616
- #[ inline( always ) ]
616
+ #[ inline]
617
617
fn translate_by ( & mut self , translation : impl Into < Self :: Translation > ) {
618
618
self . center += translation. into ( ) ;
619
619
}
620
620
621
- #[ inline( always ) ]
621
+ #[ inline]
622
622
fn rotate_by ( & mut self , rotation : impl Into < Self :: Rotation > ) {
623
623
let rotation: Rot2 = rotation. into ( ) ;
624
624
self . center = rotation * self . center ;
625
625
}
626
626
}
627
627
628
628
impl IntersectsVolume < Self > for BoundingCircle {
629
- #[ inline( always ) ]
629
+ #[ inline]
630
630
fn intersects ( & self , other : & Self ) -> bool {
631
631
let center_distance_squared = self . center . distance_squared ( other. center ) ;
632
632
let radius_sum_squared = ( self . radius ( ) + other. radius ( ) ) . squared ( ) ;
@@ -635,7 +635,7 @@ impl IntersectsVolume<Self> for BoundingCircle {
635
635
}
636
636
637
637
impl IntersectsVolume < Aabb2d > for BoundingCircle {
638
- #[ inline( always ) ]
638
+ #[ inline]
639
639
fn intersects ( & self , aabb : & Aabb2d ) -> bool {
640
640
aabb. intersects ( self )
641
641
}
0 commit comments