QhullFacetList.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/libqhullcpp/QhullFacetList.cpp#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #
10 
12 
13 #include "libqhullcpp/QhullFacet.h"
14 #include "libqhullcpp/QhullPoint.h"
15 #include "libqhullcpp/QhullRidge.h"
17 
18 using std::string;
19 using std::vector;
20 
21 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
22 #pragma warning( disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
23 #pragma warning( disable : 4996) // function was declared deprecated(strcpy, localtime, etc.)
24 #endif
25 
26 namespace orgQhull {
27 
28 #
29 
31 QhullFacetList(const Qhull &q, facetT *b, facetT *e )
33 , select_all(false)
34 {
35 }
36 
37 #
38 
39 // See qt_qhull.cpp for QList conversions
40 
41 #ifndef QHULL_NO_STL
42 std::vector<QhullFacet> QhullFacetList::
43 toStdVector() const
44 {
46  std::vector<QhullFacet> vs;
47  while(i.hasNext()){
48  QhullFacet f= i.next();
49  if(isSelectAll() || f.isGood()){
50  vs.push_back(f);
51  }
52  }
53  return vs;
54 }//toStdVector
55 #endif //QHULL_NO_STL
56 
57 #ifndef QHULL_NO_STL
58 std::vector<QhullVertex> QhullFacetList::
61 {
62  std::vector<QhullVertex> vs;
63  QhullVertexSet qvs(qh(), first().getFacetT(), 0, isSelectAll());
64 
65  for(QhullVertexSet::iterator i=qvs.begin(); i!=qvs.end(); ++i){
66  vs.push_back(*i);
67  }
68  return vs;
69 }//vertices_toStdVector
70 #endif //QHULL_NO_STL
71 
72 #
73 
75 contains(const QhullFacet &facet) const
76 {
77  if(isSelectAll()){
79  }
80  for(QhullFacetList::const_iterator i=begin(); i != end(); ++i){
81  QhullFacet f= *i;
82  if(f==facet && f.isGood()){
83  return true;
84  }
85  }
86  return false;
87 }//contains
88 
90 count() const
91 {
92  if(isSelectAll()){
94  }
95  int counter= 0;
96  for(QhullFacetList::const_iterator i=begin(); i != end(); ++i){
97  if((*i).isGood()){
98  counter++;
99  }
100  }
101  return counter;
102 }//count
103 
105 count(const QhullFacet &facet) const
106 {
107  if(isSelectAll()){
109  }
110  int counter= 0;
111  for(QhullFacetList::const_iterator i=begin(); i != end(); ++i){
112  QhullFacet f= *i;
113  if(f==facet && f.isGood()){
114  counter++;
115  }
116  }
117  return counter;
118 }//count
119 
120 }//namespace orgQhull
121 
122 #
123 
124 using std::endl;
125 using std::ostream;
130 
131 ostream &
132 operator<<(ostream &os, const QhullFacetList::PrintFacetList &pr)
133 {
134  os << pr.print_message;
135  QhullFacetList fs= *pr.facet_list;
136  os << "Vertices for " << fs.count() << " facets" << endl;
137  os << fs.printVertices();
138  os << fs.printFacets();
139  return os;
140 }//operator<<
141 
143 ostream &
144 operator<<(ostream &os, const QhullFacetList::PrintFacets &pr)
145 {
146  for(QhullFacetList::const_iterator i= pr.facet_list->begin(); i != pr.facet_list->end(); ++i){
147  QhullFacet f= *i;
148  if(pr.facet_list->isSelectAll() || f.isGood()){
149  os << f.print("");
150  }
151  }
152  return os;
153 }//printFacets
154 
157 ostream &
158 operator<<(ostream &os, const QhullFacetList::PrintVertices &pr)
159 {
160  QhullVertexSet vs(pr.facet_list->qh(), pr.facet_list->first().getFacetT(), NULL, pr.facet_list->isSelectAll());
161  for(QhullVertexSet::iterator i=vs.begin(); i!=vs.end(); ++i){
162  QhullVertex v= *i;
163  os << v.print("");
164  }
165  return os;
166 }//printVertices
167 
168 std::ostream &
169 operator<<(ostream &os, const QhullFacetList &fs)
170 {
171  os << fs.printFacets();
172  return os;
173 }//QhullFacetList
174 
std::vector< QhullFacet > toStdVector() const
QhullFacetList()
Disable default constructor. See QhullLinkedList.
iterator begin()
Definition: QhullSet.h:177
QhullRidge – Qhull&#39;s ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
A QhullFacet is the C++ equivalent to Qhull&#39;s facetT*.
Definition: QhullFacet.h:37
list v
Definition: obb.py:45
PrintVertex print(const char *message) const
Definition: QhullVertex.h:96
countT count() const
Filtered by facet.isGood(). May be 0 when !isEmpty().
bool contains(const QhullFacet &f) const
ostream & operator<<(ostream &os, const QhullFacetList::PrintFacetList &pr)
PrintFacets printFacets() const
Interface to Qhull from C++.
Definition: Qhull.h:43
iterator end()
Definition: QhullSet.h:181
QhullQh * qh() const
bool contains(const T &t) const
PrintVertices printVertices() const
PrintFacet print(const char *message)
Definition: QhullFacet.h:119
std::vector< QhullVertex > vertices_toStdVector() const
Same as PrintVertices.
bool isGood() const
Definition: QhullFacet.h:76


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:02