Formula to calculate the coords of one of the two base vertex of an isoceles triangle

94 Views Asked by At

I have an isosceles triangle, of which I know $\hat{CAB}$, $A(x, y)$ and $B(x, y)$, and from these two point I can obtain $c_1$ (and $b$, which is equal to $c_1$).

enter image description here

What I need is to find the formula to get $C_x$ and $C_y$.

My question is similar to this one: Calculate coordinates of 3rd point (vertex) of a scalene triangle if angles and sides are known. but this time the triangle should be isosceles, and I think that the formula above do not work for this type of triangle.

I also looked at this: Calculate Third Point of Triangle but I think it's different because the vertex needed is not one of the two base vertex.

1

There are 1 best solutions below

0
On BEST ANSWER

I finally found the solution. To find $C_x$ and $C_y$ you have to rotate $B$ for $a$ radians. Here is the formula:

Cx = Ax + math.cos((a) * (Bx - Ax) - math.sin((a) * (By - Ay)
Cy = Ay + math.sin((a) * (Bx - Ax) + math.cos((a) * (By - Ay)

You actually have to check in what quadrant is the point you want to rotate, to make sure that it will always rotate in the same direction (In this case it rotates in a clockwise direction).

# Written in Python 3.5.1
import math
vertex = (20.338, -12.43785)
center = (12.5335, -11.56375)
a = 150 # degrees
a = a*0.0175 # radians
if vertex[0] > center[0] and vertex[1] >= center[1]:
    qx = center[0] + math.cos((-a)) * (vertex[0] - center[0]) - math.sin((-a)) * (vertex[1] - center[1])
    qy = centro[1] + math.sin((-a)) * (vertice[0] - centro[0]) + math.cos((-a)) * (vertice[1] - centro[1])
elif vertex[0] >= center[0] and vertex[1] < center[1]:
    qx = centex[0] + math.cos((a)) * (vertex[0] - center[0]) - math.sin((-a)) * (vertex[1] - center[1])
    qy = center[1] + math.sin((-a)) * (vertex[0] - center[0]) + math.cos((a)) * (vertex[1] - center[1])
elif vertex[0] < center[0] and vertex[1] <= center[1]:
    qx = center[0] + math.cos((-a)) * (vertex[0] - center[0]) - math.sin((-a)) * (vertex[1] - center[1])
    qy = center[1] + math.sin((-a)) * (vertex[0] - center[0]) + math.cos((-a)) * (vertex[1] - center[1])
elif vertex[0] <= center[0] and vertex[1] > center[1]:
    qx = center[0] + math.cos((a)) * (vertex[0] - center[0]) - math.sin((-a)) * (vertice[1] - centro[1])
    qy = center[1] + math.sin((-a)) * (vertex[0] - center[0]) + math.cos((a)) * (vertex[1] - center[1])
print("("+str(round(qx, 3))+",", str(round(qy, 3))+")")