I am about to develop a special animation where I want to rotate a triangle (given a specific width angle) around a circle (given a specific radius) given a specific rotationAngle.
This is how I can calculate the 2 coordinates x1 / x2 that stands for the base of the triangle (the two coordinates that are hitting the circle). But I'm not able to calculate the third one!
triangle = {
x1: image.width / 2 + radius * cos((rotationAngle * PI / 180)),
y1: image.height / 2 + radius * sin((rotationAngle * PI / 180)),
x2: image.width / 2 + radius * cos(((rotationAngle + triangleSize) * PI / 180)),
y2: image.height / 2 + radius * sin(((rotationAngle + triangleSize) * PI / 180))
}
Since I know that the opposite sides of the triangle are of equal length, I only have to calculate the last point. I know the theoretical path:
- Calculate gradient A of distance xy1/xy2
- Calculate the center M of distance xy1/xy2
- Calculate the normale from A with a certain length from the center M calculate = h of triangle
Nevertheless I have problems to implement it and hope that someone will help me. Thanks in advance.


You need to define the height of the triangle, in the code segment below I have used a height of one tenth of the radius. I have also made it that the apex of the triangle is the part at exactly the rotation angle.