Results 1 to 2 of 2

Math Help - Rotation around an axis

  1. #1
    knackebrot
    Guest

    Exclamation Rotation around an axis

    Hello,

    I have made this "code" to rotate a point about another point, which stays at it's own place (notice that this is programmed, so: Math.sqrt is the square root, Math.sin is sinus etc.) :

    d = 45;
    xdistance = x2 - x;
    ydistance = y2 - y;
    distance = Math.sqrt(xdistance*xdistance+ydistance*ydistance) ;

    y = y2+distance*Math.sin(d);
    x = x2+distance*Math.cos(d);

    variables:
    d is the amount of rotation in degrees
    x is the x coordinate of the point to be rotated
    y is the y coordinate of the point to be rotated
    x2 is the x coordinate of the axis
    y2 is the y coordinate of the axis
    distance is the distance between point 1 and point 2
    But this doesn't work properly: The point DOES rotate, and in a good circle with a radius equal to "distance", but it doesn't rotate 45 degrees, but much more. I hope i've been clear to you all, because i'm not English :P

    Thanx in advance,
    Jürgen
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Sep 2005
    Posts
    20
    Try d=Pai/4
    I mean Pai=3.14...........
    The sin() function doesn't accept normal degree inputs.
    Pai is equivalent to 180 degree.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 7
    Last Post: October 6th 2010, 07:39 PM
  2. Volume of rotation (y-axis)
    Posted in the Calculus Forum
    Replies: 2
    Last Post: February 1st 2010, 06:51 PM
  3. Volumes by Rotation about y-axis
    Posted in the Calculus Forum
    Replies: 2
    Last Post: March 3rd 2009, 04:02 PM
  4. volume by rotation about x axis
    Posted in the Calculus Forum
    Replies: 1
    Last Post: November 26th 2008, 06:12 AM
  5. Verification on a x-axis rotation
    Posted in the Calculus Forum
    Replies: 1
    Last Post: September 9th 2008, 08:51 PM

Search Tags


/mathhelpforum @mathhelpforum