9 #include "QhullError.h"
10 #include "RboxPoints.h"
18 using std::ostringstream;
24 #pragma warning( disable : 4996)
35 : PointCoordinates(
"rbox")
37 , rbox_status(qh_ERRnone)
47 RboxPoints(
const char *rboxCommand)
48 : PointCoordinates(
"rbox")
50 , rbox_status(qh_ERRnone)
55 appendPoints(rboxCommand);
72 resetQhullQh(
new QhullQh);
80 rbox_status= qh_ERRnone;
84 std::string RboxPoints::
87 if(rbox_status!=qh_ERRnone){
91 return "rbox warning: no points generated\n";
103 hasRboxMessage()
const
105 return (rbox_status!=qh_ERRnone);
114 appendPoints(
const char *rboxCommand)
118 char *command=
const_cast<char*
>(
s.c_str());
119 if(qh()->cpp_object){
120 throw QhullError(10001,
"Qhull error: conflicting user of cpp_object for RboxPoints::appendPoints() or corrupted qh_qh");
122 if(extraCoordinatesCount()!=0){
123 throw QhullError(10067,
"Qhull error: Extra coordinates (%d) prior to calling RboxPoints::appendPoints. Was %s", extraCoordinatesCount(), 0, 0.0, comment().c_str());
125 countT previousCount=
count();
126 qh()->cpp_object=
this;
127 int status= qh_rboxpoints(qh(), command);
129 if(rbox_status==qh_ERRnone){
132 if(rbox_status!=qh_ERRnone){
133 throw QhullError(rbox_status, rbox_message);
135 if(extraCoordinatesCount()!=0){
136 throw QhullError(10002,
"Qhull error: extra coordinates (%d) for PointCoordinates (%x)", extraCoordinatesCount(), 0, 0.0, coordinates());
138 if(previousCount+newCount()!=
count()){
139 throw QhullError(10068,
"Qhull error: rbox specified %d points but got %d points for command '%s'", newCount(),
count()-previousCount, 0.0, comment().c_str());
168 qh_errexit_rbox(qh, 10072);
170 RboxPoints *out=
reinterpret_cast<RboxPoints *
>(qh->cpp_object);
172 if(msgcode<MSG_OUTPUT){
173 char newMessage[MSG_MAXLEN];
175 vsnprintf(newMessage,
sizeof(newMessage), fmt, args);
176 out->rbox_message += newMessage;
177 if(out->rbox_status<MSG_ERROR || out->rbox_status>=MSG_STDERR){
178 out->rbox_status= msgcode;
186 out->rbox_message +=
"RboxPoints error: options 'h', 'n' not supported.\n";
187 qh_errexit_rbox(qh, 10010);
191 int dimension= va_arg(args,
int);
192 string command(va_arg(args,
char*));
193 countT
count= va_arg(args, countT);
194 out->setDimension(dimension);
195 out->appendComment(
" \"");
196 out->appendComment(command.substr(command.find(
' ')+1));
197 out->appendComment(
"\"");
198 out->setNewCount(
count);
199 out->reservePoints();
203 *out << va_arg(args,
int);
206 *out << va_arg(args,
int);
209 *out << va_arg(args,
int);
212 *out << va_arg(args,
double);
215 *out << va_arg(args,
double);
218 *out << va_arg(args,
double);
std::set< std::string > & s
void qh_fprintf_rbox(qhT *qh, FILE *, int msgcode, const char *fmt,...)
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.