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

normalize() maybe wrong? #21

Closed
freedom12 opened this issue Jun 16, 2019 · 3 comments
Closed

normalize() maybe wrong? #21

freedom12 opened this issue Jun 16, 2019 · 3 comments

Comments

@freedom12
Copy link

freedom12 commented Jun 16, 2019

func normalized() -> Vector4 {
    let lengthSquared = self.lengthSquared
    if lengthSquared ~= 0 || lengthSquared ~= 1 {
        return self
    }
    return self / sqrt(lengthSquared)
}

should be " lengthSquared == 0 || lengthSquared == 1 "

@nicklockwood
Copy link
Owner

Why?

@nicklockwood
Copy link
Owner

Oh, hmm I see. I think the problem is really that the value of epsilon is way too large. Should probably much closer to the actual limit of float precision.

@nicklockwood
Copy link
Owner

Fixed in 0.4.1

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

No branches or pull requests

2 participants