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

within method for Vec2 and Vec3 #594

Open
whimbur-total opened this issue Dec 24, 2024 · 1 comment
Open

within method for Vec2 and Vec3 #594

whimbur-total opened this issue Dec 24, 2024 · 1 comment

Comments

@whimbur-total
Copy link

A method to check if a point self is somewhere inside the area of a rectangle with point a being the top-left corner and point b being the bottom-right corner.

pub fn within(&self, a: &Vec2, b: &Vec2) -> bool

example:

let a = Vec2::ZERO;
let b = Vec2::ONE;

assert!(Vec2::(0.5, 0.5).within(&a, &b))
assert!(Vec2::ONE.within(&a, &b))
assert!(Vec2::(1.5, 0.25).within(&a, &b)) // Assertion fails because `1.5 > 1.0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@whimbur-total and others