Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_wires_3d_rendering.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-10-22
4  * Last modified: 2015-02-15
5  *
6  * License:
7  *
8  * Description:
9  *
10  * A abstract interface for wires 3D rendering
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_I_WIRES_3D_RENDERING_H
17 #define GEOMTOOLS_I_WIRES_3D_RENDERING_H 1
18 
19 // Standard library:
20 #include <list>
21 
22 // Third party:
23 // - Boost:
24 #include <boost/cstdint.hpp>
25 // - Bayeux/datatools:
26 #include <datatools/logger.h>
27 #include <datatools/bit_mask.h>
28 
29 // This project:
30 #include <geomtools/placement.h>
31 #include <geomtools/utils.h>
32 
33 namespace geomtools {
34 
35  // Forward declaration:
36  class i_shape_3d;
37 
40  {
41  public:
42 
45  WR_NONE = 0,
64  };
65 
68  SL_NONE = 0,
69  SL_LOW = 1,
70  SL_NORMAL = 2,
71  SL_HIGH = 3,
73  SL_HUGE = 5
74  };
75 
77  static uint32_t linear_sampling(sampling_level_type);
78 
80  static uint32_t linear_sampling_from_options(uint32_t);
81 
83  static uint32_t angular_sampling(sampling_level_type);
84 
86  static uint32_t angular_sampling_from_options(uint32_t);
87 
89  static void boost_linear_sampling(uint32_t &);
90 
92  virtual ~i_wires_3d_rendering();
93 
96  void generate_wires(wires_type & wires_,
97  const placement & positioning_,
98  uint32_t options_ = 0) const;
99 
102  void generate_wires(wires_type & wires_,
103  const geomtools::vector_3d & position_,
104  const geomtools::rotation_3d & rotation_,
105  uint32_t options_ = 0) const;
106 
109  virtual void generate_wires_self(wires_type & wires_,
110  uint32_t options_ = 0) const = 0;
111 
112  };
113 
115  void transform_wire_to(const placement & p_,
116  const polyline_type & wire_,
117  polyline_type & tr_wire_);
118 
120  void transform_wires_to(const placement & p_,
121  const wires_type & wires_,
122  wires_type & tr_wires_);
123 
125  bool parse_wires(std::istream & in_, wires_type & wires_);
126 
128  void save_wires(std::ostream & out_, const wires_type & wires_, uint32_t flags_ = 0);
129 
136  {
139 
141  void reset();
142 
144  void to_line(segment_type & segment_) const;
145 
147  void to_wire(polyline_type & wire_) const;
148 
150  bool is_inside() const;
151 
153  bool is_outside() const;
154 
156  bool is_on_surface() const;
157 
161 
162  };
163 
166  void classify_in_out_segment(const segment_type & segment_,
167  const i_shape_3d & shape_,
168  const placement & shape_placement_,
169  double step_,
170  double tolerance_,
171  std::list<classified_segment> & classified_);
172 
177  {
178  public:
179 
182 
184  void reset();
185 
187  void clear();
188 
190  void configure(const i_shape_3d & shape_,
191  double step_,
192  double tolerance_);
193 
195  void configure(const i_shape_3d & shape_,
196  const placement & shape_placement_,
197  double step_,
198  double tolerance_);
199 
201  bool is_configured() const;
202 
204  void add(const segment_type & segment_);
205 
207  void add(const polyline_type & path_);
208 
210  void add(const wires_type & paths_);
211 
213  unsigned int fetch_inside_segments(std::list<segment_type> & segments_);
214 
216  unsigned int fetch_inside_wires(wires_type & wires_);
217 
219  unsigned int fetch_outside_segments(std::list<segment_type> & segments_);
220 
222  unsigned int fetch_outside_wires(wires_type & wires_);
223 
225  unsigned int fetch_surface_segments(std::list<segment_type> & segments_);
226 
228  unsigned int fetch_surface_wires(wires_type & wires_);
229 
231  unsigned int fetch_all_segments(std::list<segment_type> & segments_);
232 
234  unsigned int fetch_all_wires(wires_type & wires_);
235 
236  private:
237 
238  // Setup:
239  const i_shape_3d * _shape_;
240  placement _shape_placement_;
241  double _step_;
242  double _tolerance_;
243 
244  // Work:
245  std::list<classified_segment> _clsegs_;
246 
247  };
248 
249 } // end of namespace geomtools
250 
251 #endif
252 /*
253 ** Local Variables: --
254 ** mode: c++ --
255 ** c-file-style: "gnu" --
256 ** tab-width: 2 --
257 ** End: --
258 */
259  // GEOMTOOLS_I_WIRES_3D_RENDERING_H
shape_domain_flags_type domain
Domain flag of the segment.
Definition: i_wires_3d_rendering.h:160
static const uint32_t nbits16
Definition: bit_mask.h:76
Use high sampling for angles.
Definition: i_wires_3d_rendering.h:52
Reserved for future usage.
Definition: i_wires_3d_rendering.h:59
bool parse_wires(std::istream &in_, wires_type &wires_)
Parse a collection of polylines from an ASCII stream.
void clear()
Clear former results.
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
void reset()
Reset the current configuration.
void add(const segment_type &segment_)
Process a segment.
unsigned int fetch_inside_segments(std::list< segment_type > &segments_)
Fetch and build the segments with 'inside' classification.
Use low sampling for angles.
Definition: i_wires_3d_rendering.h:51
void transform_wires_to(const placement &p_, const wires_type &wires_, wires_type &tr_wires_)
Transform a collection of polylines.
bool is_configured() const
Check configuration flag.
vector_3d first
First point of a segment.
Definition: i_wires_3d_rendering.h:158
static uint32_t linear_sampling(sampling_level_type)
Return linear sampling from sampling level.
Activate grid rendering.
Definition: i_wires_3d_rendering.h:46
void save_wires(std::ostream &out_, const wires_type &wires_, uint32_t flags_=0)
Save a collection of polylines in an ASCII stream.
unsigned int fetch_outside_segments(std::list< segment_type > &segments_)
Fetch and build the segments with 'outside' classification.
unsigned int fetch_surface_wires(wires_type &wires_)
Fetch and build the wires with 'surface' classification.
void to_line(segment_type &segment_) const
Convert to a 3D segment object.
Default/normal density sampling.
Definition: i_wires_3d_rendering.h:70
shape_domain_flags_type
Flags determining the position of a point with respect to a 3D shape.
Definition: utils.h:199
virtual ~i_wires_3d_rendering()
Destructor.
static uint32_t linear_sampling_from_options(uint32_t)
Return linear sampling from rendering options.
unsigned int fetch_inside_wires(wires_type &wires_)
Fetch and build the wires with 'inside' classification.
bool is_on_surface() const
Check if the segment is on the surface of the volume.
Activate grid with very high density.
Definition: i_wires_3d_rendering.h:49
Low density sampling.
Definition: i_wires_3d_rendering.h:69
Definition: i_wires_3d_rendering.h:45
wires_rendering_option_type
Wires rendering optional flags.
Definition: i_wires_3d_rendering.h:44
void transform_wire_to(const placement &p_, const polyline_type &wire_, polyline_type &tr_wire_)
Transform a polyline.
Very high density sampling.
Definition: i_wires_3d_rendering.h:72
Reserved for future usage.
Definition: i_wires_3d_rendering.h:57
static uint32_t angular_sampling(sampling_level_type)
Return angular sampling from sampling level.
High density sampling.
Definition: i_wires_3d_rendering.h:71
unsigned int fetch_all_segments(std::list< segment_type > &segments_)
Fetch and build all the segments.
Base rendering options bit mask.
Definition: i_wires_3d_rendering.h:63
split_segment_wrt_shape()
Default constructor.
Activate grid with high density.
Definition: i_wires_3d_rendering.h:48
Reserved for future usage.
Definition: i_wires_3d_rendering.h:58
void configure(const i_shape_3d &shape_, double step_, double tolerance_)
Configure the algorithm.
Activate grid with low density.
Definition: i_wires_3d_rendering.h:47
A classified segment consists in a 3D segment with a first and a last point in an arbitrary reference...
Definition: i_wires_3d_rendering.h:135
Display the bounding volume.
Definition: i_wires_3d_rendering.h:60
void to_wire(polyline_type &wire_) const
Convert to a 3D polyline object.
Reserved for future usage.
Definition: i_wires_3d_rendering.h:55
classified_segment()
Default constructor.
Use very high sampling for angles.
Definition: i_wires_3d_rendering.h:53
CLHEP::HepRotation rotation_3d
Alias for the CLHEP 3D-rotation class.
Definition: clhep.h:66
brief Abstract interface for objects that can describe themselves as a collection of polylines for 3D...
Definition: i_wires_3d_rendering.h:39
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
void generate_wires(wires_type &wires_, const placement &positioning_, uint32_t options_=0) const
static void boost_linear_sampling(uint32_t &)
Boost the linear sampling.
Last defined bit.
Definition: i_wires_3d_rendering.h:62
std::list< vector_3d > polyline_type
Definition: utils.h:55
Utilities for logging information.
sampling_level_type
Sampling levels.
Definition: i_wires_3d_rendering.h:67
unsigned int fetch_surface_segments(std::list< segment_type > &segments_)
Fetch and build the segments with 'on surface' classification.
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
No sampling.
Definition: i_wires_3d_rendering.h:68
unsigned int fetch_outside_wires(wires_type &wires_)
Fetch and build the wires with 'outside' classification.
vector_3d last
Last point of a segment.
Definition: i_wires_3d_rendering.h:159
basic_segment_3d segment_type
Definition: utils.h:51
Use huge sampling for angles.
Definition: i_wires_3d_rendering.h:54
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
unsigned int fetch_all_wires(wires_type &wires_)
Fetch and build all the wires.
static const uint32_t bit00
Definition: bit_mask.h:27
void classify_in_out_segment(const segment_type &segment_, const i_shape_3d &shape_, const placement &shape_placement_, double step_, double tolerance_, std::list< classified_segment > &classified_)
bool is_inside() const
Check if the segment is inside the volume.
Reserved for future usage.
Definition: i_wires_3d_rendering.h:56
static uint32_t angular_sampling_from_options(uint32_t)
Return angular sampling from rendering options.
Explode the shape view to help debugging.
Definition: i_wires_3d_rendering.h:61
Huge density sampling.
Definition: i_wires_3d_rendering.h:73
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const =0
bool is_outside() const
Check if the segment is outside the volume.
Activate grid with huge density.
Definition: i_wires_3d_rendering.h:50
This algorithm splits a segment, a polyline or a collection of polylines in a sequence of smaller seg...
Definition: i_wires_3d_rendering.h:176
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39