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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:42:30+00:00 2026-05-28T16:42:30+00:00

Here are two different pieces of code This is what I started with Vector2

  • 0

Here are two different pieces of code

This is what I started with

Vector2 hold = Vector2.Transform(pos1, mat1);
Matrix inv = Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(hold, inv);

And this is what i’m told is the simplified version

Matrix matrix1to2 = mat1 * Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(pos1, matrix1to2);

What I don’t understand is, why isn’t the first line in the simpilifed version

Matrix matrix1to2 = Matrix.Invert(mat2)*mat1;

Since in matrix order the thing on the right would take effect first and in the original we have mat1 being multiplied in first

Edit:
The following image shows the order of operations desired

http://www.riemers.net/images/Tutorials/XNA/Csharp/Series2D/mat1.png

The tutorial says that to create this transformation you use;

Matrix carriageMat = Matrix.CreateTranslation(0, -carriage.Height, 0) * Matrix.CreateScale(playerScaling) 
* Matrix.CreateTranslation(xPos, yPos, 0) * Matrix.Identity;

Why does this work if the order is left to right?

  • 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-28T16:42:31+00:00Added an answer on May 28, 2026 at 4:42 pm

    Since in matrix order the thing on the right would take effect first
    and in the original we have mat1 being multiplied in first

    Actually, the “thing on the left” takes effect first. Matrices are applied to the vertex in the same order in which you’d read them (assuming you’re used to a Latin language).

    In XNA, you typically perform transformations in SRT (Scale, Rotate, Translate) order. That way, the object will be scaled and rotated about its own origin (rotating on is own axis) before being moved into world space.

    For example: if I wanted to rotate an object by Pi / 2, the move it 100 units along the X axis, I might use:

    var rotate = Matrix.CreateRotationY(MathHelper.PiOver2);
    var translate = Matrix.CreateTranslation(new Vector3(100,0,0));
    
    var worldMatrix = rotate * translate;
    

    If, instead, I wanted to move the object 100 units to the right, then rotate it about the world origin (0,0,0) to get a sort of orbiting effect (instead of spinning as is done in the first example), I’d use

    var worldMatrix = translate * rotate;
    

    You could also spin the object on its on axis, move it 100 units along the world X axis, the orbit it about the world origin by:

    var worldMatrix = rotateSpin * translate * rotateOrbit;
    

    where rotateSpin and rotateOrbit are rotation matrices defining your spin (rotation about object’s origin) and orbit (rotation about the world origin following translation), respectively. Note that the order in which the operations effect your service vertices is left – to – right.

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

Sidebar

Related Questions

I have this same piece of code in two different parts of my app.
Here are two different questions but I think they are related. When using Git,
Here are two chunks of code that accomplish (what I think is) the same
I have a requirement to return two different pieces of string data through RPC
I have two pieces of code in Jsfiddle. One works and the other one
So here I am with this simple question Consider these two for cycles and
Here are two questions related to modifying the data source for strongly typed dataset
Here's two screen shots, showing the effect with a small viewport that has to
Here is two variants. First: int n = 42; int* some_function(int* input) { int*
I have a question, here are two classes below: class Base{ public: virtual void

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.