Matrix 3 x 3 : Matrix « Data Types « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Data Types » MatrixScreenshots 
Matrix 3 x 3
 
//http://isotopescreencapture.codeplex.com/
//The MIT License (MIT)
namespace Isotope.Math
{
    public struct Matrix3x3
    {
        public double M11, M12, M13;
        public double M21, M22, M23;
        public double M31, M32, M33;

        public Matrix3x3(
            double m11,
            double m12,
            double m13,
            double m21,
            double m22,
            double m23,
            double m31,
            double m32,
            double m33)
        {
            M11 = m11;
            M12 = m12;
            M13 = m13;
            M21 = m21;
            M22 = m22;
            M23 = m23;
            M31 = m31;
            M32 = m32;
            M33 = m33;
        }

        public Matrix3x3 Multiply(Matrix3x3 m)
        {
            var result = new Matrix3x3();

            result.M11 = this.M11*m.M11 + this.M12*m.M21 + this.M13*m.M31;
            result.M12 = this.M11*m.M12 + this.M12*m.M22 + this.M13*m.M32;
            result.M13 = this.M11*m.M13 + this.M12*m.M23 + this.M13*m.M33;

            result.M21 = this.M21*m.M11 + this.M22*m.M21 + this.M23*m.M31;
            result.M22 = this.M21*m.M12 + this.M22*m.M22 + this.M23*m.M32;
            result.M23 = this.M21*m.M13 + this.M22*m.M23 + this.M23*m.M33;

            result.M31 = this.M31*m.M11 + this.M32*m.M21 + this.M33*m.M31;
            result.M32 = this.M31*m.M12 + this.M32*m.M22 + this.M33*m.M32;
            result.M33 = this.M31*m.M13 + this.M32*m.M23 + this.M33*m.M33;

            return result;
        }

        public static Matrix3x3 operator *(Matrix3x3 a, Matrix3x3 b)
        {
            return a.Multiply(b);
        }

    }
}

   
  
Related examples in the same category
1.Inverts a Matrix
2.Matrix class
3.Matrix used in linear algebra
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.