9 #include "QhullPoints.h"
26 QhullPoints(
const Qhull &q)
30 , point_dimension(q.hullDimension())
35 QhullPoints(
const Qhull &q, countT coordinateCount2, coordT *c)
37 , point_end(c+coordinateCount2)
39 , point_dimension(q.hullDimension())
41 QHULL_ASSERT(q.hullDimension());
42 QHULL_ASSERT(coordinateCount2>=0);
46 QhullPoints(
const Qhull &q,
int pointDimension, countT coordinateCount2, coordT *c)
48 , point_end(c+coordinateCount2)
50 , point_dimension(pointDimension)
52 QHULL_ASSERT(pointDimension>=0);
53 QHULL_ASSERT(coordinateCount2>=0);
57 QhullPoints(QhullQh *qqh,
int pointDimension, countT coordinateCount2, coordT *c)
59 , point_end(c+coordinateCount2)
61 , point_dimension(pointDimension)
63 QHULL_ASSERT(pointDimension>=0);
64 QHULL_ASSERT(coordinateCount2>=0);
71 std::vector<QhullPoint> QhullPoints::
74 QhullPointsIterator i(*
this);
75 std::vector<QhullPoint> vs;
77 vs.push_back(i.next());
86 extraCoordinatesCount()
const
88 if(point_dimension>0){
89 return (countT)((point_end-point_first)%(
size_t)point_dimension);
99 if((point_end-point_first) != (other.point_end-other.point_first)){
102 if(point_dimension!=other.point_dimension){
105 if(point_first==other.point_first){
108 if(!qh_qh || qh_qh->hull_dim==0){
109 const coordT *c= point_first;
110 const coordT *c2= other.point_first;
117 const_iterator i= begin();
118 const_iterator i2= other.begin();
131 resetQhullQh(QhullQh *qqh)
134 point_dimension= (qqh ? qqh->hull_dim : 0);
139 QhullPoint QhullPoints::
140 value(countT idx)
const
143 if(idx>=0 && idx<
count()){
144 p.defineAs(point_dimension, point_first+idx*point_dimension);
149 QhullPoint QhullPoints::
150 value(countT idx, QhullPoint &defaultValue)
const
153 if(idx>=0 && idx<
count()){
154 p.defineAs(point_dimension, point_first+idx*point_dimension);
156 p.defineAs(defaultValue);
166 const_iterator i= begin();
177 count(
const QhullPoint &t)
const
180 const_iterator i= begin();
191 indexOf(
const coordT *pointCoordinates)
const
193 if(!includesCoordinates(pointCoordinates) || point_dimension==0){
196 size_t offset= pointCoordinates-point_first;
197 countT idx= (countT)(offset/(
size_t)point_dimension);
198 countT extra= (countT)(offset%(
size_t)point_dimension);
200 throw QhullError(10066,
"Qhull error: coordinates %x are not at point boundary (extra %d at index %d)", extra, idx, 0.0, pointCoordinates);
206 indexOf(
const coordT *pointCoordinates,
int noThrow)
const
210 if(!includesCoordinates(pointCoordinates) || point_dimension==0){
213 extra= (pointCoordinates-point_first)%(
size_t)point_dimension;
215 return indexOf(pointCoordinates-extra);
219 indexOf(
const QhullPoint &t)
const
222 const_iterator i= begin();
234 lastIndexOf(
const QhullPoint &t)
const
237 const_iterator i= end();
248 QhullPoints QhullPoints::
249 mid(countT idx, countT
length)
const
254 }
else if(length<0 || idx+length>=n){
259 return QhullPoints(qh_qh, point_dimension, n*point_dimension, point_first+idx*point_dimension);
264 bool QhullPointsIterator::
265 findNext(
const QhullPoint &p)
267 while(i!=ps->constEnd()){
275 bool QhullPointsIterator::
276 findPrevious(
const QhullPoint &p)
278 while(i!=ps->constBegin()){
291 using orgQhull::QhullPoint;
292 using orgQhull::QhullPoints;
293 using orgQhull::QhullPointsIterator;
298 QhullPointsIterator i(p);
306 operator<<(ostream &os,
const QhullPoints::PrintPoints &pr)
308 os << pr.point_message;
309 QhullPoints ps= *pr.points;
310 for(QhullPoints::iterator i=ps.begin(); i!=ps.end(); ++i){
312 if(pr.with_identifier){
313 os << p.printWithIdentifier(
"");
ostream & operator<<(ostream &os, const QhullPoints &p)
bool operator==(DoFSet const &A, DoFSet const &B)
bool contains(const Container &container, const T &value)
Equivalent to container.end() != std::find(container.begin(), container.end(), value)
double length(const Eigen::MatrixBase< Derived > &value)
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.