MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / getArea

Method getArea

annotation/Annotation.cpp:45–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45float Annotation::getArea() const {
46 if (!_coordinates.empty()) {
47 double area = 0.;
48 int j = _coordinates.size() - 1;
49 for (int i = 0; i < _coordinates.size(); i++) {
50 area += (_coordinates[j].getX() + _coordinates[i].getX())*(_coordinates[j].getY() - _coordinates[i].getY());
51 j = i;
52 }
53 return std::abs(area*.5);
54 }
55 else{
56 return 0.0;
57 }
58}
59
60unsigned int Annotation::getNumberOfPoints() const {
61 return _coordinates.size();

Callers 2

Calls 2

emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected