1
2#include "SignedDistance.h"
3
4#include <cmath>
5#include <cfloat>
6
7namespace msdfgen {
8
9SignedDistance::SignedDistance() : distance(-DBL_MAX), dot(1) { }
10
11SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { }
12
13bool operator<(SignedDistance a, SignedDistance b) {
14 return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot < b.dot);
15}
16
17bool operator>(SignedDistance a, SignedDistance b) {
18 return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot > b.dot);
19}
20
21bool operator<=(SignedDistance a, SignedDistance b) {
22 return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot <= b.dot);
23}
24
25bool operator>=(SignedDistance a, SignedDistance b) {
26 return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot >= b.dot);
27}
28
29}
30