BRL-CAD
bot.h
Go to the documentation of this file.
1/* B O T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 1993-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 rt_bot */
21/** @{ */
22/** @file rt/primitives/bot.h */
23
24#ifndef RT_PRIMITIVES_BOT_H
25#define RT_PRIMITIVES_BOT_H
26
27#include "common.h"
28#include "vmath.h"
29#include "bn/tol.h"
30#include "rt/geom.h"
31#include "rt/defines.h"
32#include "rt/tol.h"
33#include "rt/view.h"
34#include "rt/soltab.h"
35
36__BEGIN_DECLS
37#ifdef USE_OPENCL
38/* largest data members first */
39struct clt_bot_specific {
40 cl_ulong offsets[5]; /* header, bvh, tris, norms. */
41 cl_uint ntri;
42 cl_uchar orientation;
43 cl_uchar flags;
44 cl_uchar pad[2];
45};
46
47struct clt_tri_specific {
48 cl_double v0[3];
49 cl_double v1[3];
50 cl_double v2[3];
51 cl_int surfno;
52 cl_uchar pad[4];
53};
54#endif
55
56/* Shared between bot and ars at the moment */
58 unsigned char bot_mode;
59 unsigned char bot_orientation;
60 unsigned char bot_flags;
61 size_t bot_ntri;
64 void *bot_facelist; /* head of linked list */
65 void **bot_facearray; /* head of face array */
66 size_t bot_tri_per_piece; /* log # tri per piece. 1 << bot_ltpp is tri per piece */
67 void *tie; /* FIXME: horrible blind cast, points to one in rt_bot_internal */
68
69#ifdef USE_OPENCL
70 struct clt_bot_specific clt_header;
71 struct clt_tri_specific *clt_triangles;
72 cl_double *clt_normals;
73#endif
74};
75
76RT_EXPORT extern void rt_bot_prep_pieces(struct bot_specific *bot,
77 struct soltab *stp,
78 size_t ntri,
79 const struct bn_tol *tol);
80
81RT_EXPORT extern size_t rt_botface(struct soltab *stp,
82 struct bot_specific *bot,
83 fastf_t *ap,
84 fastf_t *bp,
85 fastf_t *cp,
86 size_t face_no,
87 const struct bn_tol *tol);
88
89
90/* bot.c */
91RT_EXPORT extern size_t rt_bot_get_edge_list(const struct rt_bot_internal *bot,
92 size_t **edge_list);
93RT_EXPORT extern int rt_bot_edge_in_list(const size_t v1,
94 const size_t v2,
95 const size_t edge_list[],
96 const size_t edge_count0);
97RT_EXPORT extern int rt_bot_plot(struct bu_list *vhead,
98 struct rt_db_internal *ip,
99 const struct bg_tess_tol *ttol,
100 const struct bn_tol *tol,
101 const struct bview *info);
102RT_EXPORT extern int rt_bot_plot_poly(struct bu_list *vhead,
103 struct rt_db_internal *ip,
104 const struct bg_tess_tol *ttol,
105 const struct bn_tol *tol);
106RT_EXPORT extern int rt_bot_find_v_nearest_pt2(const struct rt_bot_internal *bot,
107 const point_t pt2,
108 const mat_t mat);
109RT_EXPORT extern int rt_bot_find_e_nearest_pt2(int *vert1, int *vert2, const struct rt_bot_internal *bot, const point_t pt2, const mat_t mat);
110RT_EXPORT extern fastf_t rt_bot_propget(struct rt_bot_internal *bot,
111 const char *property);
112RT_EXPORT extern int rt_bot_vertex_fuse(struct rt_bot_internal *bot,
113 const struct bn_tol *tol);
114RT_EXPORT extern int rt_bot_face_fuse(struct rt_bot_internal *bot);
115RT_EXPORT extern int rt_bot_condense(struct rt_bot_internal *bot);
116RT_EXPORT extern int rt_bot_smooth(struct rt_bot_internal *bot,
117 const char *bot_name,
118 struct db_i *dbip,
119 fastf_t normal_tolerance_angle);
120RT_EXPORT extern int rt_bot_flip(struct rt_bot_internal *bot);
121RT_EXPORT extern int rt_bot_sync(struct rt_bot_internal *bot);
122RT_EXPORT extern struct rt_bot_list * rt_bot_split(struct rt_bot_internal *bot);
123RT_EXPORT extern struct rt_bot_list * rt_bot_patches(struct rt_bot_internal *bot);
124RT_EXPORT extern void rt_bot_list_free(struct rt_bot_list *headRblp,
125 int fbflag);
126
127RT_EXPORT extern int rt_bot_same_orientation(const int *a,
128 const int *b);
129
130RT_EXPORT extern int rt_bot_tess(struct nmgregion **r,
131 struct model *m,
132 struct rt_db_internal *ip,
133 const struct bg_tess_tol *ttol,
134 const struct bn_tol *tol);
135
136RT_EXPORT extern struct rt_bot_internal * rt_bot_merge(size_t num_bots, const struct rt_bot_internal * const *bots);
137
138
139/* defined in bot.c */
140/* TODO - these global variables need to be rolled in to the rt_i structure */
141RT_EXPORT extern size_t rt_bot_minpieces;
142RT_EXPORT extern size_t rt_bot_tri_per_piece;
143RT_EXPORT extern int rt_bot_sort_faces(struct rt_bot_internal *bot,
144 size_t tris_per_piece);
145RT_EXPORT extern int rt_bot_decimate(struct rt_bot_internal *bot,
146 fastf_t max_chord_error,
147 fastf_t max_normal_error,
148 fastf_t min_edge_length);
149RT_EXPORT extern size_t rt_bot_decimate_gct(struct rt_bot_internal *bot, fastf_t feature_size);
150
151
152/** @} */
153
154__END_DECLS
155
156#endif /* RT_PRIMITIVES_BOT_H */
157
158/*
159 * Local Variables:
160 * tab-width: 8
161 * mode: C
162 * indent-tabs-mode: t
163 * c-file-style: "stroustrup"
164 * End:
165 * ex: shiftwidth=4 tabstop=8
166 */
Header file for the BRL-CAD common definitions.
void rt_bot_prep_pieces(struct bot_specific *bot, struct soltab *stp, size_t ntri, const struct bn_tol *tol)
int rt_bot_sync(struct rt_bot_internal *bot)
fastf_t rt_bot_propget(struct rt_bot_internal *bot, const char *property)
int rt_bot_edge_in_list(const size_t v1, const size_t v2, const size_t edge_list[], const size_t edge_count0)
int rt_bot_decimate(struct rt_bot_internal *bot, fastf_t max_chord_error, fastf_t max_normal_error, fastf_t min_edge_length)
size_t rt_bot_get_edge_list(const struct rt_bot_internal *bot, size_t **edge_list)
int rt_bot_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_bot_sort_faces(struct rt_bot_internal *bot, size_t tris_per_piece)
size_t rt_bot_minpieces
int rt_bot_smooth(struct rt_bot_internal *bot, const char *bot_name, struct db_i *dbip, fastf_t normal_tolerance_angle)
int rt_bot_condense(struct rt_bot_internal *bot)
struct rt_bot_internal * rt_bot_merge(size_t num_bots, const struct rt_bot_internal *const *bots)
int rt_bot_flip(struct rt_bot_internal *bot)
int rt_bot_plot(struct bu_list *vhead, struct rt_db_internal *ip, const struct bg_tess_tol *ttol, const struct bn_tol *tol, const struct bview *info)
int rt_bot_find_e_nearest_pt2(int *vert1, int *vert2, const struct rt_bot_internal *bot, const point_t pt2, const mat_t mat)
void rt_bot_list_free(struct rt_bot_list *headRblp, int fbflag)
struct rt_bot_list * rt_bot_split(struct rt_bot_internal *bot)
int rt_bot_vertex_fuse(struct rt_bot_internal *bot, const struct bn_tol *tol)
int rt_bot_face_fuse(struct rt_bot_internal *bot)
int rt_bot_same_orientation(const int *a, const int *b)
struct rt_bot_list * rt_bot_patches(struct rt_bot_internal *bot)
int rt_bot_plot_poly(struct bu_list *vhead, struct rt_db_internal *ip, const struct bg_tess_tol *ttol, const struct bn_tol *tol)
int rt_bot_find_v_nearest_pt2(const struct rt_bot_internal *bot, const point_t pt2, const mat_t mat)
size_t rt_botface(struct soltab *stp, struct bot_specific *bot, fastf_t *ap, fastf_t *bp, fastf_t *cp, size_t face_no, const struct bn_tol *tol)
size_t rt_bot_tri_per_piece
size_t rt_bot_decimate_gct(struct rt_bot_internal *bot, fastf_t feature_size)
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
Definition: tol.h:72
fastf_t * bot_thickness
Definition: bot.h:62
unsigned char bot_flags
Definition: bot.h:60
void * bot_facelist
Definition: bot.h:64
void * tie
Definition: bot.h:67
unsigned char bot_orientation
Definition: bot.h:59
size_t bot_ntri
Definition: bot.h:61
size_t bot_tri_per_piece
Definition: bot.h:66
unsigned char bot_mode
Definition: bot.h:58
void ** bot_facearray
Definition: bot.h:65
struct bu_bitv * bot_facemode
Definition: bot.h:63
Definition: bitv.h:108
Definition: list.h:131
Definition: defines.h:476
NMG topological model.
Definition: topology.h:289
NMG topological region.
Definition: topology.h:277
struct rt_bot_internal * bot
Definition: geom.h:835
Definition: soltab.h:56
fundamental vector, matrix, quaternion math macros