• Create Account

## 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.

### #1theblair  Members

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(
// 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.
out cameraTarget);
}


and

public void TransformVectorByReferenceAndOut()
{
Matrix rotationMatrix = Matrix.CreateRotationY(
// 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.
out cameraTarget);
}


So, what am I missing?

Thanks

### #2JWalsh  Moderators

494
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.