Created
January 27, 2025 20:33
-
-
Save sjhalayka/00f4748e9893413225c335cef0c84320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double determinant(const Matrix3d& m) | |
{ | |
// https://textbooks.math.gatech.edu/ila/determinants-volumes.html | |
// https://copilot.microsoft.com/chats/qQxM5K1jer1Dc6pMtuDfD | |
Vector3d a; | |
a(0) = m(0, 0); | |
a(1) = m(0, 1); | |
a(2) = m(0, 2); | |
Vector3d b; | |
b(0) = m(1, 0); | |
b(1) = m(1, 1); | |
b(2) = m(1, 2); | |
Vector3d c; | |
c(0) = m(2, 0); | |
c(1) = m(2, 1); | |
c(2) = m(2, 2); | |
Vector3d cross = b.cross(c); | |
return std::abs(a.dot(cross)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment