public void TestColumnAccessors() { var m = new Matrix3D(); m.SetColumn(0, 1F, 2F, 3F); m.SetColumn(1, new Vector3D(4f, 5f, 6f)); Assert.AreEqual(new Vector3D(1, 2, 3), m.GetColumn(0)); Assert.AreEqual(new Vector3D(4, 5, 6), m.GetColumn(1)); Assert.AreEqual(new Vector3D(0, 0, 0), m.GetColumn(2)); }
/// <summary> /// Augments the 3D orientation matrix as a 4x4 affine transformation matrix. /// </summary> public static Matrix Augment(this Matrix3D orientationMatrix, bool transpose = false) { var x = transpose ? orientationMatrix.GetColumn(0) : orientationMatrix.GetRow(0); var y = transpose ? orientationMatrix.GetColumn(1) : orientationMatrix.GetRow(1); var z = transpose ? orientationMatrix.GetColumn(2) : orientationMatrix.GetRow(2); return new Matrix(new[,] { {x.X, x.Y, x.Z, 0}, {y.X, y.Y, y.Z, 0}, {z.X, z.Y, z.Z, 0}, {0, 0, 0, 1} }); }