BRL-CAD
view.h
Go to the documentation of this file.
1 /* V I E W . H
2  * BRL-CAD
3  *
4  * Copyright (c) 1993-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 /** @file rt/view.h
21  *
22  */
23 
24 #ifndef RT_VIEW_H
25 #define RT_VIEW_H
26 
27 #include "common.h"
28 #include "vmath.h"
29 #include "bu/list.h"
30 #include "bu/hash.h"
31 #include "bu/ptbl.h"
32 #include "bn/tol.h"
33 #include "bv/defines.h"
34 #include "rt/defines.h"
35 
36 __BEGIN_DECLS
37 
38 /**
39  * NOTE: Normally, librt doesn't have a concept of a "display" of the geometry.
40  * However for at least the plotting routines, view information is sometimes
41  * needed to produce more intelligent output. In those situations, the
42  * application will generally pass in a bv structure.
43  */
44 
45 /**
46  * Specifies a subset of a primitive's geometry as the target for an
47  * operation.
48  *
49  * TODO: This structure is tentative and subject to change or removal
50  * without notice.
51  */
52 struct rt_selection {
53  void *obj; /**< @brief primitive-specific selection object */
54 };
55 
56 /**
57  * TODO: This structure is tentative and subject to change or removal
58  * without notice.
59  */
60 struct rt_selection_set {
61  struct bu_ptbl selections; /**< @brief holds struct rt_selection */
62 
63  /** selection-object-specific routine that will free all memory
64  * associated with any of the stored selections
65  */
66  void (*free_selection)(struct rt_selection *);
67 };
68 
69 /**
70  * Stores selections associated with an object. There is an entry in
71  * the selections table for each kind of selection (e.g. "active",
72  * "option"). The table entries are sets to allow more than one
73  * selection of the same type (e.g. multiple "option" selections).
74  *
75  * TODO: This structure is tentative and subject to change or removal
76  * without notice.
77  */
78 struct rt_object_selections {
79  /** selection type -> struct rt_selection_set */
80  struct bu_hash_tbl *sets;
81 };
82 
83 /**
84  * Analogous to a database query. Specifies how to filter and sort the
85  * selectable components of a primitive in order to find the most
86  * relevant selections for a particular application.
87  *
88  * TODO: This structure is tentative and subject to change or removal
89  * without notice.
90  */
91 struct rt_selection_query {
92  point_t start; /**< @brief start point of query ray */
93  vect_t dir; /**< @brief direction of query ray */
94 
95 #define RT_SORT_UNSORTED 0
96 #define RT_SORT_CLOSEST_TO_START 1
97  int sorting;
98 };
99 
100 /**
101  * Parameters of a translation applied to a selection.
102  *
103  * TODO: This structure is tentative and subject to change or removal
104  * without notice.
105  */
107  fastf_t dx;
108  fastf_t dy;
109  fastf_t dz;
110 };
111 
112 /**
113  * Describes an operation that can be applied to a selection.
114  *
115  * TODO: This structure is tentative and subject to change or removal
116  * without notice.
117  */
118 struct rt_selection_operation {
119 #define RT_SELECTION_NOP 0
120 #define RT_SELECTION_TRANSLATION 1
121  int type;
122  union {
125 };
126 
127 __END_DECLS
128 
129 #endif /* RT_VIEW_H */
130 
131 /*
132  * Local Variables:
133  * tab-width: 8
134  * mode: C
135  * indent-tabs-mode: t
136  * c-file-style: "stroustrup"
137  * End:
138  * ex: shiftwidth=4 tabstop=8
139  */
Header file for the BRL-CAD common definitions.
struct bu_hash_tbl bu_hash_tbl
Definition: hash.h:48
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 point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:355
Definition: ptbl.h:53
struct bu_hash_tbl * sets
Definition: view.h:83
struct rt_selection_translation tran
Definition: view.h:129
union rt_selection_operation::@13 parameters
point_t start
start point of query ray
Definition: view.h:96
vect_t dir
direction of query ray
Definition: view.h:97
struct bu_ptbl selections
holds struct rt_selection
Definition: view.h:63
void(* free_selection)(struct rt_selection *)
Definition: view.h:68
void * obj
primitive-specific selection object
Definition: view.h:54
fundamental vector, matrix, quaternion math macros