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
TrueAngle.c
Go to the documentation of this file.
1
/************************************************************************/
2
/**
3
4
\file TrueAngle.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
REAL blTrueAngle(REAL opp, REAL adj)
46
47
\param[in] opp Length of opposite side
48
\param[in] adj Length of adjacent side
49
\return The angle from 0 to 2PI
50
51
Returns the true positive angle between 0 and 2PI given the opp and
52
adj lengths
53
54
**************************************************************************
55
56
Revision History:
57
=================
58
- V1.0 07.02.91 Original
59
- V1.1 17.02.91 Corrected comments to new standard and added phi()
60
- V1.2 04.03.91 angle() and phi() now return _correct_ values!
61
- V1.3 01.06.92 ANSIed
62
- V1.4 08.12.92 Changed abs() to ABS() from macros.h
63
- V1.5 27.03.95 Added TrueAngle()
64
- V1.6 07.07.14 Use bl prefix for functions By: CTP
65
66
*************************************************************************/
67
/* Doxygen
68
-------
69
#GROUP Maths
70
#SUBGROUP Geometry
71
#FUNCTION blTrueAngle()
72
Return the +ve angle between 0 and 2PI given the opp and adj values.
73
*/
74
/************************************************************************/
75
/* Includes
76
*/
77
#include <math.h>
78
#include "
MathType.h
"
79
80
/************************************************************************/
81
/* Defines and macros
82
*/
83
84
/************************************************************************/
85
/* Globals
86
*/
87
88
/************************************************************************/
89
/* Prototypes
90
*/
91
92
93
/************************************************************************/
94
/*>REAL blTrueAngle(REAL opp, REAL adj)
95
------------------------------------
96
*/
/**
97
98
\param[in] opp Opposite length
99
\param[in] adj Adjacent length
100
\return Angle between 0 and 2PI
101
102
Return the +ve angle between 0 and 2PI given the opp and adj values.
103
104
- 25.07.94 Original By: ACRM
105
- 07.07.14 Use bl prefix for functions By: CTP
106
*/
107
REAL
blTrueAngle
(
REAL
opp,
REAL
adj)
108
{
109
REAL
ang;
110
111
if
(adj != 0.0)
112
{
113
ang = (
REAL
)atan((
double
)(opp/adj));
114
115
/* 4th quadrant; ang -ve so add 2PI */
116
if
(opp < 0.0 && adj > 0.0) ang += 2*
PI
;
117
118
/* 2nd & 3rd quadrant; add PI */
119
if
(adj < 0.0) ang +=
PI
;
120
}
121
else
122
{
123
if
(opp>0.0)
/* 1st->2nd quadrant boundary */
124
ang =
PI
/2.0;
125
else
/* 3rd->4th quadrant boundary */
126
ang = 3.0*
PI
/2.0;
127
}
128
129
if
(opp == 0.0)
130
{
131
if
(adj > 0.0)
/* 4th->1st quadrant boundary */
132
ang = 0.0;
133
else
/* 2nd->3rd quadrant boundary */
134
ang =
PI
;
135
}
136
137
return
(ang);
138
}
139
blTrueAngle
REAL blTrueAngle(REAL opp, REAL adj)
Definition:
TrueAngle.c:107
PI
#define PI
Definition:
macros.h:215
REAL
double REAL
Definition:
MathType.h:67
MathType.h
Type definitions for maths.
Generated on Tue Oct 24 2017 10:57:17 for Bioplib by
1.8.8