YetAnotherCoupler 3.2.0_a
Loading...
Searching...
No Matches
interval_tree.h
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
9#ifndef INTERVAL_TREE_H
10#define INTERVAL_TREE_H
11
12#include <stdlib.h>
13
15{
16 double left, right;
17};
18
19static inline int
20overlap_test(struct interval a, struct interval b)
21{
22 return (a.left <= b.left && a.right >= b.left) ||
23 (a.left > b.left && a.left <= b.right);
24}
25
27{
29 double max;
30 size_t value;
31};
32
33void
34yac_generate_interval_tree(struct interval_node intervals[], size_t num_nodes);
35
37{
39 size_t *overlap_iv;
40};
41
42void
43yac_search_interval_tree(struct interval_node tree[], size_t num_nodes,
44 struct interval query, struct overlaps *overlaps);
45
46#endif
47
void yac_search_interval_tree(struct interval_node tree[], size_t num_nodes, struct interval query, struct overlaps *overlaps)
void yac_generate_interval_tree(struct interval_node intervals[], size_t num_nodes)
static int overlap_test(struct interval a, struct interval b)
struct interval range
double right
double left
size_t * overlap_iv
size_t num_overlaps
size_t a_size