KDTree.c
/**
 *  Allocates a new SPKDTreeNode based on the arguments given to this function.
 *
 *  @param dim  	Dimension the node is split with
 *  @param val  	Value of the median in the dimension
 *  @param left		Address of the left SPKDTreeNode child
 *  @param right	Address of the left SPKDTreeNode child
 *  @param data		SPPoint array
 *  @return
 *  NULL if Memory Allocation failure occurred
 *  otherwise the allocated node.
 */
Allocates a new SPKDTreeNode based on the arguments given to this function.


Allocates a new SPKDTreeNode based on the arguments given to this function .
SPKDTreeNode nodeAllocation(int dim, int val, SPKDTreeNode* left,
		SPKDTreeNode* right, SPPoint* data) {
	SPKDTreeNode node = (SPKDTreeNode) malloc(sizeof(*node));
	if (!node) {
		declareLogMsg();
		MallocError()
		return NULL;
	}
	node->dim = dim;
	node->val = val;
	node->left = (left) ? *left : NULL;
	node->right = (right) ? *right : NULL;
	node->data = (data) ? *data : NULL;
	return node;
}
SPKDTreeNode nodeAllocation ( int dim , int val , SPKDTreeNode * left , SPKDTreeNode * right , SPPoint * data ) { SPKDTreeNode node = ( SPKDTreeNode ) malloc ( sizeof ( * node ) ) ; if ( ! node ) { declareLogMsg ( ) ; MallocError ( ) return NULL ; } node -> dim = dim ; node -> val = val ; node -> left = ( left ) ? * left : NULL ; node -> right = ( right ) ? * right : NULL ; node -> data = ( data ) ? * data : NULL ; return node ; }
Allocates a new SPKDTreeNode based on the arguments given to this function.
Allocates a new SPKDTreeNode based on the arguments given to this function .