geopro/src/render/ContourBands.hpp

33 lines
1.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <limits>
#include <vector>
#include "model/Field.hpp"
#include "model/ColorScale.hpp"
#include "model/Anomaly.hpp"
namespace geopro::render {
struct BandPolygon {
geopro::core::Rgba color;
std::vector<geopro::core::Vec2> ring; // 单环多边形局部坐标y=高程向上为正)
};
struct ContourLine {
double level = std::numeric_limits<double>::quiet_NaN(); // NaN=未解析(与真实 level 0 区分)
std::vector<geopro::core::Vec2> pts;
};
struct ContourBandsResult {
std::vector<BandPolygon> bands;
std::vector<ContourLine> lines;
};
struct ContourOptions {
int upsample = 2; // 双线性上采样倍数1=不采样)
double smooth = 0.3; // 平滑强度 0..10=不平滑)
bool makeLines = true;
};
// core::GridNaN=无效)+ ColorScale 分段 → 色带多边形 + 等值线几何。
// VTK 仅作算法vtkBandedPolyDataContourFilter无 render window。
ContourBandsResult buildContourBands(const geopro::core::Grid& g,
const geopro::core::ColorScale& cs,
const ContourOptions& opt = {});
} // namespace geopro::render