
Matrix3d / Subtract method adds
Posted Tuesday, 30 March, 2010 - 14:32 by glebedev| Project: | The Open Toolkit library |
| Version: | 1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | open |
Jump to:
This is not subtraction:
/// Subtract left matrix from this matrix.
/// The matrix to subtract.
public void Subtract(ref Matrix3d matrix)
{
R0C0 = R0C0 + matrix.R0C0;
R0C1 = R0C1 + matrix.R0C1;
R0C2 = R0C2 + matrix.R0C2;
R1C0 = R1C0 + matrix.R1C0;
R1C1 = R1C1 + matrix.R1C1;
R1C2 = R1C2 + matrix.R1C2;
R2C0 = R2C0 + matrix.R2C0;
R2C1 = R2C1 + matrix.R2C1;
R2C2 = R2C2 + matrix.R2C2;
}
/// Subtract left matrix from this matrix.
/// The matrix to subtract.
/// The resulting matrix of the subtraction.
public void Subtract(ref Matrix3d matrix, out Matrix3d result)
{
result.R0C0 = R0C0 + matrix.R0C0;
result.R0C1 = R0C1 + matrix.R0C1;
result.R0C2 = R0C2 + matrix.R0C2;
result.R1C0 = R1C0 + matrix.R1C0;
result.R1C1 = R1C1 + matrix.R1C1;
result.R1C2 = R1C2 + matrix.R1C2;
result.R2C0 = R2C0 + matrix.R2C0;
result.R2C1 = R2C1 + matrix.R2C1;
result.R2C2 = R2C2 + matrix.R2C2;
}
/// Subtract left matrix from left matrix.
/// The matrix on the matrix side of the equation.
/// The matrix on the right side of the equation
/// The resulting matrix of the subtraction.
public static void Subtract(ref Matrix3d left, ref Matrix3d right, out Matrix3d result)
{
result.R0C0 = left.R0C0 + right.R0C0;
result.R0C1 = left.R0C1 + right.R0C1;
result.R0C2 = left.R0C2 + right.R0C2;
result.R1C0 = left.R1C0 + right.R1C0;
result.R1C1 = left.R1C1 + right.R1C1;
result.R1C2 = left.R1C2 + right.R1C2;
result.R2C0 = left.R2C0 + right.R2C0;
result.R2C1 = left.R2C1 + right.R2C1;
result.R2C2 = left.R2C2 + right.R2C2;
}


Comments
#1
There's a reason why Matrix3d is not part of the public API. There's also a reason why the code is commented-out: it's simply not implemented.
I'm leaving this open in case someone wishes to work on those structures. I won't be spending any time on Matrix3/Matrix3d but if you can find a use for them, please be my guest! :-)
#2
If you have no objections, I'm going to take Matrix4d.cs and adapt it to become Matrix3d. Can I submit a patch of this when done?
#3
I'll happily add this to trunk, if you also tackle the Matrix3 struct (single-precision version).
#4
Sure, no problem. Can I commit the changes directly, or do I post them here?
#5
The code is ready...where do I send it? :-)