]> OCCT Git - occt.git/commitdiff
0032417: Coding Rules - clean up public headers gp_Mat.hxx/ gp_Mat2d.hxx from interna...
authormkrylova <mkrylova@opencascade.com>
Fri, 4 Jun 2021 08:13:47 +0000 (11:13 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 9 Jun 2021 16:40:22 +0000 (19:40 +0300)
Deleted internal macros.

src/gp/gp_Mat.cxx
src/gp/gp_Mat.hxx
src/gp/gp_Mat2d.cxx
src/gp/gp_Mat2d.hxx
src/gp/gp_XY.hxx

index b14d6b4caf55c4ae4a541949d34d6cb184532204..4e4a64cea6992b997f982ffd0c0571b0a84da8cf 100644 (file)
@@ -12,8 +12,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-//  10/09/97 : PMN : Correction BUC40192 (pb avec les matrices negatives)
-
 #ifndef OCCT_DEBUG
 #define No_Standard_OutOfRange
 #define No_Standard_ConstructionError
 #include <Standard_OutOfRange.hxx>
 #include <Standard_Dump.hxx>
 
-#define M00 ((Standard_Real*)M)[0]
-#define M01 ((Standard_Real*)M)[1]
-#define M02 ((Standard_Real*)M)[2]
-#define M10 ((Standard_Real*)M)[3]
-#define M11 ((Standard_Real*)M)[4]
-#define M12 ((Standard_Real*)M)[5]
-#define M20 ((Standard_Real*)M)[6]
-#define M21 ((Standard_Real*)M)[7]
-#define M22 ((Standard_Real*)M)[8]
-
-#define N00 ((Standard_Real*)N)[0]
-#define N01 ((Standard_Real*)N)[1]
-#define N02 ((Standard_Real*)N)[2]
-#define N10 ((Standard_Real*)N)[3]
-#define N11 ((Standard_Real*)N)[4]
-#define N12 ((Standard_Real*)N)[5]
-#define N20 ((Standard_Real*)N)[6]
-#define N21 ((Standard_Real*)N)[7]
-#define N22 ((Standard_Real*)N)[8]
-
-gp_Mat::gp_Mat (const gp_XYZ& Col1,
-               const gp_XYZ& Col2,
-               const gp_XYZ& Col3)
+// =======================================================================
+// function : gp_Mat
+// purpose  :
+// =======================================================================
+gp_Mat::gp_Mat (const gp_XYZ& theCol1,
+                           const gp_XYZ& theCol2,
+                           const gp_XYZ& theCol3)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  M00 = Col1.X(); M10 = Col1.Y(); M20 = Col1.Z();
-  M01 = Col2.X(); M11 = Col2.Y(); M21 = Col2.Z();
-  M02 = Col3.X(); M12 = Col3.Y(); M22 = Col3.Z();
+  myMat[0][0] = theCol1.X(); myMat[1][0] = theCol1.Y(); myMat[2][0] = theCol1.Z();
+  myMat[0][1] = theCol2.X(); myMat[1][1] = theCol2.Y(); myMat[2][1] = theCol2.Z();
+  myMat[0][2] = theCol3.X(); myMat[1][2] = theCol3.Y(); myMat[2][2] = theCol3.Z();
 }
 
