/usr/include/libqhullcpp/QhullPoint.h is in libqhull-dev 2015.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /****************************************************************************
**
** Copyright (c) 2009-2015 C.B. Barber. All rights reserved.
** $Id: //main/2015/qhull/src/libqhullcpp/QhullPoint.h#3 $$Change: 2066 $
** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
**
****************************************************************************/
#ifndef QHPOINT_H
#define QHPOINT_H
extern "C" {
#include "libqhull_r/qhull_ra.h"
}
#include "libqhullcpp/QhullError.h"
#include "libqhullcpp/QhullIterator.h"
#include "libqhullcpp/QhullQh.h"
#include "libqhullcpp/Coordinates.h"
#include <ostream>
namespace orgQhull {
#//!\name Defined here
class QhullPoint; //!< QhullPoint as a pointer and dimension to shared memory
class QhullPointIterator; //!< Java-style iterator for QhullPoint coordinates
#//!\name Used here
class Qhull;
//! A QhullPoint is a dimension and an array of coordinates.
//! With Qhull/QhullQh, a QhullPoint has an identifier. Point equality is relative to qh.distanceEpsilon
class QhullPoint {
#//!\name Iterators
public:
typedef coordT * base_type; // for QhullPointSet
typedef const coordT * iterator;
typedef const coordT * const_iterator;
typedef QhullPoint::iterator Iterator;
typedef QhullPoint::const_iterator ConstIterator;
#//!\name Fields
protected: // For QhullPoints::iterator, QhullPoints::const_iterator
coordT * point_coordinates; //!< Pointer to first coordinate, 0 if undefined
QhullQh * qh_qh; //!< qhT for this instance of Qhull. 0 if undefined.
//!< operator==() returns true if points within sqrt(qh_qh->distanceEpsilon())
//!< If !qh_qh, id() is -3, and operator==() requires equal coordinates
int point_dimension; //!< Default dimension is qh_qh->hull_dim
public:
#//!\name Constructors
//! QhullPoint, PointCoordinates, and QhullPoints have similar constructors
//! If Qhull/QhullQh is not initialized, then QhullPoint.dimension() is zero unless explicitly set
//! Cannot define QhullPoints(int pointDimension) since it is ambiguous with QhullPoints(QhullQh *qqh)
QhullPoint() : point_coordinates(0), qh_qh(0), point_dimension(0) {}
QhullPoint(int pointDimension, coordT *c) : point_coordinates(c), qh_qh(0), point_dimension(pointDimension) { QHULL_ASSERT(pointDimension>0); }
explicit QhullPoint(const Qhull &q);
QhullPoint(const Qhull &q, coordT *c);
QhullPoint(const Qhull &q, Coordinates &c);
QhullPoint(const Qhull &q, int pointDimension, coordT *c);
explicit QhullPoint(QhullQh *qqh) : point_coordinates(0), qh_qh(qqh), point_dimension(qqh->hull_dim) {}
QhullPoint(QhullQh *qqh, coordT *c) : point_coordinates(c), qh_qh(qqh), point_dimension(qqh->hull_dim) { QHULL_ASSERT(qqh->hull_dim>0); }
QhullPoint(QhullQh *qqh, Coordinates &c) : point_coordinates(c.data()), qh_qh(qqh), point_dimension(c.count()) {}
QhullPoint(QhullQh *qqh, int pointDimension, coordT *c) : point_coordinates(c), qh_qh(qqh), point_dimension(pointDimension) {}
//! Creates an alias. Does not make a deep copy of the point. Needed for return by value and parameter passing.
QhullPoint(const QhullPoint &other) : point_coordinates(other.point_coordinates), qh_qh(other.qh_qh), point_dimension(other.point_dimension) {}
//! Creates an alias. Does not make a deep copy of the point. Needed for vector<QhullPoint>
QhullPoint & operator=(const QhullPoint &other) { point_coordinates= other.point_coordinates; qh_qh= other.qh_qh; point_dimension= other.point_dimension; return *this; }
~QhullPoint() {}
#//!\name Conversions
#ifndef QHULL_NO_STL
std::vector<coordT> toStdVector() const;
#endif //QHULL_NO_STL
#ifdef QHULL_USES_QT
QList<coordT> toQList() const;
#endif //QHULL_USES_QT
#//!\name GetSet
public:
const coordT * coordinates() const { return point_coordinates; } //!< 0 if undefined
coordT * coordinates() { return point_coordinates; } //!< 0 if undefined
void defineAs(coordT *c) { QHULL_ASSERT(point_dimension>0); point_coordinates= c; }
void defineAs(int pointDimension, coordT *c) { QHULL_ASSERT(pointDimension>=0); point_coordinates= c; point_dimension= pointDimension; }
void defineAs(QhullPoint &other) { point_coordinates= other.point_coordinates; qh_qh= other.qh_qh; point_dimension= other.point_dimension; }
int dimension() const { return point_dimension; }
coordT * getBaseT() const { return point_coordinates; } // for QhullPointSet
countT id() const { return qh_pointid(qh_qh, point_coordinates); } // NOerrors
bool isValid() const { return (point_coordinates!=0 && point_dimension>0); };
bool operator==(const QhullPoint &other) const;
bool operator!=(const QhullPoint &other) const { return ! operator==(other); }
const coordT & operator[](int idx) const { QHULL_ASSERT(point_coordinates!=0 && idx>=0 && idx<point_dimension); return *(point_coordinates+idx); } //!< 0 to hull_dim-1
coordT & operator[](int idx) { QHULL_ASSERT(point_coordinates!=0 && idx>=0 && idx<point_dimension); return *(point_coordinates+idx); } //!< 0 to hull_dim-1
QhullQh * qh() { return qh_qh; }
void setCoordinates(coordT *c) { point_coordinates= c; }
void setDimension(int pointDimension) { point_dimension= pointDimension; }
#//!\name foreach
iterator begin() { return point_coordinates; }
const_iterator begin() const { return point_coordinates; }
const_iterator constBegin() const { return point_coordinates; }
const_iterator constEnd() const { return (point_coordinates ? point_coordinates+point_dimension : 0); }
int count() { return (point_coordinates ? point_dimension : 0); }
iterator end() { return (point_coordinates ? point_coordinates+point_dimension : 0); }
const_iterator end() const { return (point_coordinates ? point_coordinates+point_dimension : 0); }
size_t size() { return (size_t)(point_coordinates ? point_dimension : 0); }
#//!\name Methods
void advancePoint(countT idx) { if(point_coordinates) { point_coordinates += idx*point_dimension; } }
double distance(const QhullPoint &p) const;
#//!\name IO
struct PrintPoint{
const QhullPoint *point;
const char * point_message;
bool with_identifier;
PrintPoint(const char *message, bool withIdentifier, const QhullPoint &p) : point(&p), point_message(message), with_identifier(withIdentifier) {}
};//PrintPoint
PrintPoint print(const char *message) const { return PrintPoint(message, false, *this); }
PrintPoint printWithIdentifier(const char *message) const { return PrintPoint(message, true, *this); }
};//QhullPoint
QHULL_DECLARE_SEQUENTIAL_ITERATOR(QhullPoint, coordT)
}//namespace orgQhull
#//!\name Global
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullPoint::PrintPoint &pr);
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullPoint &p);
#endif // QHPOINT_H
|