9 #include "QhullPoint.h"
10 #include "QhullError.h"
25 QhullPoint(
const Qhull &q)
26 : point_coordinates(0)
28 , point_dimension(q.hullDimension())
33 QhullPoint(
const Qhull &q, coordT *c)
34 : point_coordinates(c)
36 , point_dimension(q.hullDimension())
38 QHULL_ASSERT(q.hullDimension()>0);
42 QhullPoint(
const Qhull &q,
int pointDimension, coordT *c)
43 : point_coordinates(c)
45 , point_dimension(pointDimension)
51 QhullPoint(
const Qhull &q, Coordinates &c)
52 : point_coordinates(c.data())
54 , point_dimension(c.
count())
63 std::vector<coordT> QhullPoint::
66 QhullPointIterator i(*
this);
67 std::vector<coordT> vs;
69 vs.push_back(i.next());
84 if(point_dimension!=other.point_dimension){
87 const coordT *c= point_coordinates;
88 const coordT *c2= other.point_coordinates;
95 if(!qh_qh || qh_qh->hull_dim==0){
96 for(
int k= point_dimension; k--; ){
104 for(
int k= point_dimension; k--; ){
105 double diff= *c++ - *c2++;
109 return (dist2 < qh_qh->distanceEpsilon());
116 distance(
const QhullPoint &p)
const
118 const coordT *c= point_coordinates;
119 const coordT *c2= p.point_coordinates;
120 int dim= point_dimension;
121 if(dim!=p.point_dimension){
122 throw QhullError(10075,
"QhullPoint error: Expecting dimension %d for distance(). Got %d", dim, p.point_dimension);
125 throw QhullError(10076,
"QhullPoint error: Cannot compute distance() for undefined point");
131 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]);
134 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]) + (c[2]-c2[2])*(c[2]-c2[2]);
137 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]) + (c[2]-c2[2])*(c[2]-c2[2]) + (c[3]-c2[3])*(c[3]-c2[3]);
140 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]) + (c[2]-c2[2])*(c[2]-c2[2]) + (c[3]-c2[3])*(c[3]-c2[3]) + (c[4]-c2[4])*(c[4]-c2[4]);
143 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]) + (c[2]-c2[2])*(c[2]-c2[2]) + (c[3]-c2[3])*(c[3]-c2[3]) + (c[4]-c2[4])*(c[4]-c2[4]) + (c[5]-c2[5])*(c[5]-c2[5]);
146 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]) + (c[2]-c2[2])*(c[2]-c2[2]) + (c[3]-c2[3])*(c[3]-c2[3]) + (c[4]-c2[4])*(c[4]-c2[4]) + (c[5]-c2[5])*(c[5]-c2[5]) + (c[6]-c2[6])*(c[6]-c2[6]);
149 dist= (c[0]-c2[0])*(c[0]-c2[0]) + (c[1]-c2[1])*(c[1]-c2[1]) + (c[2]-c2[2])*(c[2]-c2[2]) + (c[3]-c2[3])*(c[3]-c2[3]) + (c[4]-c2[4])*(c[4]-c2[4]) + (c[5]-c2[5])*(c[5]-c2[5]) + (c[6]-c2[6])*(c[6]-c2[6]) + (c[7]-c2[7])*(c[7]-c2[7]);
153 for(
int k=dim; k--; ){
154 dist += (*c - *c2) * (*c - *c2);
168 using orgQhull::QhullPoint;
172 operator<<(ostream &os,
const QhullPoint::PrintPoint &pr)
174 QhullPoint p= *pr.point;
176 if(pr.point_message){
177 if(*pr.point_message){
178 os << pr.point_message <<
" ";
180 if(pr.with_identifier && (i!=qh_IDunknown) && (i!=qh_IDnone)){
181 os <<
"p" << i <<
": ";
184 const realT *c= p.coordinates();
185 for(
int k=p.dimension(); k--; ){
187 if(pr.point_message){
ostream & operator<<(ostream &os, const QhullPoint::PrintPoint &pr)
Same as qh_printpointid [io.c].
bool operator==(DoFSet const &A, DoFSet const &B)
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.