BRL-CAD
xray.h
Go to the documentation of this file.
1 /* X R A Y . H
2  * BRL-CAD
3  *
4  * Copyright (c) 1993-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_xray
21  * @brief All necessary information about a ray.
22  */
23 /** @{ */
24 /** @file xray.h */
25 
26 #ifndef RT_XRAY_H
27 #define RT_XRAY_H
28 
29 #include "common.h"
30 #include "bu/list.h"
31 #include "vmath.h"
32 
33 __BEGIN_DECLS
34 #define CORNER_PTS 4
35 
36 /**
37  * @brief Primary ray data structure
38  *
39  * Not called just "ray" to prevent conflicts with VLD stuff.
40  */
41 struct xray {
42  uint32_t magic;
43  int index; /**< @brief Which ray of a bundle */
44  point_t r_pt; /**< @brief Point at which ray starts */
45  vect_t r_dir; /**< @brief Direction of ray (UNIT Length) */
46  fastf_t r_min; /**< @brief entry dist to bounding sphere */
47  fastf_t r_max; /**< @brief exit dist from bounding sphere */
48 };
49 #define RAY_NULL ((struct xray *)0)
50 #define RT_CK_RAY(_p) BU_CKMAG(_p, RT_RAY_MAGIC, "struct xray");
51 
52 /**
53  * This plural xrays structure is a bu_list based container designed
54  * to hold a list or bundle of xray(s). This bundle is utilized by
55  * rt_shootrays() through its application bundle input.
56  */
57 struct xrays
58 {
59  struct bu_list l;
60  struct xray ray;
61 };
62 
63 /**
64  * This structure is intended to describe the area and/or volume
65  * represented by a ray. In the case of the "rt" program it
66  * represents the extent in model coordinates of the prism behind the
67  * pixel being rendered.
68  *
69  * The r_pt values of the rays indicate the dimensions and location in
70  * model space of the ray origin (usually the pixel to be rendered).
71  * The r_dir vectors indicate the edges (and thus the shape) of the
72  * prism which is formed from the projection of the pixel into space.
73  */
74 struct pixel_ext {
75  uint32_t magic;
76  struct xray corner[CORNER_PTS];
77 };
78 /* This should have had an RT_ prefix */
79 #define BU_CK_PIXEL_EXT(_p) BU_CKMAG(_p, PIXEL_EXT_MAGIC, "struct pixel_ext")
80 
81 
82 __END_DECLS
83 
84 #endif /* RT_XRAY_H */
85 /** @} */
86 /*
87  * Local Variables:
88  * tab-width: 8
89  * mode: C
90  * indent-tabs-mode: t
91  * c-file-style: "stroustrup"
92  * End:
93  * ex: shiftwidth=4 tabstop=8
94  */
Header file for the BRL-CAD common definitions.
#define CORNER_PTS
Definition: xray.h:34
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:349
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:334
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:355
Definition: list.h:132
Definition: xray.h:74
struct xray corner[CORNER_PTS]
Definition: xray.h:76
uint32_t magic
Definition: xray.h:75
Primary ray data structure.
Definition: xray.h:41
point_t r_pt
Point at which ray starts.
Definition: xray.h:44
fastf_t r_max
exit dist from bounding sphere
Definition: xray.h:47
uint32_t magic
Definition: xray.h:42
int index
Which ray of a bundle.
Definition: xray.h:43
vect_t r_dir
Direction of ray (UNIT Length)
Definition: xray.h:45
fastf_t r_min
entry dist to bounding sphere
Definition: xray.h:46
Definition: xray.h:58
struct xray ray
Definition: xray.h:60
struct bu_list l
Definition: xray.h:59
fundamental vector, matrix, quaternion math macros