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

  • SEARCH
  • Home
  • 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 8771657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:50:44+00:00 2026-06-13T17:50:44+00:00

I am working on a simple mesh viewer implementation in C++ with basic functionality

  • 0

I am working on a simple mesh viewer implementation in C++ with basic functionality such as translation, rotation, scaling.
I’m stuck with with implementing the rotation of the object along z-axis using the mouse. What I want to implement is the following:

  1. Click and drag the mouse vertically (almost vertical will do, as I use a simple threshold to filter slight deviations along the horizontal axis) to rotate the object along y-axis (this part is done).
  2. Click and drag the mouse horizontally just as described above to rotate the object along x-axis (this part is done too).
  3. For z-axis rotation, I want to detect a circular (or along an arc) mouse movement. I’m stuck with this part, and don’t know how to implement this.

For the above two, i just use atan2() to determine the angle of movement. But how do I detect circular movements?

  • 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-06-13T17:50:46+00:00Added an answer on June 13, 2026 at 5:50 pm

    The only way to deal with this is to have a delay between the user starting to make the motion and the object rotating:

    When user clicks and begins to move the mouse you need to determine if its going to become a straight line movement, or a circular one. This will require a certain amount of data to be collected before that judgement can be made.

    The most extreme case would be requiring the user to make one complete circle first, then the rotation begins (in reality you could do much better than this). Just how small you are able to cut this period down to will depend on a) how precise you dictate your users actions must be, and b) how good you are with pattern recognition algorithms.

    To get you started heres an outline of an extremely poor algorithm:

    On user click store the x and y coordinates.
    Every 1/10 of a second store the new coordinates and process_for_pattern.

    in process_for_pattern you’re looking for:

    A period where the x coordinates and the y coordinates regularly both increase, both decrease, or one increases and one decreases. Over time if this pattern changes such that either the x or the y begins to reverse whilst the other continues as it was, then at that moment you can be fairly sure you’ve got a circle.

    This algorithm would require the user to draw a quarter circle before it was detected, and it does not account for size, direction, or largely irregular movements.

    If you really want to continue with this method you can get a much better algorithm, but you might want to reconsider your control method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on a simple C program I'm stuck with an if test: int line_number
Im working on simple PHP CMS system and Im stuck with database design. This
The simple working query, list the number of licenses for each license type: Query:
I'm trying to make a simple text editor with winapi, its working for simple
Good Day, I have a simple working routine in Perl that swaps two words:
Working on a simple TimeTracker App. You start a timer, wait a certain time,
im working on a simple C++ HTTP server as a school project and I
im working on a simple game like space invaders,and i got into a problem.
I'm working on a simple webservice in django. This is my first web app
I am working on some simple form validation and need some assistance. Basically, I

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.