BRL-CAD
Oriented Bounding Rectangles/Rectangular Cuboids
Collaboration diagram for Oriented Bounding Rectangles/Rectangular Cuboids:

Functions

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. More...
 
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 coplanar 3D points. Returns 0 on success. More...
 

Detailed Description

Function Documentation

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.

Uses the Rotating Calipers algorithm to find the minimum oriented bounding rectangle for a set of 2D points. Returns 0 on success.

The box will be described by a center point and 2 vectors:

* ----------------------------
* |            ^             |
* |            |             |
* |         v  |             |
* |            |             |
* |            *------------>|
* |         center     u     |
* |                          |
* |                          |
* ----------------------------
* 

Note that the box is oriented, and thus not necessarily axis aligned (u and v are perpendicular, but not necessarily parallel with the coordinate space V=0 and U=0 axis vectors.)

Parameters
[out]centercenter of oriented bounding rectangle
[out]uvector in the direction of obr x with vector length of 0.5 * obr length
[out]vvector in the obr y direction with vector length of 0.5 * obr width
points_2darray of 2D points
pnt_cntnumber of points in pnts array

Definition at line 470 of file obr.c.

References bn_obr_calc(), obr_vals::center, obr_vals::extent0, obr_vals::extent1, obr_vals::u, and obr_vals::v.

Referenced by bn_3d_coplanar_obr(), and main().

Here is the call graph for this function:

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 coplanar 3D points. Returns 0 on success.

Parameters
[out]centercenter of oriented bounding rectangle
[out]v1vector in the direction of obr x with vector length of 0.5 * obr length
[out]v2vector in the obr y direction with vector length of 0.5 * obr width
points_3darray of coplanar 3D points
pnt_cntnumber of points in pnts array

Definition at line 496 of file obr.c.

References bn_2d_obr(), bu_calloc(), bu_free(), coplanar_2d_coord_sys(), coplanar_2d_to_3d(), and coplanar_3d_to_2d().

Referenced by main(), and nmg_brep_face().

Here is the call graph for this function: