Game Development Reference
In-Depth Information
On first glance, this code may not make much sense. But the way it
works is by performing a form of Newtonian approximation. The line
with the hexadecimal value is the initial guess, and then the first itera-
tion results in an answer that is reasonably accurate.
What's also interesting is that even though this square root is often
attributed to John Carmack, the founder and technical director of id
Software, he actually didn't write it. Rys Sommefeldt tried to track
down the actual author in this interesting article on Beyond3D: ht-
tp://www.beyond3d.com/content/articles/8/ .
Scalar Multiplication
Vectors can bemultiplied bya scalar ,orasingle real number.Tomultiply avector
by a scalar, you simply multiply each component by the scalar:
If you multiply a vector by a positive scalar, it will only change the magnitude of
the vector. If you multiply the vector by a negative scalar, it will also invert the
direction of the vector. Figure 3.5 demonstrates a few different results of scalar
multiplication.
Search WWH ::




Custom Search