Horizon
canvas_mesh.hpp
1 #pragma once
2 #include "canvas/canvas_patch.hpp"
3 #include "common/common.hpp"
4 #include "clipper/clipper.hpp"
5 
6 
7 namespace horizon {
8 class CanvasMesh {
9 public:
10  void update(const class Board &brd);
11 
12  class Layer3D {
13  public:
14  class Vertex {
15  public:
16  Vertex(float ix, float iy) : x(ix), y(iy)
17  {
18  }
19 
20  float x, y;
21  };
22  std::vector<Vertex> tris;
23  std::vector<Vertex> walls;
24  float offset = 0;
25  float thickness = 0.035;
26  float alpha = 1;
27  float explode_mul = 0;
28  };
29 
30  const Layer3D &get_layer(int l) const;
31  const std::map<int, Layer3D> &get_layers() const;
32  const std::map<CanvasPatch::PatchKey, ClipperLib::Paths> &get_patches() const;
33 
34 private:
35  CanvasPatch ca;
36  std::map<int, Layer3D> layers;
37  const class Board *brd = nullptr;
38 
39  void prepare();
40  void polynode_to_tris(const ClipperLib::PolyNode *node, int layer);
41  void prepare_layer(int layer);
42  void prepare_soldermask(int layer);
43  void add_path(int layer, const ClipperLib::Path &path);
44 };
45 } // namespace horizon
ClipperLib::PolyNode
Definition: clipper.hpp:137