MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / addPoint

Method addPoint

src/Core/Transform/Polygon.cpp:94–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 void Polygon::addPoint(const Transform::UnitVector& position, int pointIndex)
95 {
96 const Transform::UnitVector pVec = position.to<Transform::Units::SceneUnits>();
97 if (pointIndex == -1 || pointIndex == m_points.size())
98 m_points.push_back(
99 std::make_unique<PolygonPoint>(*this, m_points.size(), pVec));
100 else if (pointIndex >= 0 && pointIndex < m_points.size())
101 {
102 m_points.insert(m_points.begin() + pointIndex,
103 std::make_unique<PolygonPoint>(*this, pointIndex, pVec));
104 for (point_index_t i = pointIndex; i < m_points.size(); i++)
105 m_points[i]->rw_index = i;
106 }
107 }
108
109 PolygonPoint& Polygon::findClosestPoint(const Transform::UnitVector& position,
110 bool neighbor, const std::vector<point_index_t>& excludedPoints)

Callers 3

LoadClassPolygonFunction · 0.80
loadMethod · 0.80
getSpriteByPositionMethod · 0.80

Calls 4

sizeMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected