# Coordinates of parallel triangle with a distance of 'd' between the parallel edges?

I have a triangle with Co-ordinates $\{(x_1,y_1),(x_2,y_2),(x_3,y_3)\}$. I need to find co-ordinates of a triangle,whose edges are exactly $\alpha$ distance from previous triangle. Below is the figure which illustrates this scenario. SOLUTION:

    public void enlargetriangle(Graphics g)
{
double ratiodistance=d; // distance between two triangles
Point xy1; //Point p1
Point xy2; //Point p2
Point xy3; //Point p3
double d1=Math.sqrt(Math.pow((xy2.x-xy3.x), 2)+Math.pow((xy2.y-xy3.y), 2));
double d2=Math.sqrt(Math.pow((xy3.x-xy1.x), 2)+Math.pow((xy3.y-xy1.y), 2));
double d3=Math.sqrt(Math.pow((xy1.x-xy2.x), 2)+Math.pow((xy1.y-xy2.y), 2));
double incenter_X=((((d1*xy1.x)+(d2*xy2.x)+(d3*xy3.x))/(d1+d2+d3)));
double incenter_Y=((((d1*xy1.y)+(d2*xy2.y)+(d3*xy3.y))/(d1+d2+d3)));
Point incenter= new Point((int)((((d1*xy1.x)+(d2*xy2.x)+(d3*xy3.x))/(d1+d2+d3))),(int)(((d1*xy1.y)+(d2*xy2.y)+(d3*xy3.y))/(d1+d2+d3)));
Point xy1_2=new Point((int)(incenter_X+((ratio_distance)*(xy1.x-incenter_X))),(int)(incenter_Y+((ratio_distance)*(xy1.y-incenter_Y))));
Point xy2_2=new Point((int)(incenter_X+((ratio_distance)*(xy2.x-incenter_X))),(int)(incenter_Y+((ratio_distance)*(xy2.y-incenter_Y))));
Point xy3_2=new Point((int)(incenter_X+((ratio_distance)*(xy3.x-incenter_X))),(int)(incenter_Y+((ratio_distance)*(xy3.y-incenter_Y))));
// xy1_1, xy1_2,xy1_3 are the required triangle co-ordinates
}


I'll use "$d$" as the distance between the edges of the original and expanded triangles; I need "$a$" in a more-standard role elsewhere.

Let $I$ be the incenter of the original triangle, and let $r$ be the inradius. Clearly, $I$ lies at distance $r+d$ from each side of the expanded triangle, so that it's also the expanded triangle's incenter. Therefore, for any vertex $P$ of the original triangle, and its counterpart $P^\prime$ on the expanded triangle, $\overleftrightarrow{IP}$ is the bisector of $\angle P$ and $\overleftrightarrow{IP^\prime}$ the bisector of $\angle P^\prime$; because the corresponding sides of the triangles are parallel and "equidistant", these two bisectors must coincide. We have, then, that the expanded triangle is a dilation (or scaling) of the original triangle relative to point $I$; the scale factor is $(r+d)/r$.

Thus, we can express the coordinates of $P^\prime$ in terms of those of $P$ and $I$:

$$P^\prime = I + \frac{r+d}{r}(P-I) \qquad \qquad (*)$$

With a peek at MathWorld's "Incenter" entry, we get the coordinates of $I$ to be

$$I = \left(\frac{a x_1 + b x_2 + c x_3}{a+b+c}, \frac{a y_1 + b y_2 + c y_3}{a+b+c} \right)$$

where $a$, $b$, $c$ are the lengths of edges opposite respective vertices $(x_1,y_1)$, $(x_2, y_2)$, $(x_3, y_3)$. The inradius is given by

$$r = \frac{1}{2}\sqrt{\frac{(-a+b+c)(a-b+c)(a+b-c)}{a+b+c}} = \frac{2\cdot\text{area of}\;\triangle}{a+b+c}$$

I'll leave it as an exercise for the reader to write the expressions for $I$ and $r$ completely in terms of the $(x_i,y_i)$, and then to substitute them into $(*)$.

• I have written java code and added it to the question as a solution :) Thank you for the confirmation of the idea i had. Apr 9, 2013 at 2:57
– Blue
Apr 9, 2013 at 3:03
• Sorry for the mistake. :) Apr 9, 2013 at 4:31

Let the triangle's vertices be $\,A,B,C\,$ from the upper one and anticlockwise, and their coordinates be respectively numbered. Here are some ideas:

1) Let $\,y=mx+n\,$ be the equation of side $\,AC\,$, say: you want a line $\,y=mx+n'\,$ (note both $\,m\,$'s so far are the same!). Take any point on the new line, say $\,(x_1\,,\,mx_1+n')\,$ , and determine its distance from the $\,AC\,$ to be $\,\alpha$\, , i.e.

$$\frac{|mx_1-(mx_1+n')+n|}{\sqrt{m^2+1}}=\alpha\iff |n-n'|=\alpha\sqrt{m^2+1}$$

Note that you get two possible solutions (two lines at both "sides" of $\,AC\,$ parallel to it and at a distance $\,\alpha\,$ from it) . You must choose the one on the side of vertex $\,B\,$ (for example, taking the equation of the line whose distance from $\,B\,$ is the shortest...)

2) Repeat the above with the three sides and then find the intersection points, which will be the new triangle's vertices.

...................................

a) Again call the exterior triangle's vertices $\,A,B,C\,$ from the upper one and anticlockwise, and the resp. inner triangle's vertices $\,A',B',C'\,$ . Note that $\,\Delta ABC\sim\Delta A'B'C'\,$ ...!

Continue side $\,A'B'\,$ "down" until it intersects side $\,BC\,$ at point $\,P\,$, and draw from $\,B'\,$ a perpendicular segment down to $\,BC\,$ with intersection point $\,Q\,$, so that get a tiny straight-angled triangle $\,\Delta B'PQ\,$. Passing to vector notation, you can get the angle $\,\theta\,$ between the vectors

$$\vec v:=\vec{BA}:=(x_1-x_2,y_1-y_2)\;,\;\;\text{and}\;\;\vec u:=\vec{BC}:=(x_3-x_2,y_3-y_2)$$

by means of its (usual, euclidean) inner product and norm and then the arccosine function:

$$\cos\theta:=\frac{\langle\,\vec v\,,\,\vec u\,\rangle}{||\vec v||\cdot||\vec u||}$$

and from here you can get the length of segment $\,PQ\,$:

$$\tan\theta:=\frac{\alpha}{PQ}\implies PQ=\frac{\alpha}{\tan\theta}$$

b) Well, now you can go as follows:

Take the straight angled triangle $\,\Delta BB'Q\,$ and note that $\,BQ=BP+PQ\,$ and you already know these two lengths, so you need the intersection point between the line passing through $\,B\,$ and making an angle equal to

$$\arctan\frac{\alpha}{BQ}$$

with $\,BC\,$, and to a distance of

$$\sqrt{\alpha^2+BQ^2}$$

from $\,B\,$ (again, two possible such points and etc.) , and repeat with all three vertices.

compare perimeters