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

changeable epsilon for (typeof Quaternion).FromUnitVectorsToRef #13983

Merged
merged 2 commits into from
Jun 20, 2023

Conversation

nekochanoide
Copy link
Contributor

for my use case epsilon is to big, so right now I have to copy entire method and use 1e-7 epsilon which works fine for me
I hope optional parameter for epsilon is fine

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 20, 2023

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 20, 2023

@@ -4664,10 +4664,10 @@ export class Quaternion {
* @param result the quaternion to store the result
* @returns the updated quaternion
*/
public static FromUnitVectorsToRef<T extends Quaternion>(vecFrom: DeepImmutable<Vector3>, vecTo: DeepImmutable<Vector3>, result: T): T {
public static FromUnitVectorsToRef<T extends Quaternion>(vecFrom: DeepImmutable<Vector3>, vecTo: DeepImmutable<Vector3>, result: T, epsilon = Epsilon): T {
Copy link
Contributor

Choose a reason for hiding this comment

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

The doc for epsilon is missing in the function description.

@nekochanoide
Copy link
Contributor Author

I wonder what purpose this epsilon check serves? Is it optimization or function might break, if dot product is near zero.

@carolhmj
Copy link
Contributor

I wonder what purpose this epsilon check serves? Is it optimization or function might break, if dot product is near zero.

It's to avoid breaking because of limited precision: https://blog.demofox.org/2017/11/21/floating-point-precision/

@deltakosh deltakosh merged commit 940429d into BabylonJS:master Jun 20, 2023
8 checks passed
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.

None yet

6 participants