# how to get points to expand a triangle

Dear Experts

I expect there is a straight forward formula for this, but I cannot find it.

In my VB6 app, I have defined a right triangle and the coordinates of the vortices are known.
The right angle of this triangle is in the lower left of the triangle.

I need to get the area of an expanded version of this triangle - expanded equally on all sides by 60 points (pixels in my app).

I have the area formula working well. Where I need help is how to find the points of the expanded triangle.
I can alter the x,y of the right angel easily enough; but am lacking the formula of how to find the y (for height) and x (for base). High School math is failing me,

Thanks
klheitz
Kyle Abrahams, PMP

You can't expand all sides by 60 points and still maintain a right triangle unless I'm missing something.

"A^2 + B^2 = C^2" ~ Pythagoras
k heitz

Thanks Kyle;
I attached a picture of what I'm attempting to do. It may help clarify.
The Yellow triangle is known xys; lower left corner of red/green triangle would be known.
Does this help?

Thanks
@klheitz, I don't see the attachment.

Thank you. I'll try again.
attached (hopefully)
expanded-triangle.png
Where is the 60 pixel measured? Is that the perpendicular distance between the sides?
For points laid out as
X0,Y1

x0,y1

x0,y0    x1,y0

X0,Y0                                  X1,Y0

the X,Y points of the outer triangle can be derived from the x,y points of the inner triangle by

X0=x0-60
Y0=y0-60
X1=x1+60*((x1-x0)/(y1-y0)+sqrt(1+((x1-x0)/(y1-y0))^2))
Y1=y1+60*((y1-y0)/(x1-x0)+sqrt(1+((y1-y0)/(x1-x0))^2))
You have the vertices, so simply multiply the length of each side (horizontal and vertical) by the same value (say 1.25, 1.6, ...) rather than ADDING the same value to the 2 sides.

This will give you a larger size triangle with EXACTLY the same proportions.
Agreed with Paul.

The lengths can be scaled by a factor . . . but I wouldn't go messing with the proportions.

eg:

Right triangle of 300, 400, 500.

You can't just "-60" from all sides, but you could take away 20% (or multiply by .8) from each length to give you
240, 320, 400

From my understanding of what you're trying to do is take the yellow triangle, and based on a new point in the red triangle, (the point being the corner where the 2 sides meet) scale the triangle to be that size.

If that's the case -  you can measure the distance need to grow by taking a delta of yellow and red

So:
Let yellow be X,Y points.
Let Red be A,B points (A,B replacing X&Y for clearer communication):

'how far did the triangle move to the left?
Dim percentage as Decimal = CFloat(X1 - A0) /(X1 - X0)    'Convert the top number to a float so it stays a float.
'EG:  240 / 300 =  .8

A1 = (X1-X0) * percentage  'scale X
B1 = (Y1 - Y0) * percentage 'scale Y

Hi All;
Thank you for these responses. I spent some time w/ the formulas to alter the points and wasn't able to get to the correct results - I will change my approach to line length and percentage.
I will be working on this again tomorrow morning.
Thank you again
Note: Your two triangles have parallel sides therefore equal angles.  They are like  magnifications of each other.  All linear measures have the same ratio.  You have three sides A, B, and C.

Say you want to add 60 to A1, find a ratio A1+60/A1 = R, then B2 = (B1)R, and C2 = (C1)R.  For example take standard 3, 4, 5 triangle.  60+3/3=R; then, B2=4(60+3/3, and C2=5(60+3/3).  The B2 sides would be 63, 84, 105.  Verify by using A^2+B^2=C^2.
Substituting, 63^2+84^2=105^2

This works for linear distances but not areas because the area is expanding in two dimensions not just one.
If you want the perpendicular distance between the sides of the original and expanded triangles to be 60, as Eamon Norseven construed, then the factor you'd need to scale by would be
1 + 60*(1/(y1-y0) + 1/(x1-x0) + sqrt(1/(y1-y0)^2 + 1/(x1-x0)^2))
which is what you would get from altering the points according to the formulas in http:#a40451329
Are those the formulas you spent some time with?  If so, in what way were what you were able to get not the correct results?

Hi ozo;

Using these formulas in this order:
1. X0=x0-60
2. Y0=y0-60
3. X1=x1+60*((x1-x0)/(y1-y0)+sqrt(1+((x1-x0)/(y1-y0))^2))
4. Y1=y1+60*((y1-y0)/(x1-x0)+sqrt(1+((y1-y0)/(x1-x0))^2))

One thing that is probably throwing them off, is my y-axis is ascending (eg; y1 is < y0).
To compensate I changed
y0 = y0-60 -- to -- y0 =  y0+60; and
y1= y1 + 60 * ((y1 - y0) / (x1 - x0) + Sqr(1 + ((y1 - y0) / (x1 - x0)) ^ 2)) -- to --
y1= y1 - 60 * ((y1 - y0) / (x1 - x0) + Sqr(1 + ((y1 - y0) / (x1 - x0)) ^ 2))

Attached is a png (1.png) of what I'm getting when I use the formulas in this order.
Note I fed x0,y0,y1 into the formulas after they were altered.

Before the 4-lines of code above: x0=1605//y0=3420//x1=2170//y1= 2600
After: x0=1545//y0=3480//x1=2201//y1= 2580

You'll see x1 and y1 don't extend far enough.

So I tried feeding in non-altered values for x0,y0,y1 and I get (2.png attached):
Orig values: x0=1605//y0=3420//x1=2170//y1= 2600
After formula values (x0New, y0New, x1New, y1New):
x0new=1545//y0new=3480//x1new=2202//y1new= 2581

The difference between the two is very small (see x1 in first example vs. x1new in 2nd)

Do you think this is all due to the reversal of the y-axis?
klheitz
1.png
2.png