Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 861545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:59:40+00:00 2026-05-15T08:59:40+00:00

Hi am just doing a little animation which moves an object from point a

  • 0

Hi am just doing a little animation which moves an object from point a to point b or by angle/radians.

what I currently have is this

Point CalcMove(Point pt, double angle, int speed)
    {
        Point ret = pt;

        ret.X = (int)(ret.X + speed * Math.Sin(DegToRad(angle)));
        ret.Y = (int)(ret.Y + speed * Math.Cos(DegToRad(angle)));

        return ret;
    }

but it doesn’t look what i expected.

please help?

update:
oh and am using NETCF


CalcMove(Point pt, double angle, int speed)
“Point pt” is the current object location. “angle” is where the object should go. “speed” is the step.


so after days of work..
here’s what I have worked on .. Neko for Windows Mobile 6.5

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:59:41+00:00Added an answer on May 15, 2026 at 8:59 am

    Use a rotation matrix. This code will move from a point (x,y) by theta radians to a new point (px, px)

    Point Rotate(x, y, theta)
        int px = (x * Math.Cos(theta)) - (y * Math.Sin(theta));
        int py = (y * Math.Cos(theta)) + (x * Math.Sin(theta));
        return new Point(px, py);
    end
    

    The matrix used above,

    [cosθ - sinθ][x]
    [cosθ + sinθ][y]
    

    Will move a point around the circle clockwise when using graphical coordinates.

    I did the exact same thing last week. You can animate this by finding the total theta that you wish to move and then divide that by the number of frames (or steps). Now, start every move at some arbitrary point (for example, (0, radius)) and increment some counter totalSteps and move always beginning from that initial point. If you simply move the point itself each frame you will accumulate some error, but if you always move from the initial point by the current increment, stopping when the increment == totalTheta, it will be perfect. Let me know if that makes sense.

    Maybe I should illustrate a bit more. Let’s say you have a method “BeginMove”:

    double totalTheta = 0;
    double increment = 0;
    double currentTheta = 0;
    bool moving = false;
    void BeginMove()
    {
        totalTheta = (2 * Math.PI) / numObjects;
        increment = totalTheta / steps;
        currentTheta = 0;
        moving = true;
    }
    

    Now you have a method which updates the move every frame:

    void Update
    {
        if (!moving) return;
        // do a min/max to ensure that you never pass totalTheta when incrementing.
        // there will be more error handling, but this is the basic idea.
        currentTheta += increment;
        SomeObject.Location = Rotate(0, radius, currentTheta);
        moving = (currentTheta < totalTheta);
    }
    

    There will obviously be more logic here depending upon your exact situation, but the idea is:

    1. Find the total theta to move.
    2. Find the increment (totalTheta / steps)
    3. Maintain a running total of how much you have moved already.
    4. Increment the running total by the angle increment before each move.
    5. Start each move from the same (arbitrary) point on the circle and rotate by the running total.
    6. Repeat until the running total == total theta.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just doing a little work this morning making some static libraries. Why
I'm just wondering if there's a better way of doing this in SQL Server
(Note: I have seen this question and it uses a cursor not an animation.)
I have just started studying OOP and I am a little confused of the
I have this simple little JavaScript snippet to try and protect my email address
I have a silly little game that I made just for myself, but I
Just doing a little introduction to JavaScript. I'm used to more than often testing
I'm sure I am just doing something really dumb and not seeing it but
I've just started doing some PowerShell scripting, and I'm running into a problem testing
I'm new to RhinoMock's just been doing state unit testing up till now. How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.