Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul Rect2 & Rect2i Documentation #69816

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

Mickeon
Copy link
Contributor

@Mickeon Mickeon commented Dec 9, 2022

Continuation of bla-bla-bla... #68838, #68983, #69594, #69451... You get the gist.

  • Made the wording match how other classes are documented a lot more closely;
  • Made use of [param] and several other strong references more often;
  • Changed words where it felt necessary, where they could be mistaken for another concept of Godot's API, where technical terms are more appropriate. For example:
    • "borders" -> "edges".
  • Added more examples.
  • Added "boolean context" note.
  • Changed most self-referential mentions of "Rect2" to "rectangle".
    • The reasoning for this is still debatable in my head, but I feel like it makes Rect2 as a concept much easier to explain and imagine when described as an actual rectangle (because it really just is).

Feedback is very, very welcome.

@Mickeon Mickeon requested a review from a team as a code owner December 9, 2022 17:29
@Mickeon Mickeon force-pushed the doc-peeves-rect2m branch 2 times, most recently from 0ad5a83 to fc03271 Compare December 9, 2022 17:38
@Calinou Calinou added this to the 4.0 milestone Dec 9, 2022
@Mickeon Mickeon force-pushed the doc-peeves-rect2m branch 2 times, most recently from a1a9117 to 86f5f37 Compare December 9, 2022 19:40
doc/classes/Rect2i.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2i.xml Outdated Show resolved Hide resolved
@Mickeon
Copy link
Contributor Author

Mickeon commented Feb 11, 2023

Rebased.

@Mickeon Mickeon requested review from a team as code owners April 5, 2023 14:31
@Mickeon
Copy link
Contributor Author

Mickeon commented Jul 31, 2023

Pushed a commit that should hopefully address all of the aforementioned issues.
Edit: missed a Rect2 instead of Rect2i.

doc/classes/Rect2i.xml Outdated Show resolved Hide resolved
doc/classes/Rect2i.xml Outdated Show resolved Hide resolved
@Mickeon
Copy link
Contributor Author

Mickeon commented Jul 31, 2023

Updated with the aforementioned suggestions (also mirrored in the Rect2 documentation)

@kleonc kleonc self-requested a review July 31, 2023 20:52
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
doc/classes/Rect2.xml Outdated Show resolved Hide resolved
</member>
</members>
<operators>
<operator name="operator !=">
<return type="bool" />
<param index="0" name="right" type="Rect2" />
<description>
Returns [code]true[/code] if the rectangles are not equal.
Returns [code]true[/code] if the [member position] and [member size] of the rectangles are not equal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns [code]true[/code] if the [member position] and [member size] of the rectangles are not equal.
Returns [code]true[/code] if either [member position] or [member size] of the rectangles are not equal, respectively.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now for this one I'm not sure if the... "the" is needed after "either" or not. I also don't know what the "respectively" is referring to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Respectively was meant to mean that positions are compared against each other and sizes are compared against each other (position is not being compared against size). But I think I've added it firstly, after the change to "either+or" maybe it's no longer needed indeed. 🤔
Actually making them plural should do the thing I think:

Suggested change
Returns [code]true[/code] if the [member position] and [member size] of the rectangles are not equal.
Returns [code]true[/code] if either [member position]s or [member size]s of the rectangles are not equal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid appending letters to property names. I like the former more, perhaps, but I could be trying something else...

@@ -211,7 +244,7 @@
<return type="bool" />
<param index="0" name="right" type="Rect2" />
<description>
Returns [code]true[/code] if the rectangles are exactly equal.
Returns [code]true[/code] if the [member position] and [member size] of the rectangles are exactly equal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns [code]true[/code] if the [member position] and [member size] of the rectangles are exactly equal.
Returns [code]true[/code] if both [member position] and [member size] of the rectangles are exactly equal, respectively.

(I don't think "exactly" is needed but oh well)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to specify here because there's 4 very precise floating-point numbers that have to be equal to return true. I suppose the adjective is not really necessary for Rect2i, however.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I get the reasoning. I mean "equal" and "exactly equal" are the same thing. 🙃 But if it's clearer then sure.
(and I skipped / haven't looked at the Rect2i part)

@Mickeon
Copy link
Contributor Author

Mickeon commented Aug 1, 2023

Pushed a commit that accepts most of the suggestions above (also mirrored in the Rect2i documentation)

Still unconvinced on how to describe the == and != operators without using the same generic one liner as before this PR.

One sentence I had in mind is "Returns true if all values (position and size) of both rectangles are equal." but it's quite generic, still.

@Mickeon Mickeon requested a review from kleonc August 1, 2023 10:57
doc/classes/Rect2i.xml Outdated Show resolved Hide resolved
doc/classes/Rect2i.xml Outdated Show resolved Hide resolved
Copy link
Member

@kleonc kleonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still unconvinced on how to describe the == and != operators without using the same generic one liner as before this PR.

Same here. OTOH let's be honest: probably everyone understands what these operators do anyway. 🙃 So these could probably be left even as before this PR indeed.


Anyway, overall LGTM.
(Maybe the merger will have some suggestion regarding the wording for == and != operators... 😉)

@akien-mga akien-mga merged commit df616c9 into godotengine:master Aug 2, 2023
13 checks passed
@akien-mga
Copy link
Member

Thanks!

@@ -70,41 +82,51 @@
<return type="Rect2i" />
<param index="0" name="to" type="Vector2i" />
<description>
Returns a copy of this [Rect2i] expanded so that the borders align with the given point.
Returns a copy of this rectangle expanded to include the given [param to] point, if necessary.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure this change is wrong. It was specifically modified because, when expanded to the right or bottom, the to point is not included in the rectangle by the has_point. (and this is on purpose)

Copy link
Contributor Author

@Mickeon Mickeon Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agh, this reply is technically correct. Saying "expanded to include" does imply that by calling has_point with the same point on the new rectangle , the result may or may not be true. I would like to think of a way to say this in a simpler way. At worst, the description needs to be mostly reverted back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.