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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:15:55+00:00 2026-05-18T11:15:55+00:00

Greetings all, As seen in the image, I have an object named O (set

  • 0

Greetings all,

As seen in the image,

alt text

I have an object named O (set of linestripes).Its object-coordinate system is (x’,y’,z’).
I translate,rotate this object in my OpenGL scene using following code snippet:

glPushMatrix();
 glTranslatef(Oz, Oy,Oz);
 glRotatef(rotationX , 1.0, 0.0, 0.0);  
 glRotatef(rotationY, 0.0, 1.0, 0.0);
 glRotatef(rotationZ, 0.0, 0.0, 1.0); 
contour->render();
glPopMatrix()

;

I have a point called H ,which is translated to (hx,hy,hz) world coordinates using

glPushMatrix();
 glTranslatef(hx,hy,hz);
glPopMatrix();

If I am correct, (Oz,Oy,Oz) and (hx,hy,hz) are world coordinates.

Now,what I want todo is calculate the position of H (hx,hy,hz) relative to O’s object-coordinate system.(x’,y’,z’);
As I understood,I can do this by calculating inverse transformations of object O and apply them to point H.

Any tips on this? Does OpenGL gives any functions for inverse-matrix calculation ? If I somehow found inverse-matrices what the order of multiplying them ?

Note : I want to implement “hammer” like tool where at point H ,I draw a sphere with radius R.User can use this sphere to chop the object O like a hammer.I have implemented this in 2D ,so I can use the same algorithm if I can calculate the hammer position
relative to (x’,y’,z’)

Thanks in advance.

  • 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-18T11:15:55+00:00Added an answer on May 18, 2026 at 11:15 am

    Inverting the matrix would be the general solution, but as far as I can see this isn’t actually a “general” problem. Rather than undoing an arbitrary transformation, you are trying to do the reverse of a known sequence of transformations, each of which can be inverted very simply. If your object-to-world transformation is:

    glTranslatef(Ox, Oy, Oz);
    glRotatef(rotationX , 1.0, 0.0, 0.0);
    glRotatef(rotationY, 0.0, 1.0, 0.0);
    glRotatef(rotationZ, 0.0, 0.0, 1.0);
    

    Then the world-to-object inverse is just:

    glRotatef(-rotationZ, 0.0, 0.0, 1.0);
    glRotatef(-rotationY, 0.0, 1.0, 0.0);
    glRotatef(-rotationX , 1.0, 0.0, 0.0);
    glTranslatef(-Ox, -Oy, -Oz);
    

    Basically, just back out each applied transformation in the opposite order originally applied.

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

Sidebar

Related Questions

greetings all i have a domain class named car and i have an object
Greetings all, As seen in the picture I have an extended QWidget object (which
Greetings to all! This is my first question here on stackoverflow. I have a
Greetings all, I have some JSON code that looks like this: { playlist: [
Greetings all, I have posted this on the MSDN managed news groups as well
Greetings all, As seen in the image , I draw lots of contours using
Greetings all, I have a question. On my MOSS 2007 dev box, I created
Greetings all, I have a question. I am trying to build a parametrized query
Greetings to all of you ! This is the second time I encounter quite
Greetings all, I have a question. I have created a WPF application. So, 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.