-void gp_Mat::SetCol (const Standard_Integer Col,
-                    const gp_XYZ& Value) {
-
-  Standard_OutOfRange_Raise_if (Col < 1 || Col > 3, " ");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if      (Col == 1) {
-    M00 = Value.X(); M10 = Value.Y(); M20 = Value.Z();
+// =======================================================================
+// function : SetCol
+// purpose  :
+// =======================================================================
+void gp_Mat::SetCol (const Standard_Integer theCol,
+                                const gp_XYZ& theValue)
+{
+  Standard_OutOfRange_Raise_if (theCol < 1 || theCol > 3, " ");
+  if      (theCol == 1)
+  {
+    myMat[0][0] = theValue.X(); myMat[1][0] = theValue.Y(); myMat[2][0] = theValue.Z();
   }
-  else if (Col == 2) {
-    M01 = Value.X(); M11 = Value.Y(); M21 = Value.Z();
+  else if (theCol == 2)
+  {
+    myMat[0][1] = theValue.X(); myMat[1][1] = theValue.Y(); myMat[2][1] = theValue.Z();
   }
-  else {
-    M02 = Value.X(); M12 = Value.Y(); M22 = Value.Z();
+  else
+  {
+    myMat[0][2] = theValue.X(); myMat[1][2] = theValue.Y(); myMat[2][2] = theValue.Z();
   }
 }
 
-void gp_Mat::SetCols (const gp_XYZ& Col1,
-                     const gp_XYZ& Col2,
-                     const gp_XYZ& Col3)
+// =======================================================================
+// function : SetCols
+// purpose  :
+// =======================================================================
+void gp_Mat::SetCols (const gp_XYZ& theCol1,
+                                 const gp_XYZ& theCol2,
+                                 const gp_XYZ& theCol3)
 {
-  Mat00 = Col1.X(); Mat10 = Col1.Y(); Mat20 = Col1.Z();
-  Mat01 = Col2.X(); Mat11 = Col2.Y(); Mat21 = Col2.Z();
-  Mat02 = Col3.X(); Mat12 = Col3.Y(); Mat22 = Col3.Z();
+  myMat[0][0] = theCol1.X(); myMat[1][0] = theCol1.Y(); myMat[2][0] = theCol1.Z();
+  myMat[0][1] = theCol2.X(); myMat[1][1] = theCol2.Y(); myMat[2][1] = theCol2.Z();
+  myMat[0][2] = theCol3.X(); myMat[1][2] = theCol3.Y(); myMat[2][2] = theCol3.Z();
 }
 
-void gp_Mat::SetCross (const gp_XYZ& Ref)
+// =======================================================================
+// function : SetCross
+// purpose  :
+// =======================================================================
+void gp_Mat::SetCross (const gp_XYZ& theRef)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  Standard_Real X = Ref.X();
-  Standard_Real Y = Ref.Y();
-  Standard_Real Z = Ref.Z();
-  M00 = M11 = M22 = 0.0;
-  M01 = - Z;  
-  M02 = Y;
-  M12 = - X;
-  M10 = Z;
-  M20 = - Y;
-  M21 = X;
+  const Standard_Real X = theRef.X();
+  const Standard_Real Y = theRef.Y();
+  const Standard_Real Z = theRef.Z();
+  myMat[0][0] = myMat[1][1] = myMat[2][2] = 0.0;
+  myMat[0][1] = -Z;
+  myMat[0][2] =  Y;
+  myMat[1][2] = -X;
+  myMat[1][0] =  Z;
+  myMat[2][0] = -Y;
+  myMat[2][1] =  X;
 }
 
-void gp_Mat::SetDot (const gp_XYZ& Ref)
+// =======================================================================
+// function : SetDot
+// purpose  :
+// =======================================================================
+void gp_Mat::SetDot (const gp_XYZ& theRef)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  Standard_Real X = Ref.X();
-  Standard_Real Y = Ref.Y();
-  Standard_Real Z = Ref.Z();
-  M00 = X * X;
-  M11 = Y * Y;
-  M22 = Z * Z;
-  M01 = X * Y;
-  M02 = X * Z;
-  M12 = Y * Z;
-  M10 = M01;
-  M20 = M02;
-  M21 = M12;
+  const Standard_Real X = theRef.X();
+  const Standard_Real Y = theRef.Y();
+  const Standard_Real Z = theRef.Z();
+  myMat[0][0] = X * X;
+  myMat[1][1] = Y * Y;
+  myMat[2][2] = Z * Z;
+  myMat[0][1] = X * Y;
+  myMat[0][2] = X * Z;
+  myMat[1][2] = Y * Z;
+  myMat[1][0] = myMat[0][1];
+  myMat[2][0] = myMat[0][2];
+  myMat[2][1] = myMat[1][2];
 }
 
-void gp_Mat::SetRotation (const gp_XYZ& Axis,
-                         const Standard_Real Ang)
+// =======================================================================
+// function : SetRotation
+// purpose  :
+// =======================================================================
+void gp_Mat::SetRotation (const gp_XYZ& theAxis,
+                                           const Standard_Real theAng)
 {
   //    Rot = I + sin(Ang) * M + (1. - cos(Ang)) * M*M
   //    avec  M . XYZ = Axis ^ XYZ
-
-//  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  gp_XYZ V = Axis.Normalized();
-  SetCross (V);
-  Multiply (sin(Ang));
-  gp_Mat Temp;
-  Temp.SetScale (1.0);
-  Add (Temp);
-  Standard_Real A = V.X();
-  Standard_Real B = V.Y();
-  Standard_Real C = V.Z();
-  Temp.SetRow (1, gp_XYZ(- C*C - B*B,      A*B,           A*C     ));
-  Temp.SetRow (2, gp_XYZ(     A*B,      -A*A - C*C,        B*C    ));
-  Temp.SetRow (3, gp_XYZ(     A*C,          B*C,       - A*A - B*B));
-  Temp.Multiply (1.0 - cos(Ang));
-  Add (Temp);
+  const gp_XYZ aV = theAxis.Normalized();
+  SetCross (aV);
+  Multiply (sin(theAng));
+  gp_Mat aTemp;
+  aTemp.SetScale (1.0);
+  Add (aTemp);
+  const Standard_Real A = aV.X();
+  const Standard_Real B = aV.Y();
+  const Standard_Real C = aV.Z();
+  aTemp.SetRow (1, gp_XYZ(- C*C - B*B,      A*B,           A*C     ));
+  aTemp.SetRow (2, gp_XYZ(     A*B,      -A*A - C*C,        B*C    ));
+  aTemp.SetRow (3, gp_XYZ(     A*C,          B*C,       - A*A - B*B));
+  aTemp.Multiply (1.0 - cos(theAng));
+  Add (aTemp);
 }
 
-void gp_Mat::SetRow (const Standard_Integer Row,
-                    const gp_XYZ& Value)
+// =======================================================================
+// function : SetRow
+// purpose  :
+// =======================================================================
+void gp_Mat::SetRow (const Standard_Integer theRow,
+                                const gp_XYZ& theValue)
 {
-  Standard_OutOfRange_Raise_if (Row < 1 || Row > 3, " ");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if      (Row == 1) {
-    M00 = Value.X(); M01 = Value.Y(); M02 = Value.Z();
+  Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 3, " ");
+  if      (theRow == 1)
+  {
+    myMat[0][0] = theValue.X(); myMat[0][1] = theValue.Y(); myMat[0][2] = theValue.Z();
   }
-  else if (Row == 2) {
-    M10 = Value.X(); M11 = Value.Y(); M12 = Value.Z();
+  else if (theRow == 2)
+  {
+    myMat[1][0] = theValue.X(); myMat[1][1] = theValue.Y(); myMat[1][2] = theValue.Z();
   }
-  else {
-    M20 = Value.X(); M21 = Value.Y(); M22 = Value.Z();
+  else
+  {
+    myMat[2][0] = theValue.X(); myMat[2][1] = theValue.Y(); myMat[2][2] = theValue.Z();
   }
 }
 
-void gp_Mat::SetRows (const gp_XYZ& Row1,
-                     const gp_XYZ& Row2,
-                     const gp_XYZ& Row3)
+// =======================================================================
+// function : SetRows
+// purpose  :
+// =======================================================================
+void gp_Mat::SetRows (const gp_XYZ& theRow1,
+                                 const gp_XYZ& theRow2,
+                                 const gp_XYZ& theRow3)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  M00 = Row1.X(); M01 = Row1.Y(); M02 = Row1.Z();
-  M10 = Row2.X(); M11 = Row2.Y(); M12 = Row2.Z();
-  M20 = Row3.X(); M21 = Row3.Y(); M22 = Row3.Z();
+  myMat[0][0] = theRow1.X(); myMat[0][1] = theRow1.Y(); myMat[0][2] = theRow1.Z();
+  myMat[1][0] = theRow2.X(); myMat[1][1] = theRow2.Y(); myMat[1][2] = theRow2.Z();
+  myMat[2][0] = theRow3.X(); myMat[2][1] = theRow3.Y(); myMat[2][2] = theRow3.Z();
 }
 
-gp_XYZ gp_Mat::Column (const Standard_Integer Col) const
+// =======================================================================
+// function : Column
+// purpose  :
+// =======================================================================
+gp_XYZ gp_Mat::Column (const Standard_Integer theCol) const
 {
-  Standard_OutOfRange_Raise_if (Col < 1 || Col > 3, "gp_Mat::Column() - wrong index");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if (Col == 1) return gp_XYZ (M00,M10,M20);
-  if (Col == 2) return gp_XYZ (M01,M11,M21);
-  return gp_XYZ (M02,M12,M22);
+  Standard_OutOfRange_Raise_if (theCol < 1 || theCol > 3, "gp_Mat::Column() - wrong index");
+  if (theCol == 1) return gp_XYZ (myMat[0][0], myMat[1][0], myMat[2][0]);
+  if (theCol == 2) return gp_XYZ (myMat[0][1], myMat[1][1], myMat[2][1]);
+  return gp_XYZ (myMat[0][2], myMat[1][2], myMat[2][2]);
 }
 
-gp_XYZ gp_Mat::Diagonal () const
+// =======================================================================
+// function : Diagonal
+// purpose  :
+// =======================================================================
+gp_XYZ gp_Mat::Diagonal() const
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  return gp_XYZ (M00, M11, M22);
+  return gp_XYZ (myMat[0][0], myMat[1][1], myMat[2][2]);
 }
 
-gp_XYZ gp_Mat::Row (const Standard_Integer Row) const
+// =======================================================================
+// function : Row
+// purpose  :
+// =======================================================================
+gp_XYZ gp_Mat::Row (const Standard_Integer theRow) const
 {
-  Standard_OutOfRange_Raise_if (Row < 1 || Row > 3, "gp_Mat::Row() - wrong index");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if (Row == 1) return gp_XYZ (M00,M01,M02);
-  if (Row == 2) return gp_XYZ (M10,M11,M12);
-  return gp_XYZ (M20,M21,M22);
+  Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 3, "gp_Mat::Row() - wrong index");
+  if (theRow == 1) return gp_XYZ (myMat[0][0], myMat[0][1], myMat[0][2]);
+  if (theRow == 2) return gp_XYZ (myMat[1][0], myMat[1][1], myMat[1][2]);
+  return gp_XYZ (myMat[2][0], myMat[2][1], myMat[2][2]);
 }
 
-void gp_Mat::Invert ()
+// =======================================================================
+// function : Invert
+// purpose  :
+// =======================================================================
+void gp_Mat::Invert()
 { 
-  Standard_Real new_array[3][3] ;
-  const Standard_Address M = (Standard_Address)&(   matrix[0][0]);
-  const Standard_Address N = (Standard_Address)&(new_array[0][0]);  
-
-  //
+  Standard_Real aNewMat[3][3];
   // calcul de  la transposee de la commatrice
-  //
-  N00 = M11 * M22 - M12 * M21 ;
-  N10 = -(M10 * M22 - M20 * M12) ;
-  N20 = M10 * M21 - M20 * M11 ;
-  N01 = - (M01 * M22 - M21 * M02) ;
-  N11 = M00 * M22 - M20 * M02 ;
-  N21 = -(M00 * M21 - M20 * M01) ;
-  N02 = M01 * M12 - M11 * M02 ;
-  N12 = -(M00 * M12 - M10 * M02) ;
-  N22 = M00 * M11 - M01 * M10 ;
-  Standard_Real det =  M00 * N00 + M01* N10 + M02 * N20 ;
-  Standard_Real val = det;
-  if (val < 0) val = - val;
-  Standard_ConstructionError_Raise_if (val <= gp::Resolution(), "gp_Mat::Invert() - matrix has zero determinant");
-  det = 1.0e0 / det ;
-  M00 = N00;
-  M10 = N10;
-  M20 = N20;
-  M01 = N01;
-  M11 = N11;
-  M21 = N21;
-  M02 = N02;
-  M12 = N12;
-  M22 = N22;
-  Multiply(det) ;
+  aNewMat[0][0] =   myMat[1][1] * myMat[2][2] - myMat[1][2] * myMat[2][1];
+  aNewMat[1][0] = -(myMat[1][0] * myMat[2][2] - myMat[2][0] * myMat[1][2]);
+  aNewMat[2][0] =   myMat[1][0] * myMat[2][1] - myMat[2][0] * myMat[1][1];
+  aNewMat[0][1] = -(myMat[0][1] * myMat[2][2] - myMat[2][1] * myMat[0][2]);
+  aNewMat[1][1] =   myMat[0][0] * myMat[2][2] - myMat[2][0] * myMat[0][2];
+  aNewMat[2][1] = -(myMat[0][0] * myMat[2][1] - myMat[2][0] * myMat[0][1]);
+  aNewMat[0][2] =   myMat[0][1] * myMat[1][2] - myMat[1][1] * myMat[0][2];
+  aNewMat[1][2] = -(myMat[0][0] * myMat[1][2] - myMat[1][0] * myMat[0][2]);
+  aNewMat[2][2] =   myMat[0][0] * myMat[1][1] - myMat[0][1] * myMat[1][0];
+  Standard_Real aDet =  myMat[0][0] * aNewMat[0][0] + myMat[0][1]* aNewMat[1][0] + myMat[0][2] * aNewMat[2][0];
+  Standard_Real aVal = aDet;
+  if (aVal < 0) aVal = -aVal;
+  Standard_ConstructionError_Raise_if (aVal <= gp::Resolution(), "gp_Mat::Invert() - matrix has zero determinant");
+  aDet = 1.0e0 / aDet;
+  myMat[0][0] = aNewMat[0][0];
+  myMat[1][0] = aNewMat[1][0];
+  myMat[2][0] = aNewMat[2][0];
+  myMat[0][1] = aNewMat[0][1];
+  myMat[1][1] = aNewMat[1][1];
+  myMat[2][1] = aNewMat[2][1];
+  myMat[0][2] = aNewMat[0][2];
+  myMat[1][2] = aNewMat[1][2];
+  myMat[2][2] = aNewMat[2][2];
+  Multiply (aDet);
 }
 
-gp_Mat gp_Mat::Inverted () const
+// =======================================================================
+// function : Inverted
+// purpose  :
+// =======================================================================
+gp_Mat gp_Mat::Inverted() const
 { 
-  gp_Mat NewMat;
-  const Standard_Address M = (Standard_Address)&(       matrix[0][0]);
-  const Standard_Address N = (Standard_Address)&(NewMat.matrix[0][0]);
-  //
+  gp_Mat aNewMat;
   // calcul de  la transposee de la commatrice
-  //
-  N00 = M11 * M22 - M12 * M21 ;
-  N10 = -(M10 * M22 - M20 * M12) ;
-  N20 = M10 * M21 - M20 * M11 ;
-  N01 = - (M01 * M22 - M21 * M02) ;
-  N11 = M00 * M22 - M20 * M02 ;
-  N21 = -(M00 * M21 - M20 * M01) ;
-  N02 = M01 * M12 - M11 * M02 ;
-  N12 = -(M00 * M12 - M10 * M02) ;
-  N22 = M00 * M11 - M01 * M10 ;
-  Standard_Real det =  M00 * N00 + M01* N10 + M02 * N20 ;
-  Standard_Real val = det;
-  if (val < 0) val = - val;
-  Standard_ConstructionError_Raise_if (val <= gp::Resolution(), "gp_Mat::Inverted() - matrix has zero determinant");
-  det = 1.0e0 / det ;
-  NewMat.Multiply(det) ;
-  return NewMat;
+  aNewMat.myMat[0][0] =   myMat[1][1] * myMat[2][2] - myMat[1][2] * myMat[2][1];
+  aNewMat.myMat[1][0] = -(myMat[1][0] * myMat[2][2] - myMat[2][0] * myMat[1][2]);
+  aNewMat.myMat[2][0] =   myMat[1][0] * myMat[2][1] - myMat[2][0] * myMat[1][1];
+  aNewMat.myMat[0][1] = -(myMat[0][1] * myMat[2][2] - myMat[2][1] * myMat[0][2]);
+  aNewMat.myMat[1][1] =   myMat[0][0] * myMat[2][2] - myMat[2][0] * myMat[0][2];
+  aNewMat.myMat[2][1] = -(myMat[0][0] * myMat[2][1] - myMat[2][0] * myMat[0][1]);
+  aNewMat.myMat[0][2] =   myMat[0][1] * myMat[1][2] - myMat[1][1] * myMat[0][2];
+  aNewMat.myMat[1][2] = -(myMat[0][0] * myMat[1][2] - myMat[1][0] * myMat[0][2]);
+  aNewMat.myMat[2][2] =   myMat[0][0] * myMat[1][1] - myMat[0][1] * myMat[1][0];
+  Standard_Real aDet =  myMat[0][0] * aNewMat.myMat[0][0] + myMat[0][1]* aNewMat.myMat[1][0] + myMat[0][2] * aNewMat.myMat[2][0];
+  Standard_Real aVal =  aDet;
+  if (aVal < 0) aVal = -aVal;
+  Standard_ConstructionError_Raise_if (aVal <= gp::Resolution(), "gp_Mat::Inverted() - matrix has zero determinant");
+  aDet = 1.0e0 / aDet;
+  aNewMat.Multiply (aDet);
+  return aNewMat;
 }
 
-void gp_Mat::Power (const Standard_Integer N)
+// =======================================================================
+// function : Power
+// purpose  :
+// =======================================================================
+void gp_Mat::Power (const Standard_Integer theN)
 {
-  if (N == 1) { }
-  else if (N == 0)  { SetIdentity() ; }
-  else if (N == -1) { Invert(); }
+  if (theN == 1) { }
+  else if (theN == 0)  { SetIdentity(); }
+  else if (theN == -1) { Invert(); }
   else {
-    if (N < 0) { Invert(); }
-    Standard_Integer Npower = N;
+    if (theN < 0) { Invert(); }
+    Standard_Integer Npower = theN;
     if (Npower < 0) Npower = - Npower;
     Npower--;
-    gp_Mat Temp = *this;
+    gp_Mat aTemp = *this;
     for(;;) {
-      if (IsOdd(Npower)) Multiply (Temp);
+      if (IsOdd(Npower)) Multiply (aTemp);
       if (Npower == 1)   break; 
-      Temp.Multiply (Temp);
+      aTemp.Multiply (aTemp);
       Npower>>=1;
     }
   }
 }
 
-//=======================================================================
-//function : DumpJson
-//purpose  : 
-//=======================================================================
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
 void gp_Mat::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
 {
-  OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Mat", 9, Mat00, Mat01, Mat02, Mat10, Mat11, Mat12, Mat20, Mat21, Mat22)
+  OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Mat", 9,
+                          myMat[0][0], myMat[0][1], myMat[0][2],
+                          myMat[1][0], myMat[1][1], myMat[1][2],
+                          myMat[2][0], myMat[2][1], myMat[2][2])
 }
