glebedev's picture

Matrix3d / Subtract method adds

Project:The Open Toolkit library
Version:1.x-dev
Component:Code
Category:feature request
Priority:minor
Assigned:Unassigned
Status:open
Description

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Category:bug report» feature request
Priority:critical» minor

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! :-)

anathema's picture

#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?

the Fiddler's picture

#3

I'll happily add this to trunk, if you also tackle the Matrix3 struct (single-precision version).

anathema's picture

#4

Sure, no problem. Can I commit the changes directly, or do I post them here?

anathema's picture

#5

The code is ready...where do I send it? :-)

Who's online

There are currently 0 users and 12 guests online.