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-2023 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
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 */
57ANALYZE_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
63ANALYZE_EXPORT int
64analyze_obj_inside(struct db_i *dbip, const char *outside, const char *inside, fastf_t tol);
65
66
67ANALYZE_EXPORT int
68analyze_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
73struct current_state;
74typedef 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);
75typedef void (*exp_air_callback_t)(const struct partition *pp, point_t last_out_point, point_t pt, point_t opt, void* callback_data);
76typedef void (*gaps_callback_t)(const struct xray* ray, const struct partition *pp, double gap_dist, point_t pt, void* callback_data);
77typedef void (*adj_air_callback_t)(const struct xray* ray, const struct partition *pp, point_t pt, void* callback_data);
78typedef void (*first_air_callback_t)(const struct xray* ray, const struct partition *pp, void* callback_data);
79typedef void (*last_air_callback_t)(const struct xray* ray, const struct partition *pp, void* callback_data);
80typedef 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 */
85ANALYZE_EXPORT extern fastf_t
86analyze_volume(struct current_state *context, const char *name);
87
88/**
89 * returns the volume of all the specified objects while ray-tracing
90 */
91ANALYZE_EXPORT extern fastf_t
92analyze_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 */
98ANALYZE_EXPORT extern void
99analyze_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 */
104ANALYZE_EXPORT extern fastf_t
105analyze_mass(struct current_state *context, const char *name);
106
107/**
108 * returns the mass of all the specified objects while ray-tracing
109 */
110ANALYZE_EXPORT extern fastf_t
111analyze_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 */
117ANALYZE_EXPORT extern void
118analyze_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 */
123ANALYZE_EXPORT extern void
124analyze_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 */
129ANALYZE_EXPORT extern void
130analyze_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 */
135ANALYZE_EXPORT extern void
136analyze_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 */
141ANALYZE_EXPORT extern void
142analyze_moments_total(struct current_state *context, mat_t moments);
143
144/**
145 * returns the surface area of the specified object (name)
146 */
147ANALYZE_EXPORT extern fastf_t
148analyze_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 */
153ANALYZE_EXPORT extern fastf_t
154analyze_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 */
160ANALYZE_EXPORT extern void
161analyze_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 */
166ANALYZE_EXPORT extern int
167perform_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 */
172ANALYZE_EXPORT extern
173struct current_state * analyze_current_state_init(void);
174
175ANALYZE_EXPORT extern void
176analyze_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 */
185ANALYZE_EXPORT extern void
186analyze_set_azimuth(struct current_state *context , fastf_t azimuth);
187
188ANALYZE_EXPORT extern void
189analyze_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 */
194ANALYZE_EXPORT extern void
195analyze_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 */
200ANALYZE_EXPORT extern fastf_t
201analyze_get_grid_spacing(struct current_state *context);
202
203/**
204 * sets the cell_width by cell_height ratio (default is 1)
205 */
206ANALYZE_EXPORT extern void
207analyze_set_grid_ratio(struct current_state *context, fastf_t gridRatio);
208
209/**
210 * sets the grid width and grid height values
211 */
212ANALYZE_EXPORT extern void
213analyze_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 */
218ANALYZE_EXPORT extern void
219analyze_set_aspect(struct current_state *context, fastf_t aspect);
220
221/**
222 * used to specify the minimum samples per model axis
223 */
224ANALYZE_EXPORT extern void
225analyze_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 */
230ANALYZE_EXPORT extern void
231analyze_set_overlap_tolerance(struct current_state *context , fastf_t overlap_tolerance);
232
233ANALYZE_EXPORT extern void
234analyze_set_volume_tolerance(struct current_state *context , fastf_t volume_tolerance);
235
236ANALYZE_EXPORT extern void
237analyze_set_mass_tolerance(struct current_state *context , fastf_t mass_tolerance);
238
239ANALYZE_EXPORT extern void
240analyze_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 */
245ANALYZE_EXPORT extern void
246analyze_set_ncpu(struct current_state *context , int ncpu);
247
248/**
249 * sets the required number of hits per object when raytracing
250 */
251ANALYZE_EXPORT extern void
252analyze_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 */
257ANALYZE_EXPORT extern void
258analyze_set_quiet_missed_report(struct current_state *context);
259
260/**
261 * sets the use_air flag for raytracing
262 */
263ANALYZE_EXPORT extern void
264analyze_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 */
269ANALYZE_EXPORT extern void
270analyze_set_num_views(struct current_state *context , int num_views);
271
272/**
273 * set the name of the density file
274 */
275ANALYZE_EXPORT extern void
276analyze_set_densityfile(struct current_state *context , char *densityFileName);
277
278/**
279 * registers the plotfile used to store the plot information for volume
280 */
281ANALYZE_EXPORT extern void
282analyze_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 */
287ANALYZE_EXPORT extern void
288analyze_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 */
293ANALYZE_EXPORT extern void
294analyze_enable_verbose(struct current_state *context, struct bu_vls *vls);
295
296/**
297 * used to get the value of number of regions
298 */
299ANALYZE_EXPORT extern int
300analyze_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 */
306ANALYZE_EXPORT extern void
307analyze_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 */
312ANALYZE_EXPORT extern void
313analyze_register_overlaps_callback(struct current_state *context, overlap_callback_t callback_function, void* callback_data);
314
315ANALYZE_EXPORT extern void
316analyze_register_exp_air_callback(struct current_state *context, exp_air_callback_t callback_function, void* callback_data);
317
318ANALYZE_EXPORT extern void
319analyze_register_gaps_callback(struct current_state *context, gaps_callback_t callback_function, void* callback_data);
320
321ANALYZE_EXPORT extern void
322analyze_register_adj_air_callback(struct current_state *context, adj_air_callback_t callback_function, void* callback_data);
323
324ANALYZE_EXPORT extern void
325analyze_register_first_air_callback(struct current_state *context, first_air_callback_t callback_function, void* callback_data);
326
327ANALYZE_EXPORT extern void
328analyze_register_last_air_callback(struct current_state *context, last_air_callback_t callback_function, void* callback_data);
329
330ANALYZE_EXPORT extern void
331analyze_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)
struct region_pair * add_unique_pair(struct region_pair *list, struct region *r1, struct region *r2, double dist, point_t pt)
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)
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)
struct current_state * analyze_current_state_init(void)
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)
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:345
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:330
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:366
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
hvect_t quat_t
4-element quaternion
Definition: vmath.h:360
Definition: list.h:131
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