MySQL 8.0.29
Source Code Documentation
rt_mbr.cc File Reference
#include "storage/myisam/rt_mbr.h"
#include <assert.h>
#include <algorithm>
#include "my_byteorder.h"
#include "my_double2ulonglong.h"
#include "my_macros.h"
#include "storage/myisam/myisamdef.h"
#include "storage/myisam/rt_index.h"

Macros

#define INTERSECT_CMP(amin, amax, bmin, bmax)   ((amin > bmax) || (bmin > amax))
 
#define CONTAIN_CMP(amin, amax, bmin, bmax)   ((bmin > amin) || (bmax < amax))
 
#define WITHIN_CMP(amin, amax, bmin, bmax)   ((amin > bmin) || (amax < bmax))
 
#define DISJOINT_CMP(amin, amax, bmin, bmax)   ((amin <= bmax) && (bmin <= amax))
 
#define EQUAL_CMP(amin, amax, bmin, bmax)   ((amin != bmin) || (amax != bmax))
 
#define FCMP(A, B)   ((int)(A) - (int)(B))
 
#define RT_CMP(nextflag)
 
#define RT_CMP_KORR(type, korr_func, len, nextflag)
 
#define RT_CMP_GET(type, get_func, len, nextflag)
 
#define RT_VOL_KORR(type, korr_func, len, cast)
 
#define RT_VOL_GET(type, get_func, len, cast)
 
#define RT_D_MBR_KORR(type, korr_func, len, cast)
 
#define RT_D_MBR_GET(type, get_func, len, cast)
 
#define RT_COMB_KORR(type, korr_func, store_func, len)
 
#define RT_COMB_GET(type, get_func, store_func, len)
 
#define RT_OVL_AREA_KORR(type, korr_func, len)
 
#define RT_OVL_AREA_GET(type, get_func, len)
 
#define RT_AREA_INC_KORR(type, korr_func, len)
 
#define RT_AREA_INC_GET(type, get_func, len)
 
#define RT_PERIM_INC_KORR(type, korr_func, len)
 
#define RT_PERIM_INC_GET(type, get_func, len)
 
#define RT_PAGE_MBR_KORR(type, korr_func, store_func, len)
 
#define RT_PAGE_MBR_GET(type, get_func, store_func, len)
 

Functions

int rtree_key_cmp (HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length, uint nextflag)
 
double rtree_rect_volume (HA_KEYSEG *keyseg, uchar *a, uint key_length)
 
int rtree_d_mbr (HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
 
int rtree_combine_rect (HA_KEYSEG *keyseg, uchar *a, uchar *b, uchar *c, uint key_length)
 
double rtree_overlapping_area (HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length)
 
double rtree_area_increase (HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length, double *ab_area)
 
double rtree_perimeter_increase (HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length, double *ab_perim)
 
int rtree_page_mbr (MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf, uchar *c, uint key_length)
 

Macro Definition Documentation

◆ CONTAIN_CMP

#define CONTAIN_CMP (   amin,
  amax,
  bmin,
  bmax 
)    ((bmin > amin) || (bmax < amax))

◆ DISJOINT_CMP

#define DISJOINT_CMP (   amin,
  amax,
  bmin,
  bmax 
)    ((amin <= bmax) && (bmin <= amax))

◆ EQUAL_CMP

#define EQUAL_CMP (   amin,
  amax,
  bmin,
  bmax 
)    ((amin != bmin) || (amax != bmax))

◆ FCMP

#define FCMP (   A,
 
)    ((int)(A) - (int)(B))

◆ INTERSECT_CMP

#define INTERSECT_CMP (   amin,
  amax,
  bmin,
  bmax 
)    ((amin > bmax) || (bmin > amax))

◆ RT_AREA_INC_GET

#define RT_AREA_INC_GET (   type,
  get_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = get_func(a); \
bmin = get_func(b); \
amax = get_func(a + len); \
bmax = get_func(b + len); \
a_area *= (((double)amax) - ((double)amin)); \
loc_ab_area *= \
((double)std::max(amax, bmax) - (double)std::min(amin, bmin)); \
}

◆ RT_AREA_INC_KORR

#define RT_AREA_INC_KORR (   type,
  korr_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
