🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
LineStyle.hpp
1#pragma once
2
3#include <vector>
4
5#if defined(AST_WITH_AGG)
6
7A_SUPPRESS_WARNINGS_BEGIN
8#include "agg/agg_color_rgba.h"
9#include "agg/agg_math_stroke.h"
10A_SUPPRESS_WARNINGS_END
11#include "path_converters.h" // e_snap_mode
12
13
14AST_NAMESPACE_BEGIN
15
16
18struct LineStyle {
19 double linewidth = 1.5; // pt
20 agg::rgba color{0.122, 0.467, 0.706, 1.0}; // C0 blue
21 agg::line_cap_e cap = agg::square_cap; // "projecting"
22 agg::line_join_e join = agg::round_join;
23 bool antialiased = true;
24 e_snap_mode snap = SNAP_AUTO;
25
26 double dash_offset = 0.0;
27 std::vector<double> dash_pattern{}; // 空 = 实线, 单位 pt (已按 lw 缩放)
28
29 bool simplify = true;
30 double simplify_threshold = 0.111111; // M_SQRT2/9 ≈ matplot default
31
32 double sketch_scale = 0.0;
33 double sketch_length = 0.0;
34 double sketch_randomness = 0.0;
35
36 bool is_dashed() const { return !dash_pattern.empty(); }
37 double linewidth_px(double dpi) const { return linewidth * dpi / 72.0; }
38};
39
40
41AST_NAMESPACE_END
42
43#endif // AST_WITH_AGG