BRL-CAD
aabb_ray.h
Go to the documentation of this file.
1 /* A A B B _ R A Y . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-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 
21 /*----------------------------------------------------------------------*/
22 /* @file aabb_ray.h */
23 /** @addtogroup bg_aabb_ray */
24 /** @{ */
25 
26 /**
27  * @brief
28  *
29  * Intersection between a ray and an axis-aligned box.
30  *
31  */
32 
33 #ifndef BG_AABB_RAY_H
34 #define BG_AABB_RAY_H
35 
36 #include "common.h"
37 #include "vmath.h"
38 #include "bg/defines.h"
39 
40 __BEGIN_DECLS
41 
42 /* Compute the inverse of the direction cosines */
43 BG_EXPORT extern void
44 bg_ray_invdir(vect_t *invdir, vect_t dir);
45 
46 BG_EXPORT extern int
48  fastf_t *r_min, // first hit point
49  fastf_t *r_max, // second hit point
50  point_t opt, // ray origin
51  const fastf_t *invdir, // inverses of dir[]
52  const fastf_t *aabb_min, // AABB first point
53  const fastf_t *aabb_max // AABB second point
54  );
55 
56 __END_DECLS
57 
58 #endif /* BG_AABB_RAY_H */
59 /** @} */
60 /*
61  * Local Variables:
62  * mode: C
63  * tab-width: 8
64  * indent-tabs-mode: t
65  * c-file-style: "stroustrup"
66  * End:
67  * ex: shiftwidth=4 tabstop=8
68  */
Header file for the BRL-CAD common definitions.
int bg_isect_aabb_ray(fastf_t *r_min, fastf_t *r_max, point_t opt, const fastf_t *invdir, const fastf_t *aabb_min, const fastf_t *aabb_max)
void bg_ray_invdir(vect_t *invdir, vect_t dir)
Intersection between a ray and an axis-aligned box.
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
fundamental vector, matrix, quaternion math macros