math - python geometry help -
I have the following problem, I am trying to find the following distance (F1 and F2):
This is like me:
def FindArrow (auto, 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) # Circles Centers Cord Self AxC = nobody is yourself Y.C. = None # RDS itself R = None # F1 and F2 self. Fb = none. Self.fbc = none # check if coordinates parallel invalide = self.x1 * (self.Y2 - self.Y3) + self.x2 * (self Y3 - Y1) + self. X3 * (self. Y1 - self. Y2) if (invalide == 0): return # get the properties of the center of the circle = (0.5 * ((self.x2 - self x3) * (self. X1 - Self.x3) - (Yoga itself - Y3) * (Yep. Y3 - Y1 itself)) / assimilate self. Xc = 0.5 * (self. X1 + self. X2) + s * (self Y2 - Y1) Self. YC = 0.5 * (self. Y1 + self. Y2) + S * (self.X1 - self.X2) # Get radius self. R = Math SQL (math.pow (self.xc-self.x1, 2) + math.pow (self.Yc-self.Y1, 2))
As long as everything here works Looks like, what will be the next steps to get F1 and F2 now?
Edit: Both answers (Tommer and Inertia) start working for the first image, but I have tried the following image and it does not work anymore:
If you have radius of the circle, then you can see the Pythagorean theorem Using Segment P2-P3 (see triangle) with its upper part: P2, center of the circle and P2-P3 between the center of the circle. Then decrease the radius to get F2.
Edit : If you call x
between center and segment P2-P3, then F2 or RX
(as the first image), or R + x
(as the second image). It depends on you defining F1 and F2.
If you define F1 and F2, then they always go out of the triangle P1-P2-P3 (it fits in both of your examples), then F2 = Rx If the center of the circle is on the same side of P2-P3, and
F2 = R + x
if the center of P1 and circle is in the opposite side of P2-P3 < / P>
Comments
Post a Comment