Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAPI / GeomAPI_Vertex.cpp
index 5025a6aaa75846722e73d765f7f7d2f8f6ea9f6c..adb04beeed9a1808fa9b35995467761f9f95bc4f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <gp_Pnt.hxx>
 #include <Precision.hxx>
 
+static TopoDS_Shape* buildVertex(const gp_Pnt& thePoint)
+{
+  TopoDS_Vertex aVertex;
+  BRep_Builder aBuilder;
+  aBuilder.MakeVertex(aVertex, thePoint, Precision::Confusion());
+  return new TopoDS_Shape(aVertex);
+}
+
 GeomAPI_Vertex::GeomAPI_Vertex()
   : GeomAPI_Shape()
 {
@@ -41,12 +49,14 @@ GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr<GeomAPI_Shape>& theShape)
   }
 }
 
+GeomAPI_Vertex::GeomAPI_Vertex(const std::shared_ptr<GeomAPI_Pnt>& thePoint)
+{
+  setImpl(buildVertex(thePoint->impl<gp_Pnt>()));
+}
+
 GeomAPI_Vertex::GeomAPI_Vertex(double theX, double theY, double theZ)
 {
-  TopoDS_Vertex aVertex;
-  BRep_Builder aBuilder;
-  aBuilder.MakeVertex(aVertex, gp_Pnt(theX, theY, theZ), Precision::Confusion());
-  setImpl(new TopoDS_Shape(aVertex));
+  setImpl(buildVertex(gp_Pnt(theX, theY, theZ)));
 }
 
 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Vertex::point()