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

Method getPerpendicularDistance

MyGUIEngine/src/msdfgen/core/edge-selectors.cpp:42–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40PerpendicularDistanceSelectorBase::EdgeCache::EdgeCache() : absDistance(0), aDomainDistance(0), bDomainDistance(0), aPerpendicularDistance(0), bPerpendicularDistance(0) { }
41
42bool PerpendicularDistanceSelectorBase::getPerpendicularDistance(double &distance, const Vector2 &ep, const Vector2 &edgeDir) {
43 double ts = dotProduct(ep, edgeDir);
44 if (ts > 0) {
45 double perpendicularDistance = crossProduct(ep, edgeDir);
46 if (fabs(perpendicularDistance) < fabs(distance)) {
47 distance = perpendicularDistance;
48 return true;
49 }
50 }
51 return false;
52}
53
54PerpendicularDistanceSelectorBase::PerpendicularDistanceSelectorBase() : minNegativePerpendicularDistance(-fabs(minTrueDistance.distance)), minPositivePerpendicularDistance(fabs(minTrueDistance.distance)), nearEdge(NULL), nearEdgeParam(0) { }
55

Callers

nothing calls this directly

Calls 2

dotProductFunction · 0.85
crossProductFunction · 0.85

Tested by

no test coverage detected