BRL-CAD
obr.h
Go to the documentation of this file.
1 /* O B R . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 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 obr.h */
23 /** @addtogroup obr */
24 /** @{ */
25 
26 /**
27  * @brief Routines for the computation of oriented bounding rectangles 2D and 3D
28  */
29 
30 #ifndef BN_OBR_H
31 #define BN_OBR_H
32 
33 #include "common.h"
34 #include "vmath.h"
35 #include "bn/defines.h"
36 
38 
39 /**
40  *@brief
41  * Uses the Rotating Calipers algorithm to find the
42  * minimum oriented bounding rectangle for a set of 2D
43  * points. Returns 0 on success.
44  *
45  * The box will be described by a center point and 2
46  * vectors:
47  *
48  * \verbatim
49  * ----------------------------
50  * | ^ |
51  * | | |
52  * | v | |
53  * | | |
54  * | *------------>|
55  * | center u |
56  * | |
57  * | |
58  * ----------------------------
59  * \endverbatim
60  *
61  * Note that the box is oriented, and thus not necessarily axis
62  * aligned (u and v are perpendicular, but not necessarily parallel
63  * with the coordinate space V=0 and U=0 axis vectors.)
64  *
65  * @param[out] center center of oriented bounding rectangle
66  * @param[out] u vector in the direction of obr x with
67  * vector length of 0.5 * obr length
68  * @param[out] v vector in the obr y direction with vector
69  * length of 0.5 * obr width
70  * @param points_2d array of 2D points
71  * @param pnt_cnt number of points in pnts array
72  */
73 BN_EXPORT extern int bn_2d_obr(point2d_t *center,
74  vect2d_t *u,
75  vect2d_t *v,
76  const point2d_t *points_2d,
77  int pnt_cnt);
78 
79 /**
80  *@brief
81  * Uses the Rotating Calipers algorithm to find the
82  * minimum oriented bounding rectangle for a set of coplanar 3D
83  * points. Returns 0 on success.
84  *
85  * @param[out] center center of oriented bounding rectangle
86  * @param[out] v1 vector in the direction of obr x with
87  * vector length of 0.5 * obr length
88  * @param[out] v2 vector in the obr y direction with vector
89  * length of 0.5 * obr width
90  * @param points_3d array of coplanar 3D points
91  * @param pnt_cnt number of points in pnts array
92  */
93 BN_EXPORT extern int bn_3d_coplanar_obr(point_t *center,
94  vect_t *v1,
95  vect_t *v2,
96  const point_t *points_3d,
97  int pnt_cnt);
98 
100 
101 #endif /* BN_OBR_H */
102 /** @} */
103 /*
104  * Local Variables:
105  * mode: C
106  * tab-width: 8
107  * indent-tabs-mode: t
108  * c-file-style: "stroustrup"
109  * End:
110  * ex: shiftwidth=4 tabstop=8
111  */
Header file for the BRL-CAD common definitions.
int bn_3d_coplanar_obr(point_t *center, vect_t *v1, vect_t *v2, const point_t *points_3d, int pnt_cnt)
Uses the Rotating Calipers algorithm to find the minimum oriented bounding rectangle for a set of cop...
Definition: obr.c:496
int bn_2d_obr(point2d_t *center, vect2d_t *u, vect2d_t *v, const point2d_t *points_2d, int pnt_cnt)
Routines for the computation of oriented bounding rectangles 2D and 3D.
Definition: obr.c:470
#define __BEGIN_DECLS
Definition: common.h:73
#define __END_DECLS
Definition: common.h:74