KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
g_hull.h
Go to the documentation of this file.
1 /* $Id: g_hull.h 11900 2012-03-11 20:02:34Z jguan1 $ */
2 /* =========================================================================== *
3  |
4  | Copyright (c) 1994-2011 by Kobus Barnard (author)
5  |
6  | Personal and educational use of this code is granted, provided that this
7  | header is kept intact, and that the authorship is not misrepresented, that
8  | its use is acknowledged in publications, and relevant papers are cited.
9  |
10  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
11  |
12  | Please note that the code in this file has not necessarily been adequately
13  | tested. Naturally, there is no guarantee of performance, support, or fitness
14  | for any particular task. Nonetheless, I am interested in hearing about
15  | problems that you encounter.
16  |
17  | Author: Jinyan Guan
18  * =========================================================================== */
19 
20 #ifndef KJB_G_CPP_WRAP_HULL_H
21 #define KJB_G_CPP_WRAP_HULL_H
22 
23 #include <h/h_hull.h>
24 #include <h/h_ave.h>
25 
26 #include <m_cpp/m_matrix.h>
27 
28 #include <vector>
29 
30 namespace kjb
31 {
39 (
40  const Matrix& points,
41  Matrix& hull_vertices,
42  std::vector<Matrix>& hull_facets
43 );
44 
49 bool intersect_hulls
50 (
51  const std::vector<Matrix>& pts,
52  Matrix& hull_vertices,
53  std::vector<Matrix>& hull_facets
54 );
55 
59 inline
61 {
62  using namespace kjb_c;
63  double volume = 0.0;
64  Hull* hp = NULL;
65  kjb_c::Vector* ave_hull = NULL;
66  EPETE(get_convex_hull(&hp, points.get_c_matrix(), DEFAULT_HULL_OPTIONS));
67  EPETE(get_hull_CM_and_volume(hp, &ave_hull, &volume));
68 
69  free_vector(ave_hull);
70  free_hull(hp);
71  return volume;
72 }
73 } //namespace kjb
74 
75 #endif
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
bool intersect_hulls(const std::vector< Matrix > &pts, Matrix &hull_vertices, std::vector< Matrix > &hull_facets)
Compute the intersections of the vector of points.
Definition: g_hull.cpp:58
double get_convex_hull_volume(const kjb::Matrix &points)
Get the volume of the convex hull of points.
Definition: g_hull.h:60
const Impl_type * get_c_matrix() const
Get const pointer to the underlying kjb_c::Matrix C struct.
Definition: m_matrix.h:601
int get_convex_hull(const kjb::Matrix &points, Matrix &hull_vertices, std::vector< Matrix > &hull_facets)
Get the convex hull of points hull_vertices stores the vertices of the convex hull hull_facets stores...
Definition: g_hull.cpp:29
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
struct memorypool points
Definition: triangle.c:637