Skip to content

Commit 25a51db

Browse files
committed
Clean up Rectangle a bit
1 parent aff850c commit 25a51db

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

lib/std/math/shapes.c3

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn Num[<2>] Rectangle.min(self) @inline
3636
<*
3737
Returns the maximum corner (origin + size)
3838
39-
@return "the maximum corner"
39+
@return "The maximum corner"
4040
*>
4141
fn Num[<2>] Rectangle.max(self) @inline
4242
{
@@ -64,10 +64,10 @@ fn Num Rectangle.area(self)
6464
}
6565

6666
<*
67-
Return error if the rectangle is empty.
67+
Check if the rectangle is empty.
6868
6969
@require self.size.min() >= 0 : "Invalid rectangle with negative size"
70-
@return "True is the rectangle is empty"
70+
@return "True if the rectangle is empty"
7171
*>
7272
fn bool Rectangle.is_empty(self)
7373
{
@@ -77,7 +77,7 @@ fn bool Rectangle.is_empty(self)
7777
// Spatial queries
7878

7979
<*
80-
Check if a point is contained in a rectangle
80+
Check if a point is contained in the rectangle.
8181
8282
@return "true if the point is inside or on the border of the rectangle"
8383
*>
@@ -86,7 +86,6 @@ fn bool Rectangle.contains_point(self, Num[<2>] point)
8686
return self.origin.comp_le(point).and() & (self.origin + self.size).comp_ge(point).and();
8787
}
8888

89-
9089
<*
9190
Checks if the rectangle fully contains another rectangle.
9291
@@ -113,13 +112,12 @@ fn bool Rectangle.intersects(self, Rectangle other)
113112
&& a.y < b.y + b.w;
114113
}
115114

116-
117115
// Geometry operations
118116

119117
<*
120-
Merge two rectangles into a rectangle enough to contain both rectangles.
118+
Merge two rectangles into a rectangle large enough to contain both rectangles.
121119
122-
@return "the smallest rectangle containing both rectangles"
120+
@return "The smallest rectangle containing both rectangles"
123121
*>
124122
fn Rectangle Rectangle.merge(self, Rectangle other)
125123
{
@@ -150,7 +148,8 @@ fn Rectangle? Rectangle.intersection(self, Rectangle other)
150148

151149
<*
152150
Expands the rectangle to have integral boundaries.
153-
@return "the resulting rectangle"
151+
152+
@return "The resulting rectangle"
154153
*>
155154
fn Rectangle Rectangle.integral_outer(self) @if(types::is_float(Num))
156155
{
@@ -162,7 +161,8 @@ fn Rectangle Rectangle.integral_outer(self) @if(types::is_float(Num))
162161

163162
<*
164163
Shrinks the rectangle to have integral boundaries.
165-
@return "the resulting rectangle"
164+
165+
@return "The resulting rectangle"
166166
*>
167167
fn Rectangle Rectangle.integral_inner(self) @if(types::is_float(Num))
168168
{
@@ -177,7 +177,7 @@ fn Rectangle Rectangle.integral_inner(self) @if(types::is_float(Num))
177177
178178
@require amount >= 0 : "Expected a positive or zero amount"
179179
@require (self.size - amount * 2).min() >= 0 : "Inset must result in a zero or positive size"
180-
@return "the resulting rectangle"
180+
@return "The resulting rectangle"
181181
*>
182182
fn Rectangle Rectangle.inset(self, Num amount)
183183
{
@@ -188,7 +188,7 @@ fn Rectangle Rectangle.inset(self, Num amount)
188188
Shrinks the rectangle by amount from all sides, clamping to zero size if necessary.
189189
190190
@require amount >= 0 : "Expected a positive or zero amount"
191-
@return "the resulting rectangle"
191+
@return "The resulting rectangle"
192192
*>
193193
fn Rectangle Rectangle.inset_clamped(self, Num amount)
194194
{
@@ -205,7 +205,7 @@ fn Rectangle Rectangle.inset_clamped(self, Num amount)
205205
@require amount * 2 + self.height >= 0 : "The amount would make the height negative"
206206
@ensure return.contains_rect(self)
207207

208-
@return "the resulting rectangle"
208+
@return "The resulting rectangle"
209209
*>
210210
fn Rectangle Rectangle.expand(self, Num amount)
211211
{
@@ -216,7 +216,7 @@ fn Rectangle Rectangle.expand(self, Num amount)
216216
Expands the rectangle minimally to include a point.
217217
218218
@param point : "The point to expand the rectangle with"
219-
@return "the resulting rectangle"
219+
@return "The resulting rectangle"
220220

221221
@ensure return.contains_point(point)
222222
*>
@@ -234,7 +234,7 @@ fn Rectangle Rectangle.merge_point(self, Num[<2>] point)
234234
<*
235235
Clamps a point to lie inside a rectangle.
236236
237-
@return "the resulting point"
237+
@return "The resulting point"
238238
@ensure self.contains_point(return)
239239
*>
240240
fn Num[<2>] Rectangle.clamp_point(self, Num[<2>] point)

0 commit comments

Comments
 (0)