Hi, I have created a kdtree (dynamically) using median cut approach
and now i want to free it. Here's my data structure :
typedef struct kdnode_s
{
bbox box; /* Bounding box */
char split_plane; /* 0:- x, 1:- y, 2 : z -1 : leaf*/
union
{
struct
{
struct kdnode_s *child[2]; /* two child nodes
double split; /* split point */
}nonleaf;
struct
{
unsigned long nt; /* no: of triangles in node */
triangle **tpa; /* triangle list */
}leaf;
}u;
}kdnode;
I tried to think over a few methods like postorder traversal etc but
it won't work in this scenario. what to do ?