Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
VectorUtil.cxx
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Authors: W. Brown, M. Fischler, L. Moneta 2006
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 , LCG ROOT MathLib Team *
7 * *
8 * *
9 **********************************************************************/
10
11// Implementation of VectorUtil functions
12//
13// Created by: Lorenzo Moneta 22 Aug 2006
14//
16
18
20
21namespace ROOT {
22
23namespace ROOT_MATH_ARCH {
24
26{
27 // returns phi angle in the interval (0,2*PI]
29 return angle;
30
31 if (angle > 0) {
32 int n = static_cast<int>(angle / (2. * M_PI));
33 angle -= 2. * M_PI * n;
34 } else {
35 int n = static_cast<int>(-(angle) / (2. * M_PI));
36 angle += 2. * M_PI * (n + 1);
37 }
38 return angle;
39}
40
42{
43 // returns phi angle in the interval (-PI,PI]
44
46 return angle;
47
48 if (angle > 0) {
49 int n = static_cast<int>((angle + M_PI) / (2. * M_PI));
50 angle -= 2 * M_PI * n;
51 } else {
52 int n = static_cast<int>(-(angle - M_PI) / (2. * M_PI));
53 angle += 2 * M_PI * n;
54 }
55 return angle;
56}
57
58} // namespace ROOT_MATH_ARCH
59} // namespace ROOT
#define M_PI
Definition Rotated.cxx:105
Option_t Option_t TPoint TPoint angle
double Phi_mpi_pi(double phi)
Returns phi angle in the interval (-PI,PI].
double Phi_0_2pi(double phi)
Return a phi angle in the interval (0,2*PI].
const Int_t n
Definition legend1.C:16