Link to home
Start Free TrialLog in
Avatar of ynotrobits
ynotrobits

asked on

Formula to bisect right angled triangle and calculate for perpendicular line

I'm in the midst of writing a module in Common Lisp 1 and I need to calculate the distance of a hypothetical  line projected perpendicularly from apex of the right angle of (various)  triangles to the opposite side.

I'm not the greatest at trig; I can calculate for a given triangle but I don't know the formula to actually bisect a triangle.

In the attached illustration, the distance I am trying to calculate is indicated by the green arrow. (L)

Information that I have:

1) Lengths of sides A, B and C

2) There will always be at least 1 right angle.

Information I can gather if necessary:

a) The two non-right angles.

b) The perimeter

II don't necessarily need any help with the actual code (Unless there's a Lisp function I'm unfamiliar with). What I'm after is the the generic geometric formula that will lead me to the information I'm after.


Any advice for me?

Thanks in advance


---ynotrobits






Triangle.jpg
ASKER CERTIFIED SOLUTION
Avatar of MMDeveloper
MMDeveloper
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ynotrobits
ynotrobits

ASKER

Well that did it...

Thank you

Usually I figure these things out by tinkering but I think the tinker route would have been a long road to hoe in this case.

Let me ask you this:

I'm assuming "C" will always be the hypotenuse. Are "A" and "B" interchangeable?
if I remember correct yes..


C is the side that the line is going to (or coming from, depending on how you're looking at it), and the other 2 sides are interchangeable.
Avatar of Brian Utterback
I think that there is an easier way.

Consider that the hypotenuse (side C) of the triangle is always the longest side and that the right angle is always the opposite angle from that side.  We also know that the area of this triangle is simply one half times side A times side B. We also know that looking at the triangle, taking side C as the base, the area is likewise one half the base times the height and is equal to
the previous area we calculated. Furthermore, the height in this orientation is exactly the quantity we want, the length of the
green arrow.

Putting this together, we get:

Let X = Area of the triangle, let G=length of green arrow.

X = .5*A*B
X = .5*G*C
Substituting:

.5*A*B = .5*G*C
A*B = G*C
(A*B)/C = G

Therefore, the height of a right triangle resting on its hypotenuse is always the other two sides multiplied together divided
by the hypotenuse.
Thanks for the new formula. I'll try it out now.

I just completed the Lisp translation for MMDeveloper's formula so I thought I'd post it in case someone was searching Lisp:

(setq s (/( + a b c)2))

(setq TRI_HT (*(sqrt(*(*(*(- s a)s)(- s b))(- s c)))(/ 2.0 C)))
Yes indeed, that is simpler.

In Lisp:

(setq TRI_HT(/(* a b)c))



Just as an FYI, the purpose behind all of this is to impart information to a designer who is creating shapes for CNC operations.

This information will help in preventing the creation of a part that is too big to "nest" on a given slab size.

Thanks again