![]() |
MobilityDB 1.3
|
In-memory index for STBox based on RTree. More...
#include <stdlib.h>
#include <math.h>
#include <meos.h>
#include <meos_geo.h>
#include <meos_internal.h>
#include <meos_internal_geo.h>
#include "geo/tspatial_rtree.h"
Functions | |
static void | add_answer (const int id, int **ids, int *count) |
Adds an ID to the dynamically allocated array with the answer of a query. More... | |
static double | box_area (const STBox *box, const RTree *rtree) |
Calculates the area (or volume) of an STBox. More... | |
static double | box_unioned_area (const STBox *box, const STBox *other_box, const RTree *rtree) |
Calculates the area (or volume) of the union of two STBoxes. More... | |
static double | get_axis_length (const RTree *rtree, const STBox *box, int axis) |
Calculates the length of an STBox along a specified axis. More... | |
static double | get_axis_stbox (const STBox *box, int axis, bool upper) |
Retrieves the value of a specific axis from an STBox. More... | |
static bool | is_power_of_two (const int n) |
Checks if a number bigger than 0 is a power of two or not. More... | |
static void | node_box_calculate (const RTreeNode *node, STBox *box) |
Calculates the bounding box that encloses all STBoxes in an RTree node. More... | |
static int | node_choose (const RTree *rtree, const STBox *box, const RTreeNode *node) |
Chooses the best child node for inserting a new STBox in an RTree. More... | |
static int | node_choose_least_enlargement (const RTreeNode *node, const STBox *box, const RTree *rtree) |
Selects the child node that requires the least enlargement to accommodate a new STBox. More... | |
static void | node_free (RTreeNode *node) |
Frees the memory allocated for an RTree node and its associated resources. More... | |
static void | node_insert (RTree *rtree, STBox *node_bounding_box, RTreeNode *node, STBox *new_box, int id, bool *split) |
Inserts an STBox into an RTree node and handles node splitting if necessary. More... | |
static void | node_move_box_at_index_into (RTreeNode *from, int index, RTreeNode *into) |
Moves an STBox from one RTree node to another. More... | |
static RTreeNode * | node_new (bool kind) |
Creates a new RTree node. More... | |
static void | node_qsort (const RTree *rtree, RTreeNode *node, int index, bool upper, int s, int e) |
Sorts STBoxes within an RTree node using the QuickSort algorithm. More... | |
void | node_search (const RTreeNode *node, const STBox *query, int **ids, int *count) |
Searches recursively a node looking for hits with a query. More... | |
static void | node_sort_axis (const RTree *rtree, RTreeNode *node, int index, bool upper) |
Sorts STBoxes within an RTree node along a specified axis. More... | |
static void | node_split (RTree *rtree, RTreeNode *node, STBox *box, RTreeNode **right_out) |
Splits an RTree node and redistributes its STBoxes between two nodes. More... | |
static void | node_swap (RTreeNode *node, int i, int j) |
Swaps two STBoxes and their associated data within an RTree node. More... | |
RTree * | rtree_create (meosType basetype) |
Creates an RTree index. More... | |
RTree * | rtree_create_stbox () |
Creates an RTree index for STBoxes. More... | |
void | rtree_free (RTree *rtree) |
Frees the RTree. More... | |
void | rtree_insert (RTree *rtree, STBox *box, int64 id) |
Insert an STBox into the RTree index. More... | |
int * | rtree_search (const RTree *rtree, const STBox *query, int *count) |
Queries an RTree with an STBox. More... | |
static bool | rtree_set_dims (RTree *rtree, const STBox *box) |
Sets the dimensions of an R-tree based on the meostype of the RTree. More... | |
static bool | rtree_set_functions (RTree *rtree) |
Sets the appropriate get axis function for the R-tree based on its meosType. More... | |
static int | stbox_largest_axis (const STBox *box, const RTree *rtree) |
Identifies the axis with the largest length in an STBox. More... | |