BRL-CAD
lseg.h
Go to the documentation of this file.
1 /* L S E G . 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 lseg.h */
23 /** @addtogroup bg_lseg */
24 /** @{ */
25 
26 /**
27  * @brief Functions for working with line segments
28  */
29 
30 #ifndef BG_LSEG_H
31 #define BG_LSEG_H
32 
33 #include "common.h"
34 #include "vmath.h"
35 #include "bg/defines.h"
36 
37 __BEGIN_DECLS
38 
39 /* Compute the closest point on the line segment P0->P1 to point Q. Returns
40  * the distance squared from Q to the closest point and the closest point in
41  * question if c is non-NULL.
42  */
43 BG_EXPORT double
44 bg_distsq_lseg3_pt(point_t *c, const point_t P0, const point_t P1, const point_t Q);
45 
46 /* Compute the closest points on the line segments P0->P1 and Q0->Q1. Returns
47  * the distance squared between the closest points and (optionally) the closest
48  * points in question (c1 is the point on P0->P1, c2 is the point on Q0->Q1).
49  */
50 BG_EXPORT double
52  const point_t P0, const point_t P1, const point_t Q0, const point_t Q1);
53 
54 __END_DECLS
55 
56 #endif /* BG_LSEG_H */
57 /** @} */
58 /*
59  * Local Variables:
60  * mode: C
61  * tab-width: 8
62  * indent-tabs-mode: t
63  * c-file-style: "stroustrup"
64  * End:
65  * ex: shiftwidth=4 tabstop=8
66  */
Header file for the BRL-CAD common definitions.
double bg_distsq_lseg3_pt(point_t *c, const point_t P0, const point_t P1, const point_t Q)
Functions for working with line segments.
double bg_distsq_lseg3_lseg3(point_t *c1, point_t *c2, const point_t P0, const point_t P1, const point_t Q0, const point_t Q1)
void int * c
Definition: tig.h:139
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:355
fundamental vector, matrix, quaternion math macros