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

Intersectionf.intersectSphereSphere working ok? #304

Closed
princec opened this issue Dec 20, 2021 · 2 comments
Closed

Intersectionf.intersectSphereSphere working ok? #304

princec opened this issue Dec 20, 2021 · 2 comments
Labels

Comments

@princec
Copy link

princec commented Dec 20, 2021

This code snippet illustrates something weird behind intersectSphereSphere in JOML1.10.1 (haven't checked other versions).

	@Test
	void test() {
		var a = new Vector3f(337, 1612, 71);
		var ar = 8.55963316971002f;
		var b = new Vector3f(328.10107f, 1608.3077f, 70.125f);
		var br = 4.0f;

		System.out.println(a.distance(b));

		var dest = new Vector4f();
		System.out.println(Intersectionf.intersectSphereSphere(a, ar * ar, b, br * br, dest));
	}

There are two spheres there, which are clearly colliding when we check a.distance(b), the result being 9.67 which is less than the combined radii of the two spheres of 12.56.

However, intersectSphereSphere returns false.

The neither sphere in this case is fully enveloping the other; it is a clear case of a straightforward intersection:
image

@httpdigest
Copy link
Member

Hey @princec, Thanks for the report!
And sorry about that. There was indeed a small error in the code. I even mentioned the source of the implementation but failed to type it off correctly. :/
It is now fixed in 1.10.4-SNAPSHOT. Please use that if you can, for the time being.

@httpdigest httpdigest added the bug label Dec 20, 2021
@httpdigest httpdigest added this to the 1.10.4 release milestone Dec 20, 2021
@princec
Copy link
Author

princec commented Dec 20, 2021

Thanks ever so much Kai!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants