Exemplo n.º 1
0
/**
* Static member function for creating an angle object from to 2D vector's data.
* Returns new angle instance and sets it's angle to angle between given 2D points.
*/
Angle Angle::getAngleBetween(Vector2<double> p1, Vector2<double> p2) {
	Angle angle;
	double dX = p2.getX() - p1.getX();
	double dY = p2.getY() - p1.getY();
	angle.setRadians(atan2(dY, dX));
	return angle;
}
Exemplo n.º 2
0
 Angle Vector2D::getAngle() const
 {
     Angle angle;
     angle.setRadians(atan2(yComp, xComp));
     if (angle.getDegrees() < 0)
         angle = angle + H_TAU;
     return angle;
 }
Exemplo n.º 3
0
Angle Angle::arcTangent2(float y, float x) {
	Angle a;
	a.setRadians(atan2f(y, x));
	return a;
}
Exemplo n.º 4
0
Angle Angle::arcTangent(float x) {
	Angle a;
	a.setRadians(atanf(x));
	return a;
}
Exemplo n.º 5
0
Angle Angle::arcSine(float x) {
	Angle a;
	a.setRadians(asinf(x));
	return a;
}
Exemplo n.º 6
0
Angle Angle::arcCosine(float x) {
	Angle a;
	a.setRadians(acosf(x));
	return a;
}
Exemplo n.º 7
0
/**
* Static member function for creating an angle object from radians.
* Returns new angle instance and sets it's angle to given radian value.
*/
Angle Angle::fromRadians(double radians) {
	Angle angle;
	angle.setRadians(radians);
	return angle;
}