index 2bf880d8b0319281100dd68cbbb2fc177f4383fe..1f89cb789ba9f032f7302d50416b6bb2f83eeb6a 100644 (file)
@@ -24,38 +24,8 @@ class gp_XYZ;
 class gp_Trsf;
 class gp_GTrsf;
 
-#define Mat00 matrix[0][0]
-#define Mat01 matrix[0][1]
-#define Mat02 matrix[0][2]
-#define Mat10 matrix[1][0]
-#define Mat11 matrix[1][1]
-#define Mat12 matrix[1][2]
-#define Mat20 matrix[2][0]
-#define Mat21 matrix[2][1]
-#define Mat22 matrix[2][2]
-
-#define Nat00 aNewMat.matrix[0][0]
-#define Nat01 aNewMat.matrix[0][1]
-#define Nat02 aNewMat.matrix[0][2]
-#define Nat10 aNewMat.matrix[1][0]
-#define Nat11 aNewMat.matrix[1][1]
-#define Nat12 aNewMat.matrix[1][2]
-#define Nat20 aNewMat.matrix[2][0]
-#define Nat21 aNewMat.matrix[2][1]
-#define Nat22 aNewMat.matrix[2][2]
-
-#define Oat00 theOther.matrix[0][0]
-#define Oat01 theOther.matrix[0][1]
-#define Oat02 theOther.matrix[0][2]
-#define Oat10 theOther.matrix[1][0]
-#define Oat11 theOther.matrix[1][1]
-#define Oat12 theOther.matrix[1][2]
-#define Oat20 theOther.matrix[2][0]
-#define Oat21 theOther.matrix[2][1]
-#define Oat22 theOther.matrix[2][2]
-
-//! Describes a three column, three row matrix. This sort of
-//! object is used in various vectorial or matrix computations.
+//! Describes a three column, three row matrix.
+//! This sort of object is used in various vectorial or matrix computations.
 class gp_Mat 
 {
 public:
@@ -65,9 +35,9 @@ public:
   //! creates  a matrix with null coefficients.
   gp_Mat()
   {
-    Mat00 = Mat01 = Mat02 =
-    Mat10 = Mat11 = Mat12 =
-    Mat20 = Mat21 = Mat22 = 0.0;
+    myMat[0][0] = myMat[0][1] = myMat[0][2] =
+    myMat[1][0] = myMat[1][1] = myMat[1][2] =
+    myMat[2][0] = myMat[2][1] = myMat[2][2] = 0.0;
   }
 
   gp_Mat (const Standard_Real theA11, const Standard_Real theA12, const Standard_Real theA13,
@@ -106,9 +76,9 @@ public:
   //! The other coefficients of the matrix are not modified.
   void SetDiagonal (const Standard_Real theX1, const Standard_Real theX2, const Standard_Real theX3)
   {
-    Mat00 = theX1;
-    Mat11 = theX2;
-    Mat22 = theX3;
+    myMat[0][0] = theX1;
+    myMat[1][1] = theX2;
+    myMat[2][2] = theX3;
   }
 
   //! Modifies this matrix so that applying it to any number
@@ -121,8 +91,8 @@ public:
   //! Modifies this matrix so that it represents the Identity matrix.
   void SetIdentity()
   {
-    Mat00 = Mat11 = Mat22 = 1.0;
-    Mat01 = Mat02 = Mat10 = Mat12 = Mat20 = Mat21 = 0.0;
+    myMat[0][0] = myMat[1][1] = myMat[2][2] = 1.0;
+    myMat[0][1] = myMat[0][2] = myMat[1][0] = myMat[1][2] = myMat[2][0] = myMat[2][1] = 0.0;
   }
 
   //! Modifies this matrix so that it represents a rotation. theAng is the angular value in
@@ -148,8 +118,8 @@ public:
   //! @endcode
   void SetScale (const Standard_Real theS)
   {
-    Mat00 = Mat11 = Mat22 = theS;
-    Mat01 = Mat02 = Mat10 = Mat12 = Mat20 = Mat21 = 0.0;
+    myMat[0][0] = myMat[1][1] = myMat[2][2] = theS;
+    myMat[0][1] = myMat[0][2] = myMat[1][0] = myMat[1][2] = myMat[2][0] = myMat[2][1] = 0.0;
   }
 
   //! Assigns <theValue> to the coefficient of row theRow, column theCol of   this matrix.
@@ -157,7 +127,7 @@ public:
   void SetValue (const Standard_Integer theRow, const Standard_Integer theCol, const Standard_Real theValue)
   {
     Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 3 || theCol < 1 || theCol > 3, " ");
-    matrix[theRow - 1][theCol - 1] = theValue;
+    myMat[theRow - 1][theCol - 1] = theValue;
   }
 
   //! Returns the column of theCol index.
@@ -167,9 +137,9 @@ public:
   //! Computes the determinant of the matrix.
   Standard_Real Determinant() const
   {
-    return Mat00 * (Mat11 * Mat22 - Mat21 * Mat12) -
-           Mat01 * (Mat10 * Mat22 - Mat20 * Mat12) +
-           Mat02 * (Mat10 * Mat21 - Mat20 * Mat11);
+    return myMat[0][0] * (myMat[1][1] * myMat[2][2] - myMat[2][1] * myMat[1][2]) -
+           myMat[0][1] * (myMat[1][0] * myMat[2][2] - myMat[2][0] * myMat[1][2]) +
+           myMat[0][2] * (myMat[1][0] * myMat[2][1] - myMat[2][0] * myMat[1][1]);
   }
 
   //! Returns the main diagonal of the matrix.
@@ -184,7 +154,7 @@ public:
   const Standard_Real& Value (const Standard_Integer theRow, const Standard_Integer theCol) const
   {
     Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 3 || theCol < 1 || theCol > 3, " ");
-    return matrix[theRow - 1][theCol - 1];
+    return myMat[theRow - 1][theCol - 1];
   }
 
   const Standard_Real& operator() (const Standard_Integer theRow, const Standard_Integer theCol) const { return Value (theRow, theCol); }
@@ -194,7 +164,7 @@ public:
   Standard_Real& ChangeValue (const Standard_Integer theRow, const Standard_Integer theCol)
   {
     Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 3 || theCol < 1 || theCol > 3, " ");
