GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
dataquad.h File Reference

Go to the source code of this file.

Data Structures

struct  triple
 
struct  quaddata
 

Macros

#define NW   1
 
#define NE   2
 
#define SW   3
 
#define SE   4
 

Functions

struct triplequad_point_new (double, double, double, double)
 
struct quaddataquad_data_new (double, double, double, double, int, int, int, int)
 
int quad_compare (struct triple *, struct quaddata *)
 
int quad_add_data (struct triple *, struct quaddata *, double)
 
int quad_intersect (struct quaddata *, struct quaddata *)
 
int quad_division_check (struct quaddata *, int)
 
struct quaddata ** quad_divide_data (struct quaddata *, int, double)
 
int quad_get_points (struct quaddata *, struct quaddata *, int)
 

Macro Definition Documentation

◆ NE

#define NE   2

Definition at line 29 of file dataquad.h.

◆ NW

#define NW   1

Definition at line 28 of file dataquad.h.

◆ SE

#define SE   4

Definition at line 31 of file dataquad.h.

◆ SW

#define SW   3

Definition at line 30 of file dataquad.h.

Function Documentation

◆ quad_add_data()

int quad_add_data ( struct triple point,
struct quaddata data,
double  dmin 
)

Add point to a given data.

Definition at line 139 of file dataquad.c.

◆ quad_compare()

int quad_compare ( struct triple point,
struct quaddata data 
)

Return the quadrant the point should be inserted in

Definition at line 95 of file dataquad.c.

◆ quad_data_new()

struct quaddata* quad_data_new ( double  x_or,
double  y_or,
double  xmax,
double  ymax,
int  rows,
int  cols,
int  n_points,
int  kmax 
)

Initialize quaddata structure with given arguments

This is a constructor of the quaddata structure and it allocates memory. It also creates (and allocates memory for) the given number of points (given by kmax). The point attributes are set to zero.

Definition at line 59 of file dataquad.c.

◆ quad_divide_data()

struct quaddata** quad_divide_data ( struct quaddata data,
int  kmax,
double  dmin 
)

Divide data into four new ones

Divides data into 4 new data reinserting data->points in them by calling data function quad_compare() to determine were to insert. Returns array of 4 new data (allocates memory).

Definition at line 226 of file dataquad.c.

◆ quad_division_check()

int quad_division_check ( struct quaddata data,
int  kmax 
)

Check if data needs to be divided

Checks if data needs to be divided. If data->points is empty, returns -1; if its not empty but there aren't enough points in data for division returns 0. Otherwise (if its not empty and there are too many points) returns 1.

Returns
1 if division is needed
0 if division is not needed
-1 if there are no points

Definition at line 209 of file dataquad.c.

◆ quad_get_points()

int quad_get_points ( struct quaddata data_inter,
struct quaddata data,
int  MAX 
)

Gets such points from data that lie within region determined by data_inter. Called by tree function region_data().

Definition at line 305 of file dataquad.c.

◆ quad_intersect()

int quad_intersect ( struct quaddata data_inter,
struct quaddata data 
)

Check intersection of two quaddata structures

Checks if region defined by data intersects the region defined by data_inter.

Definition at line 176 of file dataquad.c.

◆ quad_point_new()

struct triple* quad_point_new ( double  x,
double  y,
double  z,
double  sm 
)

Initialize point structure with given arguments

This is a constructor of the point structure and it allocates memory.

Note
Smoothing is part of the point structure

Definition at line 36 of file dataquad.c.

References malloc(), NULL, triple::sm, x, triple::x, triple::y, and triple::z.