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#include "TMath.h"
17
18namespace ROOT {
19
20namespace Math {
21
22
24 // returns phi angle in the interval (0,2*PI]
25 if (angle <= 2. * TMath::Pi() && angle > 0)
26 return angle;
27
28 if ( angle > 0 ) {
29 int n = static_cast<int>(angle / (2. * TMath::Pi()));
30 angle -= 2. * TMath::Pi() * n;
31 } else {
32 int n = static_cast<int>(-(angle) / (2. * TMath::Pi()));
33 angle += 2. * TMath::Pi() * (n + 1);
34 }
35 return angle;
36}
37
39 // returns phi angle in the interval (-PI,PI]
40
41 if (angle <= TMath::Pi() && angle > -TMath::Pi())
42 return angle;
43
44 if ( angle > 0 ) {
45 int n = static_cast<int>((angle + TMath::Pi()) / (2. * TMath::Pi()));
46 angle -= 2 * TMath::Pi() * n;
47 } else {
48 int n = static_cast<int>(-(angle - TMath::Pi()) / (2. * TMath::Pi()));
49 angle += 2 * TMath::Pi() * n;
50 }
51 return angle;
52}
53
54
55
56} //namespace Math
57} //namespace ROOT
Option_t Option_t TPoint TPoint angle
const Int_t n
Definition legend1.C:16
Namespace for new Math classes and functions.
double Phi_0_2pi(double phi)
Return a phi angle in the interval (0,2*PI].
double Phi_mpi_pi(double phi)
Returns phi angle in the interval (-PI,PI].
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
constexpr Double_t Pi()
Definition TMath.h:38