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)
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