Results 1 to 4 of 4

Math Help - how to determine rotated rectangle offset

  1. #1
    Newbie
    Joined
    Jan 2014
    From
    USA
    Posts
    2

    how to determine rotated rectangle offset

    If you look at the attachment, I have the green box. Say the green box is 117 pixels x 18 pixels. It is then rotated around the center point 280. How can I find the length of lines t and u? Thank you!
    Attached Thumbnails Attached Thumbnails how to determine rotated rectangle offset-rotated_textbox.png  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor ebaines's Avatar
    Joined
    Jun 2008
    From
    Illinois
    Posts
    1,113
    Thanks
    325

    Re: how to determine rotated rectangle offset

    First determine the radius of the circle: R = sqrt((117/2)^2+(18/2)^2) = 59.2 pixels. The point you are interested in is initially the upper left hand corner of the box, which after rotation 280 degrees clockwise ends up at the botton left. The starting point of that corner is at angle pi-arctan(18/117) relative to the center of the circle, or 171.2 degrees (note - angle measurements are measured counter-clockwise from the positive x-axis). You rotate it 280 degrees clockwise (that's -280 degrees) and it ends up at 171.3 - 280 = -108.7 degrees. The (x,y) coordinates of the point relative to the center of the cicrle is (R cos(108.7), R sin(108.7)), which is (-19.0, -56.0). The dimension 't' in your figure is R+x, or 59.2-19 = 40.2 pixels, and the dimension 'u' is equal to y, or -56.0 pixels.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2014
    From
    USA
    Posts
    2

    Re: how to determine rotated rectangle offset

    Thanks so much for your reply! That's exactly what I needed.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,545
    Thanks
    780

    Re: how to determine rotated rectangle offset

    Quote Originally Posted by ebaines View Post
    The point you are interested in is initially the upper left hand corner of the box, which after rotation 280 degrees clockwise ends up at the botton left.
    the dimension 'u' is equal to y, or -56.0 pixels
    To me it looks like u is the (negated) y-coordinate of the bottom right point in the last picture.

    It is possible to simplify the calculations somewhat by not computing the square root and arctangent. Namely, if a point initially has coordinates (x, y), then after rotation (counterclockwise) by angle φ its coordinates will be

    x' = x cos(φ) - y sin(φ)
    y' = x sin(φ) + y cos(φ)

    When rotated by φ clockwise, the new coordinates are

    x' = x cos(φ) + y sin(φ)
    y' = -x sin(φ) + y cos(φ)
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Angle and Offset
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: August 22nd 2012, 10:37 PM
  2. Replies: 2
    Last Post: June 28th 2012, 06:07 AM
  3. Replies: 6
    Last Post: June 2nd 2011, 04:56 PM
  4. Replies: 3
    Last Post: March 9th 2011, 01:52 AM
  5. Rotated rectangle
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: April 22nd 2008, 01:21 PM

Search Tags


/mathhelpforum @mathhelpforum