Comments (2)
You are right in that both Matrix4f.determinant()
and Matrix4f.invert()
would need to effectively do the same computations. And they indeed do. It's just that the calculations done in Matrix4f.invert()
have been massively reshuffled and reorganized to make full use of variables to hold common sub-expressions that are computed at least twice. This gave a huge performance boost compared to a naive implementation of Matrix4f.invert()
where you'd simply once call determinant()
and then do all computations for the individual matrix elements.
However, both the determinant and the inverse matrix elements share many common sub-expressions that need not be computed multiple times, so I spend literally hours refactoring it to have as few arithmetic operations and as many reuses of variables for common sub-expressions as possible.
The fact that you do not see the common alternating + - patterns in the determinant is that this has also been restructured/reshuffled to "look nicer". Note that + (a * b - c * d)
is equal to - (c * d - a * b)
. This is all there is to it, really.
And both methods should do what they are supposed to do.
from joml.
Note that
+ (a * b - c * d)
is equal to- (c * d - a * b)
. This is all there is to it, really.
This makes so much more sense now and I didn't even think about that. Nor did I think about the performance implications. Thank you for clarifying!
from joml.
Related Issues (20)
- Kotlin extensions are not involved in the final artifact HOT 5
- Matrix3f class missing set(float m[], int off) method HOT 1
- Make Matrix4f element-fields "mxy" public like in Matrix3f HOT 1
- Matrix4f.getEulerAnglesYXZ HOT 1
- The function getTransposedToAddress() does not exist HOT 2
- AABB Intersections HOT 1
- [PR Reminder] You can instatiate instances of the Math utility class
- Can't figure out interesting behavior by Matrix4f.transpose() HOT 1
- A simpler way to create a Vector2d from a Vector3d HOT 6
- Optimize Vector Multiplication? HOT 20
- rotation matrix scaling HOT 1
- Vector3d.div() incorrectly takes in Vector3d instead of Vector3dc HOT 1
- Long counterpart to integer components HOT 2
- Matrix4f.setFrustum with zNear values < 1.0f creates distortions HOT 4
- Quaternionf fromAxisAngleDeg angle parameter description discrepancy HOT 1
- Bug in MemUtilUnsafe.put3x4 HOT 1
- Consistent Array Constructors/Accessors
- Scala Operators
- [Suggestion/Discussion] Matrix Consumer Actions
- Using JOML without Kotlin HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joml.