The determinant’s absolute value is the volume scaling factor; a negative sign means orientation flips.
dotnet add package RecursiveAI.OneMathRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneMath; var det = new Matrix3x3D(-2, 0, 0, 0, 3, 0, 0, 0, 4).Determinant(); Console.WriteLine(Math.Abs(det)); Console.WriteLine(det < 0);
Unzip the example, then dotnet run.
24 True
Volume scales by 24; True means orientation reverses.
The full program
using RecursiveAI.OneMath; var transform = new Affine3D( new Matrix3x3D(-2, 0, 0, 0, 3, 0, 0, 0, 4), new Vector3D(10, 20, 30)); double determinant = transform.Linear.Determinant(); Console.WriteLine($"Determinant: {determinant}"); Console.WriteLine($"Volume multiplier: {Math.Abs(determinant)}"); Console.WriteLine($"Reverses orientation: {determinant < 0}"); Console.WriteLine($"Volume after (from 2): {2 * Math.Abs(determinant)}");
dotnet run prints:
Determinant: -24 Volume multiplier: 24 Reverses orientation: True Volume after (from 2): 48
If the floating-point determinant is nonfinite, don’t use it as a volume multiplier.
Variations
Matrix3x3D takes its nine arguments in row-major order: the first row, then the second, then the third. Here, the 2 in the first row adds twice Y to X without changing the volume:
using RecursiveAI.OneMath; var shear = new Matrix3x3D(1, 2, 0, 0, 1, 0, 0, 0, 1); Console.WriteLine(Math.Abs(shear.Determinant()));
1Related recipes
The short answer
Call transform.Linear.Determinant() for an Affine3D and take Math.Abs of the result to get the volume multiplier. If you already have the Matrix3x3D, call Determinant() directly on it. Multiply the original volume by that nonnegative factor. Keep the signed determinant separately to tell whether the transform reverses orientation.
Why is the determinant the volume scaling factor?
For a linear transform, the three transformed unit axes are the columns of the matrix. Together they span a parallelepiped, the transformed unit cube. Its volume is the magnitude of the determinant. That same factor applies to the volume of other shapes under the same linear map; see Georgia Tech’s Determinants and Volumes.
An affine transform adds a translation after the linear map, as shown in OneMath’s Affine3D source. Translation shifts every point by the same amount, so the edges of the transformed cube and its volume don’t depend on that offset. This is why the full program uses only transform.Linear even with a translation of (10, 20, 30). A shear can change the edges without changing volume: in the variation, the sheared cube has slanted sides but the same base area and height.
What does a negative determinant mean for volume?
The sign tells you about orientation, not the amount of space occupied. The example scales X by −2, Y by 3, and Z by 4. Reflecting along X reverses orientation; the three length multipliers are still 2, 3, and 4. That gives a signed determinant of −24 and a volume multiplier of 24. A shape with volume 2 therefore has volume 48 after the transform.
A mathematically zero determinant means the linear map collapses three-dimensional volume, such as a scale that sets Z to zero. Don’t treat the computed value as an exact test for that condition: OneMath’s implementation uses a cofactor expansion in double. The products can overflow or underflow, and subtraction can lose precision when terms are nearly equal. Even the sign can be sensitive near a collapse. Use the multiplier here to measure ordinary transforms, not as an exact degeneracy predicate.