示例#1
0
void ANNkd_tree::Dump(			// dump entire tree
	ANNbool with_pts,		// print points as well?
	ostream &out)			// output stream
{
    out << "#ANN " << ANNversion << "\n";
    if (with_pts) {			// print point coordinates
	out << "points " << dim << " " << n_pts << "\n";
	for (int i = 0; i < n_pts; i++) {
	    out << i << " ";
	    annPrintPt(pts[i], dim, out);
	    out << "\n";
	}
    }
    out << "tree "			// print tree elements
	<< dim << " "
	<< n_pts << " "
	<< bkt_size << "\n";

    annPrintPt(bnd_box_lo, dim, out);	// print lower bound
    out << "\n";
    annPrintPt(bnd_box_hi, dim, out);	// print upper bound
    out << "\n";

    if (root == NULL)			// empty tree?
	out << "null\n";
    else {
    	root->dump(out);		// invoke printing at root
    }
}
示例#2
0
void ANNkd_tree::Print(					// print entire tree
		ANNbool with_pts,				// print points as well?
		ostream &out)					// output stream
{
	out << "ANN Version " << ANNversion << "\n";
	if (with_pts) {						// print point coordinates
		out << "    Points:\n";
		for (int i = 0; i < n_pts; i++) {
			out << "\t" << i << ": ";
			annPrintPt(pts[i], dim, out);
			out << "\n";
		}
	}
	if (root == NULL)					// empty tree?
		out << "    Null tree.\n";
	else {
		root->print(0, out);			// invoke printing at root
	}
}