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:
27
thirdparty/msdfgen/core/DistanceMapping.cpp
vendored
Normal file
27
thirdparty/msdfgen/core/DistanceMapping.cpp
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
#include "DistanceMapping.h"
|
||||
|
||||
namespace msdfgen {
|
||||
|
||||
DistanceMapping DistanceMapping::inverse(Range range) {
|
||||
double rangeWidth = range.upper-range.lower;
|
||||
return DistanceMapping(rangeWidth, range.lower/(rangeWidth ? rangeWidth : 1));
|
||||
}
|
||||
|
||||
DistanceMapping::DistanceMapping() : scale(1), translate(0) { }
|
||||
|
||||
DistanceMapping::DistanceMapping(Range range) : scale(1/(range.upper-range.lower)), translate(-range.lower) { }
|
||||
|
||||
double DistanceMapping::operator()(double d) const {
|
||||
return scale*(d+translate);
|
||||
}
|
||||
|
||||
double DistanceMapping::operator()(Delta d) const {
|
||||
return scale*d.value;
|
||||
}
|
||||
|
||||
DistanceMapping DistanceMapping::inverse() const {
|
||||
return DistanceMapping(1/scale, -scale*translate);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user