|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
|
#include <stdio.h>#include <stdlib.h>#include <assert.h>#include "index.h"#include <float.h>#include <math.h>#include <grass/gis.h>
Go to the source code of this file.
Macros | |
| #define | BIG_NUM (FLT_MAX / 4.0) |
| #define | Undefined(x, t) ((x)->boundary[0] > (x)->boundary[t->ndims_alloc]) |
| #define | UnitSphereVolume UnitSphereVolumes[NUMDIMS] |
Variables | |
| const double | UnitSphereVolumes [] |
| #define UnitSphereVolume UnitSphereVolumes[NUMDIMS] |
Allocate the boundary array of a rectangle for a given tree.
This method allocated the boundary coordinates array in provided rectangle. It does not release previously allocated memory.
| r | The pointer to rectangle to initialize the boundary coordinates. This is usually a rectangle that was created on the stack or self allocated. |
| t | The pointer to a RTree struct |
Definition at line 81 of file rect.c.
References assert, RTree_Rect::boundary, malloc(), and t.
Referenced by RTreeAllocNode(), RTreeAllocRect(), and RTreeCreateTree().
| struct RTree_Rect * RTreeAllocRect | ( | struct RTree * | t | ) |
Create a new rectangle for a given tree.
This method allocates a new rectangle and initializes the internal boundary coordinates based on the tree dimension.
Hence a call to RTreeNewBoundary() is not necessary.
| t | The pointer to a RTree struct |
Definition at line 42 of file rect.c.
References assert, malloc(), r, RTreeAllocBoundary(), and t.
| void RTreeCombineRect | ( | struct RTree_Rect * | r1, |
| struct RTree_Rect * | r2, | ||
| struct RTree_Rect * | r3, | ||
| struct RTree * | t | ||
| ) |
| int RTreeCompareRect | ( | struct RTree_Rect * | r, |
| struct RTree_Rect * | s, | ||
| struct RTree * | t | ||
| ) |
Definition at line 570 of file rect.c.
References RTree_Rect::boundary, r, and t.
| int RTreeContained | ( | struct RTree_Rect * | r, |
| struct RTree_Rect * | s, | ||
| struct RTree * | t | ||
| ) |
| int RTreeContains | ( | struct RTree_Rect * | r, |
| struct RTree_Rect * | s, | ||
| struct RTree * | t | ||
| ) |
| int RTreeExpandRect | ( | struct RTree_Rect * | r1, |
| struct RTree_Rect * | r2, | ||
| struct RTree * | t | ||
| ) |
| void RTreeFreeBoundary | ( | struct RTree_Rect * | r | ) |
Delete the boundary of a rectangle.
This method deletes (free) the memory of the boundary of a rectangle and sets the boundary pointer to NULL.
| r | The pointer to the rectangle to delete the boundary from. |
Definition at line 98 of file rect.c.
References assert, free(), NULL, and r.
Referenced by RTreeDestroyTree(), RTreeFreeListBranch(), RTreeFreeNode(), and RTreeFreeRect().
| void RTreeFreeRect | ( | struct RTree_Rect * | r | ) |
| void RTreeInitRect | ( | struct RTree_Rect * | r, |
| struct RTree * | t | ||
| ) |
Initialize a rectangle to have all 0 coordinates.
Definition at line 109 of file rect.c.
Referenced by RTreeSetRect1D(), RTreeSetRect2D(), RTreeSetRect3D(), and RTreeSetRect4D().
| void RTreeNullRect | ( | struct RTree_Rect * | r, |
| struct RTree * | t | ||
| ) |
| int RTreeOverlap | ( | struct RTree_Rect * | r, |
| struct RTree_Rect * | s, | ||
| struct RTree * | t | ||
| ) |
Definition at line 590 of file rect.c.
References RTree_Rect::boundary, FALSE, r, t, and TRUE.
Referenced by rtree_search(), RTreeSearchF(), and RTreeSearchM().
Definition at line 304 of file rect.c.
References assert, r, RTreeTabIn(), and t.
Referenced by RTreePrintNode().
| RectReal RTreeRectMargin | ( | struct RTree_Rect * | r, |
| struct RTree * | t | ||
| ) |
| RectReal RTreeRectSphericalVolume | ( | struct RTree_Rect * | r, |
| struct RTree * | t | ||
| ) |
Definition at line 432 of file rect.c.
References r, t, Undefined, and UnitSphereVolumes.
Referenced by RTreePickBranch().
| RectReal RTreeRectSurfaceArea | ( | struct RTree_Rect * | r, |
| struct RTree * | t | ||
| ) |
| RectReal RTreeRectVolume | ( | struct RTree_Rect * | R, |
| struct RTree * | t | ||
| ) |
Set one dimensional coordinates of a rectangle for a given tree.
All coordinates of the rectangle will be initialized to 0 before the x coordinates are set.
| r | The pointer to the rectangle |
| t | The pointer to the RTree |
| x_min | The lower x coordinate |
| x_max | The higher x coordinate |
Definition at line 128 of file rect.c.
References r, RTreeInitRect(), and t.
| void RTreeSetRect2D | ( | struct RTree_Rect * | r, |
| struct RTree * | t, | ||
| double | x_min, | ||
| double | x_max, | ||
| double | y_min, | ||
| double | y_max | ||
| ) |
Set two dimensional coordinates of a rectangle for a given tree.
All coordinates of the rectangle will be initialized to 0 before the x and y coordinates are set.
| r | The pointer to the rectangle |
| t | The pointer to the RTree |
| x_min | The lower x coordinate |
| x_max | The higher x coordinate |
| y_min | The lower y coordinate |
| y_max | The higher y coordinate |
Definition at line 149 of file rect.c.
References r, RTreeInitRect(), and t.
| void RTreeSetRect3D | ( | struct RTree_Rect * | r, |
| struct RTree * | t, | ||
| double | x_min, | ||
| double | x_max, | ||
| double | y_min, | ||
| double | y_max, | ||
| double | z_min, | ||
| double | z_max | ||
| ) |
Set three dimensional coordinates of a rectangle for a given tree.
All coordinates of the rectangle will be initialized to 0 before the x,y and z coordinates are set.
| r | The pointer to the rectangle |
| t | The pointer to the RTree |
| x_min | The lower x coordinate |
| x_max | The higher x coordinate |
| y_min | The lower y coordinate |
| y_max | The higher y coordinate |
| z_min | The lower z coordinate |
| z_max | The higher z coordinate |
Definition at line 174 of file rect.c.
References r, RTreeInitRect(), and t.
| void RTreeSetRect4D | ( | struct RTree_Rect * | r, |
| struct RTree * | t, | ||
| double | x_min, | ||
| double | x_max, | ||
| double | y_min, | ||
| double | y_max, | ||
| double | z_min, | ||
| double | z_max, | ||
| double | t_min, | ||
| double | t_max | ||
| ) |
Set 4 dimensional coordinates of a rectangle for a given tree.
All coordinates of the rectangle will be initialized to 0 before the x,y,z and t coordinates are set.
| r | The pointer to the rectangle |
| t | The pointer to the RTree |
| x_min | The lower x coordinate |
| x_max | The higher x coordinate |
| y_min | The lower y coordinate |
| y_max | The higher y coordinate |
| z_min | The lower z coordinate |
| z_max | The higher z coordinate |
| t_min | The lower t coordinate |
| t_max | The higher t coordinate |
Definition at line 204 of file rect.c.
References assert, r, RTreeInitRect(), and t.
Definition at line 368 of file rect.c.
Referenced by RTreeRectSphericalVolume().