Пример #1
0
        // 获取代数余子式
        public float _GetRemianValue(int trimRow, int trimCol)
        {
            int remainNumber = mNumber - 1;
            // 余子式
            Matrix22 remain = new Matrix22();
            int      index  = 0;

            for (int row = 0; row < mNumber; row++)
            {
                for (int col = 0; col < mNumber; col++)
                {
                    if (row != trimRow && col != trimCol)
                    {
                        int rowIndex = index / remainNumber;
                        int colIndex = index % remainNumber;
                        ++index;
                        remain[rowIndex, colIndex] = this[row, col];
                    }
                }
            }
            // 代数余子式
            float remainValue = remain.Determinant() * (float)Math.Pow(-1, trimRow + trimCol);

            return(remainValue);
        }
Пример #2
0
 // 使用物体->惯性旋转矩阵构建OBB
 public OBB2D(Vector2 center, Vector2 size, Matrix22 object2Intertial)
 {
     m_Center  = center;
     m_Extent  = size * 0.5f;
     m_right   = new Vector2(object2Intertial[0, 0], object2Intertial[0, 1]);
     m_forward = new Vector2(object2Intertial[1, 0], object2Intertial[1, 1]);
 }