About this Blog

This is my first blog. Ever.

It is simply going to be about my hobby; playing with computer programming. I do not know much about blogging, but I will use this one to learn a bit more about it.

Programming has always been a bit of a passion for me, as from those early days when I first tapped in a sample BASIC program on my old Sinclair Spectrum back in 1986. I have been through many platforms, languages and OS's since, but always carried the hobby with me. I am not particularly good at it; perfection requires a large time investment and continuous practice. I do not have the luxury of the amount of time required to keep the fire burning constantly, so the hobby has inevitably gone through periods of extreme withering. I have, however, finally settled for C++, as the title of this blog implies, and play around with it for some entertainment when ever I can.

This here will serve me as a written record of what I am up to, and hopefully be a reinforcement to my memory every now and then. That is all there is to it.

So, if you read this blog, please don't expect anything snazzy, but be you welcome just the same!

Thursday, 1 December 2011

Obtaining Normals of a 3D vector

Before I address any 3D stuff in this blog I am going to review the process of obtaining normalized 3D vectors. It is not difficult, but with my penchant to forget everything in five minutes, I consign it to posterity in this post. Below are 3 distances (X, Y, Z) of a 3D vector. The object is to normalize each of them as if the total length (of a 3D hypotenuse) were one;

(X, Y, Z)

(5.4, 3.7, 6.2)

Obtain the true total length...

sqrt(5.4² + 3.7² + 6.2²) = 9.0161

Now simply divide each component by the total length...

5.4 / 9.0161 = 0.5989 (for X)

3.7 / 9.0161 = 0.4104 (for Y)

6.2 / 9.0161 = 0.6877 (for Z)

So our vector, normalized to one, now looks like;

(0.5989, 0.4104, 0.6877)

And that is it, basically.

No comments:

Post a Comment