-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
integer cast function for the math.VectorX #3109
Comments
It is technically not the same thing, but have considered using the round() function instead? It returns a vector with each component rounded. (1.2 -> 1, 2.6 -> 3) |
maybe the best approach would be to implement normal logical round like you said but also a floor and ceil methods |
@XFajk the round() functionality is implement trough class Custom:
def __init__(self, any: float):
self.any = any
def __int__(self):
print("int called")
return int(self.any)
print(int(Custom(2.8))) (example, for Vector2 it would be needed to be done in C) |
@damusss I could just try to implement the int method if some unrelated tests fail I will just close the issue |
Hey @XFajk, note that you would not use the Personally, I don't think any new implementation is needed, because there are ways to get similar behavior:
|
@aatle yeah you right I tried to implement it but I ran into the int can only return a integer problem and I dont see a better way to implement this that would feel weird |
I was thinking if making a method that turns floats in the Vector to integers would be a good addition because in my last project I found my self doing
pygame.Vector2(int(other_vector.x), int(other_vector.y))
and something likeother_vector.copy().int()
would maybe be more readablealso I can and would want to implement this I am just making an issue to get it approved that I can add this and also I to link the pull request to this issue
The text was updated successfully, but these errors were encountered: