Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


TransformVectorByReference vs TransformVectorByReferenceAndOut


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 theblair   Members   -  Reputation: 100

Like
0Likes
Like

Posted 21 January 2011 - 04:47 PM

Hi,

a short question about chapter 3, listing 3.1 (and the provided code for week 1 as well). What exactly is the difference between CheckPerformance::TransformVectorByReference and CheckPerformance::TransformVectorByReferenceAndOut? I know the code itself is not terribly important, but it's kinda bugging me.

Here are the snippets:

        public void TransformVectorByReference()
        {
            Matrix rotationMatrix = Matrix.CreateRotationY(
                MathHelper.ToRadians(45.0f));
            // Create a vector pointing the direction the camera is facing.
            Vector3 transformedReference;
            Vector3.Transform(ref cameraReference, ref rotationMatrix,
                out transformedReference);
            // Calculate the position the camera is looking at.
            Vector3.Add(ref cameraPosition, ref transformedReference,
                out cameraTarget);
        }

and

        public void TransformVectorByReferenceAndOut()
        {
            Matrix rotationMatrix = Matrix.CreateRotationY(
                MathHelper.ToRadians(45.0f));
            // Create a vector pointing the direction the camera is facing.
            Vector3 transformedReference;
            Vector3.Transform(ref cameraReference, ref rotationMatrix,
                out transformedReference);
            // Calculate the position the camera is looking at.
            Vector3.Add(ref cameraPosition, ref transformedReference,
                out cameraTarget);
        }

So, what am I missing?

Thanks :)

Sponsor:

#2 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 23 January 2011 - 05:47 PM

Hi Blair,

I, like you, do not see a difference in the code. I'm sure it was a mistake that passed by the technical editor. Often times when writing a book an author will go through multiple revisions of the code - especially if later chapters are based on earlier examples. It's not uncommon to go back and revise the code, but to forget to add it back into the chapter text, etc... In this case, he likely copied and pasted the code and forgot to make a change.



Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS