QhullQh.h
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/QhullQh.h#1 $$Change: 1981 $
5 ** $DateTime: 2015/09/28 20:26:32 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #ifndef QHULLQH_H
10 #define QHULLQH_H
11 
12 extern "C" {
13  #include "libqhull_r/qhull_ra.h"
14 }
15 
16 #include <string>
17 
18 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
19 #pragma warning( disable : 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
20 /* setjmp should not be implemented with 'catch' */
21 #endif
22 
28 
29 #define QH_TRY_ERROR 10071
30 
31 #define QH_TRY_(qh) \
32  int QH_TRY_status; \
33  if(qh->NOerrexit){ \
34  qh->NOerrexit= False; \
35  QH_TRY_status= setjmp(qh->errexit); \
36  }else{ \
37  throw QhullError(QH_TRY_ERROR, "Cannot invoke QH_TRY_() from inside a QH_TRY_. Or missing 'qh->NOerrexit=true' after previously called QH_TRY_(qh){...}"); \
38  } \
39  if(!QH_TRY_status)
40 
41 #define QH_TRY_NO_THROW_(qh) \
42  int QH_TRY_status; \
43  if(qh->NOerrexit){ \
44  qh->NOerrexit= False; \
45  QH_TRY_status= setjmp(qh->errexit); \
46  }else{ \
47  QH_TRY_status= QH_TRY_ERROR; \
48  } \
49  if(!QH_TRY_status)
50 
51 namespace orgQhull {
52 
53 #
54  class QhullQh;
56 
58 class QhullQh : public qhT {
59 
60 #
61 
62 #
63 private:
65  std::string qhull_message;
66  std::ostream * error_stream;
67  std::ostream * output_stream;
68  double factor_epsilon;
70 
71  friend void ::qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt, ... );
72 
73  static const double default_factor_epsilon;
74 
75 #
76 public:
77  QhullQh();
78  ~QhullQh();
79 private:
81  QhullQh(const QhullQh &);
82  QhullQh & operator=(const QhullQh &);
83 public:
84 
85 #
86  double factorEpsilon() const { return factor_epsilon; }
87  void setFactorEpsilon(double a) { factor_epsilon= a; }
88  void disableOutputStream() { use_output_stream= false; }
89  void enableOutputStream() { use_output_stream= true; }
90 
91 #
92  void appendQhullMessage(const std::string &s);
93  void clearQhullMessage();
94  std::string qhullMessage() const;
95  bool hasOutputStream() const { return use_output_stream; }
96  bool hasQhullMessage() const;
97  void maybeThrowQhullMessage(int exitCode);
98  void maybeThrowQhullMessage(int exitCode, int noThrow) throw();
99  int qhullStatus() const;
100  void setErrorStream(std::ostream *os);
101  void setOutputStream(std::ostream *os);
102 
103 #
104  double angleEpsilon() const { return this->ANGLEround*factor_epsilon; }
105  void checkAndFreeQhullMemory();
106  double distanceEpsilon() const { return this->DISTround*factor_epsilon; }
107 
108 };//class QhullQh
109 
110 }//namespace orgQhull
111 
112 #endif // QHULLQH_H
int qhullStatus() const
Definition: QhullQh.cpp:167
Definition: libqhull.h:465
void setFactorEpsilon(double a)
Definition: QhullQh.h:87
double distanceEpsilon() const
Epsilon for distance to hyperplane.
Definition: QhullQh.h:106
QhullRidge – Qhull&#39;s ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
void enableOutputStream()
Definition: QhullQh.h:89
bool hasQhullMessage() const
hasQhullMessage does not throw errors (~Qhull)
Definition: QhullQh.cpp:111
void maybeThrowQhullMessage(int exitCode)
Definition: QhullQh.cpp:118
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
QhullQh & operator=(const QhullQh &)
void qh_fprintf(FILE *fp, int msgcode, const char *fmt,...)
Definition: userprintf.c:42
int qhull_status
qh_ERRnone if valid
Definition: QhullQh.h:64
std::ostream * error_stream
overrides errorMessage, use appendQhullMessage()
Definition: QhullQh.h:66
realT DISTround
Definition: libqhull.h:630
std::ostream * output_stream
send output to stream
Definition: QhullQh.h:67
#define qh
Definition: libqhull.h:457
void clearQhullMessage()
clearQhullMessage does not throw errors (~Qhull)
Definition: QhullQh.cpp:102
bool use_output_stream
True if using output_stream.
Definition: QhullQh.h:69
std::string qhullMessage() const
qhullMessage does not throw errors (~Qhull)
Definition: QhullQh.cpp:157
void setOutputStream(std::ostream *os)
Updates use_output_stream.
Definition: QhullQh.cpp:180
QhullQh()
Derived from qh_new_qhull[user.c].
Definition: QhullQh.cpp:42
fmt
Definition: obb.py:126
static const double default_factor_epsilon
Default factor_epsilon is 1.0, never updated.
Definition: QhullQh.h:73
void disableOutputStream()
Definition: QhullQh.h:88
bool hasOutputStream() const
Definition: QhullQh.h:95
double factor_epsilon
Factor to increase ANGLEround and DISTround for hyperplane equality.
Definition: QhullQh.h:68
void setErrorStream(std::ostream *os)
Definition: QhullQh.cpp:173
std::string qhull_message
Returned messages from libqhull_r.
Definition: QhullQh.h:65


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