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

Box2, Box3: Escape ternary condition in "containsPoint" method #28871

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

satelllte
Copy link
Contributor

Description

I was reading the source code and it was slightly inconvenient to see this condition being negated via ternary, so it might be worth to flip it to make it more concise.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +6 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.7 kB (111.1 kB) 460.7 kB (111.1 kB) +4 B
@satelllte satelllte changed the title Box2, Box3: containsPoint - flip condition implementation Jul 14, 2024
@satelllte satelllte marked this pull request as ready for review July 14, 2024 19:22
Copy link
Collaborator

@Mugen87 Mugen87 left a comment

Choose a reason for hiding this comment

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

IMO, this is an improvement since now the test is more in line with how the literature defines the formula. From 3D Math Primer for Graphics and Game Development (2nd Ed):

image
@Mugen87 Mugen87 added this to the r167 milestone Jul 15, 2024
@Mugen87 Mugen87 merged commit aee8009 into mrdoob:dev Jul 15, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants