BRL-CAD
func.h
Go to the documentation of this file.
1 /* R T F U N C . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2010-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 rt_obj
21  *
22  * @brief Primitive manipulation functions from former functab
23  * callback table.
24  *
25  * As this is a relatively new set of interfaces, consider these
26  * functions preliminary (i.e. DEPRECATED) and subject to change until
27  * this message goes away.
28  *
29  */
30 #ifndef RT_FUNC_H
31 #define RT_FUNC_H
32 
33 #include "common.h"
34 
35 #include "bu/list.h"
36 #include "bu/parse.h"
37 #include "bu/vls.h"
38 #include "bg/plane.h"
39 #include "bn/tol.h"
40 #include "rt/defines.h"
41 #include "rt/application.h"
42 #include "rt/functab.h"
43 #include "rt/hit.h"
44 #include "rt/piece.h"
45 #include "rt/resource.h"
46 #include "rt/seg.h"
47 #include "rt/soltab.h"
48 #include "rt/tol.h"
49 #include "rt/db_internal.h"
50 #include "rt/db_instance.h"
51 #include "rt/rt_instance.h"
52 #include "rt/xray.h"
53 #include "pc.h"
54 
55 /** @{ */
56 /** @file rt/func.h */
57 
58 __BEGIN_DECLS
59 
60 /**
61  * prep an object for ray tracing
62  */
63 RT_EXPORT extern int rt_obj_prep(struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip);
64 
65 /**
66  * shoot a ray at an object that has been prepped for ray tracing
67  */
68 RT_EXPORT extern int rt_obj_shot(struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead);
69 
70 /**
71  * TBD.
72  */
73 RT_EXPORT extern int rt_obj_piece_shot(struct rt_piecestate *psp, struct rt_piecelist *plp, double dist_corr, struct xray *rp, struct application *ap, struct seg *seghead);
74 
75 /**
76  * TBD.
77  */
78 RT_EXPORT extern int rt_obj_piece_hitsegs(struct rt_piecestate *psp, struct seg *seghead, struct application *ap);
79 
80 /**
81  * print an objects parameters in debug/diagnostic form
82  */
83 RT_EXPORT extern int rt_obj_print(const struct soltab *stp);
84 
85 /**
86  * calculate a normal on an object that has been hit via rt_shot()
87  */
88 RT_EXPORT extern int rt_obj_norm(struct hit *hitp, struct soltab *stp, struct xray *rp);
89 
90 /**
91  * calculate object uv parameterization for a given hit point
92  */
93 RT_EXPORT extern int rt_obj_uv(struct application *ap, struct soltab *stp, struct hit *hitp, struct uvcoord *uvp);
94 
95 /**
96  * calculate object curvature for a given hit point
97  */
98 RT_EXPORT extern int rt_obj_curve(struct curvature *cvp, struct hit *hitp, struct soltab *stp);
99 
100 /**
101  * DEPRECATED: Unimplemented.
102  */
103 DEPRECATED RT_EXPORT extern int rt_obj_class(void);
104 
105 /**
106  * release the memory used by a solid
107  */
108 RT_EXPORT extern int rt_obj_free(struct soltab *stp);
109 
110 /**
111  * obtain a vlist wireframe representation of an object for plotting purposes
112  */
113 RT_EXPORT extern int rt_obj_plot(struct bu_list *vhead, struct rt_db_internal *ip, const struct bg_tess_tol *ttol, const struct bn_tol *tol);
114 
115 /**
116  * shoot an array of rays at a set of homogeneous objects.
117  */
118 RT_EXPORT extern int rt_obj_vshot(struct soltab *stp[], struct xray *rp[], struct seg *segp, int n, struct application *ap);
119 
120 /**
121  * tessellate an object (into NMG form)
122  */
123 RT_EXPORT extern int rt_obj_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct bg_tess_tol *ttol, const struct bn_tol *tol);
124 
125 /**
126  * tessellate an object (into NURBS NMG form)
127  */
128 RT_EXPORT extern int rt_obj_tnurb(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct bn_tol *tol);
129 
130 /**
131  * v4/v5 object import from disk
132  */
133 RT_EXPORT extern int rt_obj_import(struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip, struct resource *resp);
134 
135 /**
136  * v4/v5 object export to disk
137  */
138 RT_EXPORT extern int rt_obj_export(struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip, struct resource *resp);
139 
140 /**
141  * free the internal representation of an object
142  */
143 RT_EXPORT extern int rt_obj_ifree(struct rt_db_internal *ip);
144 
145 /**
146  * db object 'get' support, obtain a tcl list representation
147  */
148 RT_EXPORT extern int rt_obj_get(struct bu_vls *logstr, const struct rt_db_internal *ip, const char *attr);
149 
150 /**
151  * db object 'adjust' support, modify a tcl list representation
152  */
153 RT_EXPORT extern int rt_obj_adjust(struct bu_vls *logstr, struct rt_db_internal *ip, int argc, const char **argv);
154 
155 /**
156  * describe an object in text form (used by the 'l' command)
157  */
158 RT_EXPORT extern int rt_obj_describe(struct bu_vls *logstr, const struct rt_db_internal *ip, int verbose, double mm2local);
159 
160 /**
161  * create a 'default' object
162  */
163 RT_EXPORT extern int rt_obj_make(const struct rt_functab *ftp, struct rt_db_internal *ip);
164 
165 /**
166  * apply a matrix transformation to an object (translation, rotation, scale)
167  */
168 RT_EXPORT extern int rt_obj_xform(struct rt_db_internal *op, const mat_t mat, struct rt_db_internal *ip, int release, struct db_i *dbip);
169 
170 /**
171  * obtain parameters for an object in libpc form
172  */
173 RT_EXPORT extern int rt_obj_params(struct pc_pc_set *ps, const struct rt_db_internal *ip);
174 
175 /**
176  * mirror an object about a plane
177  */
178 RT_EXPORT extern int rt_obj_mirror(struct rt_db_internal *ip, const plane_t *plane);
179 
180 /**
181  * if `stp` is prepped, serialize; otherwise, deserialize from `external`
182  */
183 RT_EXPORT extern int rt_obj_prep_serialize(struct soltab *stp, const struct rt_db_internal *ip, struct bu_external *external, size_t *version);
184 
185 __END_DECLS
186 
187 #endif /* RT_FUNC_H */
188 
189 /** @} */
190 
191 /*
192  * Local Variables:
193  * tab-width: 8
194  * mode: C
195  * indent-tabs-mode: t
196  * c-file-style: "stroustrup"
197  * End:
198  * ex: shiftwidth=4 tabstop=8
199  */
Header file for the BRL-CAD common definitions.
void float float int * n
Definition: tig.h:74
#define DEPRECATED
Definition: common.h:401
DEPRECATED int rt_obj_class(void)
int rt_obj_tnurb(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct bn_tol *tol)
int rt_obj_params(struct pc_pc_set *ps, const struct rt_db_internal *ip)
int rt_obj_prep(struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
int rt_obj_export(struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip, struct resource *resp)
int rt_obj_ifree(struct rt_db_internal *ip)
int rt_obj_free(struct soltab *stp)
int rt_obj_import(struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip, struct resource *resp)
int rt_obj_print(const struct soltab *stp)
int rt_obj_make(const struct rt_functab *ftp, struct rt_db_internal *ip)
int rt_obj_mirror(struct rt_db_internal *ip, const plane_t *plane)
int rt_obj_adjust(struct bu_vls *logstr, struct rt_db_internal *ip, int argc, const char **argv)
int rt_obj_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct bg_tess_tol *ttol, const struct bn_tol *tol)
int rt_obj_curve(struct curvature *cvp, struct hit *hitp, struct soltab *stp)
int rt_obj_plot(struct bu_list *vhead, struct rt_db_internal *ip, const struct bg_tess_tol *ttol, const struct bn_tol *tol)
int rt_obj_norm(struct hit *hitp, struct soltab *stp, struct xray *rp)
int rt_obj_shot(struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead)
int rt_obj_vshot(struct soltab *stp[], struct xray *rp[], struct seg *segp, int n, struct application *ap)
int rt_obj_get(struct bu_vls *logstr, const struct rt_db_internal *ip, const char *attr)
int rt_obj_xform(struct rt_db_internal *op, const mat_t mat, struct rt_db_internal *ip, int release, struct db_i *dbip)
int rt_obj_describe(struct bu_vls *logstr, const struct rt_db_internal *ip, int verbose, double mm2local)
int rt_obj_uv(struct application *ap, struct soltab *stp, struct hit *hitp, struct uvcoord *uvp)
int rt_obj_piece_hitsegs(struct rt_piecestate *psp, struct seg *seghead, struct application *ap)
int rt_obj_prep_serialize(struct soltab *stp, const struct rt_db_internal *ip, struct bu_external *external, size_t *version)
int rt_obj_piece_shot(struct rt_piecestate *psp, struct rt_piecelist *plp, double dist_corr, struct xray *rp, struct application *ap, struct seg *seghead)
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:370
fastf_t plane_t[ELEMENTS_PER_PLANE]
Definition of a plane equation.
Definition: vmath.h:397
Definition: tol.h:72
Definition: list.h:132
Definition: vls.h:53
Definition: hit.h:118
Information about where a ray hits the surface.
Definition: hit.h:61
NMG topological model.
Definition: topology.h:289
NMG topological region.
Definition: topology.h:277
Definition: pc.h:106
Definition: seg.h:59
Definition: soltab.h:57
Definition: hit.h:152
Primary ray data structure.
Definition: xray.h:41