MCPcopy Create free account
hub / github.com/MyGUI/mygui / boundMiters

Method boundMiters

MyGUIEngine/src/msdfgen/core/Contour.cpp:39–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void Contour::boundMiters(double &xMin, double &yMin, double &xMax, double &yMax, double border, double miterLimit, int polarity) const {
40 if (edges.empty())
41 return;
42 Vector2 prevDir = edges.back()->direction(1).normalize(true);
43 for (std::vector<EdgeHolder>::const_iterator edge = edges.begin(); edge != edges.end(); ++edge) {
44 Vector2 dir = -(*edge)->direction(0).normalize(true);
45 if (polarity*crossProduct(prevDir, dir) >= 0) {
46 double miterLength = miterLimit;
47 double q = .5*(1-dotProduct(prevDir, dir));
48 if (q > 0)
49 miterLength = min(1/sqrt(q), miterLimit);
50 Point2 miter = (*edge)->point(0)+border*miterLength*(prevDir+dir).normalize(true);
51 boundPoint(xMin, yMin, xMax, yMax, miter);
52 }
53 prevDir = (*edge)->direction(1).normalize(true);
54 }
55}
56
57int Contour::winding() const {
58 if (edges.empty())

Callers

nothing calls this directly

Calls 10

crossProductFunction · 0.85
dotProductFunction · 0.85
minFunction · 0.85
boundPointFunction · 0.85
directionMethod · 0.80
emptyMethod · 0.45
normalizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
pointMethod · 0.45

Tested by

no test coverage detected