MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / perimeter

Function perimeter

Geometry/Geometry 2D.cpp:568–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566 return -1;
567}
568double perimeter(vector<PT> &p) {
569 double ans=0; int n = p.size();
570 for (int i = 0; i < n; i++) ans += dist(p[i], p[(i + 1) % n]);
571 return ans;
572}
573double area(vector<PT> &p) {
574 double ans = 0; int n = p.size();
575 for (int i = 0; i < n; i++) ans += cross(p[i], p[(i + 1) % n]);

Callers 1

Calls 2

distFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected