The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
src
simpleangle.c
Go to the documentation of this file.
1
/************************************************************************/
2
/**
3
4
\file simpleangle.c
5
6
\version V1.6
7
\date 07.07.14
8
\brief
9
10
\copyright (c) UCL / Dr. Andrew C. R. Martin, 1993-2014
11
\author Dr. Andrew C. R. Martin
12
\par
13
Institute of Structural & Molecular Biology,
14
University College London,
15
Gower Street,
16
London.
17
WC1E 6BT.
18
\par
19
andrew@bioinf.org.uk
20
andrew.martin@ucl.ac.uk
21
22
**************************************************************************
23
24
This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
25
according to the conditions laid out in the accompanying file
26
COPYING.DOC.
27
28
The code may be modified as required, but any modifications must be
29
documented so that the person responsible can be identified.
30
31
The code may not be sold commercially or included as part of a
32
commercial product except as described in the file COPYING.DOC.
33
34
**************************************************************************
35
36
Description:
37
============
38
39
40
**************************************************************************
41
42
Usage:
43
======
44
45
**************************************************************************
46
47
Revision History:
48
=================
49
50
- V1.6 07.07.14 Use bl prefix for functions By: CTP
51
52
*************************************************************************/
53
/* Doxygen
54
-------
55
#GROUP Maths
56
#SUBGROUP Geometry
57
#FUNCTION blSimpleangle()
58
Simplifies a signed angle to an unsigned angle <=2*PI
59
*/
60
/************************************************************************/
61
/* Includes
62
*/
63
#include <math.h>
64
#include "
MathType.h
"
65
#include "
macros.h
"
66
67
/************************************************************************/
68
/* Defines and macros
69
*/
70
71
/************************************************************************/
72
/* Globals
73
*/
74
75
/************************************************************************/
76
/* Prototypes
77
*/
78
79
80
/************************************************************************/
81
/*>REAL blSimpleangle(REAL ang)
82
----------------------------
83
*/
/**
84
85
\param[in] ang An angle
86
\return Simplified angle
87
88
Simplifies a signed angle to an unsigned angle <=2*PI
89
90
- 07.02.89 Original By: ACRM
91
- 04.03.91 Fixed return value
92
- 16.06.93 Changed float to REAL
93
- 07.07.14 Use bl prefix for functions By: CTP
94
*/
95
REAL
blSimpleangle
(
REAL
ang)
96
{
97
/* Reduce to less than 360 degrees */
98
while
(ang > 2*
PI
) ang -= 2*
PI
;
99
100
if
(ang >= 0.0 && ang <=
PI
)
/* 1st & 2nd quadrant +ve */
101
return
(ang);
102
else
if
(ang >
PI
)
/* 3rd & 4th quadrant +ve */
103
ang = 2*
PI
- ang;
104
else
if
(ang < 0.0 && ang > -
PI
)
/* 1st & 2nd quadrant -ve */
105
ang =
ABS
(ang);
106
else
/* 3rd & 4th quadrant -ve */
107
ang = 2*
PI
+ ang;
108
109
return
(ang);
110
}
111
blSimpleangle
REAL blSimpleangle(REAL ang)
Definition:
simpleangle.c:95
PI
#define PI
Definition:
macros.h:215
macros.h
Useful macros.
REAL
double REAL
Definition:
MathType.h:67
ABS
#define ABS(x)
Definition:
macros.h:235
MathType.h
Type definitions for maths.
Generated on Tue Oct 24 2017 10:57:16 for Bioplib by
1.8.8