-    return matrix[theRow - 1][theCol - 1];
+    return myMat[theRow - 1][theCol - 1];
   }
 
   Standard_Real& operator() (const Standard_Integer theRow, const Standard_Integer theCol) { return ChangeValue (theRow, theCol); }
@@ -316,7 +286,7 @@ friend class gp_GTrsf;
 
 private:
 
-  Standard_Real matrix[3][3];
+  Standard_Real myMat[3][3];
 
 };
 
@@ -327,17 +297,17 @@ private:
 inline gp_Mat::gp_Mat (const Standard_Real theA11, const Standard_Real theA12, const Standard_Real theA13,
                        const Standard_Real theA21, const Standard_Real theA22, const Standard_Real theA23,
                        const Standard_Real theA31, const Standard_Real theA32, const Standard_Real theA33)
-  {
-    Mat00 = theA11;
-    Mat01 = theA12;
-    Mat02 = theA13;
-    Mat10 = theA21;
-    Mat11 = theA22;
-    Mat12 = theA23;
-    Mat20 = theA31;
-    Mat21 = theA32;
-    Mat22 = theA33;
-  }
+{
+  myMat[0][0] = theA11;
+  myMat[0][1] = theA12;
+  myMat[0][2] = theA13;
+  myMat[1][0] = theA21;
+  myMat[1][1] = theA22;
+  myMat[1][2] = theA23;
+  myMat[2][0] = theA31;
+  myMat[2][1] = theA32;
+  myMat[2][2] = theA33;
+}
 
 //=======================================================================
 //function : Add
@@ -345,15 +315,15 @@ inline gp_Mat::gp_Mat (const Standard_Real theA11, const Standard_Real theA12, c
 //=======================================================================
 inline void gp_Mat::Add (const gp_Mat& theOther)
 {
-  Mat00 = Mat00 + Oat00;
-  Mat01 = Mat01 + Oat01;
-  Mat02 = Mat02 + Oat02;
-  Mat10 = Mat10 + Oat10;
-  Mat11 = Mat11 + Oat11;
-  Mat12 = Mat12 + Oat12;
-  Mat20 = Mat20 + Oat20;
-  Mat21 = Mat21 + Oat21;
-  Mat22 = Mat22 + Oat22;
+  myMat[0][0] += theOther.myMat[0][0];
+  myMat[0][1] += theOther.myMat[0][1];
+  myMat[0][2] += theOther.myMat[0][2];
+  myMat[1][0] += theOther.myMat[1][0];
+  myMat[1][1] += theOther.myMat[1][1];
+  myMat[1][2] += theOther.myMat[1][2];
+  myMat[2][0] += theOther.myMat[2][0];
+  myMat[2][1] += theOther.myMat[2][1];
+  myMat[2][2] += theOther.myMat[2][2];
 }
 
 //=======================================================================
@@ -363,15 +333,15 @@ inline void gp_Mat::Add (const gp_Mat& theOther)
 inline gp_Mat gp_Mat::Added (const gp_Mat& theOther) const
 {
   gp_Mat aNewMat;
-  Nat00 = Mat00 + Oat00;
-  Nat01 = Mat01 + Oat01;
-  Nat02 = Mat02 + Oat02;
-  Nat10 = Mat10 + Oat10;
-  Nat11 = Mat11 + Oat11;
-  Nat12 = Mat12 + Oat12;
-  Nat20 = Mat20 + Oat20;
-  Nat21 = Mat21 + Oat21;
-  Nat22 = Mat22 + Oat22;
+  aNewMat.myMat[0][0] = myMat[0][0] + theOther.myMat[0][0];
+  aNewMat.myMat[0][1] = myMat[0][1] + theOther.myMat[0][1];
+  aNewMat.myMat[0][2] = myMat[0][2] + theOther.myMat[0][2];
+  aNewMat.myMat[1][0] = myMat[1][0] + theOther.myMat[1][0];
+  aNewMat.myMat[1][1] = myMat[1][1] + theOther.myMat[1][1];
+  aNewMat.myMat[1][2] = myMat[1][2] + theOther.myMat[1][2];
+  aNewMat.myMat[2][0] = myMat[2][0] + theOther.myMat[2][0];
+  aNewMat.myMat[2][1] = myMat[2][1] + theOther.myMat[2][1];
+  aNewMat.myMat[2][2] = myMat[2][2] + theOther.myMat[2][2];
   return aNewMat;
 }
 
@@ -387,16 +357,16 @@ inline void gp_Mat::Divide (const Standard_Real theScalar)
     aVal = -aVal;
   }
   Standard_ConstructionError_Raise_if (aVal <= gp::Resolution(),"gp_Mat : Divide by 0");
-  Standard_Real anUnSurScalar = 1.0 / theScalar;
-  Mat00 *= anUnSurScalar;
-  Mat01 *= anUnSurScalar;
-  Mat02 *= anUnSurScalar;
-  Mat10 *= anUnSurScalar;
-  Mat11 *= anUnSurScalar;
-  Mat12 *= anUnSurScalar;
-  Mat20 *= anUnSurScalar;
-  Mat21 *= anUnSurScalar;
-  Mat22 *= anUnSurScalar;
+  const Standard_Real anUnSurScalar = 1.0 / theScalar;
+  myMat[0][0] *= anUnSurScalar;
+  myMat[0][1] *= anUnSurScalar;
+  myMat[0][2] *= anUnSurScalar;
+  myMat[1][0] *= anUnSurScalar;
+  myMat[1][1] *= anUnSurScalar;
+  myMat[1][2] *= anUnSurScalar;
+  myMat[2][0] *= anUnSurScalar;
+  myMat[2][1] *= anUnSurScalar;
+  myMat[2][2] *= anUnSurScalar;
 }
 
 //=======================================================================
@@ -412,16 +382,16 @@ inline gp_Mat gp_Mat::Divided (const Standard_Real theScalar) const
   }
   Standard_ConstructionError_Raise_if (aVal <= gp::Resolution(),"gp_Mat : Divide by 0");
   gp_Mat aNewMat;
-  Standard_Real anUnSurScalar = 1.0 / theScalar;
-  Nat00 = Mat00 * anUnSurScalar;
-  Nat01 = Mat01 * anUnSurScalar;
-  Nat02 = Mat02 * anUnSurScalar;
-  Nat10 = Mat10 * anUnSurScalar;
-  Nat11 = Mat11 * anUnSurScalar;
-  Nat12 = Mat12 * anUnSurScalar;
-  Nat20 = Mat20 * anUnSurScalar;
-  Nat21 = Mat21 * anUnSurScalar;
-  Nat22 = Mat22 * anUnSurScalar;
+  const Standard_Real anUnSurScalar = 1.0 / theScalar;
+  aNewMat.myMat[0][0] = myMat[0][0] * anUnSurScalar;
+  aNewMat.myMat[0][1] = myMat[0][1] * anUnSurScalar;
+  aNewMat.myMat[0][2] = myMat[0][2] * anUnSurScalar;
+  aNewMat.myMat[1][0] = myMat[1][0] * anUnSurScalar;
+  aNewMat.myMat[1][1] = myMat[1][1] * anUnSurScalar;
+  aNewMat.myMat[1][2] = myMat[1][2] * anUnSurScalar;
+  aNewMat.myMat[2][0] = myMat[2][0] * anUnSurScalar;
+  aNewMat.myMat[2][1] = myMat[2][1] * anUnSurScalar;
+  aNewMat.myMat[2][2] = myMat[2][2] * anUnSurScalar;
   return aNewMat;
 }
 
@@ -431,25 +401,24 @@ inline gp_Mat gp_Mat::Divided (const Standard_Real theScalar) const
 //=======================================================================
 inline void gp_Mat::Multiply (const gp_Mat& theOther)
 {
-  Standard_Real aT00, aT01, aT02, aT10, aT11, aT12, aT20, aT21, aT22;
-  aT00 = Mat00 * Oat00 + Mat01 * Oat10 + Mat02 * Oat20;
-  aT01 = Mat00 * Oat01 + Mat01 * Oat11 + Mat02 * Oat21;
-  aT02 = Mat00 * Oat02 + Mat01 * Oat12 + Mat02 * Oat22;
-  aT10 = Mat10 * Oat00 + Mat11 * Oat10 + Mat12 * Oat20;
-  aT11 = Mat10 * Oat01 + Mat11 * Oat11 + Mat12 * Oat21;
-  aT12 = Mat10 * Oat02 + Mat11 * Oat12 + Mat12 * Oat22;
-  aT20 = Mat20 * Oat00 + Mat21 * Oat10 + Mat22 * Oat20;
-  aT21 = Mat20 * Oat01 + Mat21 * Oat11 + Mat22 * Oat21;
-  aT22 = Mat20 * Oat02 + Mat21 * Oat12 + Mat22 * Oat22;
-  Mat00 = aT00;
-  Mat01 = aT01;
-  Mat02 = aT02;
-  Mat10 = aT10;
-  Mat11 = aT11;
-  Mat12 = aT12;
-  Mat20 = aT20;
-  Mat21 = aT21;
-  Mat22 = aT22;
+  const Standard_Real aT00 = myMat[0][0] * theOther.myMat[0][0] + myMat[0][1] * theOther.myMat[1][0] + myMat[0][2] * theOther.myMat[2][0];
+  const Standard_Real aT01 = myMat[0][0] * theOther.myMat[0][1] + myMat[0][1] * theOther.myMat[1][1] + myMat[0][2] * theOther.myMat[2][1];
+  const Standard_Real aT02 = myMat[0][0] * theOther.myMat[0][2] + myMat[0][1] * theOther.myMat[1][2] + myMat[0][2] * theOther.myMat[2][2];
+  const Standard_Real aT10 = myMat[1][0] * theOther.myMat[0][0] + myMat[1][1] * theOther.myMat[1][0] + myMat[1][2] * theOther.myMat[2][0];
+  const Standard_Real aT11 = myMat[1][0] * theOther.myMat[0][1] + myMat[1][1] * theOther.myMat[1][1] + myMat[1][2] * theOther.myMat[2][1];
+  const Standard_Real aT12 = myMat[1][0] * theOther.myMat[0][2] + myMat[1][1] * theOther.myMat[1][2] + myMat[1][2] * theOther.myMat[2][2];
+  const Standard_Real aT20 = myMat[2][0] * theOther.myMat[0][0] + myMat[2][1] * theOther.myMat[1][0] + myMat[2][2] * theOther.myMat[2][0];
+  const Standard_Real aT21 = myMat[2][0] * theOther.myMat[0][1] + myMat[2][1] * theOther.myMat[1][1] + myMat[2][2] * theOther.myMat[2][1];
+  const Standard_Real aT22 = myMat[2][0] * theOther.myMat[0][2] + myMat[2][1] * theOther.myMat[1][2] + myMat[2][2] * theOther.myMat[2][2];
+  myMat[0][0] = aT00;
+  myMat[0][1] = aT01;
+  myMat[0][2] = aT02;
+  myMat[1][0] = aT10;
+  myMat[1][1] = aT11;
+  myMat[1][2] = aT12;
+  myMat[2][0] = aT20;
+  myMat[2][1] = aT21;
+  myMat[2][2] = aT22;
 }
 
 //=======================================================================
