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

Zero instance for TransformMatrixKHR #240

Closed
sheaf opened this issue Dec 11, 2020 · 4 comments
Closed

Zero instance for TransformMatrixKHR #240

sheaf opened this issue Dec 11, 2020 · 4 comments

Comments

@sheaf
Copy link
Collaborator

sheaf commented Dec 11, 2020

The current Zero instance for TransformMatrixKHR doesn't abide by the specification:

instance Zero TransformMatrixKHR where
  zero = TransformMatrixKHR
           (zero, zero, zero, zero)
           (zero, zero, zero, zero)
           (zero, zero, zero, zero)
  • The first three columns of matrix must define an invertible 3x3 matrix

If possible, the instance should be changed to

instance Zero TransformMatrixKHR where
 zero = TransformMatrixKHR
          (1,0,0,0)
          (0,1,0,0)
          (0,0,1,0)

However, if for any reason that's annoying, I think it would be better to remove the instance entirely.

@expipiplus1
Copy link
Owner

expipiplus1 commented Dec 12, 2020 via email

@expipiplus1
Copy link
Owner

expipiplus1 commented Dec 17, 2020

I think the zero instance should be left as it is. But we could consider adding an 'Identity'/'One' class for this and some other things (such as Quaternionf http://expipiplus1.github.io/vulkan/openxr-0.1-docs/OpenXR-Core10-Space.html#v:Quaternionf); probably best done in a utils package.

@sheaf
Copy link
Collaborator Author

sheaf commented Dec 17, 2020

Well I don't really see the point of the Zero instance as it is, as one would never want to use it. I suppose the perspective of "zero should mean all the bits are 0" justifies it, but I don't find it very convincing. I think zero should provide a default value whenever there exists a unique possible default value; in this case we want a multiplicative identity as opposed to an additive identity.

@expipiplus1
Copy link
Owner

Yeah, you're right, it's actually only useful for satisfying that law which is pretty flimsy anyway, shouldn't be too hard to make the change.

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