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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:50:00+00:00 2026-06-11T23:50:00+00:00

I have this 3×3 matrix which I’m using to preform basic transformations like translation,

  • 0

I have this 3×3 matrix which I’m using to preform basic transformations like translation, scaling and rotation, but the rotation part isn’t working as it should. For any angle larger then 30 degrees or so, it just looks.. wierd.

The method looks like this:

public void rotate(float angle) {
    double rads = angle * (Math.PI/180);
    float sin = (float) Math.sin(rads);
    float cos = (float) Math.cos(rads);

    matrix[0][0] = cos;
    matrix[0][1] = -sin;
    matrix[1][0] = sin;
    matrix[1][1] = cos; 
}

And the methods applying the transformation:

For X:

public float[] applyTransformX(float[] x, float[] y) {
    float[] transformed = new float[x.length];
    for(int i=0; i<x.length; i++) {
        transformed[i] = (x[i] * matrix[0][0]) + (y[i] * matrix[0][1] + matrix[0][2]);
        System.out.println((x[i] * matrix[0][0]) + (y[i] * matrix[0][1] + matrix[0][2]));

    }
    return transformed;
}

For Y:

public float[] applyTransformY(float[] x, float[] y) {
    float[] transformed = new float[x.length];
    for(int i=0; i<x.length; i++) {
        transformed[i] = (x[i] * matrix[1][0]) + (y[i] * matrix[1][1] + matrix[1][2]);
    }
    return transformed;
}

Are there any fundamental things I’m missing here? I’m aware of the fact that I’m not doing the transformations around a fixed point. Is that perhaps why I’m experiencing this problem?

As I said, the translation and scaling is working as it should.

  • 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-11T23:50:01+00:00Added an answer on June 11, 2026 at 11:50 pm

    All that I can think of is that there might be a rounding error resulting from a discrepancy in the sizes of the three terms that you’re adding to get each x[i], and to get each y[i]. My instinct would be to add in the translation term last, so that a sizable translation doesn’t cause loss of significance in the terms that result from rotation. This just requires you removing some of your parentheses, so that the standard left-to-right order of operations kicks in. In other words, in the method for calculating the X values, write:

    transformed[i] = x[i] * matrix[0][0] + y[i] * matrix[0][1] + matrix[0][2];
    

    without any of the parentheses. Similarly, when calculating the Y values, write

    transformed[i] = x[i] * matrix[1][0] + y[i] * matrix[1][1] + matrix[1][2];
    

    If that doesn’t help, then please post some actual numbers, so that we can see which calculations might be causing loss of significance. The fact that this works OK for small angles suggests that you are seeing a rounding error, as opposed to an actual incorrect calculation method.

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

Sidebar

Related Questions

I have a file which is space delimited which looks like this: probeset_id submitted_id
I have this form, in which i need to populate a combo box with
i have some xaml files that include text, this text is in paterns, like
I have this string: 525,294,475,215,365,745 and i need to remove 475..and comma. and if
I have been using this guide http://tinyurl.com/mercurial-iis to attempt to setup Mercurial on IIS
I have a php array like this: [ ['url_id' => 2191238, 'time_spent' => 41],
I have this crash issue after I upgrade using XCode 4.2. It never happened
All, I have a table that looks like this: Date Pitcher WHIP -------- --------------
I have an array in php like this : Array ( [0] => Array
I have this issue when I would like to go the Game Over screen.

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.