I'm trying to make a properly-rotated isosceles triangle. I have the following data:
(x, y)
coordinates of the vertex point, A(x, y)
coordinates of the midpoint of the base, amAnd I need to find the coordinates of the other two points, B and C. What is an algorithm for finding these last two points with only the above information? Searching Google just got me a lot of equations that assume it's pointed directly up, but I need these to be placed before a transformation is performed.
To find B
and C
:
a_mA = (A - a_m)/|A - a_m|
a_mA
– let's call it a_mA'
a_mA' = (-a_mA.y, a_mA.x)
B
, step width/2
units in the direction of a_mA'
and add a_m
:
B = (width/2)*a_mA' + a_m
C
, step -width/2
units in the direction of a_mA'
and add a_m
:
C = (-width/2)*a_mA' + a_m
JsFiddle example: https://jsfiddle.net/asq7h2jd/