GRASS GIS 8 Programmer's Manual
8.4.1(2025)-45ca3179ab
Loading...
Searching...
No Matches
ortho.c
Go to the documentation of this file.
1
/* ortho.c CCMATH mathematics library source code.
2
*
3
* Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
4
* This code may be redistributed under the terms of the GNU library
5
* public license (LGPL). ( See the lgpl.license file for details.)
6
* ------------------------------------------------------------------------
7
*/
8
#include "
ccmath.h
"
9
static
double
tpi = 6.28318530717958647;
10
11
void
ortho
(
double
*e,
int
n)
12
{
13
int
i, j, k, m;
14
15
double
*p, *q, c, s, a,
unfl
(
void
);
16
17
for
(i = 0, p = e; i < n; ++i) {
18
for
(j = 0; j < n; ++j) {
19
if
(i == j)
20
*p++ = 1.;
21
else
22
*p++ = 0.;
23
}
24
}
25
for
(i = 0, m = n - 1; i < m; ++i) {
26
for
(j = i + 1; j < n; ++j) {
27
a = tpi *
unfl
();
28
c = cos(a);
29
s = sin(a);
30
p = e + n * i;
31
q = e + n * j;
32
for
(k = 0; k < n; ++k) {
33
a = *p * c + *q * s;
34
*q = *q * c - *p * s;
35
*p++ = a;
36
++q;
37
}
38
}
39
}
40
}
ccmath.h
ortho
void ortho(double *e, int n)
Definition
ortho.c:11
unfl
double unfl(void)
Definition
unfl.c:10
external
ccmath
ortho.c
Generated on Sat Jun 21 2025 21:07:27 for GRASS GIS 8 Programmer's Manual by
1.13.2