QhullFacetSet.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/QhullFacetSet.cpp#2 $$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 #ifndef QHULL_NO_STL
19 using std::vector;
20 #endif
21 
22 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
23 #pragma warning( disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
24 #pragma warning( disable : 4996) // function was declared deprecated(strcpy, localtime, etc.)
25 #endif
26 
27 namespace orgQhull {
28 
29 #
30 
31 // See qt-qhull.cpp for QList conversions
32 
33 #ifndef QHULL_NO_STL
34 std::vector<QhullFacet> QhullFacetSet::
35 toStdVector() const
36 {
38  std::vector<QhullFacet> vs;
39  while(i.hasNext()){
40  QhullFacet f= i.next();
41  if(isSelectAll() || f.isGood()){
42  vs.push_back(f);
43  }
44  }
45  return vs;
46 }//toStdVector
47 #endif //QHULL_NO_STL
48 
49 #
50 
51 bool QhullFacetSet::
52 contains(const QhullFacet &facet) const
53 {
54  if(isSelectAll()){
55  return QhullSet<QhullFacet>::contains(facet);
56  }
57  for(QhullFacetSet::const_iterator i=begin(); i != end(); ++i){
58  QhullFacet f= *i;
59  if(f==facet && f.isGood()){
60  return true;
61  }
62  }
63  return false;
64 }//contains
65 
67 count() const
68 {
69  if(isSelectAll()){
71  }
72  int counter= 0;
73  for(QhullFacetSet::const_iterator i=begin(); i != end(); ++i){
74  QhullFacet f= *i;
75  if(f.isGood()){
76  counter++;
77  }
78  }
79  return counter;
80 }//count
81 
83 count(const QhullFacet &facet) const
84 {
85  if(isSelectAll()){
86  return QhullSet<QhullFacet>::count(facet);
87  }
88  int counter= 0;
89  for(QhullFacetSet::const_iterator i=begin(); i != end(); ++i){
90  QhullFacet f= *i;
91  if(f==facet && f.isGood()){
92  counter++;
93  }
94  }
95  return counter;
96 }//count
97 
98 }//namespace orgQhull
99 
100 #
101 
102 using std::endl;
103 using std::ostream;
106 
107 ostream &
108 operator<<(ostream &os, const QhullFacetSet &fs)
109 {
110  os << fs.print("");
111  return os;
112 }//<<QhullFacetSet
113 
114 ostream &
115 
116 operator<<(ostream &os, const QhullFacetSet::PrintFacetSet &pr)
117 {
118  os << pr.print_message;
119  QhullFacetSet fs= *pr.facet_set;
120  for(QhullFacetSet::iterator i=fs.begin(); i != fs.end(); ++i){
121  QhullFacet f= *i;
122  if(fs.isSelectAll() || f.isGood()){
123  os << f;
124  }
125  }
126  return os;
127 }//<< QhullFacetSet::PrintFacetSet
128 
130 ostream &
131 operator<<(ostream &os, const QhullFacetSet::PrintIdentifiers &p)
132 {
133  os << p.print_message;
134  for(QhullFacetSet::const_iterator i=p.facet_set->begin(); i!=p.facet_set->end(); ++i){
135  const QhullFacet f= *i;
136  if(f.getFacetT()==qh_MERGEridge){
137  os << " MERGE";
138  }else if(f.getFacetT()==qh_DUPLICATEridge){
139  os << " DUP";
140  }else if(p.facet_set->isSelectAll() || f.isGood()){
141  os << " f" << f.id();
142  }
143  }
144  os << endl;
145  return os;
146 }//<<QhullFacetSet::PrintIdentifiers
147 
orgQhull::QhullFacetSet::count
countT count() const
Filtered by facet.isGood(). May be 0 when !isEmpty().
Definition: QhullFacetSet.cpp:67
QhullFacet.h
qh_DUPLICATEridge
#define qh_DUPLICATEridge
Definition: poly.h:46
orgQhull::QhullFacetSet
Definition: QhullFacetSet.h:33
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::QhullFacetSet::contains
bool contains(const QhullFacet &f) const
Definition: QhullFacetSet.cpp:52
orgQhull::QhullFacetSet::print
const PrintFacetSet print(const char *message) const
Definition: QhullFacetSet.h:84
QhullFacetSet.h
orgQhull::QhullSetIterator
Faster then interator/const_iterator due to T::base_type.
Definition: QhullSet.h:289
orgQhull::QhullFacetSet::isSelectAll
bool isSelectAll() const
Definition: QhullFacetSet.h:71
orgQhull::QhullSet::contains
bool contains(const T &t) const
Definition: QhullSet.h:385
operator<<
ostream & operator<<(ostream &os, const QhullFacetSet &fs)
Definition: QhullFacetSet.cpp:108
QhullRidge.h
orgQhull::QhullSetBase::count
countT count() const
Definition: QhullSet.h:72
qh_MERGEridge
#define qh_MERGEridge
Definition: poly.h:57
orgQhull::QhullFacetSet::toStdVector
std::vector< QhullFacet > toStdVector() const
Definition: QhullFacetSet.cpp:35
orgQhull::QhullFacet::id
countT id() const
Definition: QhullFacet.h:79
orgQhull::QhullFacet::getFacetT
facetT * getFacetT() const
Definition: QhullFacet.h:77
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
QhullPoint.h
orgQhull::QhullSetIterator::next
T next()
Definition: QhullSet.h:317
orgQhull::QhullSet< QhullFacet >::begin
iterator begin()
Definition: QhullSet.h:183
QhullVertex.h
orgQhull::QhullSet< QhullFacet >::end
iterator end()
Definition: QhullSet.h:187
orgQhull::QhullSetIterator::hasNext
bool hasNext() const
Definition: QhullSet.h:315


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:14