MCPcopy Create free account
hub / github.com/axmolengine/axmol / getArea

Method getArea

core/2d/AutoPolygon.cpp:159–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159float PolygonInfo::getArea() const
160{
161 float area = 0;
162 V3F_C4B_T2F* verts = triangles.verts;
163 unsigned short* indices = triangles.indices;
164 for (unsigned int i = 0; i < triangles.indexCount; i += 3)
165 {
166 auto A = verts[indices[i]].vertices;
167 auto B = verts[indices[i + 1]].vertices;
168 auto C = verts[indices[i + 2]].vertices;
169 area += (A.x * (B.y - C.y) + B.x * (C.y - A.y) + C.x * (A.y - B.y)) / 2;
170 }
171 return area;
172}
173
174AutoPolygon::AutoPolygon(std::string_view filename)
175 : _image(nullptr), _data(nullptr), _filename(""), _width(0), _height(0), _scaleFactor(0)

Callers 9

setScaleMethod · 0.45
addShapeMethod · 0.45
removeShapeMethod · 0.45
removeAllShapesMethod · 0.45
initSpritesMethod · 0.45
updateLabelMethod · 0.45
makeSpriteMethod · 0.45
initIncrementStatsMethod · 0.45

Calls

no outgoing calls

Tested by 4

initSpritesMethod · 0.36
updateLabelMethod · 0.36
makeSpriteMethod · 0.36
initIncrementStatsMethod · 0.36