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.

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

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

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

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.

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

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)+

Y1=y1+60*((y1-y0)/(x1-x0)+

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

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

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

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.

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?

Using these formulas in this order:

1. X0=x0-60

2. Y0=y0-60

3. X1=x1+60*((x1-x0)/(y1-y0)+

4. Y1=y1+60*((y1-y0)/(x1-x0)+

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/

After: x0=1545//y0=3480//x1=2201/

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/

After formula values (x0New, y0New, x1New, y1New):

x0new=1545//y0new=3480//x1

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

X1=x1+60*((x1-x0)/(-y1--y0

-Y1=-y1+60*((-y1--y0)/(x1-

X0=x0-60

-Y0=-y0-60

simplifying

Y1=y1-60*((y0-y1)/(x1-x0)+

X1=x1+60*((x1-x0)/(y0-y1)+

Y0=y0+60

X0=x0-60

Orig values: x0=1605//y0=3420//x1=2170/

After formula values

X0=1545//Y0=3480//X1=2284.

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
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.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with premium.
Start your 7-day free trial.

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