@@ -458,25 +427,24 @@ inline void gp_Mat::Multiply (const gp_Mat& theOther)
 //=======================================================================
 inline void gp_Mat::PreMultiply (const gp_Mat& theOther)
 {
-  Standard_Real aT00, aT01, aT02, aT10, aT11, aT12, aT20, aT21, aT22;
-  aT00 = Oat00 * Mat00 + Oat01 * Mat10 + Oat02 * Mat20;
-  aT01 = Oat00 * Mat01 + Oat01 * Mat11 + Oat02 * Mat21;
-  aT02 = Oat00 * Mat02 + Oat01 * Mat12 + Oat02 * Mat22;
-  aT10 = Oat10 * Mat00 + Oat11 * Mat10 + Oat12 * Mat20;
-  aT11 = Oat10 * Mat01 + Oat11 * Mat11 + Oat12 * Mat21;
-  aT12 = Oat10 * Mat02 + Oat11 * Mat12 + Oat12 * Mat22;
-  aT20 = Oat20 * Mat00 + Oat21 * Mat10 + Oat22 * Mat20;
-  aT21 = Oat20 * Mat01 + Oat21 * Mat11 + Oat22 * Mat21;
-  aT22 = Oat20 * Mat02 + Oat21 * Mat12 + Oat22 * Mat22;
-  Mat00 = aT00;
-  Mat01 = aT01;
-  Mat02 = aT02;
-  Mat10 = aT10;
-  Mat11 = aT11;
-  Mat12 = aT12;
-  Mat20 = aT20;
-  Mat21 = aT21;
-  Mat22 = aT22;
+  const Standard_Real aT00 = theOther.myMat[0][0] * myMat[0][0] + theOther.myMat[0][1] * myMat[1][0] + theOther.myMat[0][2] * myMat[2][0];
+  const Standard_Real aT01 = theOther.myMat[0][0] * myMat[0][1] + theOther.myMat[0][1] * myMat[1][1] + theOther.myMat[0][2] * myMat[2][1];
+  const Standard_Real aT02 = theOther.myMat[0][0] * myMat[0][2] + theOther.myMat[0][1] * myMat[1][2] + theOther.myMat[0][2] * myMat[2][2];
+  const Standard_Real aT10 = theOther.myMat[1][0] * myMat[0][0] + theOther.myMat[1][1] * myMat[1][0] + theOther.myMat[1][2] * myMat[2][0];
+  const Standard_Real aT11 = theOther.myMat[1][0] * myMat[0][1] + theOther.myMat[1][1] * myMat[1][1] + theOther.myMat[1][2] * myMat[2][1];
+  const Standard_Real aT12 = theOther.myMat[1][0] * myMat[0][2] + theOther.myMat[1][1] * myMat[1][2] + theOther.myMat[1][2] * myMat[2][2];
+  const Standard_Real aT20 = theOther.myMat[2][0] * myMat[0][0] + theOther.myMat[2][1] * myMat[1][0] + theOther.myMat[2][2] * myMat[2][0];
+  const Standard_Real aT21 = theOther.myMat[2][0] * myMat[0][1] + theOther.myMat[2][1] * myMat[1][1] + theOther.myMat[2][2] * myMat[2][1];
+  const Standard_Real aT22 = theOther.myMat[2][0] * myMat[0][2] + theOther.myMat[2][1] * myMat[1][2] + theOther.myMat[2][2] * myMat[2][2];
+  myMat[0][0] = aT00;
+  myMat[0][1] = aT01;
+  myMat[0][2] = aT02;
+  myMat[1][0] = aT10;
+  myMat[1][1] = aT11;
+  myMat[1][2] = aT12;
+  myMat[2][0] = aT20;
+  myMat[2][1] = aT21;
+  myMat[2][2] = aT22;
 }
 
 //=======================================================================
@@ -486,15 +454,15 @@ inline void gp_Mat::PreMultiply (const gp_Mat& theOther)
 inline gp_Mat gp_Mat::Multiplied (const Standard_Real theScalar) const
 {
   gp_Mat aNewMat;
-  Nat00 = theScalar * Mat00;
-  Nat01 = theScalar * Mat01;
-  Nat02 = theScalar * Mat02;
-  Nat10 = theScalar * Mat10;
-  Nat11 = theScalar * Mat11;
-  Nat12 = theScalar * Mat12;
-  Nat20 = theScalar * Mat20;
-  Nat21 = theScalar * Mat21;
-  Nat22 = theScalar * Mat22;
+  aNewMat.myMat[0][0] = theScalar * myMat[0][0];
+  aNewMat.myMat[0][1] = theScalar * myMat[0][1];
+  aNewMat.myMat[0][2] = theScalar * myMat[0][2];
+  aNewMat.myMat[1][0] = theScalar * myMat[1][0];
+  aNewMat.myMat[1][1] = theScalar * myMat[1][1];
+  aNewMat.myMat[1][2] = theScalar * myMat[1][2];
+  aNewMat.myMat[2][0] = theScalar * myMat[2][0];
+  aNewMat.myMat[2][1] = theScalar * myMat[2][1];
+  aNewMat.myMat[2][2] = theScalar * myMat[2][2];
   return aNewMat;
 }
 
@@ -504,15 +472,15 @@ inline gp_Mat gp_Mat::Multiplied (const Standard_Real theScalar) const
 //=======================================================================
 inline void gp_Mat::Multiply (const Standard_Real theScalar)
 {
-  Mat00 *= theScalar;
-  Mat01 *= theScalar;
-  Mat02 *= theScalar;
-  Mat10 *= theScalar;
-  Mat11 *= theScalar;
-  Mat12 *= theScalar;
-  Mat20 *= theScalar;
-  Mat21 *= theScalar;
-  Mat22 *= theScalar;
+  myMat[0][0] *= theScalar;
+  myMat[0][1] *= theScalar;
+  myMat[0][2] *= theScalar;
+  myMat[1][0] *= theScalar;
+  myMat[1][1] *= theScalar;
+  myMat[1][2] *= theScalar;
+  myMat[2][0] *= theScalar;
+  myMat[2][1] *= theScalar;
+  myMat[2][2] *= theScalar;
 }
 
 //=======================================================================
@@ -521,15 +489,15 @@ inline void gp_Mat::Multiply (const Standard_Real theScalar)
 //=======================================================================
 inline void gp_Mat::Subtract (const gp_Mat& theOther)
 {
-  Mat00 -= Oat00;
-  Mat01 -= Oat01;
-  Mat02 -= Oat02;
-  Mat10 -= Oat10;
-  Mat11 -= Oat11;
-  Mat12 -= Oat12;
-  Mat20 -= Oat20;
-  Mat21 -= Oat21;
-  Mat22 -= Oat22;
+  myMat[0][0] -= theOther.myMat[0][0];
+  myMat[0][1] -= theOther.myMat[0][1];
+  myMat[0][2] -= theOther.myMat[0][2];
+  myMat[1][0] -= theOther.myMat[1][0];
+  myMat[1][1] -= theOther.myMat[1][1];
+  myMat[1][2] -= theOther.myMat[1][2];
+  myMat[2][0] -= theOther.myMat[2][0];
+  myMat[2][1] -= theOther.myMat[2][1];
+  myMat[2][2] -= theOther.myMat[2][2];
 }
 
 //=======================================================================
@@ -539,15 +507,15 @@ inline void gp_Mat::Subtract (const gp_Mat& theOther)
 inline gp_Mat gp_Mat::Subtracted (const gp_Mat& theOther) const
 {
   gp_Mat aNewMat;
-  Nat00 = Mat00 - Oat00;
-  Nat01 = Mat01 - Oat01;
-  Nat02 = Mat02 - Oat02;
-  Nat10 = Mat10 - Oat10;
-  Nat11 = Mat11 - Oat11;
-  Nat12 = Mat12 - Oat12;
-  Nat20 = Mat20 - Oat20;
-  Nat21 = Mat21 - Oat21;
-  Nat22 = Mat22 - Oat22;
+  aNewMat.myMat[0][0] = myMat[0][0] - theOther.myMat[0][0];
+  aNewMat.myMat[0][1] = myMat[0][1] - theOther.myMat[0][1];
+  aNewMat.myMat[0][2] = myMat[0][2] - theOther.myMat[0][2];
+  aNewMat.myMat[1][0] = myMat[1][0] - theOther.myMat[1][0];
+  aNewMat.myMat[1][1] = myMat[1][1] - theOther.myMat[1][1];
+  aNewMat.myMat[1][2] = myMat[1][2] - theOther.myMat[1][2];
+  aNewMat.myMat[2][0] = myMat[2][0] - theOther.myMat[2][0];
+  aNewMat.myMat[2][1] = myMat[2][1] - theOther.myMat[2][1];
+  aNewMat.myMat[2][2] = myMat[2][2] - theOther.myMat[2][2];
   return aNewMat;
 }
 
