Skip to content

Conversation

epmoyer
Copy link

@epmoyer epmoyer commented Jul 6, 2017

Added methods (and tests) for .fromPolar() .randomDirection() .boundMagnitude()

.fromPolar creates a new Victor object from polar coordinates. Angle is required. Magnitude is optional and defaults to 1.

.randomDirection() creates a new Victor object with a random direction. Magnitude is optional and defaults to 1.

.boundMagnitude() bounds the magnitude of a Victor object to the magnitude specified. If the original vector is shorter than magnitude then it is left unchanged. If it is longer than magnitude, then it is scaled to have a length of magnitude (direction is preserved).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant