MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / get_wedge_indices

Function get_wedge_indices

src/CanvasComponents/BrushComponentCode.cpp:120–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120std::vector<size_t> get_wedge_indices(const std::vector<BrushPoint>& points) {
121 if(points.size() < 2)
122 return {};
123 std::vector<size_t> toRet;
124 toRet.emplace_back(0);
125 for(size_t i = 1; i < points.size() - 1; i++) {
126 Vector2f v1Norm = (points[i - 1].pos - points[i].pos).normalized();
127 Vector2f v2Norm = (points[i + 1].pos - points[i].pos).normalized();
128 if(v1Norm.dot(v2Norm) > -0.6f)
129 toRet.emplace_back(i);
130 }
131 toRet.emplace_back(points.size() - 1);
132 return toRet;
133}
134
135std::vector<BrushPoint> smooth_points(const std::vector<BrushPoint>& points, size_t beginIndex, size_t endIndex, unsigned numOfDivisions) {
136 size_t pointsSize = endIndex - beginIndex + 1;

Callers 1

create_trianglesFunction · 0.85

Calls 3

sizeMethod · 0.45
normalizedMethod · 0.45
dotMethod · 0.45

Tested by

no test coverage detected