Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/msdfgen/core/DistanceMapping.h
9903 views
1
2
#pragma once
3
4
#include "Range.hpp"
5
6
namespace msdfgen {
7
8
/// Linear transformation of signed distance values.
9
class DistanceMapping {
10
11
public:
12
/// Explicitly designates value as distance delta rather than an absolute distance.
13
class Delta {
14
public:
15
double value;
16
inline explicit Delta(double distanceDelta) : value(distanceDelta) { }
17
inline operator double() const { return value; }
18
};
19
20
static DistanceMapping inverse(Range range);
21
22
DistanceMapping();
23
DistanceMapping(Range range);
24
double operator()(double d) const;
25
double operator()(Delta d) const;
26
DistanceMapping inverse() const;
27
28
private:
29
double scale;
30
double translate;
31
32
inline DistanceMapping(double scale, double translate) : scale(scale), translate(translate) { }
33
34
};
35
36
}
37
38