Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. int GetAngleABC(Point a, Point b, Point c)
  2. {
  3. Point ab = { b.x - a.x, b.y - a.y };
  4. Point cb = { b.x - c.x, b.y - c.y };
  5.  
  6. float dot = (ab.x * cb.x + ab.y * cb.y); // dot product
  7. float cross = (ab.x * cb.y - ab.y * cb.x); // cross product
  8.  
  9. float alpha = atan2(cross, dot);
  10.  
  11. return (int)floor(alpha * 180.0 / CV_PI + 0.5);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement