Salome HOME
Cosmetics. Move XML files to the separate folder inside a corresponding project in VS.
[modules/shaper.git] / src / SketchPlugin / Test / TestFillet.py
index a52ce5a5cc37af35de8cbc48f4a854411d880105..d230a29a5d347fcc2cb393f30649b851adab782f 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
 """
     TestFillet.py
     Unit test of SketchPlugin_Fillet class
@@ -5,7 +24,6 @@
     SketchPlugin_Fillet
         static const std::string MY_CONSTRAINT_FILLET_ID("SketchFillet");
         data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId());
-        data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttrList::typeId());
         data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId());
         data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), ModelAPI_AttributeRefAttrList::typeId());
 
@@ -105,7 +123,7 @@ def checkSmoothness(theSketch):
 
 def checkArcLineSmoothness(theArc, theLine):
     aCenter = geomDataAPI_Point2D(theArc.attribute("center_point"))
-    aDistance = distancePointLine(aCenter, theLine)
+    aDistance = model.distancePointLine(aCenter, theLine)
     aRadius = arcRadius(theArc)
     assert(math.fabs(aRadius - aDistance) < TOLERANCE)
 
@@ -142,16 +160,6 @@ def arcRadius(theArc):
     aStart = geomDataAPI_Point2D(theArc.attribute("start_point"))
     return model.distancePointPoint(aCenter, aStart)
 
-def distancePointLine(thePoint, theLine):
-    aLineStart = geomDataAPI_Point2D(theLine.attribute("StartPoint"))
-    aLineEnd = geomDataAPI_Point2D(theLine.attribute("EndPoint"))
-    aLength = model.distancePointPoint(aLineStart, aLineEnd)
-
-    aDir1x, aDir1y = aLineEnd.x() - aLineStart.x(), aLineEnd.y() - aLineStart.y()
-    aDir2x, aDir2y = thePoint.x() - aLineStart.x(), thePoint.y() - aLineStart.y()
-    aCross = aDir1x * aDir2y - aDir1y * aDir2x
-    return math.fabs(aCross) / aLength
-
 
 #=========================================================================
 # Initialization of the test