MobilityDB 1.3
Loading...
Searching...
No Matches

◆ getQuadrant4D()

static uint8 getQuadrant4D ( const TBox centroid,
const TBox inBox 
)
static

Calculate the quadrant.

The quadrant is 8 bit unsigned integer with 4 least bits in use. This function accepts temporal boxes as input. All 4 bits are set by comparing a corner of the box. This makes 16 quadrants in total.

Continuing with the example at the top of this file

| |
| |
| -----+-----
| | inbox
| |
-------------+-------------
|
|
|
|
Datum centroid(PG_FUNCTION_ARGS)

where centroid and inbox are as follows

centroid = TBOXFLOAT XT([3, 5],[2001-01-03, 2001-01-05])
inbox = TBOXFLOAT XT([7, 9],[2001-01-07, 2001-01-09])

Then

  • quadrant |= 0x8 since 7 > 3
  • quadrant |= 0x4 since 9 > 5
  • quadrant |= 0x2 since 2001-01-07 > 2001-01-03
  • quadrant |= 0x1 since 2001-01-09 > 2001-01-05