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 
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
facetT * top
Definition: libqhull.h:374
QhullRidge – Qhull&#39;s ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
ridgeT * getRidgeT() const
Definition: QhullRidge.h:85
A QhullFacet is the C++ equivalent to Qhull&#39;s facetT*.
Definition: QhullFacet.h:37
countT id() const
Definition: QhullFacet.h:73
qhT qh_qh
Definition: global.c:26
facetT * getFacetT() const
Definition: QhullFacet.h:71
QhullFacet bottomFacet() const
Definition: QhullRidge.h:82
facetT * bottom
Definition: libqhull.h:375
list v
Definition: obb.py:45
QhullRidge nextRidge3d(const QhullFacet &f) const
Definition: QhullRidge.h:95
QhullQh * qh_qh
QhullQh/qhT for ridgeT, may be 0.
Definition: QhullRidge.h:61
#define qh
Definition: libqhull.h:457
flagT nonconvex
Definition: libqhull.h:379
const PrintVertexSet print(const char *message) const
ostream & operator<<(ostream &os, const QhullRidge &r)
Definition: QhullRidge.cpp:90
Interface to Qhull from C++.
Definition: Qhull.h:43
countT id() const
Definition: QhullRidge.h:86
PrintRidge print(const char *message) const
Definition: QhullRidge.h:106
bool hasNextRidge3d(const QhullFacet &f) const
Definition: QhullRidge.cpp:49
ridgeT * qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp)
Definition: poly2.c:2368
flagT tested
Definition: libqhull.h:378
ridgeT * qh_ridge
Corresponding ridgeT, never 0.
Definition: QhullRidge.h:60
static ridgeT s_empty_ridge
Definition: QhullRidge.h:64
QhullVertexSet vertices() const
Definition: QhullRidge.h:97
QhullFacet topFacet() const
Definition: QhullRidge.h:91


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