QhullVertexSet.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2009-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/libqhullcpp/QhullVertexSet.cpp#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #
10 
12 
14 #include "libqhullcpp/QhullPoint.h"
15 #include "libqhullcpp/QhullRidge.h"
17 #include "libqhullcpp/Qhull.h"
18 
19 using std::string;
20 using std::vector;
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  /* setjmp should not be implemented with 'catch' */
25 #endif
26 
27 namespace orgQhull {
28 
30 QhullVertexSet(const Qhull &q, facetT *facetlist, setT *facetset, bool allfacets)
31 : QhullSet<QhullVertex>(q.qh(), 0)
32 , qhsettemp_defined(false)
33 {
34  QH_TRY_(q.qh()){ // no object creation -- destructors skipped on longjmp()
35  setT *vertices= qh_facetvertices(q.qh(), facetlist, facetset, allfacets);
36  defineAs(vertices);
37  qhsettemp_defined= true;
38  }
39  q.qh()->NOerrexit= true;
40  q.qh()->maybeThrowQhullMessage(QH_TRY_status);
41 }//QhullVertexSet facetlist facetset
42 
46 QhullVertexSet(QhullQh *qqh, facetT *facetlist, setT *facetset, bool allfacets)
47 : QhullSet<QhullVertex>(qqh, 0)
48 , qhsettemp_defined(false)
49 {
50  QH_TRY_(qh()){ // no object creation -- destructors skipped on longjmp()
51  setT *vertices= qh_facetvertices(qh(), facetlist, facetset, allfacets);
52  defineAs(vertices);
53  qhsettemp_defined= true;
54  }
55  qh()->NOerrexit= true;
56  qh()->maybeThrowQhullMessage(QH_TRY_status);
57 }//QhullVertexSet facetlist facetset
58 
65 : QhullSet<QhullVertex>(other)
66 , qhsettemp_defined(false)
67 {
68  if(other.qhsettemp_defined){
69  throw QhullError(10077, "QhullVertexSet: Cannot use copy constructor since qhsettemp_defined (e.g., QhullVertexSet for a set and/or list of QhFacet). Contains %d vertices", other.count());
70  }
71 }//copy constructor
72 
77 {
79  qhsettemp_defined= false;
80  if(other.qhsettemp_defined){
81  throw QhullError(10078, "QhullVertexSet: Cannot use copy constructor since qhsettemp_defined (e.g., QhullVertexSet for a set and/or list of QhFacet). Contains %d vertices", other.count());
82  }
83  return *this;
84 }//assignment
85 
88 {
90  qhsettemp_defined= false;
91  QH_TRY_(qh()){ // no object creation -- destructors skipped on longjmp()
92  qh_settempfree(qh(), referenceSetT()); // errors if not top of tempstack or if qhmem corrupted
93  }
94  qh()->NOerrexit= true;
96  }
97 }//freeQhSetTemp
98 
101 {
102  freeQhSetTemp();
103 }//~QhullVertexSet
104 
105 //FIXUP -- Move conditional, QhullVertexSet code to QhullVertexSet.cpp
106 #ifndef QHULL_NO_STL
107 std::vector<QhullVertex> QhullVertexSet::
108 toStdVector() const
109 {
111  std::vector<QhullVertex> vs;
112  while(i.hasNext()){
113  QhullVertex v= i.next();
114  vs.push_back(v);
115  }
116  return vs;
117 }//toStdVector
118 #endif //QHULL_NO_STL
119 
120 }//namespace orgQhull
121 
122 #
123 
124 using std::endl;
125 using std::ostream;
130 
132 ostream &
133 operator<<(ostream &os, const QhullVertexSet::PrintIdentifiers &pr)
134 {
135  os << pr.print_message;
136  for(QhullVertexSet::const_iterator i= pr.vertex_set->begin(); i!=pr.vertex_set->end(); ++i){
137  const QhullVertex v= *i;
138  os << " v" << v.id();
139  }
140  os << endl;
141  return os;
142 }//<<QhullVertexSet::PrintIdentifiers
143 
145 ostream &
146 operator<<(ostream &os, const QhullVertexSet::PrintVertexSet &pr){
147 
148  os << pr.print_message;
149  const QhullVertexSet *vs= pr.vertex_set;
150  QhullVertexSetIterator i= *vs;
151  while(i.hasNext()){
152  const QhullVertex v= i.next();
153  const QhullPoint p= v.point();
154  os << " p" << p.id() << "(v" << v.id() << ")";
155  }
156  os << endl;
157 
158  return os;
159 }//<< PrintVertexSet
160 
161 
orgQhull::QhullVertexSet::qhsettemp_defined
bool qhsettemp_defined
Definition: QhullVertexSet.h:37
orgQhull::QhullVertexSet
Definition: QhullVertexSet.h:33
orgQhull::QhullPoint::id
countT id() const
Definition: QhullPoint.h:97
QH_TRY_
#define QH_TRY_(qh)
Definition: QhullQh.h:31
orgQhull::QhullVertexSet::toStdVector
std::vector< QhullVertex > toStdVector() const
Definition: QhullVertexSet.cpp:108
orgQhull::QhullVertexSet::freeQhSetTemp
void freeQhSetTemp()
Definition: QhullVertexSet.cpp:87
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::QhullPoint
Definition: QhullPoint.h:39
orgQhull::QhullError::NOthrow
@ NOthrow
Definition: QhullError.h:33
Qhull.h
orgQhull::QhullVertex
Definition: QhullVertex.h:48
QhullVertexSet.h
orgQhull::QhullSetIterator
Faster then interator/const_iterator due to T::base_type.
Definition: QhullSet.h:289
orgQhull::QhullSetBase::qh
QhullQh * qh() const
Definition: QhullSet.h:77
facetT
Definition: libqhull.h:262
orgQhull::QhullVertexSet::QhullVertexSet
QhullVertexSet()
Default constructor disabled. Will implement allocation later.
operator<<
ostream & operator<<(ostream &os, const QhullVertexSet::PrintIdentifiers &pr)
Print Vertex identifiers to stream. Space prefix. From qh_printVertexheader [io_r....
Definition: QhullVertexSet.cpp:133
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
setT
Definition: qset.h:83
QhullRidge.h
orgQhull::QhullSet::count
countT count(const T &t) const
Definition: QhullSet.h:395
orgQhull::QhullVertexSetIterator
QhullSetIterator< QhullVertex > QhullVertexSetIterator
Definition: QhullVertexSet.h:30
qh
#define qh
Definition: libqhull.h:457
orgQhull::QhullSet
Definition: QhullSet.h:105
qhT::NOerrexit
boolT NOerrexit
Definition: libqhull.h:737
orgQhull::QhullQh
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
orgQhull::QhullVertexSet::~QhullVertexSet
~QhullVertexSet()
Definition: QhullVertexSet.cpp:100
orgQhull::QhullVertexSet::operator=
QhullVertexSet & operator=(const QhullVertexSet &other)
Definition: QhullVertexSet.cpp:76
q
q
QhullPoint.h
qh_facetvertices
setT * qh_facetvertices(facetT *facetlist, setT *facets, boolT allfacets)
Definition: io.c:801
qh_settempfree
void qh_settempfree(setT **set)
Definition: qset.c:1174
orgQhull::QhullError
Definition: QhullError.h:26
orgQhull::QhullSetIterator::next
T next()
Definition: QhullSet.h:317
QhullVertex.h
orgQhull::QhullSet::operator=
QhullSet< T > & operator=(const QhullSet< T > &other)
Definition: QhullSet.h:126
orgQhull::QhullQh::maybeThrowQhullMessage
void maybeThrowQhullMessage(int exitCode)
Definition: QhullQh.cpp:118
obb.v
list v
Definition: obb.py:48
orgQhull::QhullSetIterator::hasNext
bool hasNext() const
Definition: QhullSet.h:315
orgQhull::QhullSetBase::referenceSetT
setT ** referenceSetT()
Definition: QhullSet.h:78


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