@@ -566,15 +534,15 @@ __attribute__((optnone))
 inline void gp_Mat::Transpose()
 {
   Standard_Real aTemp;
-  aTemp  = Mat01;
-  Mat01  = Mat10;
-  Mat10  = aTemp;
-  aTemp  = Mat02;
-  Mat02  = Mat20;
-  Mat20  = aTemp;
-  aTemp  = Mat12;
-  Mat12  = Mat21;
-  Mat21  = aTemp;
+  aTemp  = myMat[0][1];
+  myMat[0][1] = myMat[1][0];
+  myMat[1][0] = aTemp;
+  aTemp  = myMat[0][2];
+  myMat[0][2] = myMat[2][0];
+  myMat[2][0] = aTemp;
+  aTemp  = myMat[1][2];
+  myMat[1][2] = myMat[2][1];
+  myMat[2][1] = aTemp;
 }
 
 //=======================================================================
index e721db6fa8b4193cd806a85d1bde2a2f34cdc037..7b73b555bd23fb763bcbf86f7f5642c1221f0f59 100644 (file)
@@ -12,8 +12,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-//  10/09/97 : PMN : Correction BUC40192 (pb avec les matrices negatives)
-
 #ifndef OCCT_DEBUG
 #define No_Standard_OutOfRange
 #define No_Standard_ConstructionError
 #include <Standard_ConstructionError.hxx>
 #include <Standard_OutOfRange.hxx>
 
-#define M00 ((Standard_Real*)M)[0]
-#define M01 ((Standard_Real*)M)[1]
-#define M10 ((Standard_Real*)M)[2]
-#define M11 ((Standard_Real*)M)[3]
-
-#define N00 ((Standard_Real*)N)[0]
-#define N01 ((Standard_Real*)N)[1]
-#define N10 ((Standard_Real*)N)[2]
-#define N11 ((Standard_Real*)N)[3]
-
-gp_Mat2d::gp_Mat2d (const gp_XY& Col1, const gp_XY& Col2)
+// =======================================================================
+// function : gp_Mat2d
+// purpose  :
+// =======================================================================
+gp_Mat2d::gp_Mat2d (const gp_XY& theCol1, const gp_XY& theCol2)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  M00 = Col1.X(); M10 = Col1.Y();
-  M01 = Col2.X(); M11 = Col2.Y();
+  myMat[0][0] = theCol1.X(); myMat[1][0] = theCol1.Y();
+  myMat[0][1] = theCol2.X(); myMat[1][1] = theCol2.Y();
 }
 
-void gp_Mat2d::SetCol (const Standard_Integer Col,
-                      const gp_XY& Value)
+// =======================================================================
+// function : SetCol
+// purpose  :
+// =======================================================================
+void gp_Mat2d::SetCol (const Standard_Integer theCol,
+                       const gp_XY& theValue)
 {
-  Standard_OutOfRange_Raise_if (Col < 1 || Col > 2, "gp_Mat2d::SetCol() - invalid index");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if  (Col == 1) {
-    M00 = Value.X();
-    M10 = Value.Y();
+  Standard_OutOfRange_Raise_if (theCol < 1 || theCol > 2, "gp_Mat2d::SetCol() - invalid index");
+  if  (theCol == 1)
+  {
+    myMat[0][0] = theValue.X();
+    myMat[1][0] = theValue.Y();
   }
-  else {
-    M01 = Value.X();
-    M11 = Value.Y();
+  else
+  {
+    myMat[0][1] = theValue.X();
+    myMat[1][1] = theValue.Y();
   }
 }
 
-void gp_Mat2d::SetCols (const gp_XY& Col1,
-                       const gp_XY& Col2)
+// =======================================================================
+// function : SetCols
+// purpose  :
+// =======================================================================
+void gp_Mat2d::SetCols (const gp_XY& theCol1,
+                        const gp_XY& theCol2)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  M00 = Col1.X(); M10 = Col1.Y();
-  M01 = Col2.X(); M11 = Col2.Y();
+  myMat[0][0] = theCol1.X(); myMat[1][0] = theCol1.Y();
+  myMat[0][1] = theCol2.X(); myMat[1][1] = theCol2.Y();
 }
 
-void gp_Mat2d::SetRow (const Standard_Integer Row, const gp_XY& Value)
+// =======================================================================
+// function : SetRow
+// purpose  :
+// =======================================================================
+void gp_Mat2d::SetRow (const Standard_Integer theRow, const gp_XY& theValue)
 {
-  Standard_OutOfRange_Raise_if (Row < 1 || Row > 2, "gp_Mat2d::SetRow() - invalid index");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if (Row == 1) {
-    M00 = Value.X();
-    M01 = Value.Y();
+  Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 2, "gp_Mat2d::SetRow() - invalid index");
+  if (theRow == 1)
+  {
+    myMat[0][0] = theValue.X();
+    myMat[0][1] = theValue.Y();
   }
-  else {
-    M10 = Value.X();
-    M11 = Value.Y();
+  else
+  {
+    myMat[1][0] = theValue.X();
+    myMat[1][1] = theValue.Y();
   }
 }
 
-void gp_Mat2d::SetRows (const gp_XY& Row1, const gp_XY& Row2)
+// =======================================================================
+// function : SetRows
+// purpose  :
+// =======================================================================
+void gp_Mat2d::SetRows (const gp_XY& theRow1, const gp_XY& theRow2)
 {
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  M00 = Row1.X(); M01 = Row1.Y();
-  M10 = Row2.X(); M11 = Row2.Y();
+  myMat[0][0] = theRow1.X(); myMat[0][1] = theRow1.Y();
+  myMat[1][0] = theRow2.X(); myMat[1][1] = theRow2.Y();
 }
 
-gp_XY gp_Mat2d::Column (const Standard_Integer Col) const
+// =======================================================================
+// function : Column
+// purpose  :
+// =======================================================================
+gp_XY gp_Mat2d::Column (const Standard_Integer theCol) const
 {
-  Standard_OutOfRange_Raise_if (Col < 1 || Col > 2, "gp_Mat2d::Column() - invalid index");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if (Col == 1) return gp_XY (M00,M10);
-  return gp_XY (M01,M11);
+  Standard_OutOfRange_Raise_if (theCol < 1 || theCol > 2, "gp_Mat2d::Column() - invalid index");
+  if (theCol == 1)
+  {
+    return gp_XY (myMat[0][0], myMat[1][0]);
+  }
+  return gp_XY (myMat[0][1], myMat[1][1]);
 }
 
-gp_XY gp_Mat2d::Diagonal () const
+// =======================================================================
+// function : Diagonal
+// purpose  :
+// =======================================================================
+gp_XY gp_Mat2d::Diagonal() const
 { 
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  return gp_XY (M00,M11);
+  return gp_XY (myMat[0][0], myMat[1][1]);
 }
 
-gp_XY gp_Mat2d::Row (const Standard_Integer Row) const
+// =======================================================================
+// function : Row
+// purpose  :
+// =======================================================================
+gp_XY gp_Mat2d::Row (const Standard_Integer theRow) const
 {
-  Standard_OutOfRange_Raise_if (Row < 1 || Row > 2, "gp_Mat2d::Row() - invalid index");
-  const Standard_Address M = (Standard_Address)&(matrix[0][0]);
-  if (Row == 1) return gp_XY (M00,M01);
-  return gp_XY (M10,M11);
+  Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 2, "gp_Mat2d::Row() - invalid index");
+  if (theRow == 1)
+  {
+    return gp_XY (myMat[0][0], myMat[0][1]);
+  }
+  return gp_XY (myMat[1][0], myMat[1][1]);
 }
 
-void gp_Mat2d::Invert ()
+// =======================================================================
+// function : Invert
+// purpose  :
+// =======================================================================
+void gp_Mat2d::Invert()
 {
-  Standard_Real new_matrix[2][2],
-  det ;
-  const Standard_Address N = (Standard_Address)&(new_matrix[0][0]);
-  const Standard_Address M = (Standard_Address)&(    matrix[0][0]);
-  N00 = M11 ;
-  N01 = -M01 ;
-  N10 = -M10 ;
-  N11 = M00  ;
-  det = N00 * N11 - N01 * N10 ;
-  Standard_Real val = det;
+  Standard_Real aNewMat[2][2];
+  aNewMat[0][0] =  myMat[1][1];
+  aNewMat[0][1] = -myMat[0][1];
+  aNewMat[1][0] = -myMat[1][0];
+  aNewMat[1][1] =  myMat[0][0];
+  Standard_Real aDet = aNewMat[0][0] * aNewMat[1][1] - aNewMat[0][1] * aNewMat[1][0];
+  Standard_Real val = aDet;
   if (val < 0) val = - val;
   Standard_ConstructionError_Raise_if (val <= gp::Resolution(), "gp_Mat2d::Invert() - matrix has zero determinant");
-  det = 1.0 / det ;
-  M00 = N00 * det ;
-  M10 = N10 * det ;
-  M01 = N01 * det ;
-  M11 = N11 * det ;
+  aDet = 1.0 / aDet;
+  myMat[0][0] = aNewMat[0][0] * aDet;
+  myMat[1][0] = aNewMat[1][0] * aDet;
+  myMat[0][1] = aNewMat[0][1] * aDet;
+  myMat[1][1] = aNewMat[1][1] * aDet;
 }
 
-void gp_Mat2d::Power (const Standard_Integer N)
+// =======================================================================
+// function : Power
+// purpose  :
+// =======================================================================
+void gp_Mat2d::Power (const Standard_Integer theN)
 {
-  if      (N ==  1) { }
-  else if (N ==  0) { SetIdentity (); }
-  else if (N == -1) { Invert(); }
+  if      (theN ==  1) { }
+  else if (theN ==  0) { SetIdentity(); }
+  else if (theN == -1) { Invert(); }
   else {
-    if (N < 0) Invert();
-    Standard_Integer Npower = N;
+    if (theN < 0) Invert();
+    Standard_Integer Npower = theN;
     if (Npower < 0) Npower = - Npower;
     Npower--;
-    gp_Mat2d Temp = *this;
+    gp_Mat2d aTemp = *this;
     for(;;) {
-      if (IsOdd(Npower)) Multiply (Temp);
+      if (IsOdd(Npower)) Multiply (aTemp);
       if (Npower == 1)   break;
-      Temp.Multiply (Temp);
+      aTemp.Multiply (aTemp);
       Npower = Npower/2;
     }
   }
 }
-
index 3c328263cb198a4e8a03af17b6cd3f0d14f38b2c..63d0f52031a4e3ba95137bef2a8d3178dcc2f24a 100644 (file)
@@ -23,23 +23,8 @@ class gp_Trsf2d;
 class gp_GTrsf2d;
 class gp_XY;
 
-#define Mat2d00 ((Standard_Real*)aM)[0]
-#define Mat2d01 ((Standard_Real*)aM)[1]
-#define Mat2d10 ((Standard_Real*)aM)[2]
-#define Mat2d11 ((Standard_Real*)aM)[3]
-
-#define Nat2d00 ((Standard_Real*)aN)[0]
-#define Nat2d01 ((Standard_Real*)aN)[1]
-#define Nat2d10 ((Standard_Real*)aN)[2]
-#define Nat2d11 ((Standard_Real*)aN)[3]
-
-#define Oat2d00 ((Standard_Real*)anO)[0]
-#define Oat2d01 ((Standard_Real*)anO)[1]
-#define Oat2d10 ((Standard_Real*)anO)[2]
-#define Oat2d11 ((Standard_Real*)anO)[3]
-
-//! Describes a two column, two row matrix. This sort of
-//! object is used in various vectorial or matrix computations.
+//! Describes a two column, two row matrix.
+//! This sort of object is used in various vectorial or matrix computations.
 class gp_Mat2d 
 {
 public:
@@ -49,8 +34,7 @@ public:
   //! Creates  a matrix with null coefficients.
   gp_Mat2d()
   {
-    const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-    Mat2d00 = Mat2d01 = Mat2d10 = Mat2d11 = 0.0;
+    myMat[0][0] = myMat[0][1] = myMat[1][0] = myMat[1][1] = 0.0;
   }
 
   //! theCol1, theCol2 are the 2 columns of the matrix.
@@ -72,17 +56,15 @@ public:
   //! The other coefficients of the matrix are not modified.
   void SetDiagonal (const Standard_Real theX1, const Standard_Real theX2)
   {
-    const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-    Mat2d00 = theX1;
-    Mat2d11 = theX2;
+    myMat[0][0] = theX1;
+    myMat[1][1] = theX2;
   }
 
   //! Modifies this matrix, so that it represents the Identity matrix.
   void SetIdentity()
   {
-    const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-    Mat2d00 = Mat2d11 = 1.0;
-    Mat2d01 = Mat2d10 = 0.0;
+    myMat[0][0] = myMat[1][1] = 1.0;
+    myMat[0][1] = myMat[1][0] = 0.0;
   }
 
   //! Modifies this matrix, so that it represents a rotation. theAng is the angular
@@ -104,9 +86,8 @@ public:
   //! @endcode
   void SetScale (const Standard_Real theS)
   {
-    const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-    Mat2d00 = Mat2d11 = theS;
-    Mat2d01 = Mat2d10 = 0.0;
+    myMat[0][0] = myMat[1][1] = theS;
+    myMat[0][1] = myMat[1][0] = 0.0;
   }
 
   //! Assigns <theValue> to the coefficient of row theRow, column theCol of this matrix.
@@ -114,7 +95,7 @@ public:
   void SetValue (const Standard_Integer theRow, const Standard_Integer theCol, const Standard_Real theValue)
   {
     Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 2 || theCol < 1 || theCol > 2, " ");
-    matrix[theRow - 1][theCol - 1] = theValue;
+    myMat[theRow - 1][theCol - 1] = theValue;
   }
 
   //! Returns the column of theCol index.
@@ -124,8 +105,7 @@ public:
   //! Computes the determinant of the matrix.
   Standard_Real Determinant() const
   {
-    const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-    return  Mat2d00 * Mat2d11 - Mat2d10 * Mat2d01;
+    return myMat[0][0] * myMat[1][1] - myMat[1][0] * myMat[0][1];
   }
 
   //! Returns the main diagonal of the matrix.
@@ -141,7 +121,7 @@ public:
   const Standard_Real& Value (const Standard_Integer theRow, const Standard_Integer theCol) const
   {
     Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 2 || theCol < 1 || theCol > 2, " ");
-    return matrix[theRow - 1][theCol - 1];
+    return myMat[theRow - 1][theCol - 1];
   }
 
   const Standard_Real& operator() (const Standard_Integer theRow, const Standard_Integer theCol) const { return Value (theRow, theCol); }
