We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a35ff39 commit e093cd6Copy full SHA for e093cd6
blobs/src/lib.rs
@@ -89,6 +89,14 @@ impl AABB {
89
Self { min, max }
90
}
91
92
+ pub fn from_center_size(center: Vec2, size: Vec2) -> Self {
93
+ let half_size = size * 0.5;
94
+ Self {
95
+ min: center - half_size,
96
+ max: center + half_size,
97
+ }
98
99
+
100
pub fn center(&self) -> Vec2 {
101
(self.min + self.max) * 0.5
102
@@ -97,6 +105,13 @@ impl AABB {
105
self.max - self.min
106
107
108
+ pub fn contains(&self, point: Vec2) -> bool {
109
+ self.min.x <= point.x
110
+ && self.min.y <= point.y
111
+ && self.max.x >= point.x
112
+ && self.max.y >= point.y
113
114
115
pub fn expand_to_include_point(&mut self, point: Vec2) {
116
self.min = self.min.min(point);
117
self.max = self.max.max(point);
0 commit comments