algorithm - How do I find all points of an isosceles triangle given the vertex point, base midpoint, and base width? -
i'm trying make properly-rotated isosceles triangle. have following data:
- the
(x, y)
coordinates of vertex point, a - the
(x, y)
coordinates of midpoint of base, am - the width of base, a
and need find coordinates of other 2 points, b , c. what algorithm finding these last 2 points above information? searching google got me lot of equations assume it's pointed directly up, need these placed before transformation performed.
to find b
, c
:
- find normalized direction vector
a_ma = (a - a_m)/|a - a_m|
- find vector orthogonal vector
a_ma
– let's calla_ma'
a_ma' = (-a_ma.y, a_ma.x)
- to find
b
, stepwidth/2
units in direction ofa_ma'
, adda_m
:b = (width/2)*a_ma' + a_m
- to find
c
, step-width/2
units in direction ofa_ma'
, adda_m
:c = (-width/2)*a_ma' + a_m
jsfiddle example: https://jsfiddle.net/asq7h2jd/
Comments
Post a Comment