109 out <<
"points " <<
dim <<
" " <<
n_pts <<
"\n";
110 for (
int i = 0; i <
n_pts; i++) {
137 out <<
"split " << cut_dim <<
" " << cut_val <<
" ";
138 out << cd_bnds[
ANN_LO] <<
" " << cd_bnds[
ANN_HI] <<
"\n";
151 out <<
"leaf " <<
n_pts;
152 for (
int j = 0; j <
n_pts; j++) {
153 out <<
" " << bkt[j];
162 out <<
"shrink " << n_bnds <<
"\n";
163 for (
int j = 0; j < n_bnds; j++) {
164 out << bnds[j].cd <<
" " << bnds[j].cv <<
" " << bnds[j].sd <<
"\n";
203 the_dim, the_n_pts, the_bkt_size,
204 the_bnd_box_lo, the_bnd_box_hi);
207 SkeletonTree(the_n_pts, the_dim, the_bkt_size, the_pts, the_pidx);
209 bnd_box_lo = the_bnd_box_lo;
210 bnd_box_hi = the_bnd_box_hi;
232 the_dim, the_n_pts, the_bkt_size,
233 the_bnd_box_lo, the_bnd_box_hi);
236 SkeletonTree(the_n_pts, the_dim, the_bkt_size, the_pts, the_pidx);
237 bnd_box_lo = the_bnd_box_lo;
238 bnd_box_hi = the_bnd_box_hi;
273 if (strcmp(str,
"#ANN") != 0) {
284 if (strcmp(str,
"points") == 0) {
289 for (
int i = 0; i < the_n_pts; i++) {
292 if (idx < 0 || idx >= the_n_pts) {
295 for (j = 0; j < the_dim; j++) {
296 in >> the_pts[idx][j];
313 if (strcmp(str,
"tree") == 0) {
320 for (j = 0; j < the_dim; j++) {
321 in >> the_bnd_box_lo[j];
323 for (j = 0; j < the_dim; j++) {
324 in >> the_bnd_box_hi[j];
326 the_pidx =
new ANNidx[the_n_pts];
329 the_root =
annReadTree(in, tree_type, the_pidx, next_idx);
330 if (next_idx != the_n_pts) {
385 if (strcmp(tag,
"null") == 0) {
391 if (strcmp(tag,
"leaf") == 0) {
394 int old_idx = next_idx;
399 for (
int i = 0; i <
n_pts; i++) {
400 in >> the_pidx[next_idx++];
403 return new ANNkd_leaf(n_pts, &the_pidx[old_idx]);
408 else if (strcmp(tag,
"split") == 0) {
410 in >> cd >> cv >> lb >> hb;
421 else if (strcmp(tag,
"shrink") == 0) {
429 for (
int i = 0; i < n_bnds; i++) {
430 in >> cd >> cv >> sd;
void annError(const char *msg, ANNerr level)
virtual void dump(ostream &out)
static ANNkd_ptr annReadDump(istream &in, ANNtreeType tree_type, ANNpointArray &the_pts, ANNidxArray &the_pidx, int &the_dim, int &the_n_pts, int &the_bkt_size, ANNpoint &the_bnd_box_lo, ANNpoint &the_bnd_box_hi)
DLL_API ANNpointArray annAllocPts(int n, int dim)
virtual void dump(ostream &out)
ANNbd_tree(int n, int dd, int bs=1)
virtual void Dump(ANNbool with_pts, std::ostream &out)
static ANNkd_ptr annReadTree(istream &in, ANNtreeType tree_type, ANNidxArray the_pidx, int &next_idx)
DLL_API ANNpoint annAllocPt(int dim, ANNcoord c=0)
ANNkd_tree(int n=0, int dd=0, int bs=1)
void annPrintPt(ANNpoint pt, int dim, std::ostream &out)
virtual void dump(ostream &out)