BRL-CAD
info.h
Go to the documentation of this file.
1 /* I N F O . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup libanalyze
21  *
22  * Functions provided by the LIBANALYZE geometry analysis library.
23  *
24  */
25 /** @{ */
26 /** @file analyze/info.h */
27 
28 #ifndef ANALYZE_INFO_H
29 #define ANALYZE_INFO_H
30 
31 #include "common.h"
32 #include "raytrace.h"
33 
34 #include "analyze/defines.h"
35 
36 __BEGIN_DECLS
37 
38 /*
39  * Overlap specific structures
40  */
41 
42 struct region_pair {
43  struct bu_list l;
44  union {
45  const char *name;
46  struct region *r1;
47  } r;
48  struct region *r2;
49  unsigned long count;
50  double max_dist;
52 };
53 
54 /**
55  * region_pair for gqa
56  */
57 ANALYZE_EXPORT extern struct region_pair *add_unique_pair(struct region_pair *list,
58  struct region *r1,
59  struct region *r2,
60  double dist, point_t pt);
61 
62 
63 ANALYZE_EXPORT int
64 analyze_obj_inside(struct db_i *dbip, const char *outside, const char *inside, fastf_t tol);
65 
66 
67 ANALYZE_EXPORT int
68 analyze_find_subtracted(struct bu_ptbl *results, struct rt_wdb *wdbp,
69  const char *pbrep, struct rt_gen_worker_vars *pbrep_rtvars,
70  const char *curr_comb, struct bu_ptbl *candidates, void *curr_union_data, size_t ncpus);
71 
72 
73 struct current_state;
74 typedef void (*overlap_callback_t)(const struct xray* ray, const struct partition *pp, const struct region *reg1, const struct region *reg2, double depth, void* callback_data);
75 typedef void (*exp_air_callback_t)(const struct partition *pp, point_t last_out_point, point_t pt, point_t opt, void* callback_data);
76 typedef void (*gaps_callback_t)(const struct xray* ray, const struct partition *pp, double gap_dist, point_t pt, void* callback_data);
77 typedef void (*adj_air_callback_t)(const struct xray* ray, const struct partition *pp, point_t pt, void* callback_data);
78 typedef void (*first_air_callback_t)(const struct xray* ray, const struct partition *pp, void* callback_data);
79 typedef void (*last_air_callback_t)(const struct xray* ray, const struct partition *pp, void* callback_data);
80 typedef void (*unconf_air_callback_t)(const struct xray* ray, const struct partition *in_part, const struct partition *out_part, void* callback_data);
81 
82 /**
83  * returns the volume of the specified object (name)
84  */
85 ANALYZE_EXPORT extern fastf_t
86 analyze_volume(struct current_state *context, const char *name);
87 
88 /**
89  * returns the volume of all the specified objects while ray-tracing
90  */
91 ANALYZE_EXPORT extern fastf_t
92 analyze_total_volume(struct current_state *context);
93 
94 /**
95  * stores the region name, volume, high and low ranges of volume
96  * for the specified index of region in region table.
97  */
98 ANALYZE_EXPORT extern void
99 analyze_volume_region(struct current_state *context, int index, char** reg_name, double *volume, double *high, double *low);
100 
101 /**
102  * returns the mass of the specified object (name)
103  */
104 ANALYZE_EXPORT extern fastf_t
105 analyze_mass(struct current_state *context, const char *name);
106 
107 /**
108  * returns the mass of all the specified objects while ray-tracing
109  */
110 ANALYZE_EXPORT extern fastf_t
111 analyze_total_mass(struct current_state *context);
112 
113 /**
114  * stores the region name, mass, high and low ranges of mass
115  * for the specified index of region in region table.
116  */
117 ANALYZE_EXPORT extern void
118 analyze_mass_region(struct current_state *context, int index, char** reg_name, double *mass, double *high, double *low);
119 
120 /**
121  * returns the centroid of the specified object (name)
122  */
123 ANALYZE_EXPORT extern void
124 analyze_centroid(struct current_state *context, const char *name, point_t value);
125 
126 /**
127  * returns the centroid of all the specified objects while ray-tracing
128  */
129 ANALYZE_EXPORT extern void
130 analyze_total_centroid(struct current_state *context, point_t value);
131 
132 /**
133  * returns the moments and products of inertia of the specified object (name)
134  */
135 ANALYZE_EXPORT extern void
136 analyze_moments(struct current_state *context, const char *name, mat_t value);
137 
138 /**
139  * returns the moments and products of all the specified objects while ray-tracing
140  */
141 ANALYZE_EXPORT extern void
142 analyze_moments_total(struct current_state *context, mat_t moments);
143 
144 /**
145  * returns the surface area of the specified object (name)
146  */
147 ANALYZE_EXPORT extern fastf_t
148 analyze_surf_area(struct current_state *context, const char *name);
149 
150 /**
151  * returns the surface area of all the specified objects while ray-tracing
152  */
153 ANALYZE_EXPORT extern fastf_t
154 analyze_total_surf_area(struct current_state *state);
155 
156 /**
157  * stores the region name, surf_area, high and low ranges of surf_area
158  * for the specified index of region in region table.
159  */
160 ANALYZE_EXPORT extern void
161 analyze_surf_area_region(struct current_state *state, int i, char **name, double *surf_area, double *high, double *low);
162 
163 /**
164  * performs raytracing based on the current state
165  */
166 ANALYZE_EXPORT extern int
167 perform_raytracing(struct current_state *context, struct db_i *dbip, char *names[], int num_objects, int flags);
168 
169 /**
170  * functions to initialize and clear current_state struct
171  */
172 ANALYZE_EXPORT extern
173 struct current_state * analyze_current_state_init(void);
174 
175 ANALYZE_EXPORT extern void
176 analyze_free_current_state(struct current_state *context);
177 
178 /*
179  * Below are the setter functions for the parameters of check API
180  */
181 
182 /**
183  * sets the azimuth and elevation for single grid to shoot rays
184  */
185 ANALYZE_EXPORT extern void
186 analyze_set_azimuth(struct current_state *context , fastf_t azimuth);
187 
188 ANALYZE_EXPORT extern void
189 analyze_set_elevation(struct current_state *context , fastf_t elevation);
190 
191 /**
192  * sets the grid_spacing and grid spacing limit for shooting the rays
193  */
194 ANALYZE_EXPORT extern void
195 analyze_set_grid_spacing(struct current_state *context , fastf_t gridSpacing, fastf_t gridSpacingLimit);
196 
197 /**
198  * returns the grid_spacing when the raytracing stopped -- used for printing summaries
199  */
200 ANALYZE_EXPORT extern fastf_t
201 analyze_get_grid_spacing(struct current_state *context);
202 
203 /**
204  * sets the cell_width by cell_height ratio (default is 1)
205  */
206 ANALYZE_EXPORT extern void
207 analyze_set_grid_ratio(struct current_state *context, fastf_t gridRatio);
208 
209 /**
210  * sets the grid width and grid height values
211  */
212 ANALYZE_EXPORT extern void
213 analyze_set_grid_size(struct current_state *state, fastf_t width, fastf_t height);
214 
215 /**
216  * sets the width by height ratio (default is 1)
217  */
218 ANALYZE_EXPORT extern void
219 analyze_set_aspect(struct current_state *context, fastf_t aspect);
220 
221 /**
222  * used to specify the minimum samples per model axis
223  */
224 ANALYZE_EXPORT extern void
225 analyze_set_samples_per_model_axis(struct current_state *context, fastf_t samples_per_model_axis);
226 
227 /**
228  * sets the tolerance values for overlaps, volume, mass and surface area for the analysis
229  */
230 ANALYZE_EXPORT extern void
231 analyze_set_overlap_tolerance(struct current_state *context , fastf_t overlap_tolerance);
232 
233 ANALYZE_EXPORT extern void
234 analyze_set_volume_tolerance(struct current_state *context , fastf_t volume_tolerance);
235 
236 ANALYZE_EXPORT extern void
237 analyze_set_mass_tolerance(struct current_state *context , fastf_t mass_tolerance);
238 
239 ANALYZE_EXPORT extern void
240 analyze_set_surf_area_tolerance(struct current_state *context, fastf_t sa_tolerance);
241 
242 /**
243  * sets the number of cpus to be used for raytracing
244  */
245 ANALYZE_EXPORT extern void
246 analyze_set_ncpu(struct current_state *context , int ncpu);
247 
248 /**
249  * sets the required number of hits per object when raytracing
250  */
251 ANALYZE_EXPORT extern void
252 analyze_set_required_number_hits(struct current_state *context , size_t required_number_hits);
253 
254 /**
255  * sets a flag which quiets the missed reports
256  */
257 ANALYZE_EXPORT extern void
258 analyze_set_quiet_missed_report(struct current_state *context);
259 
260 /**
261  * sets the use_air flag for raytracing
262  */
263 ANALYZE_EXPORT extern void
264 analyze_set_use_air(struct current_state *context , int use_air);
265 
266 /**
267  * set the number of views when shooting triple grids of rays
268  */
269 ANALYZE_EXPORT extern void
270 analyze_set_num_views(struct current_state *context , int num_views);
271 
272 /**
273  * set the name of the density file
274  */
275 ANALYZE_EXPORT extern void
276 analyze_set_densityfile(struct current_state *context , char *densityFileName);
277 
278 /**
279  * registers the plotfile used to store the plot information for volume
280  */
281 ANALYZE_EXPORT extern void
282 analyze_set_volume_plotfile(struct current_state *context , FILE* plotvolume);
283 
284 /**
285  * used to set debug flag and get debug information into the bu_vls pointer
286  */
287 ANALYZE_EXPORT extern void
288 analyze_enable_debug(struct current_state *context, struct bu_vls *vls);
289 
290 /**
291  * used to set verbose flag and get verbose information into the bu_vls pointer
292  */
293 ANALYZE_EXPORT extern void
294 analyze_enable_verbose(struct current_state *context, struct bu_vls *vls);
295 
296 /**
297  * used to get the value of number of regions
298  */
299 ANALYZE_EXPORT extern int
300 analyze_get_num_regions(struct current_state *context);
301 
302 /**
303  * used to prepare single grid (eye position) by expliciting mentioning viewsize,
304  * eye model and orientation
305  */
306 ANALYZE_EXPORT extern void
307 analyze_set_view_information(struct current_state *context, double viewsize, point_t *eye_model, quat_t *orientation);
308 
309 /**
310  * registers the callback functions defined by the user to be called when raytracing
311  */
312 ANALYZE_EXPORT extern void
313 analyze_register_overlaps_callback(struct current_state *context, overlap_callback_t callback_function, void* callback_data);
314 
315 ANALYZE_EXPORT extern void
316 analyze_register_exp_air_callback(struct current_state *context, exp_air_callback_t callback_function, void* callback_data);
317 
318 ANALYZE_EXPORT extern void
319 analyze_register_gaps_callback(struct current_state *context, gaps_callback_t callback_function, void* callback_data);
320 
321 ANALYZE_EXPORT extern void
322 analyze_register_adj_air_callback(struct current_state *context, adj_air_callback_t callback_function, void* callback_data);
323 
324 ANALYZE_EXPORT extern void
325 analyze_register_first_air_callback(struct current_state *context, first_air_callback_t callback_function, void* callback_data);
326 
327 ANALYZE_EXPORT extern void
328 analyze_register_last_air_callback(struct current_state *context, last_air_callback_t callback_function, void* callback_data);
329 
330 ANALYZE_EXPORT extern void
331 analyze_register_unconf_air_callback(struct current_state *context, unconf_air_callback_t callback_function, void* callback_data);
332 
333 __END_DECLS
334 
335 #endif /* ANALYZE_INFO_H */
336 
337 /** @} */
338 
339 /*
340  * Local Variables:
341  * tab-width: 8
342  * mode: C
343  * indent-tabs-mode: t
344  * c-file-style: "stroustrup"
345  * End:
346  * ex: shiftwidth=4 tabstop=8
347  */
Header file for the BRL-CAD common definitions.
void(* overlap_callback_t)(const struct xray *ray, const struct partition *pp, const struct region *reg1, const struct region *reg2, double depth, void *callback_data)
Definition: info.h:74
void analyze_set_num_views(struct current_state *context, int num_views)
void analyze_set_grid_ratio(struct current_state *context, fastf_t gridRatio)
void analyze_volume_region(struct current_state *context, int index, char **reg_name, double *volume, double *high, double *low)
int analyze_obj_inside(struct db_i *dbip, const char *outside, const char *inside, fastf_t tol)
void analyze_set_volume_plotfile(struct current_state *context, FILE *plotvolume)
void analyze_set_view_information(struct current_state *context, double viewsize, point_t *eye_model, quat_t *orientation)
void analyze_set_densityfile(struct current_state *context, char *densityFileName)
void analyze_set_samples_per_model_axis(struct current_state *context, fastf_t samples_per_model_axis)
void analyze_register_first_air_callback(struct current_state *context, first_air_callback_t callback_function, void *callback_data)
void analyze_free_current_state(struct current_state *context)
void analyze_enable_verbose(struct current_state *context, struct bu_vls *vls)
int perform_raytracing(struct current_state *context, struct db_i *dbip, char *names[], int num_objects, int flags)
struct region_pair * add_unique_pair(struct region_pair *list, struct region *r1, struct region *r2, double dist, point_t pt)
void analyze_register_overlaps_callback(struct current_state *context, overlap_callback_t callback_function, void *callback_data)
void analyze_enable_debug(struct current_state *context, struct bu_vls *vls)
void analyze_set_grid_spacing(struct current_state *context, fastf_t gridSpacing, fastf_t gridSpacingLimit)
void analyze_register_exp_air_callback(struct current_state *context, exp_air_callback_t callback_function, void *callback_data)
void analyze_register_adj_air_callback(struct current_state *context, adj_air_callback_t callback_function, void *callback_data)
void analyze_set_use_air(struct current_state *context, int use_air)
void analyze_set_grid_size(struct current_state *state, fastf_t width, fastf_t height)
void analyze_set_aspect(struct current_state *context, fastf_t aspect)
void analyze_moments_total(struct current_state *context, mat_t moments)
fastf_t analyze_total_volume(struct current_state *context)
void analyze_set_azimuth(struct current_state *context, fastf_t azimuth)
fastf_t analyze_volume(struct current_state *context, const char *name)
fastf_t analyze_get_grid_spacing(struct current_state *context)
int analyze_get_num_regions(struct current_state *context)
void analyze_surf_area_region(struct current_state *state, int i, char **name, double *surf_area, double *high, double *low)
struct current_state * analyze_current_state_init(void)
fastf_t analyze_total_surf_area(struct current_state *state)
void(* adj_air_callback_t)(const struct xray *ray, const struct partition *pp, point_t pt, void *callback_data)
Definition: info.h:77
void analyze_mass_region(struct current_state *context, int index, char **reg_name, double *mass, double *high, double *low)
void analyze_set_overlap_tolerance(struct current_state *context, fastf_t overlap_tolerance)
void analyze_set_volume_tolerance(struct current_state *context, fastf_t volume_tolerance)
void(* exp_air_callback_t)(const struct partition *pp, point_t last_out_point, point_t pt, point_t opt, void *callback_data)
Definition: info.h:75
void analyze_set_ncpu(struct current_state *context, int ncpu)
void(* gaps_callback_t)(const struct xray *ray, const struct partition *pp, double gap_dist, point_t pt, void *callback_data)
Definition: info.h:76
void analyze_set_surf_area_tolerance(struct current_state *context, fastf_t sa_tolerance)
void(* first_air_callback_t)(const struct xray *ray, const struct partition *pp, void *callback_data)
Definition: info.h:78
void analyze_set_quiet_missed_report(struct current_state *context)
void analyze_register_last_air_callback(struct current_state *context, last_air_callback_t callback_function, void *callback_data)
void(* last_air_callback_t)(const struct xray *ray, const struct partition *pp, void *callback_data)
Definition: info.h:79
void analyze_moments(struct current_state *context, const char *name, mat_t value)
void analyze_register_unconf_air_callback(struct current_state *context, unconf_air_callback_t callback_function, void *callback_data)
fastf_t analyze_surf_area(struct current_state *context, const char *name)
fastf_t analyze_mass(struct current_state *context, const char *name)
void analyze_centroid(struct current_state *context, const char *name, point_t value)
void analyze_register_gaps_callback(struct current_state *context, gaps_callback_t callback_function, void *callback_data)
void analyze_set_elevation(struct current_state *context, fastf_t elevation)
void(* unconf_air_callback_t)(const struct xray *ray, const struct partition *in_part, const struct partition *out_part, void *callback_data)
Definition: info.h:80
void analyze_set_mass_tolerance(struct current_state *context, fastf_t mass_tolerance)
fastf_t analyze_total_mass(struct current_state *context)
void analyze_total_centroid(struct current_state *context, point_t value)
void analyze_set_required_number_hits(struct current_state *context, size_t required_number_hits)
int analyze_find_subtracted(struct bu_ptbl *results, struct rt_wdb *wdbp, const char *pbrep, struct rt_gen_worker_vars *pbrep_rtvars, const char *curr_comb, struct bu_ptbl *candidates, void *curr_union_data, size_t ncpus)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:349
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:334
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:370
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:355
hvect_t quat_t
4-element quaternion
Definition: vmath.h:364
Definition: list.h:132
Definition: ptbl.h:53
Definition: vls.h:53
double max_dist
Definition: info.h:50
unsigned long count
Definition: info.h:49
vect_t coord
Definition: info.h:51
union region_pair::@14 r
const char * name
Definition: info.h:45
struct region * r1
Definition: info.h:46
struct bu_list l
Definition: info.h:43
struct region * r2
Definition: info.h:48
Definition: region.h:44
Definition: wdb.h:62
Primary ray data structure.
Definition: xray.h:41