GRASS GIS 8 Programmer's Manual
8.5.0dev(2025)-565e82de51
Main Page
Related Pages
Data Structures
Data Structures
Class Hierarchy
Data Fields
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
Enumerations
a
c
d
e
h
i
j
l
m
n
o
p
r
s
t
v
y
Enumerator
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
gammavol.c
Go to the documentation of this file.
1
/****************************************************************************
2
* MODULE: R-Tree library
3
*
4
* AUTHOR(S): Antonin Guttman - original code
5
* Daniel Green (green@superliminal.com) - major clean-up
6
* and implementation of bounding spheres
7
* Markus Metz - file-based and memory-based R*-tree
8
*
9
* PURPOSE: Multidimensional index
10
*
11
* COPYRIGHT: (C) 2010 by the GRASS Development Team
12
*
13
* This program is free software under the GNU General Public
14
* License (>=v2). Read the file COPYING that comes with GRASS
15
* for details.
16
*****************************************************************************/
17
18
#include <
stdio.h
>
19
#include <math.h>
20
21
#ifndef ABS
22
#define ABS(a) ((a) > 0 ? (a) : -(a))
23
#endif
24
25
#define EP .0000000001
26
27
double
sphere_volume
(
double
dimension)
28
{
29
double
log_gamma, log_volume;
30
31
log_gamma = lgamma(dimension / 2.0 + 1);
32
log_volume = dimension / 2.0 * log(
M_PI
) - log_gamma;
33
return
exp(log_volume);
34
}
35
36
int
main
(
void
)
37
{
38
double
dim = 0, delta = 1;
39
40
while
(
ABS
(delta) >
EP
)
41
if
(
sphere_volume
(dim + delta) >
sphere_volume
(dim))
42
dim += delta;
43
else
44
delta /= -2;
45
fprintf(stdout,
"max volume = %.10f at dimension %.10f\n"
,
46
sphere_volume
(dim), dim);
47
return
0;
48
}
sphere_volume
double sphere_volume(double dimension)
Definition:
gammavol.c:27
main
int main(void)
Definition:
gammavol.c:36
EP
#define EP
Definition:
gammavol.c:25
ABS
#define ABS(a)
Definition:
gammavol.c:22
M_PI
#define M_PI
Definition:
gis.h:158
stdio.h
lib
vector
rtree
gammavol.c
Generated on Thu Mar 20 2025 07:33:24 for GRASS GIS 8 Programmer's Manual by
1.9.1