virtualx-engine/thirdparty/msdfgen/core/SignedDistance.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
935 B
C++
Raw Normal View History

#include "SignedDistance.h"
#include <cmath>
namespace msdfgen {
const SignedDistance SignedDistance::INFINITE(-1e240, 1);
SignedDistance::SignedDistance() : distance(-1e240), dot(1) { }
SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { }
bool operator<(SignedDistance a, SignedDistance b) {
return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot < b.dot);
}
bool operator>(SignedDistance a, SignedDistance b) {
return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot > b.dot);
}
bool operator<=(SignedDistance a, SignedDistance b) {
return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot <= b.dot);
}
bool operator>=(SignedDistance a, SignedDistance b) {
return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot >= b.dot);
}
}