Results 1 to 2 of 2

Thread: Get X,Y coordinates from offset towards degrees

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    70

    Get X,Y coordinates from offset towards degrees

    Hi.

    Say if I have a set of X and Y coordinates and I want to move an object offset by 200 towards 50 degrees.

    Is there an existing function to simulate this that will return the x and y coordinates for the destination?

    Thanks

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Get X,Y coordinates from offset towards degrees

    Quote Originally Posted by Disyne
    Hi.

    Say if I have a set of X and Y coordinates and I want to move an object offset by 200 towards 50 degrees.

    Is there an existing function to simulate this that will return the x and y coordinates for the destination?

    Thanks
    Afaik there isn't such a function and you have to calculate the destination coordinates,

    xDst = xSrc + offset * cos(angle)
    yDst = ySrc + offset * sin(angle)

    and angle must be in radians,

    angle_in_radians = (Pi / 180) * angle_in_degrees
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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