mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
31 lines
935 B
C++
31 lines
935 B
C++
|
|
||
|
#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);
|
||
|
}
|
||
|
|
||
|
}
|