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
inside.c
Go to the documentation of this file.
1
/*****************************************************************************
2
*
3
* MODULE: Vector library
4
*
5
* AUTHOR(S): Original author CERL, probably Dave Gerdes.
6
* Update to GRASS 5.7 Radim Blazek.
7
*
8
* PURPOSE: Lower level functions for reading/writing/manipulating vectors.
9
*
10
* COPYRIGHT: (C) 2001 by the GRASS Development Team
11
*
12
* This program is free software under the GNU General Public
13
* License (>=v2). Read the file COPYING that comes with GRASS
14
* for details.
15
*
16
*****************************************************************************/
17
18
#include <
grass/vector.h
>
19
20
double
dig_x_intersect
(
double
beg_x,
double
end_x,
double
beg_y,
double
end_y,
21
double
Y
)
22
{
23
double
b
;
24
25
/* assumes beg_y != end_y */
26
27
/* sort for numerical stability */
28
if
(end_x < beg_x || (end_x == beg_x && end_y < beg_y)) {
29
b
= end_x;
30
end_x = beg_x;
31
beg_x =
b
;
32
33
b
= end_y;
34
end_y = beg_y;
35
beg_y =
b
;
36
}
37
38
/* solve simple linear equation to get X = a + b * Y
39
* with
40
* b = (end_x - beg_x) / (end_y - beg_y)
41
* a = beg_x - b * beg_y
42
*
43
* simplify a + b * Y:
44
* a + b * Y = beg_x - b * beg_y + b * Y
45
* a + b * Y = beg_x + b * (Y - beg_y) */
46
47
b
= (end_x - beg_x) / (end_y - beg_y);
48
49
return
beg_x +
b
* (
Y
- beg_y);
50
}
dig_x_intersect
double dig_x_intersect(double beg_x, double end_x, double beg_y, double end_y, double Y)
Definition:
inside.c:20
Y
#define Y
Definition:
ogsf.h:141
b
double b
Definition:
r_raster.c:39
vector.h
lib
vector
diglib
inside.c
Generated on Thu Mar 20 2025 07:33:26 for GRASS GIS 8 Programmer's Manual by
1.9.1