4
$\begingroup$

I have two vectors CA and CB which I 'stroked' with lines of width a and b. I need to calculate D and E points to draw miter joint between two stroked vectors. What I know is:

  • A point coordinates
  • B point coordinates
  • C point coordinates
  • β angle
  • a length
  • b length

What I'm looking are coordinates of points D and E. I need to find universal formula that lets me to calculate those points at any β. (please see pic.1 below)

enter image description here

I can calculate those points if use stroke with same length for both vectors (a == b). I'm doing it by reflecting point C over vector AC with distance 0.5*a. Then I have right angle triangle, on which γ angle at point C equals 90° - (0.5 * β) angle. Therefore I have all three angles for the triangle and length of CF (half of a) which lets my to calculate coordinates of point D. (please see pic.2 below). I use triangle CGE to calculate E coordinates in the same way as above.

enter image description here

My problems start when I need to use different width for the vector's stroke (a != b) (please see pic.3 below). In that case when I draw CFD triangle I cannot calculate γ angle as it is not 90° - (0.5 * β) anymore and I have no idea how to calculate D and E coordinates. Can someone point me in the right direction how to find γ angle or if there is any other (better) way to calculate coordinates of D and E?

enter image description here

$\endgroup$
4
$\begingroup$

Draw two vectors $\vec u$ and $\vec v$ as in the picture below. They form a parallelogram having $a/2$ and $b/2$ as altitudes. It follows that $$ u={b\over 2\sin\beta},\quad v={a\over 2\sin\beta}. $$ It is then easy to compute $\vec u$ and $\vec v$: $$ \vec u={A-B\over AB}{b\over 2\sin\beta},\quad \vec v={C-B\over BC}{a\over 2\sin\beta} $$ and finally: $$ D=B+\vec u+\vec v,\quad E=B-\vec u-\vec v. $$

enter image description here

$\endgroup$
2
  • $\begingroup$ Amazing! It looks much cleaner and simpler from what I was trying to do. I know it may be pretty basic, but I'm not sure how to do computations on points (A-B/AB), therefore I'm not sure how to compute u⃗ and v⃗. Are A, B and C row matrices in your equation? Would you mind to show me an example calculation? $\endgroup$ – Guferos Jul 6 '16 at 10:16
  • $\begingroup$ $A-B$ and $C-B$ are displacement vectors. Example: $A=(1,3)$, $B=(5,1)$, $A-B=(-4,2)$. While $AB$ is the distance between $A$ and $B$. For the example at hand, $AB=\sqrt{20}$ so that $${A-B\over AB}=(-{4\over\sqrt{20}},{2\over\sqrt{20}}).$$ $\endgroup$ – Intelligenti pauca Jul 6 '16 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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