Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: Jan 11, 2021 9:57 AM
Views: 2
Tags: polygon
  1.  
  2. public Point getCenter() {
  3.     double x0=0, y0=0;
  4.     for(Point p : pts) {
  5.         x0 += p.x;
  6.         y0 += p.y;
  7.     }
  8.     x0 = x0 / pts.length;
  9.     y0 = y0 / pts.length;
  10.     return new Point(x0, y0);
  11. }
  12.  
  13.