| 1 |
|
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "Range.hpp" |
| 5 |
|
| 6 |
namespace msdfgen { |
| 7 |
|
| 8 |
|
| 9 |
class DistanceMapping { |
| 10 |
|
| 11 |
public: |
| 12 |
|
| 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 |
} |