Week 2 Entry - Vectors

Vectors - What are they in a computer science context?

In class, we discussed a few different ways that mathematicians, physicists, and computer scientists refer to a vector and its place in a virtual space. For our use cases, being those of a graphics programmer, we will refer to a vector as a displacement that is located in an arbitrary location within a 2D or 3D space. While we use the dimensions, or relative difference in coordinates, to find the important values of the displacement, there is not a specific origin or location to which it must be tied in order to understand how it could change an object being altered by this vector over a given time frame.

Directly adding and subtracting multiple vectors from one another is simple and provides results that are easily understood. The two multiplication processes of taking the dot product and the cross product however provide a more complicated, interesting result that has many potentially critical concepts locked behind their understanding and implementation within a multi-dimensional space.

Applying Vectors Practically

The cross product can be applied to two known vectors to determine a vector normal to the 2D plane spanned by the known vectors. Other use cases include those related to forces and the calculation of the angle between two vectors. We did not apply the cross product within the coursework this week outside of the lectures, but its use for finding unknown orthogonal, local vectors for a given mesh will be important for mapping its relative effect on elements such as particles or light interaction.

The dot product, however, was practically applied through the homework through the concept of projection. There exists a direct relationship between the dot product of vectors 'A' and 'B' and the "amount" of 'A' that travels in the direction of 'B' or vice versa (the dot product being commutative). The product of two vectors can seamlessly be used to find the scalar value representing a vector's projection onto another's plane. This result was utilized in finding a "projection vector" representing the dot product (scalar) of two given vectors and then multiplied by the unit vector (purely representing the direction) of the projected-onto vector. The application of projection can clearly be important in the visualization of light and shadows.

This concept was best understood after watching many visual-forward and maths-forward videos that made an effort to connect the geometry of the projections with the idea of what a vector is and how they can relate to one another.


Turbulent Journey to Results

Debugging is a skill never too soon embraced, and frankly, I often forget just how useful it is until it's too late and an hour has meaninglessly gone by. During the implementation of the final function creating a projection vector, I re-wrote and drew up a solution on my tablet countless times. Having been convinced that my theoretical application of the projection formula being written was valid, I never once thought that my utilized function for finding the dot product itself was not entirely correct, as the test case for it gave me the a-okay. Unfortunately, the test case gave the OK on this not-quite-a-dot product function...

Needless to say, about an hour was wasted thinking I conceptually misunderstood the algebra for solving the projection vector. After being convinced that I understood the algebra even better than I did before, and still not getting the correct output, I finally made the call to check the debugger many steps too late...

Seeing the 'dot = 11' shot me right in the heart, and I hope that this will be the last time I am so negligent and stubborn toward utilizing the debugger. The odds are against me.




Comments

Popular Posts