# Name for a Vector Function

## Recommended Posts

I have the following function for a 2d vector struct that takes a magnitude and diretion and adds it to a vector:
void foo(Vector2d v, SCALAR magnitude, RADIANS angle)
{
SCALAR x, y;

x = magnitude * cos(angle);
y = magnitude * sin(angle);

v.x += x;
v.y += y;
}


I'm not sure what to name this function. addVector isn't good because a magnitude and a direction is not really a vector. Any ideas? It often seems that coming up with intuitive names is the most difficult part about Software Engineering (used in the loosest sense, as applied to my novice game programming skills). Thanks for your help.

##### Share on other sites

I hear there are these neat little baby name books you can use for inspiration..

##### Share on other sites
Quote:
 Original post by PhineasaddVector isn't good because a magnitude and a direction is not really a vector.

A magnitude and a direction is a vector.

In this case you're adding a vector represented in polar coordinates to a vector represented in cartesian coordinates.

addPolarVector seems like a decent name for it.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628284
• Total Posts
2981828

• 10
• 10
• 10
• 11
• 17