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 
QhullFacet.h
orgQhull::QhullVertexSet
Definition: QhullVertexSet.h:33
orgQhull::QhullFacet::print
PrintFacet print(const char *message)
Definition: QhullFacet.h:125
orgQhull::QhullLinkedList< QhullFacet >::end
iterator end()
Definition: QhullLinkedList.h:124
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::QhullLinkedList::count
countT count() const
Definition: QhullLinkedList.h:254
orgQhull::QhullFacetList::QhullFacetList
QhullFacetList()
Disable default constructor. See QhullLinkedList.
orgQhull::QhullVertex
Definition: QhullVertex.h:48
QhullFacetList.h
facetT
Definition: libqhull.h:262
orgQhull::QhullLinkedListIterator::hasNext
bool hasNext() const
Definition: QhullLinkedList.h:211
orgQhull::QhullFacetList::isSelectAll
bool isSelectAll() const
Definition: QhullFacetList.h:76
orgQhull::QhullFacetList
Definition: QhullFacetList.h:41
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
orgQhull::QhullFacetList::toStdVector
std::vector< QhullFacet > toStdVector() const
Definition: QhullFacetList.cpp:43
QhullRidge.h
orgQhull::QhullFacetList::printVertices
PrintVertices printVertices() const
Definition: QhullFacetList.h:100
orgQhull::QhullLinkedListIterator::next
T next()
Definition: QhullLinkedList.h:213
orgQhull::QhullLinkedList::contains
bool contains(const T &t) const
Definition: QhullLinkedList.h:269
q
q
orgQhull::QhullLinkedList< QhullFacet >::begin
iterator begin()
Definition: QhullLinkedList.h:120
orgQhull::QhullFacet::isGood
bool isGood() const
Definition: QhullFacet.h:82
orgQhull::QhullFacet
A QhullFacet is the C++ equivalent to Qhull's facetT*.
Definition: QhullFacet.h:43
generate_distance_plot.b
float b
Definition: generate_distance_plot.py:7
QhullPoint.h
orgQhull::QhullFacetList::contains
bool contains(const QhullFacet &f) const
Definition: QhullFacetList.cpp:75
orgQhull::QhullLinkedList< QhullFacet >::first
const QhullFacet & first() const
Definition: QhullLinkedList.h:106
orgQhull::QhullLinkedListIterator
Definition: QhullLinkedList.h:200
orgQhull::QhullFacetList::qh
QhullQh * qh() const
Definition: QhullFacetList.h:77
orgQhull::QhullFacetList::printFacets
PrintFacets printFacets() const
Definition: QhullFacetList.h:94
orgQhull::QhullFacetList::vertices_toStdVector
std::vector< QhullVertex > vertices_toStdVector() const
Same as PrintVertices.
Definition: QhullFacetList.cpp:60
orgQhull::QhullLinkedList
Definition: QhullLinkedList.h:50
orgQhull::QhullSet::begin
iterator begin()
Definition: QhullSet.h:183
orgQhull::QhullFacetList::count
countT count() const
Filtered by facet.isGood(). May be 0 when !isEmpty().
Definition: QhullFacetList.cpp:90
QhullVertex.h
operator<<
ostream & operator<<(ostream &os, const QhullFacetList::PrintFacetList &pr)
Definition: QhullFacetList.cpp:132
orgQhull::QhullSet::end
iterator end()
Definition: QhullSet.h:187
obb.v
list v
Definition: obb.py:48


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58