Results 1 to 4 of 4

Math Help - Rotated rectangle

  1. #1
    Newbie
    Joined
    Apr 2008
    Posts
    3

    Rotated rectangle

    Dear Forum,

    Hoping someone can help me with a little trig and geometry

    In the attached pic the grey rectangle has been rotated by @ degrees, the red dotted box is then constructed around it to exactly enclose it.

    given the dimensions of the bounding box and the angle of rotation, I want to calucate the size of the original rectangle (and hence its coordinates)

    i.e. given w, h and @, what are x, y (and therby a, b, c, d)?

    sin @ = c / x = b / y = S
    cos @ = a / x = d / y = C
    tan @ = c / a = b / d = T

    w = a + b
    y = c + d

    =>

    w = xC + yS
    x = (w - yS) / C

    h = xS + yC
    x = (h - yC) / S

    =>

    (w - yS) / C = (h - yC) / S
    S(w - yS) = C(h-yC)
    Sw - ySS = Ch - yCC
    Sw - Ch = ySS - yCC
    Sw - Ch = y(SS - CC)
    y = (Sw - Ch) / (SS - CC)

    The problem is that at @=45, SS-CC is 0!

    So I've trying to find an alternative method of representing this equation.

    plotting y against @ for 0-90 degrees, gives the graph in graph.png - which shows a nice smooth curve but with the asymptotic problem at 45 degrees.

    Would be quite happy with an equivalent but alternate solution which works well for say, angles < 30 and > 60. (which is what i'm expecting, i.e. some equation dividing by sin or cos, given the /0 at 0 or 90degrees)

    Thank you!
    Attached Thumbnails Attached Thumbnails Rotated rectangle-fig.png   Rotated rectangle-graph.png  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,866
    Thanks
    745
    Hello, Dave!

    Your work is excellent!

    If \theta = 45^o, both rectangles are squares . . . and all bets are off.
    . . Your derived formulas are not needed and do not apply.

    \text{We would have: }\;w \,= \,h\,\text{ and }\,x \,=\, y \,=\, \frac{w}{\sqrt{2}}

    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Apr 2008
    Posts
    3
    Hi, thanks for 1st reply!

    For solving this in the general case (using a computer) I've obviously got to avoid the case where @=45, but I really also need to be careful with angles close to 45 because all the maths goes screwy with those tiny divisors! An input angle of 45.0001 is quite possible and will give a divisor of 3.5e-5, obviously the dividend also becomes unusable.

    What I would really like is a quick test along the lines of:

    Code:
    if angle < 40 or angle > 50:
      y = (Sw - Ch) / (SS - CC)
    else:
      y = ...
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Apr 2008
    Posts
    3
    Hi again,

    Your answer isn't quite right - the original rectangle maintains its dimensions no matter what the angle is, so at 45 degrees w = h, but x != y.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 6
    Last Post: June 2nd 2011, 05:56 PM
  2. Rotated about the...
    Posted in the Calculus Forum
    Replies: 9
    Last Post: May 2nd 2010, 06:47 PM
  3. volume rotated about y=2
    Posted in the Calculus Forum
    Replies: 1
    Last Post: December 13th 2009, 02:05 PM
  4. Replies: 1
    Last Post: November 23rd 2009, 07:41 PM
  5. Rotated Ellipse
    Posted in the Calculus Forum
    Replies: 7
    Last Post: October 21st 2007, 08:43 PM

Search Tags


/mathhelpforum @mathhelpforum