# How to get innerTriangle Co-ordinates?

Let say I have the following triangles,

I know the distance which is same. I know all the co-ordinates. How to get inner triangle co-ordinates?

Edit: I was able to solved the issue by getting the mid-points of all lines. From these mid-points I can move d distance, So I can get three points. No I have 3 points and 3 slopes. From this, I can get three new equations. Simultaneously, solving the equation get the 3 points.

-
The right angle of the inner triangle is at $(5,5)$, which is outside the outer triangle, so something is screwy here. – Gerry Myerson Apr 12 '12 at 6:05
@GerryMyerson, this is just an example. Triangle can be any co-ordinates and distance can be anything. Please give me the solution. – user960567 Apr 12 '12 at 6:06
Also, you've posted a bunch of questions of pretty much this type. Have you learned anything from the solutions to all those other problems? – Gerry Myerson Apr 12 '12 at 6:07
I have learnt a lot @GerryMyerson. Thanks for this perfact site. Currently, I am using a method which is not working perfactly. That's why I asked another one. – user960567 Apr 12 '12 at 6:13

It seems to me that what many of your problems have in common is a given line $L$ and a given distance $d$ and you want a line $M$ parallel to $L$ and at distance $d$ from $L$, so let's solve this problem once and for all and then maybe you can solve all your problems.

Let the line $L$ be given by $y=mx+b$. Pick any point $P$ on this line, say, $P=(0,b)$. The line through $P$ perpendicular to $L$ has equation $$y=-(1/m)x+b$$ We want a point $Q$ on this line at distance $d$ from $(0,b)$, so we want $$x^2+(y-b)^2=d^2$$ So we have two (displayed) equations in the two unknowns $x,y$. The first equation says $y-b=-x/m$, and sticking that in the second equation we get $x^2+(x^2/m^2)=d^2$ which you can solve for $x$, getting $x=\pm dm/\sqrt{m^2+1}$. Then you can use the first displayed equation to get $y$. Note that there are two solutions, one on either side of the line $L$. In practice, you should have no difficulty telling which of the two possibilities for $Q$ is the one you want.

Now that you have the coordinates for $Q$, let's say $Q=(r,s)$, the equation of the line $M$ is simply $y=m(x-r)+s$.

Now you generally want vertices, not lines, but that's easily taken care of; once you have the equations of the lines that form your polygon, you find the vertices by solving pairs of equation of lines simultaneously.

You may have to be a little careful with the formulas if the lines involved are horizontal or vertical, but these are the easy cases where you don't really need to do all the work outlined above anyway.

As an exercise, try to carry out these steps with your triangle-in-a-triangle.

-
How you can say that (0,b) is on line. This will not always the case. Note, using vectors I can easily get a point from edges to distance d. But this is not giving correct result. – user960567 Apr 12 '12 at 6:56
See my edited post. – user960567 Apr 12 '12 at 11:43
Aside from the special case of vertical lines, every line can be written as $y=mx+b$. How can you deny that $(0,b)$ is on this line? It may not be on the part of the line that interests you, but for the purpose of finding a parallel line at a given distance that doesn't matter. – Gerry Myerson Apr 12 '12 at 12:38
Polygon has lot of chances that they have one(or more) vertical and horizontal lines. So, I can't assume(0,b) and (a,0). BTW, thanks. I am using the solution present in my question. Any suggestion will be welcome. – user960567 Apr 13 '12 at 2:29
The horizontal and vertical lines are easy to deal with. The lines at distance $d$ from the vertical line $x=a$ are the lines $x=a+d$ and $x=a-d$. Similarly for the horizontal lines. – Gerry Myerson Apr 13 '12 at 6:56

With your particular numbers, the diagram does not quite work. But I will give a procedure that works if you want the distances to be, say $2$.

The equation of our slanted line is $8x+6y-48=0$. We find for example the coordinates of the rightmost corner of the little triangle. Its $y$-coordinate is $2$. Let the $x$-coordinate be $p$.

The distance from $(p,2)$ to the slanted line is given by $$\frac{|8p+6\cdot 2-48|}{\sqrt{8^2+6^2}}.$$ Set this equal to $2$. There are two solutions $p$. Discard the one which is outside the big triangle.

-
The triangle(or may be it is polygon) can be anything. I need generic solution. So, I cannot use p,2. I am currently getting the co-ordinates using the vectors from all edges of outer triangle. For e.g, (0,0) to distance=8, I can get another co-ordinates using vectors. But this is not giving correct result. – user960567 Apr 12 '12 at 6:18
For a right triangle, put the right angle at the origin, the other two vertices along the axes. Exactly the same method will work, I picked distance $2$ for concreteness, since your question was concrete. Of course exactly the same procedure works if we use $d$ instead of $2$. In the general case, find equations for the sides, and use the same distance formula. But we will have to work with general point $(p,q)$ and make the distances to consecutive edges equal to $d$. For each vertex that gives two equations in two unknowns. – André Nicolas Apr 12 '12 at 6:24
But it is not neccessary a right angle triangle. – user960567 Apr 12 '12 at 6:36
If you know the vertices of the big triangle, you can find the equations of the lines that form the edges. Then see my comment just above. – André Nicolas Apr 12 '12 at 6:39
I know how to get the new co-ordinates from edges using simple vectors and the distance from edges to a inner triangle points is always same. But this is not correct. You can visualize this. – user960567 Apr 12 '12 at 6:44

Let's denote distance as $d$ .Since inner triangle (see picture below) is similar to the outer triangle it follows :

$6 : 8 = \sqrt{(x_B-d)^2+(d-d)^2} : \sqrt{(y_C-d)^2+(d-d)^2}$

Since inner triangle is right-angled triangle it follows :

$\sqrt{(d-y_C)^2+(x_B-d)^2}=\sqrt{(y_C-d)^2}+\sqrt{(x_B-d)^2}$

So you have a system of two equations in two unknowns .

-
This is just an example. Triangle can be any co-ordinates and distance can be anything. Please give me the solution. – user960567 Apr 12 '12 at 6:35
@user960567 I guess that you know how to solve system of two equations in two unknowns...System of equations in two variables – pedja Apr 12 '12 at 6:41
Please see the aboive comments – user960567 Apr 12 '12 at 6:46
See my edited post. – user960567 Apr 12 '12 at 11:43

From your diagram, the point at right angle of the inner triangle is at (5,5), which is outside the outer triangle. you can draw two triangles using coordinating system. Please check your problem.

-
This is just an example. Triangle can be any co-ordinates and distance can be anything. Please give me the solution. – user960567 Apr 12 '12 at 6:34
Your answer, Prasad, does it add anything to my first comment on the original question? – Gerry Myerson Apr 12 '12 at 6:39
See my edited post. – user960567 Apr 12 '12 at 11:43