| 1 |
|
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <vector> |
| 5 |
#include "Vector2.hpp" |
| 6 |
#include "edge-selectors.h" |
| 7 |
#include "contour-combiners.h" |
| 8 |
|
| 9 |
namespace msdfgen { |
| 10 |
|
| 11 |
|
| 12 |
template <class ContourCombiner> |
| 13 |
class ShapeDistanceFinder { |
| 14 |
|
| 15 |
public: |
| 16 |
typedef typename ContourCombiner::DistanceType DistanceType; |
| 17 |
|
| 18 |
|
| 19 |
explicit ShapeDistanceFinder(const Shape &shape); |
| 20 |
|
| 21 |
DistanceType distance(const Point2 &origin); |
| 22 |
|
| 23 |
|
| 24 |
static DistanceType oneShotDistance(const Shape &shape, const Point2 &origin); |
| 25 |
|
| 26 |
private: |
| 27 |
const Shape &shape; |
| 28 |
ContourCombiner contourCombiner; |
| 29 |
std::vector<typename ContourCombiner::EdgeSelectorType::EdgeCache> shapeEdgeCache; |
| 30 |
|
| 31 |
}; |
| 32 |
|
| 33 |
typedef ShapeDistanceFinder<SimpleContourCombiner<TrueDistanceSelector> > SimpleTrueShapeDistanceFinder; |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
#include "ShapeDistanceFinder.hpp" |