0022651: Impossible to build OCC as static library due to using Standard_EXPORT inste...
[occt.git] / src / GeomInt / GeomInt.cxx
1
2 // Created on:   25.08.14 17:59:59
3 // Created by:    jgv@VIVEX
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <GeomInt.hxx>
18 #include <TColStd_IndexedMapOfInteger.hxx>
19
20 //=======================================================================
21 //function : AdjustPeriodic
22 //purpose  : 
23 //=======================================================================
24 Standard_Boolean GeomInt::AdjustPeriodic(const Standard_Real thePar,
25                                          const Standard_Real theParMin,
26                                          const Standard_Real theParMax,
27                                          const Standard_Real thePeriod,
28                                          Standard_Real &theNewPar,
29                                          Standard_Real &theOffset,
30                                          const Standard_Real theEps)
31 {
32   Standard_Boolean bMin, bMax;
33   //
34   theOffset = 0.;
35   theNewPar = thePar;
36   bMin = theParMin - thePar > theEps;
37   bMax = thePar - theParMax > theEps;
38   //
39   if (bMin || bMax) {
40     Standard_Real dp, aNbPer;
41     //
42     dp = (bMin) ? (theParMax - thePar) : (theParMin - thePar);
43     modf(dp / thePeriod, &aNbPer);
44     //
45     theOffset = aNbPer * thePeriod;
46     theNewPar += theOffset;
47   }
48   //
49   return (theOffset > 0.);
50 }