Add paint stroke sampling tests
This commit is contained in:
39
src/paint/stroke.h
Normal file
39
src/paint/stroke.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "foundation/result.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
namespace pp::paint {
|
||||
|
||||
constexpr std::size_t max_stroke_points = 1000000;
|
||||
constexpr std::size_t max_stroke_samples = 1000000;
|
||||
|
||||
struct StrokePoint {
|
||||
float x = 0.0F;
|
||||
float y = 0.0F;
|
||||
float pressure = 1.0F;
|
||||
std::uint32_t time_ms = 0;
|
||||
};
|
||||
|
||||
struct StrokeSample {
|
||||
float x = 0.0F;
|
||||
float y = 0.0F;
|
||||
float pressure = 1.0F;
|
||||
float distance = 0.0F;
|
||||
};
|
||||
|
||||
struct StrokeSamplingConfig {
|
||||
float spacing = 1.0F;
|
||||
bool include_endpoint = true;
|
||||
std::size_t max_samples = max_stroke_samples;
|
||||
};
|
||||
|
||||
[[nodiscard]] pp::foundation::Result<std::vector<StrokeSample>> sample_stroke(
|
||||
std::span<const StrokePoint> points,
|
||||
StrokeSamplingConfig config) noexcept;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user