python geometry help
- by Enriquev
Hello,
I have the following problem, I am trying to find the following distances (F1 and F2):
This is what I have as of now:
def FindArrow(self, X1, Y1, X2, Y2, X3, Y3):
self.X1 = float(X1)
self.Y1 = float(Y1)
self.X2 = float(X2)
self.Y2 = float(Y2)
self.X3 = float(X3)
self.Y3 = float(Y3)
#center coords of the circle
self.Xc = None
self.Yc = None
#radius
self.R = None
#F1 and F2
self.FAB = None
self.FBC = None
#check if the coordinates are collinear
invalide = self.X1 * (self.Y2 - self.Y3) + self.X2 * (self.Y3 - self.Y1) + self.X3 * (self.Y1 - self.Y2)
if (invalide == 0):
return
#get the coords of the circle's center
s = (0.5 * ((self.X2 - self.X3)*(self.X1 - self.X3) - (self.Y2 - self.Y3) * (self.Y3 - self.Y1))) / invalide
self.Xc = 0.5 * (self.X1 + self.X2) + s * (self.Y2 - self.Y1)
self.Yc = 0.5 * (self.Y1 + self.Y2) + s * (self.X1 - self.X2)
#get the radius
self.R = math.sqrt(math.pow(self.Xc - self.X1, 2) + math.pow(self.Yc - self.Y1, 2))
Until here everything seems to work, now what would be the next steps to get F1 and F2 ?