//! Same as UsingLibQhull but does not throw exceptions //! !defined() on failure. For use in destructors UsingLibQhull:: UsingLibQhull(Qhull *q, int noThrow) : my_qhull(0) // Fail by default , qh_exitcode(0) { QHULL_UNUSED(noThrow); QhullQh *qhullqh= q->qhullQh(); if(s_using_libqhull){ QhullError e(10050, "Qhull error: UsingLibQhull already in use"); e.logError(); }else if(!qhullqh || qhullqh->run_id != q->qhull_run_id){ QhullError e(10051, "Qhull error: Qhull.qhullQh (%x) undefined or QhullQh.runId %d != Qhull.runId %d. Overwritten?", (qhullqh ? qhullqh->run_id : -1), q->qhull_run_id, 0.0, qhullqh); e.logError(); }else{ // qh.old_qhstat is zero at initialization // qh.old_tempstack is zero when empty // QhullQh() and UsingLibQhull() are the same #if qh_QHpointer if(qh_qh){ qh old_qhstat= qh_qhstat; qh old_tempstack= qhmem.tempstack; } qh_qh= qhullqh; qh_qhstat= qhullqh->old_qhstat; qhmem.tempstack= qhullqh->old_tempstack; qhullqh->old_qhstat= 0; qhullqh->old_tempstack= 0; #endif my_qhull= q; s_qhull_output= q; // set s_qhull_output for qh_fprintf() qh NOerrexit= False; // assumes setjmp called next } }//UsingLibQhull qhull noThrow
void QhullQh:: maybeThrowQhullMessage(int exitCode, int noThrow) throw() { QHULL_UNUSED(noThrow); if(qhull_status==qh_ERRnone){ qhull_status= exitCode; } if(qhull_status!=qh_ERRnone){ QhullError e(qhull_status, qhull_message); e.logErrorLastResort(); } }//maybeThrowQhullMessage
//! If qhRundID undefined uses QhullPoint::s_points_begin and dimension int QhullPoint:: id(int qhRunId, int dimension, const coordT *c) { QHULL_UNUSED(dimension); if(UsingLibQhull::hasPoints()){ if(qhRunId==UsingLibQhull::NOqhRunId){ const coordT *pointsEnd; int dimension; const coordT *points= UsingLibQhull::globalPoints(&dimension, &pointsEnd); if(c>=points && c<pointsEnd){ int offset= (int)(c-points); // WARN64 return offset/dimension; } }else{ UsingLibQhull q(qhRunId); // NOerrors from qh_pointid or qh_setindex return qh_pointid(const_cast<coordT *>(c)); } } long long i=(long long)c; return (int)i; // WARN64 }//id