I've been struggling at this problem for about 3 days now. I've posted it on a couple forums will no answers, so maybe I'll get a solution here. Thanks in advance!

Diagram: Diagram

Plain Diagram: Plain Diagram

Known: A, B, C, P, R, T, Z, h, w

Need: D, E, F; Length of dcef and ef segments

Y axis is inverted!

(0,0) is at top left corner of rectangle

Known Example Data

h = 600

w = 800

C is at (w/2,h/2) = (400,300)

R is at (400,0)

P is at (400,600)

A is at (534,88)

B is at (740,296)

T is at (534,0)

Z is at (534,600)

∠TAB = 135°

∠ZAB = 45°



Problem Solving

∠ZFE = 90 - ∠PCE

∠ZFE = 45°

segCP = segRC = 400

segCF = sin(∠PCF) × segCP

segCF = sin(45) × 400

segCF = 282.8427125

∠TAB will be anywhere from 0° to 360°, which in-turn would affect what side and position F would be.

∠RCF always = ∠TAB

E is not a point on AZ

A may change coordinates, DE will always be parallel and congruent to AB

The Question!

Now all I really need is the length of segEF to solve the problem, since we know that segDE = segAB.

So segDF = segDE + segEF

Can educate me on the steps to get the length of segEF?

  • $\begingroup$ E is not a point on AZ $\endgroup$
    – Swivel
    Nov 10, 2011 at 19:43
  • $\begingroup$ Still no takers? I've got a cookie! $\endgroup$
    – Swivel
    Nov 17, 2011 at 3:03

1 Answer 1


Call the line containing $C$, $D$, $E$, and $F$ $\ell$. $\ell$ has the same slope as the line containing $A$ and $B$. Given $A=(x_A,y_A)$, $B=(x_B,y_B)$, and $C=(x_C,y_C)$, the slope of $\ell$ is $\frac{y_B-y_A}{x_B-x_A}$ and it passes through $C$, so an equation for $\ell$ is: $$\ell: y-y_C=\frac{y_B-y_A}{x_B-x_A}(x-x_C).$$ The line through $A$ and $D$ is perpendicular to $\ell$, so its slope is the opposite-reciprocal of the slope of $\ell$, or $-\frac{x_B-x_A}{y_B-y_A}$, and it passes through $A$, so an equation for it is: $$y-y_A=-\frac{x_B-x_A}{y_B-y_A}(x-x_A).$$ The $D$ is the intersection of these two lines, so its coordinate are the solution to the system of those two equations, which gives $$x_D=\frac{x_A^3-2 x_A^2 x_B+x_A \left(x_B^2+(y_A-y_B) (y_A-y_C)\right)+(y_A-y_B) (x_C (y_A-y_B)+x_B (-y_A+y_C))}{(x_A-x_B)^2+(y_A-y_B)^2}$$ and $$y_D=\frac{\left(x_A^2+x_B x_C-x_A (x_B+x_C)+y_A (y_A-y_B)\right) (y_A-y_B)+(x_A-x_B)^2 y_C}{(x_A-x_B)^2+(y_A-y_B)^2}.$$

Now, the vector from $A$ to $B$ ($\overrightarrow{AB}=\langle x_B-x_A,y_B-y_A\rangle$) is equal to the vector from $D$ to $E$, so adding that vector to $D=(x_D,y_D)$ gives $E=(x_D+x_B-x_A,y_D+y_B-y_A)$. The vector $\overrightarrow{EF}$ has the same direction as $\overrightarrow{AB}$, but its vertical ($y$) component should be the same as the vertical distance from $E$ to $F$, which is is $h-(y_D+y_B-y_A)$. So, multiply $\overrightarrow{AB}$ by the ratio of the desired vertical component to the known vertical component to get $\overrightarrow{EF}$. That is, $$\overrightarrow{EF}=\overrightarrow{AB}\cdot\frac{h-(y_D+y_B-y_A)}{y_B-y_A}=\left\langle\frac{(x_A-x_B)(h+y_A-y_B-y_D)}{y_A-y_B},h+y_A-y_B-y_D\right\rangle.$$ The coordinates of $F$ can be found by adding $\overrightarrow{EF}$ to the coordinates of $F$.

Given the coordinates of $D$, $E$, and $F$, you can compute the distances you want.

  • $\begingroup$ It's been a while since I stopped looking for the answer to this, but I'm glad I got one! I'll attempt to utilize the above formula and see how far I get with it. This is awesome! Thanks Isaac! I'll mark this as the solution if and when I put it through some tests. $\endgroup$
    – Swivel
    Apr 4, 2013 at 19:56
  • $\begingroup$ Now, I do have a question regarding this... Because the equation for EF utilizes height, if the angle of TAB is decreased so that the point F is on the right edge of the rectangle (instead of the bottom edge of the rectangle), would the equation have to change? $\endgroup$
    – Swivel
    Apr 4, 2013 at 20:45
  • $\begingroup$ Do you know the answer to the question asked in the comment about? $\endgroup$
    – Swivel
    Nov 7, 2014 at 16:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .