# Find Point At Edge of Rectangle, Given Unrelated Angle

## Overview

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:

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°

∠RCE = ∠TAB

∠PCE = ∠ZAB

## 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?

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

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.