0022627: Change OCCT memory management defaults
[occt.git] / src / AdvApprox / AdvApprox_PrefCutting.cxx
CommitLineData
7fd59977 1// File: AdvApprox_PrefCutting.cxx
2// Created: Wed Jul 3 15:34:08 1996
3// Author: Joelle CHAUVET
4// <jct@sgi38>
5
6
7#include <AdvApprox_PrefCutting.ixx>
8#include <Precision.hxx>
9
10AdvApprox_PrefCutting::AdvApprox_PrefCutting(const TColStd_Array1OfReal& CutPnts):
11 myPntOfCutting(1, CutPnts.Length())
12{
13 myPntOfCutting = CutPnts;
14}
15
16Standard_Boolean AdvApprox_PrefCutting::Value(const Standard_Real a,
17 const Standard_Real b,
18 Standard_Real& cuttingvalue) const
19{
20// longueur minimum d'un intervalle parametrique : PConfusion()
21// pour F(U,V) : EPS1=1.e-9 (cf.MMEPS1)
22 Standard_Real lgmin = 10 * Precision::PConfusion();
23 Standard_Integer i;
24 Standard_Real cut, mil=(a+b)/2,
25 dist = Abs((a-b)/2);
26 cut = mil;
27 for ( i=myPntOfCutting.Lower(); i<= myPntOfCutting.Upper(); i++) {
28 if ((dist-lgmin) > Abs(mil-myPntOfCutting.Value(i))) {
29 cut = myPntOfCutting.Value(i);
30 dist = Abs(mil-myPntOfCutting.Value(i));
31 }
32 }
33 cuttingvalue = cut;
34 return (Abs(cut-a)>=lgmin && Abs(b-cut)>=lgmin);
35}