File indexing completed on 2025-01-18 09:28:08
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <string>
0012 #include <vector>
0013
0014 #include "actsvg/core/style.hpp"
0015 #include "actsvg/proto/grid.hpp"
0016 #include "actsvg/proto/portal.hpp"
0017 #include "actsvg/proto/surface.hpp"
0018 #include "actsvg/styles/defaults.hpp"
0019
0020 namespace actsvg {
0021
0022 namespace proto {
0023
0024
0025
0026
0027
0028
0029
0030 template <typename point3_container>
0031 struct volume {
0032
0033 using surface_type = surface<point3_container>;
0034
0035 using portal_type = portal<point3_container>;
0036
0037
0038 enum type { e_cylinder = 0, e_cuboid = 1, e_other = 2 };
0039
0040
0041 unsigned int _index = 0u;
0042
0043
0044 unsigned int _depth_level = 0u;
0045
0046
0047 std::string _name = "unnamed";
0048
0049
0050 type _type = e_cylinder;
0051 std::vector<scalar> _bound_values;
0052 point3_container _vertices = {};
0053
0054
0055 style::fill _fill;
0056 style::stroke _stroke = defaults::__nn_stroke;
0057 style::transform _transform;
0058
0059
0060 std::vector<std::string> _info = {};
0061
0062
0063 std::vector<std::vector<surface<point3_container>>> _surfaces = {};
0064
0065
0066 std::vector<portal<point3_container>> _portals = {};
0067
0068
0069 grid _surface_grid;
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 std::vector<std::vector<std::vector<size_t>>> _grid_associations = {};
0088
0089
0090
0091
0092
0093 void colorize(std::vector<style::color>& colors_) {
0094 if (_index < colors_.size()) {
0095 _fill._fc = colors_[_index];
0096 }
0097 for (auto& p : _portals) {
0098
0099 for (auto& vl : p._volume_links) {
0100 if (vl._link_index < colors_.size()) {
0101 vl._stroke._sc = colors_[vl._link_index];
0102 vl._stroke._sc._opacity = 1.;
0103 vl._end_marker._fill._fc = colors_[vl._link_index];
0104 vl._end_marker._fill._fc._opacity = 1.;
0105 vl._end_marker._stroke = vl._stroke;
0106 }
0107 }
0108 }
0109 }
0110 };
0111
0112 }
0113
0114 }