0031548: Visualization, SelectBasics_PickResult - include surface normal into picking...
[occt.git] / src / gp / gp_GTrsf.hxx
index 0d2414c..8a1118d 100644 (file)
@@ -244,28 +244,44 @@ public:
   
     gp_Trsf Trsf() const;
 
+  //! Convert transformation to 4x4 matrix.
+  template<class T>
+  void GetMat4 (NCollection_Mat4<T>& theMat) const
+  {
+    if (shape == gp_Identity)
+    {
+      theMat.InitIdentity();
+      return;
+    }
+
+    theMat.SetValue (0, 0, static_cast<T> (Value (1, 1)));
+    theMat.SetValue (0, 1, static_cast<T> (Value (1, 2)));
+    theMat.SetValue (0, 2, static_cast<T> (Value (1, 3)));
+    theMat.SetValue (0, 3, static_cast<T> (Value (1, 4)));
+    theMat.SetValue (1, 0, static_cast<T> (Value (2, 1)));
+    theMat.SetValue (1, 1, static_cast<T> (Value (2, 2)));
+    theMat.SetValue (1, 2, static_cast<T> (Value (2, 3)));
+    theMat.SetValue (1, 3, static_cast<T> (Value (2, 4)));
+    theMat.SetValue (2, 0, static_cast<T> (Value (3, 1)));
+    theMat.SetValue (2, 1, static_cast<T> (Value (3, 2)));
+    theMat.SetValue (2, 2, static_cast<T> (Value (3, 3)));
+    theMat.SetValue (2, 3, static_cast<T> (Value (3, 4)));
+    theMat.SetValue (3, 0, static_cast<T> (0));
+    theMat.SetValue (3, 1, static_cast<T> (0));
+    theMat.SetValue (3, 2, static_cast<T> (0));
+    theMat.SetValue (3, 3, static_cast<T> (1));
+  }
+
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-
-
   gp_Mat matrix;
   gp_XYZ loc;
   gp_TrsfForm shape;
   Standard_Real scale;
 
-
 };