amax = korr_func(a + len); \
bmax = korr_func(b + len); \
a_area *= (((double)amax) - ((double)amin)); \
loc_ab_area *= \
((double)std::max(amax, bmax) - (double)std::min(amin, bmin)); \
}

◆ RT_CMP

#define RT_CMP (   nextflag)
Value:
if (nextflag & MBR_INTERSECT) { \
if (INTERSECT_CMP(amin, amax, bmin, bmax)) return 1; \
} else if (nextflag & MBR_CONTAIN) { \
if (CONTAIN_CMP(amin, amax, bmin, bmax)) return 1; \
} else if (nextflag & MBR_WITHIN) { \
if (WITHIN_CMP(amin, amax, bmin, bmax)) return 1; \
} else if (nextflag & MBR_EQUAL) { \
if (EQUAL_CMP(amin, amax, bmin, bmax)) return 1; \
} else if (nextflag & MBR_DISJOINT) { \
if (DISJOINT_CMP(amin, amax, bmin, bmax)) return 1; \
} else /* if unknown comparison operator */ \
{ \
assert(0); \
}
#define MBR_DISJOINT
Definition: my_base.h:1024
#define MBR_CONTAIN
Definition: my_base.h:1021
#define MBR_WITHIN
Definition: my_base.h:1023
#define MBR_INTERSECT
Definition: my_base.h:1022
#define MBR_EQUAL
Definition: my_base.h:1025
#define INTERSECT_CMP(amin, amax, bmin, bmax)
Definition: rt_mbr.cc:35
#define CONTAIN_CMP(amin, amax, bmin, bmax)
Definition: rt_mbr.cc:36
#define DISJOINT_CMP(amin, amax, bmin, bmax)
Definition: rt_mbr.cc:38
#define WITHIN_CMP(amin, amax, bmin, bmax)
Definition: rt_mbr.cc:37
#define EQUAL_CMP(amin, amax, bmin, bmax)
Definition: rt_mbr.cc:39

◆ RT_CMP_GET

#define RT_CMP_GET (   type,
  get_func,
  len,
  nextflag 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = get_func(a); \
bmin = get_func(b); \
amax = get_func(a + len); \
bmax = get_func(b + len); \
RT_CMP(nextflag); \
}

◆ RT_CMP_KORR

#define RT_CMP_KORR (   type,
  korr_func,
  len,
  nextflag 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
amax = korr_func(a + len); \
bmax = korr_func(b + len); \
RT_CMP(nextflag); \
}

◆ RT_COMB_GET

#define RT_COMB_GET (   type,
  get_func,
  store_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = get_func(a); \
bmin = get_func(b); \
amax = get_func(a + len); \
bmax = get_func(b + len); \
amin = std::min(amin, bmin); \
amax = std::max(amax, bmax); \
store_func(c, amin); \
store_func(c + len, amax); \
}

◆ RT_COMB_KORR

#define RT_COMB_KORR (   type,
  korr_func,
  store_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
amax = korr_func(a + len); \
bmax = korr_func(b + len); \
amin = std::min(amin, bmin); \
amax = std::max(amax, bmax); \
store_func(c, amin); \
store_func(c + len, amax); \
}

◆ RT_D_MBR_GET

#define RT_D_MBR_GET (   type,
  get_func,
  len,
  cast 
)
Value:
{ \
type amin, amax; \
amin = get_func(a); \
amax = get_func(a + len); \
*res++ = cast(amin); \
*res++ = cast(amax); \
}

◆ RT_D_MBR_KORR

#define RT_D_MBR_KORR (   type,
  korr_func,
  len,
  cast 
)
Value:
{ \
type amin, amax; \
amin = korr_func(a); \
amax = korr_func(a + len); \
*res++ = cast(amin); \
*res++ = cast(amax); \
}

◆ RT_OVL_AREA_GET

#define RT_OVL_AREA_GET (   type,
  get_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = get_func(a); \
bmin = get_func(b); \
amax = get_func(a + len); \
bmax = get_func(b + len); \
amin = std::max(amin, bmin); \
amax = std::min(amax, bmax); \
if (amin >= amax) return 0; \
res *= amax - amin; \
}

◆ RT_OVL_AREA_KORR

#define RT_OVL_AREA_KORR (   type,
  korr_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
amax = korr_func(a + len); \
bmax = korr_func(b + len); \
amin = std::max(amin, bmin); \
amax = std::min(amax, bmax); \
if (amin >= amax) return 0; \
res *= amax - amin; \
}

