Project Submission (late)
Dependencies: mbed
Vector2Di/Vector2Di.cpp
- Committer:
- el17tc
- Date:
- 2019-05-10
- Revision:
- 3:83e79d31930c
- Parent:
- 0:72f372170a73
File content as of revision 3:83e79d31930c:
#include "Vector2Di.h" // Vector manipulation functions // they are pretty self explanatory (very basic) Vector2Di Vector2Di::operator -() { Vector2Di negV = {x*-1, y*-1}; return negV; } void Vector2Di::addVector(Vector2Di v) { int newX = x + v.x; int newY = y + v.y; x = newX; y = newY; } void Vector2Di::rotateVector(double angle) { double newX = (x * cos(angle)) + (y * -sin(angle)); double newY = (x * sin(angle)) + (y * cos(angle)); x = static_cast<int>(newX); y = static_cast<int>(newY); }