9 #include "QhullHyperplane.h"
12 #include "QhullPoint.h"
25 QhullHyperplane(
const Qhull &q)
26 : hyperplane_coordinates(0)
28 , hyperplane_offset(0.0)
29 , hyperplane_dimension(0)
34 QhullHyperplane(
const Qhull &q,
int hyperplaneDimension, coordT *c, coordT hyperplaneOffset)
35 : hyperplane_coordinates(c)
37 , hyperplane_offset(hyperplaneOffset)
38 , hyperplane_dimension(hyperplaneDimension)
47 std::vector<coordT> QhullHyperplane::
50 QhullHyperplaneIterator i(*
this);
51 std::vector<coordT>
fs;
53 fs.push_back(i.next());
55 fs.push_back(hyperplane_offset);
68 if(hyperplane_dimension!=other.hyperplane_dimension || !hyperplane_coordinates || !other.hyperplane_coordinates){
71 double d= fabs(hyperplane_offset-other.hyperplane_offset);
72 if(d > (qh_qh ? qh_qh->distanceEpsilon() : 0.0)){
75 double angle= hyperplaneAngle(other);
77 double a= fabs(
angle-1.0);
78 if(a > (qh_qh ? qh_qh->angleEpsilon() : 0.0)){
90 double QhullHyperplane::
91 distance(
const QhullPoint &p)
const
93 const coordT *point= p.coordinates();
94 int dim= p.dimension();
95 QHULL_ASSERT(dim==dimension());
96 const coordT *normal= coordinates();
101 dist= offset() + point[0] * normal[0] + point[1] * normal[1];
104 dist= offset() + point[0] * normal[0] + point[1] * normal[1] + point[2] * normal[2];
107 dist= offset()+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3];
110 dist= offset()+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3]+point[4]*normal[4];
113 dist= offset()+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3]+point[4]*normal[4]+point[5]*normal[5];
116 dist= offset()+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3]+point[4]*normal[4]+point[5]*normal[5]+point[6]*normal[6];
119 dist= offset()+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3]+point[4]*normal[4]+point[5]*normal[5]+point[6]*normal[6]+point[7]*normal[7];
123 for (
int k=dim; k--; )
124 dist += *point++ * *normal++;
130 double QhullHyperplane::
131 hyperplaneAngle(
const QhullHyperplane &other)
const
135 result= qh_getangle(qh_qh, hyperplane_coordinates, other.hyperplane_coordinates);
137 qh_qh->NOerrexit=
true;
138 qh_qh->maybeThrowQhullMessage(QH_TRY_status);
145 const coordT *c= coordinates();
146 for (
int k=dimension(); k--; ){
158 using orgQhull::QhullHyperplane;
163 operator<<(ostream &os,
const QhullHyperplane &p)
170 operator<<(ostream &os,
const QhullHyperplane::PrintHyperplane &pr)
172 os << pr.print_message;
173 QhullHyperplane p= *pr.hyperplane;
174 const realT *c= p.coordinates();
175 for(
int k=p.dimension(); k--; ){
177 if(pr.print_message){
183 os << pr.hyperplane_offset_message <<
" " << p.offset();
ostream & operator<<(ostream &os, const QhullHyperplane &p)
double angle(const Eigen::Ref< const Eigen::Vector3d > &a, const Eigen::Ref< const Eigen::Vector3d > &b)
Get angle, in radians, between two vectors on range [0,pi].
T norm(const Tensor< T > &ttens)
bool operator==(DoFSet const &A, DoFSet const &B)
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.