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

Method distance

MyGUIEngine/src/msdfgen/core/ShapeDistanceFinder.hpp:10–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9template <class ContourCombiner>
10typename ShapeDistanceFinder<ContourCombiner>::DistanceType ShapeDistanceFinder<ContourCombiner>::distance(const Point2 &origin) {
11 contourCombiner.reset(origin);
12#ifdef MSDFGEN_USE_CPP11
13 typename ContourCombiner::EdgeSelectorType::EdgeCache *edgeCache = shapeEdgeCache.data();
14#else
15 typename ContourCombiner::EdgeSelectorType::EdgeCache *edgeCache = shapeEdgeCache.empty() ? NULL : &shapeEdgeCache[0];
16#endif
17
18 for (std::vector<Contour>::const_iterator contour = shape.contours.begin(); contour != shape.contours.end(); ++contour) {
19 if (!contour->edges.empty()) {
20 typename ContourCombiner::EdgeSelectorType &edgeSelector = contourCombiner.edgeSelector(int(contour-shape.contours.begin()));
21
22 const EdgeSegment *prevEdge = contour->edges.size() >= 2 ? *(contour->edges.end()-2) : *contour->edges.begin();
23 const EdgeSegment *curEdge = contour->edges.back();
24 for (std::vector<EdgeHolder>::const_iterator edge = contour->edges.begin(); edge != contour->edges.end(); ++edge) {
25 const EdgeSegment *nextEdge = *edge;
26 edgeSelector.addEdge(*edgeCache++, prevEdge, curEdge, nextEdge);
27 prevEdge = curEdge;
28 curEdge = nextEdge;
29 }
30 }
31 }
32
33 return contourCombiner.distance();
34}
35
36template <class ContourCombiner>
37typename ShapeDistanceFinder<ContourCombiner>::DistanceType ShapeDistanceFinder<ContourCombiner>::oneShotDistance(const Shape &shape, const Point2 &origin) {

Callers 1

oneShotDistanceMethod · 0.45

Calls 7

resetMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
addEdgeMethod · 0.45

Tested by

no test coverage detected