Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
(Improvement) Add additional calculation methods to RoomXY #521
(Improvement) Add additional calculation methods to RoomXY #521
Changes from all commits
f79dac1
0ed82bf
bea776c
0a45f47
b47b6ca
355b832
fc8ec03
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strongly disagree with these impls existing, considering even in-game objects disagree on being row or column major (which this implicitly enforces).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was copied over from
Position
, purely because it allows for usage as a key in things likeBTreeMap
and that seems like a reasonable thing to keep parity with. If we want to tear it out here, we should tear it out there as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, yes. Position is even worse, since on top of picking row/column major, you also have to decide if you're doing a lex order on the (room name, room xy) pair or treating the whole position as a single world xy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For position, there's really 6 different ways you could arrange the components into a 4-tuple and use the lex ordering to come up with a sensible Position ordering:
(room_name.x, room_xy.x, room_name.y, room_xy.y)
(room_name.y, room_xy.y, room_name.x, room_xy.x)
<- the one Position implements(room_name.x, room_name.y, room_xy.x, room_xy.y)
(room_name.x, room_name.y, room_xy.y, room_xy.x)
(room_name.y, room_name.x, room_xy.x, room_xy.y)
(room_name.y, room_name.x, room_xy.y, room_xy.x)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can tear this out if we really want to, and you can open up a PR for tearing out the
Position
implementation, but I'm not comfortable doing the latter in this PR. It feels out of scope for the intended goal of bringingRoomXY
into approximate API parity withPosition
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a weird one; wouldn't you want a float in
[0,1]
forself*x + target*(1-x)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure what you're asking here. Can you clarify a bit more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this is supposed to be some sort of interpolation method, where you get a point on the line segment between self and target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, this is a directional interpolation method. I'm not sure that returning the interpolation multiplier (or even vector) is all that helpful, though, since the user would still need to determine what
RoomXY
corresponds to that interpolation multiplier.As with
PartialOrd
, this was copied fromPosition
for API parity.