Formula to bisect right angled triangle and calculate for perpendicular line

Posted on 2008-11-12
Last Modified: 2012-05-05
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


Question by:ynotrobits
    LVL 15

    Accepted Solution

    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


    Author Comment

    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?
    LVL 15

    Expert Comment

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

    Expert Comment

    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.

    Author Comment

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

    Author Comment

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    A short article about a problem I had getting the GPS LocationListener working.
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now