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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:09:17+00:00 2026-06-12T19:09:17+00:00

Is my math wrong? The user is supposed to be able to input an

  • 0

Is my math wrong? The user is supposed to be able to input an angle in degrees, and it rotate the matrix respectively. Instead, it shrinks the object and flips it… calling

glmxRotate(&modelview, 0.0f, 0.0f, 1.0f, 90.0f);

(with modelview being an identity matrix) yields:

Regular: https://i.stack.imgur.com/sSgi8.png

Rotated: https://i.stack.imgur.com/xTPvq.png

Here’s glmxRotate:

glmxvoid glmxRotate(glmxMatrix* matrix, glmxfloat x, glmxfloat y, glmxfloat z,
    glmxfloat angle)
{
    if(matrix -> mx_size != 4){GLMX_ERROR = GLMX_NOT_4X4; return;}

    //convert to rads
    angle *= 180.0f / 3.14159;

    const glmxfloat len = sqrtf((x * x) + (y * y) + (z * z)),
                    c = cosf(angle),
                    c1 = 1.0f - c,
                    s = sinf(angle);

    //normalize vector
    x /= len;
    y /= len;
    z /= len;

    glmxfloat rot_mx[] = {x * x * c1 + c,
                          x * y * c1 + z * s,
                          x * z * c1 - y * s,
                          0.0f,

                          x * y * c1 - z * s,
                          y * y * c1 + c,
                          y * z * c1 + x * s,
                          0.0f,

                          x * z * c1 + y * s,
                          y * z * c1 - x * s,
                          z * z * c1 + c,
                          0.0f,

                          0.0f,
                          0.0f,
                          0.0f,
                          1.0f,};

    _glmxMultiMatrixArray(matrix, rot_mx, 4);
}

Also, if a translation matrix is defined with the translation in the last four column, how would one go about translating an identity matrix, because the outcome would always yield 0s?

  • 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-12T19:09:18+00:00Added an answer on June 12, 2026 at 7:09 pm

    Your matrix looks correct to me, though are you aware that your angle to rads multiplication is actually a radians to angle multiplication?

    //convert to rads
    angle *= 180.0f / 3.14159;
    

    Should be Pi/180.f.

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

Sidebar

Related Questions

(iPhone) I'm trying to make it so that the user can rotate an object
When you have Math.floor(Math.random()*10)+1 its supposed to pick a random number between 1-10 from
I am looking to return true if the user entered 4 into the input
So I'm trying to make a little Matrix themed program, I want the user
What is wrong with this program? Every time I run it the first math
using Org.BouncyCastle.Math; string p = E7A69EBDF105F2A6BBDEAD7E798F76A209AD73FB466431E2E7352ED262F8C558F10BEFEA977DE9E21DCEE9B04D245F300ECCBBA03E72630556D011023F9E857F; BigInteger P= new BigInteger(p); throwing Exception System.FormatException: Input
Most of SQL queries have no math operation on where clause. What is wrong
from math import * def solution_handler(self, input): while re.search(r'(?<!\.)(\d+)(?!\.)(\d*)', input): rx = re.search(r'(?<!\.)(\d+)(?!\.)(\d*)', input)
I am trying to get the standard deviation of a user input string. I
Math escapes me today. How do I find the X speed and the Y

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.