def calculateTextPoint(self): # TODO : test if the position is ok """ calculate the text position """ t = self.getDimensioLines() p1, p2 = t[0] p1 = Point(p1.x(), p1.y()) v = Vector(p1, Point(p2.x(), p2.y())) vm = v.mag() vm.mult(v.norm / 2) pe = p1 + vm.point return QtCore.QPointF(pe.x, pe.y)
def calculateTextPoint(self): # TODO : test if the position is ok """ calculate the text position """ t=self.getDimensioLines() p1, p2=t[0] p1=Point(p1.x(), p1.y()) v=Vector(p1, Point(p2.x(), p2.y())) vm=v.mag() vm.mult(v.norm/2) pe=p1+vm.point return QtCore.QPointF(pe.x, pe.y)
def GetRadiusPointFromExt(self,x,y): """ get The intersecrion point from the line(x,y,cx,cy) and the circle """ _cx, _cy = self.center.getCoords() _r = self.radius centerPoint=Point(_cx,_cy) outPoint=Point(x,y) vector=Vector(outPoint,centerPoint) vNorm=vector.norm() newNorm=abs(vNorm-_r) magVector=vector.mag() magVector.mult(newNorm) newPoint=magVector.point() intPoint=Point(outPoint+newPoint) return intPoint.getCoords()
def GetRadiusPointFromExt(self, x, y): """ get The intersecrion point from the line(x,y,cx,cy) and the circle """ _cx, _cy = self.center.getCoords() _r = self.radius centerPoint = Point(_cx, _cy) outPoint = Point(x, y) vector = Vector(outPoint, centerPoint) vNorm = vector.norm() newNorm = abs(vNorm - _r) magVector = vector.mag() magVector.mult(newNorm) newPoint = magVector.point() intPoint = Point(outPoint + newPoint) return intPoint.getCoords()