BRL-CAD
defines.h
Go to the documentation of this file.
1/* D E F I N E S . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2011-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_defines
21 *
22 * Common definitions for LIBRT
23 *
24 */
25
26/** @{ */
27/** @file rt/defines.h */
28
29#ifndef RT_DEFINES_H
30#define RT_DEFINES_H
31
32#ifndef RT_EXPORT
33# if defined(RT_DLL_EXPORTS) && defined(RT_DLL_IMPORTS)
34# error "Only RT_DLL_EXPORTS or RT_DLL_IMPORTS can be defined, not both."
35# elif defined(RT_DLL_EXPORTS)
36# define RT_EXPORT COMPILER_DLLEXPORT
37# elif defined(RT_DLL_IMPORTS)
38# define RT_EXPORT COMPILER_DLLIMPORT
39# else
40# define RT_EXPORT
41# endif
42#endif
43
44#include "common.h"
45
46#ifdef USE_OPENCL
47#include <limits.h>
48#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
49#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
50
51#define CL_TARGET_OPENCL_VERSION 120
52
53#ifdef __APPLE__
54#include <OpenCL/cl.h>
55#else
56#include <CL/cl.h>
57#endif
58
59#ifndef CL_VERSION_1_2
60# error "OpenCL 1.2 required."
61#endif
62
63#ifdef CLT_SINGLE_PRECISION
64#define cl_double cl_float
65#define cl_double3 cl_float3
66#define cl_double4 cl_float4
67#define cl_double16 cl_float16
68#endif
69#endif
70
71#include "bg/defines.h"
72
73/*
74 * Values for Solid ID.
75 */
76#define ID_NULL 0 /**< @brief Unused */
77#define ID_TOR 1 /**< @brief Toroid */
78#define ID_TGC 2 /**< @brief Generalized Truncated General Cone */
79#define ID_ELL 3 /**< @brief Ellipsoid */
80#define ID_ARB8 4 /**< @brief Generalized ARB. V + 7 vectors */
81#define ID_ARS 5 /**< @brief ARS */
82#define ID_HALF 6 /**< @brief Half-space */
83#define ID_REC 7 /**< @brief Right Elliptical Cylinder [TGC special] */
84#define ID_POLY 8 /**< @brief Polygonal faceted object */
85#define ID_BSPLINE 9 /**< @brief B-spline object */
86#define ID_SPH 10 /**< @brief Sphere */
87#define ID_NMG 11 /**< @brief n-Manifold Geometry solid */
88#define ID_EBM 12 /**< @brief Extruded bitmap solid */
89#define ID_VOL 13 /**< @brief 3-D Volume */
90#define ID_ARBN 14 /**< @brief ARB with N faces */
91#define ID_PIPE 15 /**< @brief Pipe (wire) solid */
92#define ID_PARTICLE 16 /**< @brief Particle system solid */
93#define ID_RPC 17 /**< @brief Right Parabolic Cylinder */
94#define ID_RHC 18 /**< @brief Right Hyperbolic Cylinder */
95#define ID_EPA 19 /**< @brief Elliptical Paraboloid */
96#define ID_EHY 20 /**< @brief Elliptical Hyperboloid */
97#define ID_ETO 21 /**< @brief Elliptical Torus */
98#define ID_GRIP 22 /**< @brief Pseudo Solid Grip */
99#define ID_JOINT 23 /**< @brief Pseudo Solid/Region Joint */
100#define ID_HF 24 /**< @brief Height Field */
101#define ID_DSP 25 /**< @brief Displacement map */
102#define ID_SKETCH 26 /**< @brief 2D sketch */
103#define ID_EXTRUDE 27 /**< @brief Solid of extrusion */
104#define ID_SUBMODEL 28 /**< @brief Instanced submodel */
105#define ID_CLINE 29 /**< @brief FASTGEN4 CLINE solid */
106#define ID_BOT 30 /**< @brief Bag o' triangles */
107
108/* Add a new primitive id above here (this is will break v5 format)
109 * NOTE: must update the non-geometric object id's below the
110 * ADD_BELOW_HERE marker
111 */
112#define ID_MAX_SOLID 47 /**< @brief Maximum defined ID_xxx for solids */
113
114/*
115 * Non-geometric objects
116 */
117#define ID_COMBINATION 31 /**< @brief Combination Record */
118#define ID_UNUSED1 32 /**< @brief UNUSED (placeholder) */
119#define ID_BINUNIF 33 /**< @brief Uniform-array binary */
120#define ID_UNUSED2 34 /**< @brief UNUSED (placeholder) */
121#define ID_CONSTRAINT 39 /**< @brief Constraint object */
122#define ID_MATERIAL 46 /**< @brief Material object */
123
124/* - ADD_BELOW_HERE - */
125/* superellipsoid should be 31, but is not v5 compatible */
126#define ID_SUPERELL 35 /**< @brief Superquadratic ellipsoid */
127#define ID_METABALL 36 /**< @brief Metaball */
128#define ID_BREP 37 /**< @brief B-rep object */
129#define ID_HYP 38 /**< @brief Hyperboloid of one sheet */
130#define ID_REVOLVE 40 /**< @brief Solid of Revolution */
131#define ID_PNTS 41 /**< @brief Collection of Points */
132#define ID_ANNOT 42 /**< @brief Annotation */
133#define ID_HRT 43 /**< @brief Heart */
134#define ID_DATUM 44 /**< @brief Datum references */
135#define ID_SCRIPT 45 /**< @brief Script */
136#define ID_MAXIMUM 47 /**< @brief Maximum defined ID_xxx value */
137
138/**
139 * DEPRECATED: external applications should use other LIBRT API to
140 * access database objects.
141 *
142 * The directory is organized as forward linked lists hanging off of
143 * one of RT_DBNHASH headers in the db_i structure.
144 *
145 * FIXME: this should not be public API, push container and iteration
146 * down into LIBRT. External applications should not use this.
147 */
148#define RT_DBNHASH 8192 /**< @brief hash table is an
149 * array of linked lists with
150 * this many array pointer
151 * elements (Memory use for
152 * 32-bit: 32KB, 64-bit: 64KB)
153 */
154
155#if ((RT_DBNHASH)&((RT_DBNHASH)-1)) != 0
156/**
157 * DEPRECATED: external applications should use other LIBRT API to
158 * access database objects.
159 */
160#define RT_DBHASH(sum) ((size_t)(sum) % (RT_DBNHASH))
161#else
162/**
163 * DEPRECATED: external applications should use other LIBRT API to
164 * access database objects.
165 */
166#define RT_DBHASH(sum) ((size_t)(sum) & ((RT_DBNHASH)-1))
167#endif
168
169/* Used to set globals declared in bot.c */
170#define RT_DEFAULT_MINPIECES 32
171#define RT_DEFAULT_TRIS_PER_PIECE 4
172#define RT_DEFAULT_MINTIE 0 /* TODO: find the best value */
173
174
175#define BACKING_DIST (-2.0) /**< @brief mm to look behind start point */
176#define OFFSET_DIST 0.01 /**< @brief mm to advance point into box */
177
178/**
179 * FIXME: These should probably be vmath macros
180 */
181#define RT_BADNUM(n) (!((n) >= -INFINITY && (n) <= INFINITY))
182#define RT_BADVEC(v) (RT_BADNUM((v)[X]) || RT_BADNUM((v)[Y]) || RT_BADNUM((v)[Z]))
183
184/* FIXME: this is a dubious define that should be removed */
185#define RT_MAXLINE 10240
186
187#define RT_PART_NUBSPT 0
188
189#endif /* RT_DEFINES_H */
190
191/** @} */
192
193/*
194 * Local Variables:
195 * tab-width: 8
196 * mode: C
197 * indent-tabs-mode: t
198 * c-file-style: "stroustrup"
199 * End:
200 * ex: shiftwidth=4 tabstop=8
201 */
Header file for the BRL-CAD common definitions.