mirror of
https://github.com/godotengine/godot.git
synced 2024-12-27 11:24:59 +08:00
30 lines
896 B
C++
30 lines
896 B
C++
|
|
#include "SignedDistance.h"
|
|
|
|
#include <cmath>
|
|
#include <cfloat>
|
|
|
|
namespace msdfgen {
|
|
|
|
SignedDistance::SignedDistance() : distance(-DBL_MAX), 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);
|
|
}
|
|
|
|
}
|