getPerimeter method

double getPerimeter()

Implementation

double getPerimeter() {
  double perimeter = 0.0;
  final int numPoints = Points.length;

  for (int i = 0; i < numPoints; i++) {
    final Point currentPoint = Points[i];
    final Point nextPoint = Points[(i + 1) % numPoints];

    final double edgeLength = _calculateDistance(currentPoint, nextPoint);
    perimeter += edgeLength;
  }

  return perimeter;
}