Changeset 8544 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 06/11/07 16:36:14 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MMath.cc
r8484 r8544 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.3 1 2007-05-10 12:14:54 tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.32 2007-06-11 15:35:14 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 567 567 if (r==0) 568 568 { 569 x1 = -a/2;569 x1 = x2 = -a/2; 570 570 return 1; 571 571 } … … 710 710 const Double_t rq = R/TMath::Abs(Q); 711 711 712 const Double_t t = TMath::ACos(rq/sqrtq)/3; 713 714 static const Double_t sqrt3 = TMath::Sqrt(3.); 715 716 const Double_t s = TMath::Sin(t)*sqrt3; 717 const Double_t c = TMath::Cos(t); 718 719 x1 = 2*sqrtq * c - a/3; 720 x2 = -sqrtq * (s + c) - a/3; 721 x3 = sqrtq * (s - c) - a/3; 722 723 /* --- Easier to understand but slower --- 712 724 const Double_t th1 = TMath::ACos(rq/sqrtq); 713 725 const Double_t th2 = th1 + TMath::TwoPi(); … … 717 729 x2 = 2.*sqrtq * TMath::Cos(th2/3.) - a/3.; 718 730 x3 = 2.*sqrtq * TMath::Cos(th3/3.) - a/3.; 719 731 */ 720 732 return 3; 721 733 } -
trunk/MagicSoft/Mars/mbase/MMath.h
r8324 r8544 70 70 inline Int_t ModF(Double_t dbl, Double_t &frac) { Double_t rc; frac = modf(dbl, &rc); return TMath::Nint(rc); } 71 71 72 inline Double_t Sqrt3(Double_t x) { return TMath::Sign(TMath::Power(TMath::Abs(x), 1./3),x); }72 inline Double_t Sqrt3(Double_t x) { return cbrt(x); } 73 73 74 74 inline Double_t Sgn(Double_t d) { return d<0 ? -1 : 1; }
Note:
See TracChangeset
for help on using the changeset viewer.