Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-30 09:40:27

0001 // This file is part of the actsvg package.
0002 //
0003 // Copyright (C) 2024 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <array>
0012 
0013 #include "actsvg/core/defs.hpp"
0014 #include "actsvg/proto/grid.hpp"
0015 #include "actsvg/styles/defaults.hpp"
0016 
0017 namespace actsvg {
0018 
0019 namespace proto {
0020 
0021 struct material_slab {
0022     // x0, l0, a, z, rho, thickness
0023     std::array<scalar, 6u> _properties = {0., 0., 0., 0., 0., 0.};
0024 };
0025 
0026 using matrial_matrix = std::vector<std::vector<material_slab> >;
0027 
0028 /** A helper function to get the min max ranges from material properties
0029  *
0030  * @param mm_ the material slab
0031  *
0032  * @return the boundaries in t/X0, t/L0, a*z/rho
0033  */
0034 std::array<std::array<scalar, 2u>, 3u> material_ranges(
0035     const matrial_matrix& mm_);
0036 
0037 /** A proto surface material class that represents material properties
0038  *  in a binned and non-binned manner
0039  **/
0040 struct surface_material {
0041 
0042     /// The material matrix
0043     std::vector<std::vector<material_slab> > _material_matrix = {};
0044 
0045     /// The bin ids in a grid
0046     proto::grid _grid = {};
0047 
0048     // The material ranges
0049     std::array<std::array<scalar, 2u>, 3u> _material_ranges = {};
0050 
0051     /// The gradient
0052     style::gradient _gradient = defaults::__rgb_gradient;
0053 
0054     /// The gradient pos
0055     point2 _gradient_pos = {0, 0};
0056 
0057     /// Gradient bos size
0058     std::array<scalar, 2u> _gradient_box = {0., 0.};
0059 
0060     /// Gradient stroke
0061     style::stroke _gradient_stroke = style::stroke{};
0062 
0063     /// Gradient font
0064     style::font _gradient_font = style::font{};
0065 
0066     /// Gradient label
0067     style::label _gradient_label = style::label{};
0068 
0069     /// The info position
0070     point2 _info_pos = {0, 0};
0071 
0072     /// The info font
0073     style::font _info_font = style::font{};
0074 
0075     /// Evaluate the material ranges
0076     void evaluate_material_ranges() {
0077         _material_ranges = material_ranges(_material_matrix);
0078     }
0079 };
0080 
0081 }  // namespace proto
0082 }  // namespace actsvg