-
Notifications
You must be signed in to change notification settings - Fork 141
Added Geometry Methods! #160
base: main
Are you sure you want to change the base?
Added Geometry Methods! #160
Conversation
Added the following methods Rectangle.scale() RuneliteObject.scale() Rectangle.get_center_left RuneliteObject.distance_from_rect_left RuneliteObject.distance_from_top_left()
Examples |
returns new objects instead of modifying existing ones
created a copy, then scaled
This is now done, one point to note is the RuneliteObject loses its "shape" with the scaling method, now instead of axis containing all the points within it's bounding color-box, it has all the points within its new corners. This can be revisited another time but without sucking all the processing and taking seconds this was the fastest way. When scaling it's a given that we lose accuracy anyways, but there could be a better way. |
Another alternative and quicker processing is to use the check for axis in the random_point() method only check if a rectangle is not scaled. Maybe when we scale a rectangle set a boolean to true |
#119 |
I added some additional methods for sorting based on arbitrary points. Haven't had time to review the rest but will hopefully get at it this week. |
I think the solution for the With all that said, since I added that sort key method that allows any point as input, should we get rid of the other hardcoded ones? Probably not necessary to have them, as sorting code is typically only written once, so it's not like it's added work to add the extra parameter. That way, we can also implement sorting for tile-based movement based on the direction the player has to travel (and thus, any point along the edges of the game view). This would result in possibly more accurate results. And last, I think I might add some
|
Fixes OSR-29
Fixes 119
Added the following methods
Rectangle.scale()
RuneliteObject.scale()
Rectangle.get_center_left
RuneliteObject.distance_from_rect_left
RuneliteObject.distance_from_top_left()