]> OCCT Git - occt-copy.git/commitdiff
Method for adding new nodes CR25936_1
authordbv <dbv@opencascade.com>
Tue, 31 Mar 2015 14:44:21 +0000 (17:44 +0300)
committerdbv <dbv@opencascade.com>
Tue, 31 Mar 2015 14:44:21 +0000 (17:44 +0300)
src/Poly/Poly_Triangulation.cxx
src/Poly/Poly_Triangulation.hxx

index c0bbe5b185bdf7f1482055fecb894e2f8605f617..6c5e8bfe6f0438dbdc49856141a21893c7cc0fd3 100644 (file)
@@ -119,6 +119,30 @@ void Poly_Triangulation::RemoveUVNodes()
   myUVNodes.Clear();
 }
 
+//=======================================================================
+//function : AddNode
+//purpose  : 
+//=======================================================================
+Standard_Integer Poly_Triangulation::AddNode (const gp_Pnt& theNode)
+{
+  myNodes.Append (theNode);
+
+  if (!myUVNodes.IsEmpty())
+  {
+    myUVNodes.Append (gp_Pnt2d (0.0, 0.0));
+  }
+
+  if (!myNormals.IsEmpty())
+  {
+    Standard_Integer aNbNormals = myNodes.Size();
+    myNormals.SetValue (aNbNormals + 2, 0.0);
+    myNormals.SetValue (aNbNormals + 1, 0.0);
+    myNormals.SetValue (aNbNormals, 0.0);
+  }
+
+  return myNodes.Size();
+}
+
 //=======================================================================
 //function : Node
 //purpose  : 
index 92a3b8516ae4b8f4669595d6a532bdb6bc60d8e3..635a3e670ffa9a5b89986158f501bbda9f8d64b8 100644 (file)
@@ -109,6 +109,11 @@ public:
   //! @return true if 2D nodes are associated with 3D nodes for this triangulation.
   Standard_Boolean HasUVNodes() const { return !myUVNodes.IsEmpty(); }
 
+  //! Adds Node to the triangulation. If triangulation has UVNodes or Normals
+  //! they will be expanded and set to zero values to match the new number of nodes.
+  //! @return index of the added Node.
+  Standard_EXPORT Standard_Integer AddNode (const gp_Pnt& theNode);
+
   //! @return node at the given index.
   //! Raises exception if theIndex is less than 1 or bigger than NbNodes().
   Standard_EXPORT const gp_Pnt& Node (const Standard_Integer theIndex) const;
@@ -117,10 +122,6 @@ public:
   //! Raises exception if theIndex is less than 1 or bigger than NbNodes().
   Standard_EXPORT gp_Pnt& ChangeNode (const Standard_Integer theIndex);
 
-  //! Adds UVNode to the triangulation.
-  //! @return index of the added UVNode.
-  Standard_EXPORT Standard_Integer AddUVNode (const gp_Pnt2d& theUVNode);
-
   //! @return UVNode at the given index.
   //! Raises Standard_OutOfRange exception.
   Standard_EXPORT const gp_Pnt2d& UVNode (const Standard_Integer theIndex) const;