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

Sphere Fix: Handle empty cases in Sphere.union #24701

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented Sep 27, 2022

Related issue: #24694

Description

Handle cases where the spheres are empty in Sphere.union. Here is the behavior before and after.

s1 = new THREE.Sphere();
s2 = new THREE.Sphere();

s1.center.set( 1, 0, 0 );
s1.radius = 0.1;
s2.makeEmpty();

s1.union( s2 );
console.log( s1.center, s1.radius );
// BEFORE: "( 0.050000000000000044, 0, 0 )" "1.05"
// AFTER: "( 1, 0, 0 )" "0.1"

s1.makeEmpty();
s2.center.set( 1, 0, 0 );
s2.radius = 0.1;

s1.union( s2 );
console.log( s1.center, s1.radius );
// BEFORE: "( 1, 0, 0 )" "0.10000000000000003"
// AFTER: "( 1, 0, 0 )" "0.1"

@gkjohnson gkjohnson added this to the r145 milestone Sep 27, 2022
@mrdoob
Copy link
Owner

mrdoob commented Sep 27, 2022

@WestLangley Merging this for now. We can revert if you find any issues.

@mrdoob mrdoob merged commit 341b2e8 into mrdoob:dev Sep 27, 2022
@mrdoob
Copy link
Owner

mrdoob commented Sep 27, 2022

Thanks!

@gkjohnson gkjohnson deleted the sphere-union-fix branch September 27, 2022 14:37
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

Successfully merging this pull request may close these issues.

3 participants