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 8430797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:41:04+00:00 2026-06-10T05:41:04+00:00

I have designed a C++ class that abstracts the user from trackball rotation, zooming

  • 0

I have designed a C++ class that abstracts the user from trackball rotation, zooming and panning. I have got the rotation (using trackball) and zooming working as expected. However, panning does not behave as expected. When I pick a point and drag, I expect that on finishing drag, the picked point continues to be under the mouse. My understanding of panning in perspective projection is as follows. The target and the camera position, both will be affected by a pan operation. The camera target and the camera position (eye) should be translated proportional to the drag. The proportionality (may not be constant) should be based on z depth.

Panning is straight forward in orthographic projection but poses a problem in perspective. It will be useful if one can explain the math and the implementation detail for OpenGL.

  • 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-10T05:41:05+00:00Added an answer on June 10, 2026 at 5:41 am

    I don’t know about the OpenGL specifics, but if I understand your question correctly I can help out with the mathematics:

    I assume you have already selected the object, by clicking the object and thus “sending” a ray through your scene that hits your object in the anchorpoint p.

    To understand the following:

    Panning with perspective projection

    Now you drag your mouse along vector t. Using the intercept theorem you can easily calculate the vector s by which p has to be translated to “keep it under the cursor”:

    |p| / |q| = |s| / |t|

    |s| = ( |p| / |q| ) * |t|

    s is parallel to t, so it is t normalized multiplicated by |s|:

    s = t / |t| * |s|

    s = t / |t| * ( |p| / |q| ) * |t|

    s = t * ( |p| / |q| )

    If you are panning, you are doing the exact same thing, just that you are not shifting p by s, but you have to translate your whole scene by –s.

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

Sidebar

Related Questions

I am working on a class library using C#. I have designed 3 main
I have some C# class libraries, that were designed without taking into account things
I have a helper class designed to get data from Core Data and pass
I have designed the following class that should work kind of like a method
I have designed several animated Panel s in C# that all inherit from one
I have an application that allows, using an abstract class, people to write their
I have a class that is designed primarily as a POCO class, with various
While developing a game I have designed a class that in normal operation has
Sometimes you have a class that is designed to be inherited, but not all
I have designed a menu that consists of a few buttons in several different

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.