]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchPlugin/Test/TestConstraintTangent.py
Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / SketchPlugin / Test / TestConstraintTangent.py
index 09649edfa275b2fc3fc652991af53ced7bc343b1..3f3ac2e7ed9382800fe81551d4df974ab3b58e94 100644 (file)
@@ -40,23 +40,6 @@ from salome.shaper import model
 
 __updated__ = "2015-03-17"
 
-def distancePointLine(point, line):
-    """
-    subroutine to calculate distance between point and line
-    result of calculated distance is has 10**-5 precision
-    """
-    aStartPoint = geomDataAPI_Point2D(line.attribute("StartPoint"))
-    aEndPoint = geomDataAPI_Point2D(line.attribute("EndPoint"))
-    # orthogonal direction
-    aDirX = -(aEndPoint.y() - aStartPoint.y())
-    aDirY = (aEndPoint.x() - aStartPoint.x())
-    aLen = math.sqrt(aDirX**2 + aDirY**2)
-    aDirX = aDirX / aLen
-    aDirY = aDirY / aLen
-    aVecX = point.x() - aStartPoint.x()
-    aVecY = point.y() - aStartPoint.y()
-    return round(math.fabs(aVecX * aDirX + aVecY * aDirY), 5)
-
 def checkArcLineTangency(theArc, theLine):
     """
     subroutine to check that the line is tangent to arc/circle
@@ -68,7 +51,7 @@ def checkArcLineTangency(theArc, theLine):
         aCenter = geomDataAPI_Point2D(theArc.attribute("center_point"))
         aStartPnt = geomDataAPI_Point2D(theArc.attribute("start_point"))
         aRadius = model.distancePointPoint(aStartPnt, aCenter)
-    aDist = distancePointLine(aCenter, theLine)
+    aDist = model.distancePointLine(aCenter, theLine)
     assert math.fabs(aDist - aRadius) < 2.e-5, "aDist = {0}, aRadius = {1}".format(aDist, aRadius)
 
 def checkArcArcTangency(theArc1, theArc2):