BRL-CAD
op.h
Go to the documentation of this file.
1/* O P . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2014-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 op.h
21 *
22 * Routines for detecting, using, and managing boolean operators.
23 *
24 */
25
26#ifndef RT_OP_H
27#define RT_OP_H
28
29#include "rt/defines.h"
30
31__BEGIN_DECLS
32
33/**
34 * Boolean operations between solids.
35 */
36#define MKOP(x) (x)
37
38#define OP_SOLID MKOP(1) /**< @brief Leaf: tr_stp -> solid */
39#define OP_UNION MKOP(2) /**< @brief Binary: L union R */
40#define OP_INTERSECT MKOP(3) /**< @brief Binary: L intersect R */
41#define OP_SUBTRACT MKOP(4) /**< @brief Binary: L subtract R */
42#define OP_XOR MKOP(5) /**< @brief Binary: L xor R, not both*/
43#define OP_REGION MKOP(6) /**< @brief Leaf: tr_stp -> combined_tree_state */
44#define OP_NOP MKOP(7) /**< @brief Leaf with no effect */
45/* Internal to library routines */
46#define OP_NOT MKOP(8) /**< @brief Unary: not L */
47#define OP_GUARD MKOP(9) /**< @brief Unary: not L, or else! */
48#define OP_XNOP MKOP(10) /**< @brief Unary: L, mark region */
49#define OP_NMG_TESS MKOP(11) /**< @brief Leaf: tr_stp -> nmgregion */
50/* LIBWDB import/export interface to combinations */
51#define OP_DB_LEAF MKOP(12) /**< @brief Leaf of combination, db fmt */
52#define OP_FREE MKOP(13) /**< @brief Unary: L has free chain */
53
54
55typedef enum {
59 DB_OP_INTERSECT = '+'
61
62/**
63 * Give a single char, translate it to a db_op_t. If it does not
64 * correspond to a known operator, DB_OP_NULL is returned
65 */
66RT_EXPORT db_op_t
67db_char2op(const char c);
68
69/**
70 * Get the next CSG boolean operator found in a given string.
71 *
72 * Skipping any whitespace, this routine returns the CSG boolean
73 * operation in canonical (single-byte enumeration) form. It will
74 * attempt to recognize operators in various unicode formats if the
75 * input string contains mixed encodings.
76 */
77RT_EXPORT db_op_t
78db_str2op(const char *str);
79
80__END_DECLS
81
82#endif /* RT_OP_H */
83
84/*
85 * Local Variables:
86 * tab-width: 8
87 * mode: C
88 * indent-tabs-mode: t
89 * c-file-style: "stroustrup"
90 * End:
91 * ex: shiftwidth=4 tabstop=8
92 */
void int * c
Definition: tig.h:139
db_op_t db_str2op(const char *str)
db_op_t
Definition: op.h:55
@ DB_OP_UNION
Definition: op.h:57
@ DB_OP_NULL
Definition: op.h:56
@ DB_OP_INTERSECT
Definition: op.h:59
@ DB_OP_SUBTRACT
Definition: op.h:58
db_op_t db_char2op(const char c)