◆ RT_PAGE_MBR_GET

#define RT_PAGE_MBR_GET (   type,
  get_func,
  store_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = get_func(k + inc); \
amax = get_func(k + inc + len); \
k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag); \
for (; k < last; k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag)) { \
bmin = get_func(k + inc); \
bmax = get_func(k + inc + len); \
if (amin > bmin) amin = bmin; \
if (amax < bmax) amax = bmax; \
} \
store_func(c, amin); \
c += len; \
store_func(c, amax); \
c += len; \
inc += 2 * len; \
}
Type inc(Shards< COUNT > &shards, size_t id)
Increment the counter of a shard by 1.
Definition: ut0counter.h:292
#define rt_PAGE_NEXT_KEY(key, key_length, nod_flag)
Definition: rt_index.h:36

◆ RT_PAGE_MBR_KORR

#define RT_PAGE_MBR_KORR (   type,
  korr_func,
  store_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(k + inc); \
amax = korr_func(k + inc + len); \
k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag); \
for (; k < last; k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag)) { \
bmin = korr_func(k + inc); \
bmax = korr_func(k + inc + len); \
if (amin > bmin) amin = bmin; \
if (amax < bmax) amax = bmax; \
} \
store_func(c, amin); \
c += len; \
store_func(c, amax); \
c += len; \
inc += 2 * len; \
}

◆ RT_PERIM_INC_GET

#define RT_PERIM_INC_GET (   type,
  get_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = get_func(a); \
bmin = get_func(b); \
amax = get_func(a + len); \
bmax = get_func(b + len); \
a_perim += (((double)amax) - ((double)amin)); \
*ab_perim += \
((double)std::max(amax, bmax) - (double)std::min(amin, bmin)); \
}

◆ RT_PERIM_INC_KORR

#define RT_PERIM_INC_KORR (   type,
  korr_func,
  len 
)
Value:
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
amax = korr_func(a + len); \
bmax = korr_func(b + len); \
a_perim += (((double)amax) - ((double)amin)); \
*ab_perim += \
((double)std::max(amax, bmax) - (double)std::min(amin, bmin)); \
}

◆ RT_VOL_GET

#define RT_VOL_GET (   type,
  get_func,
  len,
  cast 
)
Value:
{ \
type amin, amax; \
amin = get_func(a); \
amax = get_func(a + len); \
res *= (cast(amax) - cast(amin)); \
}

◆ RT_VOL_KORR

#define RT_VOL_KORR (   type,
  korr_func,
  len,
  cast 
)
Value:
{ \
type amin, amax; \
amin = korr_func(a); \
amax = korr_func(a + len); \
res *= (cast(amax) - cast(amin)); \
}

◆ WITHIN_CMP

#define WITHIN_CMP (   amin,
  amax,
  bmin,
  bmax 
)    ((amin > bmin) || (amax < bmax))

Function Documentation

◆ rtree_area_increase()

double rtree_area_increase ( HA_KEYSEG keyseg,
uchar a,
uchar b,
uint  key_length,
double *  ab_area 
)

◆ rtree_combine_rect()

int rtree_combine_rect ( HA_KEYSEG keyseg,
uchar a,
uchar b,
uchar c,
uint  key_length 
)

◆ rtree_d_mbr()

int rtree_d_mbr ( HA_KEYSEG keyseg,
uchar a,
uint  key_length,
double *  res 
)

◆ rtree_key_cmp()

int rtree_key_cmp ( HA_KEYSEG keyseg,
uchar b,
uchar a,
uint  key_length,
uint  nextflag 
)

◆ rtree_overlapping_area()

double rtree_overlapping_area ( HA_KEYSEG keyseg,
uchar a,
uchar b,
uint  key_length 
)

◆ rtree_page_mbr()

int rtree_page_mbr ( MI_INFO info,
HA_KEYSEG keyseg,
uchar page_buf,
uchar c,
uint  key_length 
)

◆ rtree_perimeter_increase()

double rtree_perimeter_increase ( HA_KEYSEG keyseg,
uchar a,
uchar b,
uint  key_length,
double *  ab_perim 
)

◆ rtree_rect_volume()

double rtree_rect_volume ( HA_KEYSEG keyseg,
uchar a,
uint  key_length 
)