/*
   File:        incremental.h
   Author:      Dan Pelleg and Andrew W. Moore
   Created:     Fri Feb 19 17:19:46 EST 1999
   Description: Header for Incrementally growing kdtrees

   Copyright 1999, The Auton Lab
*/


#ifndef INCREMENTAL_H
#define INCREMENTAL_H
#include "simple_kdtree.h"
#include "dyvp_array.h"

void make_simple_kdtree_from_file(const char *filename, double min_box_width,
                                  int max_leaf_size,
                                  simple_kdtree **kd,
                                  dyvp_array **data_list);

/* Increases the length of each side of the hrect by the given fraction,
   while keeping the hrect's center at the same place */
void expand_hrect(hrect *hr, double frac);

void save_hrect(const char *filename, const hrect *hr);

/* if hi=true, given a number return it formatted for printing, so that the
printed representation (when scanf'ed), it will be no smaller than its real
value.  if hi=false, does the same but guarantees it will not show larger
than its value. Note that the value may need to be changed (up or down,
as appropriate) for this to hold.
*/
const char *const hrect_boundary_format_str(double num, bool hi);

/* the squared L2 norm of the width */
double hrect_sqd_norm(const hrect *hr);

void dyv_from_line_of_file(FILE *s, int size, dyv **point);

#endif /* #ifndef INCREMENTAL_H */