@@ -152,7 +132,7 @@ public:
   Standard_Real& ChangeValue (const Standard_Integer theRow, const Standard_Integer theCol)
   {
     Standard_OutOfRange_Raise_if (theRow < 1 || theRow > 2 || theCol < 1 || theCol > 2, " ");
-    return matrix[theRow - 1][theCol - 1];
+    return myMat[theRow - 1][theCol - 1];
   }
 
   Standard_Real& operator() (const Standard_Integer theRow, const Standard_Integer theCol) { return ChangeValue (theRow, theCol); }
@@ -269,7 +249,7 @@ friend class gp_XY;
 
 private:
 
-  Standard_Real matrix[2][2];
+  Standard_Real myMat[2][2];
 
 };
 
@@ -279,12 +259,11 @@ private:
 //=======================================================================
 inline void gp_Mat2d::SetRotation (const Standard_Real theAng)
 {
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
   Standard_Real aSinA = sin (theAng);
   Standard_Real aCosA = cos (theAng);
-  Mat2d00 = Mat2d11 = aCosA;
-  Mat2d01 = -aSinA;
-  Mat2d10 =  aSinA;
+  myMat[0][0] = myMat[1][1] = aCosA;
+  myMat[0][1] = -aSinA;
+  myMat[1][0] =  aSinA;
 }
 
 //=======================================================================
@@ -293,12 +272,10 @@ inline void gp_Mat2d::SetRotation (const Standard_Real theAng)
 //=======================================================================
 inline void gp_Mat2d::Add (const gp_Mat2d& theOther)
 {
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address anO = (Standard_Address)&(theOther.matrix[0][0]);
-  Mat2d00 += Oat2d00;
-  Mat2d01 += Oat2d01;
-  Mat2d10 += Oat2d10;
-  Mat2d11 += Oat2d11;
+  myMat[0][0] += theOther.myMat[0][0];
+  myMat[0][1] += theOther.myMat[0][1];
+  myMat[1][0] += theOther.myMat[1][0];
+  myMat[1][1] += theOther.myMat[1][1];
 }
 
 //=======================================================================
@@ -308,13 +285,10 @@ inline void gp_Mat2d::Add (const gp_Mat2d& theOther)
 inline gp_Mat2d gp_Mat2d::Added (const gp_Mat2d& theOther) const
 {
   gp_Mat2d aNewMat2d;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address aN = (Standard_Address)&(aNewMat2d.matrix[0][0]);
-  const Standard_Address anO = (Standard_Address)&(theOther   .matrix[0][0]);
-  Nat2d00 = Mat2d00 + Oat2d00;
-  Nat2d01 = Mat2d01 + Oat2d01;
-  Nat2d10 = Mat2d10 + Oat2d10;
-  Nat2d11 = Mat2d11 + Oat2d11;
+  aNewMat2d.myMat[0][0] = myMat[0][0] + theOther.myMat[0][0];
+  aNewMat2d.myMat[0][1] = myMat[0][1] + theOther.myMat[0][1];
+  aNewMat2d.myMat[1][0] = myMat[1][0] + theOther.myMat[1][0];
+  aNewMat2d.myMat[1][1] = myMat[1][1] + theOther.myMat[1][1];
   return aNewMat2d;
 }
 
@@ -324,11 +298,10 @@ inline gp_Mat2d gp_Mat2d::Added (const gp_Mat2d& theOther) const
 //=======================================================================
 inline void gp_Mat2d::Divide (const Standard_Real theScalar)
 {
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  Mat2d00 /= theScalar;
-  Mat2d01 /= theScalar;
-  Mat2d10 /= theScalar;
-  Mat2d11 /= theScalar;
+  myMat[0][0] /= theScalar;
+  myMat[0][1] /= theScalar;
+  myMat[1][0] /= theScalar;
+  myMat[1][1] /= theScalar;
 }
 
 //=======================================================================
@@ -338,12 +311,10 @@ inline void gp_Mat2d::Divide (const Standard_Real theScalar)
 inline gp_Mat2d gp_Mat2d::Divided (const Standard_Real theScalar) const
 {
   gp_Mat2d aNewMat2d;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address aN = (Standard_Address)&(aNewMat2d.matrix[0][0]);
-  Nat2d00 = Mat2d00 / theScalar;
-  Nat2d01 = Mat2d01 / theScalar;
-  Nat2d10 = Mat2d10 / theScalar;
-  Nat2d11 = Mat2d11 / theScalar;
+  aNewMat2d.myMat[0][0] = myMat[0][0] / theScalar;
+  aNewMat2d.myMat[0][1] = myMat[0][1] / theScalar;
+  aNewMat2d.myMat[1][0] = myMat[1][0] / theScalar;
+  aNewMat2d.myMat[1][1] = myMat[1][1] / theScalar;
   return aNewMat2d;
 }
 
