Results 1 to 2 of 2

Math Help - [SOLVED] Rotate about a pivot point

  1. #1
    Newbie
    Joined
    Aug 2009
    Posts
    2

    [SOLVED] Rotate about a pivot point

    This is a programming problem, but the math is what I need help with.

    The PHP ImagickDraw API's rotate() method does not take a pivot point in the parameters, it assumes the origin (0,0).

    What I need to figure out is what to pass to translate(x,y) and rotate(degrees) to make a rectangle rotate about a specified pivot point.

    So say I have pivotX and pivotY, how could I get the translateX, translateY, and rotation?

    Additionally, I would like to know the new resulting bounding box that would be required to encompass the entire rectangle, but it's not absolutely necessary.

    Thanks =)
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Aug 2009
    Posts
    2
    Nevermind, I got it:

    [PHP]
    $rads = ($this->angle * pi() / 180.0);
    $tx = $px - ($px * cos($rads)) + ($py * sin($rads));
    $ty = $py - ($py * cos($rads)) - ($px * sin($rads));
    [/PHP]
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Move and Rotate a point around a new origin
    Posted in the Advanced Applied Math Forum
    Replies: 24
    Last Post: February 25th 2011, 02:33 AM
  2. Rotate a rectangle with respect to a point
    Posted in the Trigonometry Forum
    Replies: 2
    Last Post: August 20th 2009, 02:13 AM
  3. Rotate a line about a point
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: August 18th 2009, 10:24 AM
  4. Pivot quantity-question
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: October 14th 2008, 03:35 PM
  5. Using sin and cos to rotate a point
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: September 10th 2007, 09:07 AM

Search Tags


/mathhelpforum @mathhelpforum