Results 1 to 9 of 9

Thread: right triangles

Threaded View

  1. #7
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: right triangles

    Yup, I understood what lx2 and ly2 were. I confused the hypotenuse and opposite side, though, in my previous post--doh! I could use my two formulas together to get the correct x offset, but using the tangent function is shorter so I'll do that. It's the second of the three possible solutions I mentioned at first to solving for the length of the unknown leg of the triangle.

    Since tangent = opposite / adjacent, tan(30 degrees) = x offset / b where b is the red vertical line's length. In Paint I found b=105 pixels; this is probably 10 + sf.Height - 151, though I don't use .NET. Then, the x offset is b*tan(30 degrees), or

    lx2 = 351 + 105*tan(30 deg) = 351 + 105*0.577 = 412.

    The y offset is simply b, so ly2 = 151 - 105 = 46. I've drawn a line from (351, 151) to (412, 46) on the attached image in blue, which is I believe what you're after. One important thing to note, though, is that if you want the blue line I've drawn to "lock" to the outer rectangle, you'll have to use different equations for each side of the rectangle, since your triangle problem changes each time.
    Attached Images Attached Images  
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width