3
$\begingroup$

I am trying to write a programming algorithm to find two points on a trapezoid. The trapezoid could be rotated in any direction, and $h_1$, $h_2$, and $h_3$ could be any length. See attached mockup:

Solve for $c$, $d$. trapezoid problem

  • 0
    What are $x$ and $y$? Are $(a_x,a_y)$ coordinates of $a$?2017-02-20
  • 0
    Yes. Sorry, I haven't done work like this in 20 years!2017-02-20
  • 0
    Does the line marked $h_3$ connect the midpoints of the lines $ab$ and $cd$?2017-02-20
  • 0
    Yes. the lines h[1,2,3] are just there for reference to show that it's a trapezoid2017-02-20

1 Answers 1

0

There are actually two solutions for $c$ and $d$ depending upon which normal vector you take to the vector $\mathbf{u}=\left\langle a_x-b_x,a_y-b_y \right\rangle$.

$\mathbf{u}_\perp=\pm\left\langle a_y-b_y,b_x-a_x\right\rangle$. You may check that the dot product $\mathbf{u}\cdot \mathbf{u}_\perp=0$.

Then $\mathbf{v}=\left\langle \dfrac{a_x+b_x}{2},\dfrac{a_y+b_y}{2}\right\rangle$ is the vector midpoint of the segment from $b$ to $a$, so the vector midpoint of segment $cd$ is $\mathbf{w}=\left(\mathbf{v}+\dfrac{\mathbf{u}_\perp}{\vert\mathbf{u}_\perp\vert}\cdot h_3\right)$ where $\vert\mathbf{u}_\perp\vert=\vert\mathbf{u}\vert=h_1$,

Then, as vectors $\mathbf{c}=\left\langle c_x,c_y\right\rangle=\mathbf{w}+\dfrac{\mathbf{u}h_2}{2\vert \mathbf{u}\vert}$ and $\mathbf{c}=\left\langle d_x,d_y\right\rangle=\mathbf{w}-\dfrac{\mathbf{u}h_2}{2\vert \mathbf{u}\vert}$

rhombus