BRL-CAD
tri_tri.h
Go to the documentation of this file.
1/* T R I _ T R I . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-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
21/*----------------------------------------------------------------------*/
22/* @file tri_tri.h */
23/** @addtogroup bg_tri_tri */
24/** @{ */
25
26/**
27 * @brief
28 * Tomas Möller's triangle/triangle intersection routines from the article
29 *
30 * "A Fast Triangle-Triangle Intersection Test",
31 * Journal of Graphics Tools, 2(2), 1997
32 */
33
34#ifndef BG_TRI_TRI_H
35#define BG_TRI_TRI_H
36
37#include "common.h"
38#include "vmath.h"
39#include "bg/defines.h"
40
41__BEGIN_DECLS
42
43BG_EXPORT extern int bg_tri_tri_isect_coplanar(point_t V0,
44 point_t V1,
45 point_t V2,
46 point_t U0,
47 point_t U1,
48 point_t U2,
49 int area_flag);
50
51/* Experimental */
52BG_EXPORT extern int bg_tri_tri_isect_coplanar2(point_t V0,
53 point_t V1,
54 point_t V2,
55 point_t U0,
56 point_t U1,
57 point_t U2,
58 int area_flag);
59
60
61/* Return 1 if the triangles intersect, else 0 */
62BG_EXPORT extern int bg_tri_tri_isect(point_t V0,
63 point_t V1,
64 point_t V2,
65 point_t U0,
66 point_t U1,
67 point_t U2);
68
69/* Return 1 if the triangles intersect, else 0. coplanar flag
70 * is set if the triangles are coplanar, and isectpts are set
71 * to the start and end points of the line segment describing
72 * the triangle intersections. If the intersection is a point,
73 * isectpt2 will be the same point as isectpt1. */
74BG_EXPORT extern int bg_tri_tri_isect_with_line(point_t V0,
75 point_t V1,
76 point_t V2,
77 point_t U0,
78 point_t U1,
79 point_t U2,
80 int *coplanar,
81 point_t *isectpt1,
82 point_t *isectpt2);
83
84__END_DECLS
85
86#endif /* BG_TRI_TRI_H */
87/** @} */
88/*
89 * Local Variables:
90 * mode: C
91 * tab-width: 8
92 * indent-tabs-mode: t
93 * c-file-style: "stroustrup"
94 * End:
95 * ex: shiftwidth=4 tabstop=8
96 */
Header file for the BRL-CAD common definitions.
int bg_tri_tri_isect_coplanar(point_t V0, point_t V1, point_t V2, point_t U0, point_t U1, point_t U2, int area_flag)
Tomas Möller's triangle/triangle intersection routines from the article.
int bg_tri_tri_isect_with_line(point_t V0, point_t V1, point_t V2, point_t U0, point_t U1, point_t U2, int *coplanar, point_t *isectpt1, point_t *isectpt2)
int bg_tri_tri_isect_coplanar2(point_t V0, point_t V1, point_t V2, point_t U0, point_t U1, point_t U2, int area_flag)
int bg_tri_tri_isect(point_t V0, point_t V1, point_t V2, point_t U0, point_t U1, point_t U2)
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
fundamental vector, matrix, quaternion math macros