QhullHyperplane.h
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/QhullHyperplane.h#3 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #ifndef QHHYPERPLANE_H
10 #define QHHYPERPLANE_H
11 
12 extern "C" {
13  #include "libqhull_r/qhull_ra.h"
14 }
15 #include "libqhullcpp/QhullError.h"
17 #include "libqhullcpp/QhullQh.h"
18 
19 #include <ostream>
20 
21 namespace orgQhull {
22 
23 #
24  class Qhull;
25  class QhullPoint;
26 
27 #
28  class QhullHyperplane;
30  class QhullHyperplaneIterator;
32 
33 class QhullHyperplane { // Similar to QhullPoint
34 public:
35 #
36  typedef const coordT * iterator;
37  typedef const coordT * const_iterator;
40 
41 private:
42 #
43  coordT * hyperplane_coordinates;
44  QhullQh * qh_qh;
45  coordT hyperplane_offset;
46  int hyperplane_dimension;
47 
48 #
49 public:
51  explicit QhullHyperplane(const Qhull &q);
52  QhullHyperplane(const Qhull &q, int hyperplaneDimension, coordT *c, coordT hyperplaneOffset);
54  QhullHyperplane(QhullQh *qqh, int hyperplaneDimension, coordT *c, coordT hyperplaneOffset) : hyperplane_coordinates(c), qh_qh(qqh), hyperplane_offset(hyperplaneOffset), hyperplane_dimension(hyperplaneDimension) {}
55  // Creates an alias. Does not copy the hyperplane's coordinates. Needed for return by value and parameter passing.
57  // Creates an alias. Does not copy the hyperplane's coordinates. Needed for vector<QhullHyperplane>
58  QhullHyperplane & operator=(const QhullHyperplane &other) { hyperplane_coordinates= other.hyperplane_coordinates; qh_qh= other.qh_qh; hyperplane_offset= other.hyperplane_offset; hyperplane_dimension= other.hyperplane_dimension; return *this; }
60 
61 #
62 #ifndef QHULL_NO_STL
64  std::vector<coordT> toStdVector() const;
65 #endif //QHULL_NO_STL
66 #ifdef QHULL_USES_QT
67  QList<coordT> toQList() const;
68 #endif //QHULL_USES_QT
69 
70 #
71 public:
72  const coordT * coordinates() const { return hyperplane_coordinates; }
74  void defineAs(int hyperplaneDimension, coordT *c, coordT hyperplaneOffset) { QHULL_ASSERT(hyperplaneDimension>=0); hyperplane_coordinates= c; hyperplane_dimension= hyperplaneDimension; hyperplane_offset= hyperplaneOffset; }
76  void defineAs(QhullHyperplane &other) { hyperplane_coordinates= other.coordinates(); hyperplane_dimension= other.dimension(); hyperplane_offset= other.offset(); }
77  int dimension() const { return hyperplane_dimension; }
78  bool isValid() const { return hyperplane_coordinates!=0 && hyperplane_dimension>0; }
79  coordT offset() const { return hyperplane_offset; }
80  bool operator==(const QhullHyperplane &other) const;
81  bool operator!=(const QhullHyperplane &other) const { return !operator==(other); }
82  const coordT & operator[](int idx) const { QHULL_ASSERT(idx>=0 && idx<hyperplane_dimension); return *(hyperplane_coordinates+idx); }
83  coordT & operator[](int idx) { QHULL_ASSERT(idx>=0 && idx<hyperplane_dimension); return *(hyperplane_coordinates+idx); }
85  void setDimension(int hyperplaneDimension) { hyperplane_dimension= hyperplaneDimension; }
86  void setOffset(coordT hyperplaneOffset) { hyperplane_offset= hyperplaneOffset; }
87 
88 #
89  iterator begin() { return hyperplane_coordinates; }
93  int count() { return hyperplane_dimension; }
96  size_t size() { return (size_t)hyperplane_dimension; }
97 
98 #
99  double distance(const QhullPoint &p) const;
100  double hyperplaneAngle(const QhullHyperplane &other) const;
101  double norm() const;
102 
103 #
104  struct PrintHyperplane{
105  const QhullHyperplane *hyperplane;
106  const char * print_message;
107  const char * hyperplane_offset_message;
108  PrintHyperplane(const char *message, const char *offsetMessage, const QhullHyperplane &p) : hyperplane(&p), print_message(message), hyperplane_offset_message(offsetMessage) {}
109  };//PrintHyperplane
110  PrintHyperplane print(const char *message) const { return PrintHyperplane(message, "", *this); }
111  PrintHyperplane print(const char *message, const char *offsetMessage) const { return PrintHyperplane(message, offsetMessage, *this); }
112 
113 };//QhullHyperplane
114 
116 
117 }//namespace orgQhull
118 
119 #
120 
121 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullHyperplane::PrintHyperplane &pr);
122 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullHyperplane &p);
123 
124 #endif // QHHYPERPLANE_H
125 
orgQhull::QhullHyperplane::operator!=
bool operator!=(const QhullHyperplane &other) const
Definition: QhullHyperplane.h:87
coordT
#define coordT
Definition: libqhull.h:80
orgQhull::QhullHyperplane::Iterator
QhullHyperplane::iterator Iterator
Definition: QhullHyperplane.h:44
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::QhullHyperplane::QhullHyperplane
QhullHyperplane()
Definition: QhullHyperplane.h:56
orgQhull::QhullHyperplane::isValid
bool isValid() const
Definition: QhullHyperplane.h:84
orgQhull::QhullHyperplane::operator=
QhullHyperplane & operator=(const QhullHyperplane &other)
Definition: QhullHyperplane.h:64
QhullIterator.h
orgQhull::QhullHyperplane::~QhullHyperplane
~QhullHyperplane()
Definition: QhullHyperplane.h:65
print
void print(const Tensor &tensor)
orgQhull::QhullHyperplane::const_iterator
const typedef coordT * const_iterator
Definition: QhullHyperplane.h:43
orgQhull::QhullHyperplane::coordinates
const coordT * coordinates() const
Definition: QhullHyperplane.h:78
orgQhull::QhullHyperplane::qh_qh
QhullQh * qh_qh
qhT for distanceEpsilon() in operator==
Definition: QhullHyperplane.h:50
orgQhull::QhullHyperplane::size
size_t size()
Definition: QhullHyperplane.h:102
orgQhull::QhullHyperplane::constBegin
const_iterator constBegin() const
Definition: QhullHyperplane.h:97
orgQhull::QhullHyperplane::operator==
bool operator==(const QhullHyperplane &other) const
Definition: QhullHyperplane.cpp:72
orgQhull::Qhull
Interface to Qhull from C++.
Definition: Qhull.h:49
orgQhull::QhullHyperplane::hyperplane_coordinates
coordT * hyperplane_coordinates
Normal to hyperplane. facetT.normal is normalized to 1.0.
Definition: QhullHyperplane.h:49
c
c
orgQhull::QhullHyperplane::defineAs
void defineAs(int hyperplaneDimension, coordT *c, coordT hyperplaneOffset)
Definition: QhullHyperplane.h:80
orgQhull::QhullHyperplane::setDimension
void setDimension(int hyperplaneDimension)
Definition: QhullHyperplane.h:91
orgQhull::QhullHyperplane::hyperplane_dimension
int hyperplane_dimension
Dimension of hyperplane.
Definition: QhullHyperplane.h:52
orgQhull::QhullHyperplane::begin
iterator begin()
Definition: QhullHyperplane.h:95
operator<<
std::ostream & operator<<(std::ostream &os, const orgQhull::QhullHyperplane::PrintHyperplane &pr)
orgQhull::QhullHyperplane::offset
coordT offset() const
Definition: QhullHyperplane.h:85
orgQhull::QhullHyperplane::dimension
int dimension() const
Definition: QhullHyperplane.h:83
orgQhull::QhullQh
POD type equivalent to qhT. No virtual members.
Definition: QhullQh.h:58
orgQhull::QhullHyperplane
Definition: QhullHyperplane.h:39
orgQhull::QhullHyperplane::setCoordinates
void setCoordinates(coordT *c)
Definition: QhullHyperplane.h:90
qhull_ra.h
orgQhull::QhullHyperplane::toStdVector
std::vector< coordT > toStdVector() const
Definition: QhullHyperplane.cpp:54
orgQhull::QhullHyperplane::ConstIterator
QhullHyperplane::const_iterator ConstIterator
Definition: QhullHyperplane.h:45
orgQhull::QhullHyperplane::operator[]
const coordT & operator[](int idx) const
Definition: QhullHyperplane.h:88
orgQhull::QhullHyperplane::norm
double norm() const
Definition: QhullHyperplane.cpp:149
QhullQh.h
orgQhull::QhullHyperplane::hyperplaneAngle
double hyperplaneAngle(const QhullHyperplane &other) const
Definition: QhullHyperplane.cpp:137
orgQhull::QhullHyperplane::count
int count()
Definition: QhullHyperplane.h:99
QHULL_ASSERT
#define QHULL_ASSERT
Definition: QhullError.h:16
orgQhull::QhullHyperplane::end
iterator end()
Definition: QhullHyperplane.h:100
QHULL_DECLARE_SEQUENTIAL_ITERATOR
#define QHULL_DECLARE_SEQUENTIAL_ITERATOR(C, T)
Definition: QhullIterator.h:39
QhullError.h
orgQhull::QhullHyperplane::hyperplane_offset
coordT hyperplane_offset
Distance from hyperplane to origin.
Definition: QhullHyperplane.h:51
orgQhull::QhullHyperplane::iterator
const typedef coordT * iterator
Definition: QhullHyperplane.h:42
orgQhull::QhullHyperplane::constEnd
const_iterator constEnd() const
Definition: QhullHyperplane.h:98
orgQhull::QhullHyperplane::setOffset
void setOffset(coordT hyperplaneOffset)
Definition: QhullHyperplane.h:92
orgQhull::QhullHyperplane::PrintHyperplane
Definition: QhullHyperplane.h:110


hpp-fcl
Author(s):
autogenerated on Fri Jan 26 2024 03:46:14