BRL-CAD
Loading...
Searching...
No Matches
sat.h
Go to the documentation of this file.
1/* S A T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2025 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/* @file sat.h */
22/** @addtogroup bg_sat */
23/** @{ */
24
25/**
26 * @brief
27 *
28 * Implementation of Separating Axis Theorem intersection tests
29 *
30 */
31
32#ifndef BG_SAT_H
33#define BG_SAT_H
34
35#include "common.h"
36#include "vmath.h"
37#include "bg/defines.h"
38
39__BEGIN_DECLS
40
41/**
42 * Test for an intersection between a line and an Axis-Aligned Bounding Box (AABB).
43 *
44 * Returns 1 if they intersect, 0 otherwise.
45 */
46BG_EXPORT extern int
48 point_t origin, vect_t ldir,
49 point_t aabb_center, vect_t aabb_extent
50 );
51
52/**
53 * Test for an intersection between a line and an Oriented Bounding Box (OBB).
54 *
55 * Returns 1 if they intersect, 0 otherwise.
56 */
57BG_EXPORT extern int
59 point_t origin, vect_t ldir,
60 point_t obb_center, vect_t obb_extent1, vect_t obb_extent2, vect_t obb_extent3
61 );
62
63/**
64 * Test for an intersection between a triangle and an Axis-Aligned Bounding Box (AABB).
65 *
66 * Returns 1 if they intersect, 0 otherwise.
67 */
68BG_EXPORT extern int
70 point_t v1, point_t v2, point_t v3,
71 point_t aabb_center, vect_t aabb_extent
72 );
73
74/**
75 * Test for an intersection between a triangle and an Oriented Bounding Box (OBB).
76 *
77 * Returns 1 if they intersect, 0 otherwise.
78 */
79BG_EXPORT extern int
81 point_t v1, point_t v2, point_t v3,
82 point_t obb_center, vect_t obb_extent1, vect_t obb_extent2, vect_t obb_extent3
83 );
84
85/**
86 * Test for an intersection between an Axis-Aligned Bounding Box (AABB) and an
87 * Oriented Bounding Box (OBB). The latter is defined by a center point and
88 * three perpendicular vectors from the center to the centers of the various
89 * faces.
90 *
91 * Returns 1 if they intersect, 0 otherwise.
92 */
93BG_EXPORT extern int
95 point_t aabb_min, point_t aabb_max,
96 point_t obb_center, vect_t obb_extent1, vect_t obb_extent2, vect_t obb_extent3
97 );
98
99/**
100 * Test for an intersection between two Oriented Bounding Boxes (OBBs). The
101 * boxes are defined by a center point and three perpendicular vectors from the
102 * center to the centers of the various faces.
103 *
104 * Returns 1 if they intersect, 0 otherwise.
105 */
106BG_EXPORT extern int
108 point_t obb1_center, vect_t obb1_extent1, vect_t obb1_extent2, vect_t obb1_extent3,
109 point_t obb2_center, vect_t obb2_extent1, vect_t obb2_extent2, vect_t obb2_extent3
110 );
111
112
113__END_DECLS
114
115#endif /* BG_SAT_H */
116/** @} */
117/*
118 * Local Variables:
119 * mode: C
120 * tab-width: 8
121 * indent-tabs-mode: t
122 * c-file-style: "stroustrup"
123 * End:
124 * ex: shiftwidth=4 tabstop=8
125 */
Header file for the BRL-CAD common definitions.
int bg_sat_tri_obb(point_t v1, point_t v2, point_t v3, point_t obb_center, vect_t obb_extent1, vect_t obb_extent2, vect_t obb_extent3)
int bg_sat_line_aabb(point_t origin, vect_t ldir, point_t aabb_center, vect_t aabb_extent)
Implementation of Separating Axis Theorem intersection tests.
int bg_sat_obb_obb(point_t obb1_center, vect_t obb1_extent1, vect_t obb1_extent2, vect_t obb1_extent3, point_t obb2_center, vect_t obb2_extent1, vect_t obb2_extent2, vect_t obb2_extent3)
int bg_sat_aabb_obb(point_t aabb_min, point_t aabb_max, point_t obb_center, vect_t obb_extent1, vect_t obb_extent2, vect_t obb_extent3)
int bg_sat_line_obb(point_t origin, vect_t ldir, point_t obb_center, vect_t obb_extent1, vect_t obb_extent2, vect_t obb_extent3)
int bg_sat_tri_aabb(point_t v1, point_t v2, point_t v3, point_t aabb_center, vect_t aabb_extent)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition vmath.h:349
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition vmath.h:355
fundamental vector, matrix, quaternion math macros