Jump to content
  • Advertisement
Sign in to follow this  
Phineas

Name for a Vector Function

This topic is 4589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Phineas
addVector 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!