Example #1
0
int main() {

	Vector2<int> vec;
	vec.setX(2);
	vec.setY(3);

	Vector2<double> p1(-3, -2);
	Vector2<double> p2(0, 0);
	Angle angle3 = Angle::getAngleBetween(p2, p1);
	std::cout << angle3.getDegrees() << std::endl;

	std::cout << "Vector " << vec.toString() << std::endl;

	Angle angle;
	angle.setDegrees(90);
	std::cout << "first angle " << angle.getDegrees() << std::endl;
	
	Angle angle2;
	angle2.setDegrees(20);
	std::cout << "second angle " << angle2.getDegrees() << std::endl;

	angle += angle2;
	std::cout << "first angle is now " << angle.getDegrees() << std::endl;

	system("pause");
	
	
	return 0;
}
Example #2
0
 Angle Vector2D::getAngle() const
 {
     Angle angle;
     angle.setRadians(atan2(yComp, xComp));
     if (angle.getDegrees() < 0)
         angle = angle + H_TAU;
     return angle;
 }
Example #3
0
	inline std::string toString(const Angle & a) {
		char cStr[255];
		sprintf(cStr, "A(Rad:%f Deg:%f)", a.getRadian(), a.getDegrees());
		return std::string(cStr);
	}