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

Patch over circular dep between Box3 and Sphere #10547

Merged
merged 2 commits into from
Jan 12, 2017
Merged

Patch over circular dep between Box3 and Sphere #10547

merged 2 commits into from
Jan 12, 2017

Conversation

chazcb
Copy link
Contributor

@chazcb chazcb commented Jan 9, 2017

Box3 relies on Sphere, and Sphere relies on Box3 to instantiate an instance of Box3 and use that instance's methods inside setFromPoints. This is a fairly naive patch to resolve the circular dependency so that we can load three.js source files using webpack / babel.

…three js source files directly instead of requiring all of the THREE.
@chazcb chazcb changed the title Allow lazy loading of the Box3 constructor, so that webpack can load … Patch over circular dep between Box3 and Sphere Jan 9, 2017

return function setFromPoints( points, optionalCenter ) {

box = box || new Box3();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe you can add here a comment like box = box || new Box3(); // see #10547

Copy link
Owner

Choose a reason for hiding this comment

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

I would also do...

if ( box === undefined ) box = new Box3();

Copy link
Collaborator

Choose a reason for hiding this comment

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

We prevent circular references all the time using this pattern. Why the inline comment in this case?

@chazcb
Copy link
Contributor Author

chazcb commented Jan 11, 2017

Thanks for the suggestions @mrdoob and @Mugen87

@mrdoob mrdoob merged commit 95c3521 into mrdoob:dev Jan 12, 2017
@mrdoob
Copy link
Owner

mrdoob commented Jan 12, 2017

Thanks!

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.

4 participants