BRL-CAD
util.h
Go to the documentation of this file.
1/* G C V _ U T I L . 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/** @file gcv/util.h
21 *
22 * Utility functions provided by the LIBGCV geometry conversion
23 * library.
24 *
25 */
26
27#ifndef GCV_UTIL_H
28#define GCV_UTIL_H
29
30#include "common.h"
31
32#include "gcv/defines.h"
33
34#include "rt/geom.h"
35#include "rt/tree.h"
36
37
38__BEGIN_DECLS
39
40
41/*
42 * Tessellate the object at the specified path.
43 */
44struct rt_bot_internal *gcv_facetize(struct db_i *db, const struct db_full_path *path, const struct bn_tol *tol, const struct bg_tess_tol *tess_tol);
45
46
47/*
48 * Topological test for determining whether the given BoT satisfies
49 * the conditions for solidity.
50 *
51 * Equivalent to gcv_bot_is_closed_fan() && gcv_bot_is_orientable()
52 */
53GCV_EXPORT extern int gcv_bot_is_solid(const struct rt_bot_internal *bot);
54
55GCV_EXPORT extern int gcv_bot_is_closed_fan(const struct rt_bot_internal *bot);
56
57GCV_EXPORT extern int gcv_bot_is_orientable(const struct rt_bot_internal *bot);
58
59
60/**
61 * write_region is a function pointer to a routine that will
62 * write out the region in a given file format.
63 *
64 * This routine must be prepared to run in parallel.
65 */
67{
68 void (*write_region)(struct nmgregion *r, const struct db_full_path *pathp, struct db_tree_state *tsp, void *client_data);
70};
71
72/**
73 * Perform Boolean evaluation on a tree of tessellated leaf nodes.
74 *
75 * Usually specified as the db_walk_tree() region_end callback,
76 * calling this routine for each positive region encountered.
77 *
78 * The client_data parameter is expected to point to a struct gcv_region_end_data.
79 */
80GCV_EXPORT extern union tree *gcv_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data);
81
82/**
83 * Exact same as gcv_region_end, except using the marching cubes algorithm.
84 */
85GCV_EXPORT extern union tree *gcv_region_end_mc(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data);
86
87
88GCV_EXPORT extern union tree *gcv_bottess_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data);
89
90
91GCV_EXPORT extern union tree *gcv_bottess(int argc, const char **argv, struct db_i *dbip, struct bg_tess_tol *ttol);
92
93
94__END_DECLS
95
96#endif /* GCV_UTIL_H */
97
98/*
99 * Local Variables:
100 * tab-width: 8
101 * mode: C
102 * indent-tabs-mode: t
103 * c-file-style: "stroustrup"
104 * End:
105 * ex: shiftwidth=4 tabstop=8
106 */
Header file for the BRL-CAD common definitions.
union tree * gcv_region_end_mc(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data)
int gcv_bot_is_orientable(const struct rt_bot_internal *bot)
union tree * gcv_bottess(int argc, const char **argv, struct db_i *dbip, struct bg_tess_tol *ttol)
union tree * gcv_bottess_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data)
struct rt_bot_internal * gcv_facetize(struct db_i *db, const struct db_full_path *path, const struct bn_tol *tol, const struct bg_tess_tol *tess_tol)
union tree * gcv_region_end(struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data)
int gcv_bot_is_solid(const struct rt_bot_internal *bot)
int gcv_bot_is_closed_fan(const struct rt_bot_internal *bot)
Definition: tol.h:72
void * client_data
Definition: util.h:69
void(* write_region)(struct nmgregion *r, const struct db_full_path *pathp, struct db_tree_state *tsp, void *client_data)
Definition: util.h:68
NMG topological region.
Definition: topology.h:277
Definition: tree.h:147