-1

How to calculate the third point of the isosceles triangle using JAVA, given its two points and the circumcenter. There will be two solutions for this, and it is sufficient for me if I get the shortest one from the points A and B.

Anand
  • 693
  • 1
  • 8
  • 26
  • 3
    If by _circumcenter_ you mean the intersection point of the perpendicular bisectors of a triangle, then as it is also the center of the triangle's _circumcircle_ (the circle that passes through all three of the triangle's vertices) I don't see how you can find **only two** solutions: **every** point on that circle can be the third point! – Bob__ Jul 14 '16 at 20:09
  • Only 2 solutions can be obtained because the third point of the triangle will be on the line connecting midpoint of the two points and the center of the circle. This line intersects the circle twice. – Anand Jul 15 '16 at 09:32
  • So you are considering only [_isosceles_](http://mathworld.wolfram.com/IsoscelesTriangle.html) triangles. Fine, but since this is not the [general case](http://www.mathopenref.com/trianglecircumcenter.html), it should be specified in the question. – Bob__ Jul 15 '16 at 11:32
  • Yeah you are right. I will add it now. – Anand Jul 15 '16 at 19:45
  • Are you having trouble with the math involved (look at those Q&A about [Perpendicular line passing through the midpoint of another line](http://math.stackexchange.com/questions/306468/perpendicular-line-passing-through-the-midpoint-of-another-line) and [intersection between circle and line](http://math.stackexchange.com/a/228855), if it's the case) or with the implementation in Java (please, show what have you done so far)? – Bob__ Jul 15 '16 at 21:10

1 Answers1

1

If AB is the base of isosceles triangle (AC=BC), then solution is rather simple.

Given points A, B, CC (circumcenter)

Circumradius is

 R = Length(CC-A) = Sqrt((CC.X - A.X)^2 + (CC.Y - A.Y)^2)

Edit: changed direction vector calculation to avoid ambiguity:

Middle point of AB

 M = ((A.X + B.X)/2, (A.Y + B.Y)/2)

Direction vector from CC to vertice C

D = (CC.X - M.X, CC.Y - M.Y)

Normalized (unit) direction vector

uD = (D.X / Length(D), D.Y / Length(D))

Vertice C coordinates

C = (CC.X + R * uD.X, CC.Y + R * uD.Y)
MBo
  • 77,366
  • 5
  • 53
  • 86
  • Hello, thank you for the solution. However, there should be 2 solutions for C. Can I get the other coordinate by CC.X - R * uD.X, CC.Y - R * uD.Y – Anand Jul 21 '16 at 12:32
  • With described conditions there is only one solution. – MBo Jul 21 '16 at 13:55