Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #//! QhullRidge -- Qhull's ridge structure, ridgeT, as a C++ class
00010
00011 #include "QhullSets.h"
00012 #include "QhullVertex.h"
00013 #include "QhullRidge.h"
00014
00015 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
00016 #pragma warning( disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
00017 #pragma warning( disable : 4996) // function was declared deprecated(strcpy, localtime, etc.)
00018 #endif
00019
00020 namespace orgQhull {
00021
00022 #//class statics
00023 ridgeT QhullRidge::
00024 s_empty_ridge= {0,0,0,0,0,
00025 0,0};
00026
00027 #//Constructor, destructor, etc.
00028
00029 #//Accessors
00030
00034 bool QhullRidge::
00035 hasNextRidge3d(const QhullFacet f) const
00036 {
00037 vertexT *v= 0;
00038 ridgeT *ridge= qh_nextridge3d(getRidgeT(), f.getFacetT(), &v);
00039 return (ridge!=0);
00040 }
00041
00042
00043
00046 QhullRidge QhullRidge::
00047 nextRidge3d(const QhullFacet f, QhullVertex *nextVertex) const
00048 {
00049 vertexT *v= 0;
00050 ridgeT *ridge= qh_nextridge3d(getRidgeT(), f.getFacetT(), &v);
00051 if(!ridge){
00052 throw QhullError(10030, "Qhull error nextRidge3d: missing next ridge for facet %d ridge %d. Does facet contain ridge?", f.id(), id());
00053 }
00054 if(nextVertex!=0){
00055 *nextVertex= QhullVertex(v);
00056 }
00057 return QhullRidge(ridge);
00058 }
00059
00060
00061 }
00062
00063 #//Global functions
00064
00065 using std::endl;
00066 using std::ostream;
00067 using orgQhull::QhullRidge;
00068 using orgQhull::QhullVertex;
00069 using orgQhull::UsingLibQhull;
00070
00071 ostream &
00072 operator<<(ostream &os, const QhullRidge &r)
00073 {
00074 os << r.print(UsingLibQhull::NOqhRunId);
00075 return os;
00076 }
00077
00080 ostream &
00081 operator<<(ostream &os, const QhullRidge::PrintRidge &pr)
00082 {
00083 QhullRidge r= *pr.ridge;
00084 os << " - r" << r.id();
00085 if(r.getRidgeT()->tested){
00086 os << " tested";
00087 }
00088 if(r.getRidgeT()->nonconvex){
00089 os << " nonconvex";
00090 }
00091 os << endl;
00092 os << r.vertices().print(pr.run_id, " vertices:");
00093 if(r.getRidgeT()->top && r.getRidgeT()->bottom){
00094 os << " between f" << r.topFacet().id() << " and f" << r.bottomFacet().id() << endl;
00095 }else if(r.getRidgeT()->top){
00096 os << " top f" << r.topFacet().id() << endl;
00097 }else if(r.getRidgeT()->bottom){
00098 os << " bottom f" << r.bottomFacet().id() << endl;
00099 }
00100
00101 return os;
00102 }