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:
37
thirdparty/msdfgen/core/ShapeDistanceFinder.h
vendored
Normal file
37
thirdparty/msdfgen/core/ShapeDistanceFinder.h
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "Vector2.hpp"
|
||||
#include "edge-selectors.h"
|
||||
#include "contour-combiners.h"
|
||||
|
||||
namespace msdfgen {
|
||||
|
||||
/// Finds the distance between a point and a Shape. ContourCombiner dictates the distance metric and its data type.
|
||||
template <class ContourCombiner>
|
||||
class ShapeDistanceFinder {
|
||||
|
||||
public:
|
||||
typedef typename ContourCombiner::DistanceType DistanceType;
|
||||
|
||||
// Passed shape object must persist until the distance finder is destroyed!
|
||||
explicit ShapeDistanceFinder(const Shape &shape);
|
||||
/// Finds the distance from origin. Not thread-safe! Is fastest when subsequent queries are close together.
|
||||
DistanceType distance(const Point2 &origin);
|
||||
|
||||
/// Finds the distance between shape and origin. Does not allocate result cache used to optimize performance of multiple queries.
|
||||
static DistanceType oneShotDistance(const Shape &shape, const Point2 &origin);
|
||||
|
||||
private:
|
||||
const Shape &shape;
|
||||
ContourCombiner contourCombiner;
|
||||
std::vector<typename ContourCombiner::EdgeSelectorType::EdgeCache> shapeEdgeCache;
|
||||
|
||||
};
|
||||
|
||||
typedef ShapeDistanceFinder<SimpleContourCombiner<TrueDistanceSelector> > SimpleTrueShapeDistanceFinder;
|
||||
|
||||
}
|
||||
|
||||
#include "ShapeDistanceFinder.hpp"
|
Reference in New Issue
Block a user