QhullRidge.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/QhullRidge.cpp#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #
10 
11 #include "libqhullcpp/QhullRidge.h"
12 
13 #include "libqhullcpp/QhullSets.h"
15 #include "libqhullcpp/Qhull.h"
16 
17 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
18 #pragma warning( disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
19 #pragma warning( disable : 4996) // function was declared deprecated(strcpy, localtime, etc.)
20 #endif
21 
22 namespace orgQhull {
23 
24 #
25 ridgeT QhullRidge::
26 s_empty_ridge= {0,0,0,0,0,
27  0,0};
28 
29 #
30 
31 QhullRidge::QhullRidge(const Qhull &q)
32 : qh_ridge(&s_empty_ridge)
33 , qh_qh(q.qh())
34 {
35 }//Default
36 
38 : qh_ridge(r ? r : &s_empty_ridge)
39 , qh_qh(q.qh())
40 {
41 }//ridgeT
42 
43 #
44 
45 bool QhullRidge::
49 hasNextRidge3d(const QhullFacet &f) const
50 {
51  if(!qh_qh){
52  return false;
53  }
54  vertexT *v= 0;
55  // Does not call qh_errexit(), TRY_QHULL_ not needed
56  ridgeT *ridge= qh_nextridge3d(getRidgeT(), f.getFacetT(), &v);
57  return (ridge!=0);
58 }//hasNextRidge3d
59 
63 nextRidge3d(const QhullFacet &f, QhullVertex *nextVertex) const
64 {
65  vertexT *v= 0;
66  ridgeT *ridge= 0;
67  if(qh_qh){
68  // Does not call qh_errexit(), TRY_QHULL_ not needed
69  ridge= qh_nextridge3d(getRidgeT(), f.getFacetT(), &v);
70  if(!ridge){
71  throw QhullError(10030, "Qhull error nextRidge3d: missing next ridge for facet %d ridge %d. Does facet contain ridge?", f.id(), id());
72  }
73  }
74  if(nextVertex!=0){
75  *nextVertex= QhullVertex(qh_qh, v);
76  }
77  return QhullRidge(qh_qh, ridge);
78 }//nextRidge3d
79 
80 }//namespace orgQhull
81 
82 #
83 
84 using std::endl;
85 using std::ostream;
88 
89 ostream &
90 operator<<(ostream &os, const QhullRidge &r)
91 {
92  os << r.print("");
93  return os;
94 }//<< QhullRidge
95 
97 ostream &
98 operator<<(ostream &os, const QhullRidge::PrintRidge &pr)
99 {
100  if(*pr.print_message){
101  os << pr.print_message << " ";
102  }else{
103  os << " - ";
104  }
105  QhullRidge r= *pr.ridge;
106  os << "r" << r.id();
107  if(r.getRidgeT()->tested){
108  os << " tested";
109  }
110  if(r.getRidgeT()->nonconvex){
111  os << " nonconvex";
112  }
113  os << endl;
114  os << r.vertices().print(" vertices:");
115  if(r.getRidgeT()->top && r.getRidgeT()->bottom){
116  os << " between f" << r.topFacet().id() << " and f" << r.bottomFacet().id() << endl;
117  }else if(r.getRidgeT()->top){
118  os << " top f" << r.topFacet().id() << endl;
119  }else if(r.getRidgeT()->bottom){
120  os << " bottom f" << r.bottomFacet().id() << endl;
121  }
122 
123  return os;
124 }//<< PrintRidge
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::QhullRidge::QhullRidge
QhullRidge()
Definition: QhullRidge.h:89
Qhull.h
orgQhull::QhullVertex
Definition: QhullVertex.h:48
octree.r
r
Definition: octree.py:9
qh_nextridge3d
ridgeT * qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp)
Definition: poly2.c:2368
orgQhull::QhullRidge::getRidgeT
ridgeT * getRidgeT() const
Definition: QhullRidge.h:104
qh_qh
qhT qh_qh
Definition: global.c:26
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
QhullRidge.h
orgQhull::QhullRidge
Definition: QhullRidge.h:58
qh
#define qh
Definition: libqhull.h:457
ridgeT
Definition: libqhull.h:371
orgQhull::QhullFacet::id
countT id() const
Definition: QhullFacet.h:79
q
q
orgQhull::QhullFacet::getFacetT
facetT * getFacetT() const
Definition: QhullFacet.h:77
orgQhull::QhullFacet
A QhullFacet is the C++ equivalent to Qhull's facetT*.
Definition: QhullFacet.h:43
orgQhull::QhullRidge::nextRidge3d
QhullRidge nextRidge3d(const QhullFacet &f) const
Definition: QhullRidge.h:114
vertexT
Definition: libqhull.h:396
orgQhull::QhullRidge::qh_qh
QhullQh * qh_qh
QhullQh/qhT for ridgeT, may be 0.
Definition: QhullRidge.h:80
orgQhull::QhullError
Definition: QhullError.h:26
QhullVertex.h
QhullSets.h
orgQhull::QhullRidge::hasNextRidge3d
bool hasNextRidge3d(const QhullFacet &f) const
Definition: QhullRidge.cpp:55
obb.v
list v
Definition: obb.py:48
operator<<
ostream & operator<<(ostream &os, const QhullRidge &r)
Definition: QhullRidge.cpp:90


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