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.

an isosceles triangle rotated vertex (labeled blue capital a) in lower-left , base (labeled red lower-case a) on upper-right. base bisected midpoint (labeled green subscript m). other 2 points labeled purple capital b , orange capital c, respectively.

to find b , c:

  1. find normalized direction vector a_ma = (a - a_m)/|a - a_m|
  2. find vector orthogonal vector a_ma – let's call a_ma'
    • a_ma' = (-a_ma.y, a_ma.x)
  3. to find b, step width/2 units in direction of a_ma' , add a_m:
    • b = (width/2)*a_ma' + a_m
  4. to find c, step -width/2 units in direction of a_ma' , add a_m:
    • c = (-width/2)*a_ma' + a_m

jsfiddle example: https://jsfiddle.net/asq7h2jd/


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -