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
k heitzsoftware developerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
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
0
k heitzsoftware developerAuthor Commented:
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
0
ThomasMcA2Commented:
@klheitz, I don't see the attachment.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

k heitzsoftware developerAuthor Commented:
Thank you. I'll try again.
attached (hopefully)
expanded-triangle.png
0
Thibault St john Cholmondeley-ffeatherstonehaugh the 2ndCommented:
Where is the 60 pixel measured? Is that the perpendicular distance between the sides?
0
ozoCommented:
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))
0
Paul SauvéRetiredCommented:
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.
0
Kyle AbrahamsSenior .Net DeveloperCommented:
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
0
k heitzsoftware developerAuthor Commented:
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
0
dhsindyRetired considering supplemental income.Commented:
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.
0
ozoCommented:
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?
0
k heitzsoftware developerAuthor Commented:
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?
Thanks in advance
klheitz
1.png
2.png
0
ozoCommented:
Reversing y
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))
X0=x0-60
-Y0=-y0-60
simplifying
Y1=y1-60*((y0-y1)/(x1-x0)+sqrt(1+((y0-y1)/(x1-x0))^2))
X1=x1+60*((x1-x0)/(y0-y1)+sqrt(1+((x1-x0)/(y0-y1))^2))
Y0=y0+60
X0=x0-60


Orig values: x0=1605//y0=3420//x1=2170//y1= 2600
After formula values
X0=1545//Y0=3480//X1=2284.205//Y1=2407.171
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
k heitzsoftware developerAuthor Commented:
Thank you ozo! This works perfectly.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.