Angle between two points
//----------------------------------------------------------------------------
double CalculateAngle(Point point1, Point point2, Point origin)
{
double angleToP1 = atan2((point1.X - origin.X), (point1.Y - origin.Y));
double angleToP2 = atan2((point2.X - origin.X), (point2.Y - origin.Y));
double angle = angleToP2 - angleToP1;
if (angle < 0) angle += (2 * vtkMath::Pi());
return angle;
}
double CalculateAngle(Point point1, Point point2, Point origin)
{
double angleToP1 = atan2((point1.X - origin.X), (point1.Y - origin.Y));
double angleToP2 = atan2((point2.X - origin.X), (point2.Y - origin.Y));
double angle = angleToP2 - angleToP1;
if (angle < 0) angle += (2 * vtkMath::Pi());
return angle;
}
Commenti
Posta un commento