@@ -353,15 +324,12 @@ inline gp_Mat2d gp_Mat2d::Divided (const Standard_Real theScalar) const
 //=======================================================================
 inline void gp_Mat2d::Multiply (const gp_Mat2d& theOther)
 {
-  Standard_Real aT00, aT10;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address anO = (Standard_Address)&(theOther.matrix[0][0]);
-  aT00 = Mat2d00 * Oat2d00 + Mat2d01 * Oat2d10;
-  aT10 = Mat2d10 * Oat2d00 + Mat2d11 * Oat2d10;
-  Mat2d01 = Mat2d00 * Oat2d01 + Mat2d01 * Oat2d11;
-  Mat2d11 = Mat2d10 * Oat2d01 + Mat2d11 * Oat2d11;
-  Mat2d00 = aT00;
-  Mat2d10 = aT10;
+  const Standard_Real aT00 = myMat[0][0] * theOther.myMat[0][0] + myMat[0][1] * theOther.myMat[1][0];
+  const Standard_Real aT10 = myMat[1][0] * theOther.myMat[0][0] + myMat[1][1] * theOther.myMat[1][0];
+  myMat[0][1] = myMat[0][0] * theOther.myMat[0][1] + myMat[0][1] * theOther.myMat[1][1];
+  myMat[1][1] = myMat[1][0] * theOther.myMat[0][1] + myMat[1][1] * theOther.myMat[1][1];
+  myMat[0][0] = aT00;
+  myMat[1][0] = aT10;
 }
 
 //=======================================================================
@@ -370,15 +338,16 @@ inline void gp_Mat2d::Multiply (const gp_Mat2d& theOther)
 //=======================================================================
 inline void gp_Mat2d::PreMultiply (const gp_Mat2d& theOther)
 {
-  Standard_Real aT00, aT01;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address anO = (Standard_Address)&(theOther.matrix[0][0]);
-  aT00 = Oat2d00 * Mat2d00 + Oat2d01 * Mat2d10;
-  Mat2d10 = Oat2d10 * Mat2d00 + Oat2d11 * Mat2d10;
-  aT01 = Oat2d00 * Mat2d01 + Oat2d01 * Mat2d11;
-  Mat2d11 = Oat2d10 * Mat2d01 + Oat2d11 * Mat2d11;
-  Mat2d00 = aT00;
-  Mat2d01 = aT01;
+  const Standard_Real aT00 = theOther.myMat[0][0] * myMat[0][0]
+                           + theOther.myMat[0][1] * myMat[1][0];
+  myMat[1][0] = theOther.myMat[1][0] * myMat[0][0]
+              + theOther.myMat[1][1] * myMat[1][0];
+  const Standard_Real aT01 = theOther.myMat[0][0] * myMat[0][1]
+                           + theOther.myMat[0][1] * myMat[1][1];
+  myMat[1][1] = theOther.myMat[1][0] * myMat[0][1]
+              + theOther.myMat[1][1] * myMat[1][1];
+  myMat[0][0] = aT00;
+  myMat[0][1] = aT01;
 }
 
 //=======================================================================
@@ -388,12 +357,10 @@ inline void gp_Mat2d::PreMultiply (const gp_Mat2d& theOther)
 inline gp_Mat2d gp_Mat2d::Multiplied (const Standard_Real theScalar) const
 {
   gp_Mat2d aNewMat2d;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address aN = (Standard_Address)&(aNewMat2d.matrix[0][0]);
-  Nat2d00 = Mat2d00 * theScalar;
-  Nat2d01 = Mat2d01 * theScalar;
-  Nat2d10 = Mat2d10 * theScalar;
-  Nat2d11 = Mat2d11 * theScalar;
+  aNewMat2d.myMat[0][0] = myMat[0][0] * theScalar;
+  aNewMat2d.myMat[0][1] = myMat[0][1] * theScalar;
+  aNewMat2d.myMat[1][0] = myMat[1][0] * theScalar;
+  aNewMat2d.myMat[1][1] = myMat[1][1] * theScalar;
   return aNewMat2d;
 }
 
@@ -403,11 +370,10 @@ inline gp_Mat2d gp_Mat2d::Multiplied (const Standard_Real theScalar) const
 //=======================================================================
 inline void gp_Mat2d::Multiply (const Standard_Real theScalar)
 {
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  Mat2d00 *= theScalar;
-  Mat2d01 *= theScalar;
-  Mat2d10 *= theScalar;
-  Mat2d11 *= theScalar;
+  myMat[0][0] *= theScalar;
+  myMat[0][1] *= theScalar;
+  myMat[1][0] *= theScalar;
+  myMat[1][1] *= theScalar;
 }
 
 //=======================================================================
@@ -416,12 +382,10 @@ inline void gp_Mat2d::Multiply (const Standard_Real theScalar)
 //=======================================================================
 inline void gp_Mat2d::Subtract (const gp_Mat2d& theOther)
 {
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address anO = (Standard_Address)&(theOther.matrix[0][0]);
-  Mat2d00 -= Oat2d00;
-  Mat2d01 -= Oat2d01;
-  Mat2d10 -= Oat2d10;
-  Mat2d11 -= Oat2d11;
+  myMat[0][0] -= theOther.myMat[0][0];
+  myMat[0][1] -= theOther.myMat[0][1];
+  myMat[1][0] -= theOther.myMat[1][0];
+  myMat[1][1] -= theOther.myMat[1][1];
 }
 
 //=======================================================================
@@ -431,13 +395,10 @@ inline void gp_Mat2d::Subtract (const gp_Mat2d& theOther)
 inline gp_Mat2d gp_Mat2d::Subtracted (const gp_Mat2d& theOther) const
 {
   gp_Mat2d aNewMat2d;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address aN = (Standard_Address)&(aNewMat2d.matrix[0][0]);
-  const Standard_Address anO = (Standard_Address)&(theOther.matrix[0][0]);
-  Nat2d00 = Mat2d00 - Oat2d00;
-  Nat2d01 = Mat2d01 - Oat2d01;
-  Nat2d10 = Mat2d10 - Oat2d10;
-  Nat2d11 = Mat2d11 - Oat2d11;
+  aNewMat2d.myMat[0][0] = myMat[0][0] - theOther.myMat[0][0];
+  aNewMat2d.myMat[0][1] = myMat[0][1] - theOther.myMat[0][1];
+  aNewMat2d.myMat[1][0] = myMat[1][0] - theOther.myMat[1][0];
+  aNewMat2d.myMat[1][1] = myMat[1][1] - theOther.myMat[1][1];
   return aNewMat2d;
 }
 
@@ -447,11 +408,9 @@ inline gp_Mat2d gp_Mat2d::Subtracted (const gp_Mat2d& theOther) const
 //=======================================================================
 inline void gp_Mat2d::Transpose()
 {
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  Standard_Real aTemp;
-  aTemp     = Mat2d01;
-  Mat2d01  = Mat2d10;
-  Mat2d10  = aTemp;
+  const Standard_Real aTemp = myMat[0][1];
+  myMat[0][1] = myMat[1][0];
+  myMat[1][0] = aTemp;
 }
 
 //=======================================================================
@@ -461,12 +420,10 @@ inline void gp_Mat2d::Transpose()
 inline gp_Mat2d gp_Mat2d::Transposed() const
 {
   gp_Mat2d aNewMat2d;
-  const Standard_Address aM = (Standard_Address)&(matrix[0][0]);
-  const Standard_Address aN = (Standard_Address)&(aNewMat2d.matrix[0][0]);
-  Nat2d10 = Mat2d01;
-  Nat2d01 = Mat2d10;
-  Nat2d00 = Mat2d00;
-  Nat2d11 = Mat2d11;
+  aNewMat2d.myMat[1][0] = myMat[0][1];
+  aNewMat2d.myMat[0][1] = myMat[1][0];
+  aNewMat2d.myMat[0][0] = myMat[0][0];
+  aNewMat2d.myMat[1][1] = myMat[1][1];
   return aNewMat2d; 
 }
 
index a046cbf94851c4bc6976b7520862f8e5cd29d915..2310780e02a16e5082ea40302d6107a2e263ee92 100644 (file)
@@ -222,8 +222,8 @@ public:
   //! @endcode
   Standard_NODISCARD gp_XY Multiplied (const gp_Mat2d& theMatrix) const
   {
-    const Standard_Address aM = (Standard_Address) &(theMatrix.Value (1, 1));
-    return gp_XY (Mat2d00 * x + Mat2d01 * y, Mat2d10 * x + Mat2d11 * y);
+    return gp_XY (theMatrix.Value (1, 1) * x + theMatrix.Value (1, 2) * y,
+                  theMatrix.Value (2, 1) * x + theMatrix.Value (2, 2) * y);
   }
 
   Standard_NODISCARD gp_XY operator*  (const gp_Mat2d& theMatrix) const { return Multiplied (theMatrix); }
@@ -349,9 +349,8 @@ private:
 //=======================================================================
 inline void gp_XY::Multiply (const gp_Mat2d& theMatrix)
 {
-  const Standard_Address aM = (Standard_Address) &(theMatrix.Value (1, 1));
-  Standard_Real aXresult = Mat2d00 * x + Mat2d01 * y;
-  y = Mat2d10 * x + Mat2d11 * y;
+  Standard_Real aXresult = theMatrix.Value (1, 1) * x + theMatrix.Value (1, 2) * y;
+  y = theMatrix.Value (2, 1) * x + theMatrix.Value (2, 2) * y;
   x = aXresult;
 }