Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given the following graph:

enter image description here

Where SP is the start point and EP is the end point of a line - how would I rotate p1 and p2 on axis SP in such a way that they would represent an isosceles triangle e.g.

enter image description here

share|improve this question
1  
What is special about the second picture? For example, do you want your triangle to be isosceles? –  dtldarek Feb 4 '13 at 9:03
    
@dtldarek Judging from the title of the question, I'd say 'yes' –  mrf Feb 4 '13 at 9:10
    
@dtldarek yes, I have updated the question. –  James Feb 4 '13 at 9:26
add comment

1 Answer

Calculate the distance between say $p_1$ and $SP$, $d = |SP - p_1|$. Suppose $v := EP - SP = (v_1, v_2)$. Then $n = (-v_2, v_1)$ is the direction you need to go in. Then your points are $SP \pm \frac{d n}{|n|}$

share|improve this answer
    
Could you elaborate a little on v := EP - SP = (v1, v2)? i.e. where does v1/v2 come from (bit rusty with maths!). –  James Feb 4 '13 at 10:16
1  
Let $EP = (x_1, y_1)$ and $SP = (x_2, y_2)$. Then what I meant is that $v = (x_2 - x_1, y_2 - y_1)$. So $n$ would then be $(y_1 - y_2, x_2 - x_1)$. –  muzzlator Feb 4 '13 at 10:18
    
Thanks and the last formula could you explain the last equation i.e. dn/|n|? I understand that p1/p2 will be the SP +- whatever the value of that equation is. –  James Feb 4 '13 at 10:29
    
I suppose you need to know what $|v|$ means, $|v|$ is the length of a vector $v$ and you can calculate it in 2-dimensions by doing $|(v_1, v_2)| = \sqrt{v_1^2 + v_2^2}$. So, after you find $d = |SP - p_1|$, you then take the vector we just calculated $n$, first scale it by $d$, then scale it by $1 / |n|$ –  muzzlator Feb 4 '13 at 10:39
    
So in laymans terms - P1 := SP - (d x n / √ n)? –  James Feb 4 '13 at 10:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.