From: dbv Date: Tue, 31 Mar 2015 14:44:21 +0000 (+0300) Subject: Method for adding new nodes X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=fdb679fe1ade301d1a7b4adeaf5f57f7428faf4f;p=occt-copy.git Method for adding new nodes --- diff --git a/src/Poly/Poly_Triangulation.cxx b/src/Poly/Poly_Triangulation.cxx index c0bbe5b185..6c5e8bfe6f 100644 --- a/src/Poly/Poly_Triangulation.cxx +++ b/src/Poly/Poly_Triangulation.cxx @@ -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 : diff --git a/src/Poly/Poly_Triangulation.hxx b/src/Poly/Poly_Triangulation.hxx index 92a3b8516a..635a3e670f 100644 --- a/src/Poly/Poly_Triangulation.hxx +++ b/src/Poly/Poly_Triangulation.hxx @@ -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;