initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
38
thirdparty/msdfgen/core/SignedDistance.hpp
vendored
Normal file
38
thirdparty/msdfgen/core/SignedDistance.hpp
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include "base.h"
|
||||
|
||||
namespace msdfgen {
|
||||
|
||||
/// Represents a signed distance and alignment, which together can be compared to uniquely determine the closest edge segment.
|
||||
class SignedDistance {
|
||||
|
||||
public:
|
||||
double distance;
|
||||
double dot;
|
||||
|
||||
inline SignedDistance() : distance(-DBL_MAX), dot(0) { }
|
||||
inline SignedDistance(double dist, double d) : distance(dist), dot(d) { }
|
||||
|
||||
};
|
||||
|
||||
inline bool operator<(const SignedDistance a, const SignedDistance b) {
|
||||
return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot < b.dot);
|
||||
}
|
||||
|
||||
inline bool operator>(const SignedDistance a, const SignedDistance b) {
|
||||
return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot > b.dot);
|
||||
}
|
||||
|
||||
inline bool operator<=(const SignedDistance a, const SignedDistance b) {
|
||||
return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot <= b.dot);
|
||||
}
|
||||
|
||||
inline bool operator>=(const SignedDistance a, const SignedDistance b) {
|
||||
return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot >= b.dot);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user