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


Who is Participating?
MMDeveloperConnect With a Mentor Commented:
wow it's been a while.. I think it's calculated like this

height = (2/c)*(SQRT(s*(s-a)*(s-b)*(s-c)))

where s = (A+B+C) / 2

ynotrobitsAuthor Commented:
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.
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Brian UtterbackPrinciple Software EngineerCommented:
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

.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.
ynotrobitsAuthor Commented:
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)))
ynotrobitsAuthor Commented:
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
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.

All Courses

From novice to tech pro — start learning today.