mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
Generic classes "LProp_FuncCurExt", "LProp_FuncCurNul" and "LProp_NumericCurInf" from "LProp" package converted to the non-generic classes and moved to the "Geom2dLProp" package. Therefore names of this classes were changed to "Geom2dLProp_FuncCurExt", "Geom2dLProp_FuncCurNul" and "Geom2dLProp_NumericCurInf". Generic class "Sweep_LinearRegularSweep" from "Sweep" package converted to the non-generic classes and moved to the "BRepSweep" package. Therefore name of this class was changed to "BRepSweep_NumLinearRegularSweep". Also 2 internal classes of "BRepSweep_NumLinearRegularSweep" moved to "BRepSweep.cdl". Generic classes "Primitives_Wedge" and "Primitives_OneAxis" from "Primitives" package converted to the non-generic classes and moved to the "BRepPrim" package. Therefore names of this classes were changed to "BRepPrim_GWedge" and "BRepPrim_OneAxis". Also enum "Direction" moved to BRepPrim. Therefore all "Primitives" package was deleted. And some other minor changes were done. Internal classes Array2OfShapes and SequenceOfShapes from BRepSweep_NumLinearRegularSweep replaced to Array2OfShape and SequenceOfShape from TopTools.
129 lines
4.5 KiB
C++
129 lines
4.5 KiB
C++
// Created on: 1994-09-05
|
|
// Created by: Yves FRICAUD
|
|
// Copyright (c) 1994-1999 Matra Datavision
|
|
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
#include <Geom2dLProp_NumericCurInf2d.ixx>
|
|
|
|
#include <Geom2dLProp_FuncCurExt.hxx>
|
|
#include <Geom2dLProp_FuncCurNul.hxx>
|
|
|
|
#include <Geom2dLProp_Curve2dTool.hxx>
|
|
#include <math_FunctionRoots.hxx>
|
|
#include <math_BracketedRoot.hxx>
|
|
#include <Precision.hxx>
|
|
|
|
//=======================================================================
|
|
//function :
|
|
//purpose :
|
|
//=======================================================================
|
|
Geom2dLProp_NumericCurInf2d::Geom2dLProp_NumericCurInf2d()
|
|
{
|
|
}
|
|
//=======================================================================
|
|
//function : PerformCurExt
|
|
//purpose :
|
|
//=======================================================================
|
|
void Geom2dLProp_NumericCurInf2d::PerformCurExt (const Handle(Geom2d_Curve)& C,LProp_CurAndInf& Result)
|
|
{
|
|
PerformCurExt(C,Geom2dLProp_Curve2dTool::FirstParameter(C),Geom2dLProp_Curve2dTool::LastParameter(C),Result);
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : PerformCurExt
|
|
//purpose :
|
|
//=======================================================================
|
|
void Geom2dLProp_NumericCurInf2d::PerformCurExt (const Handle(Geom2d_Curve)& C,
|
|
const Standard_Real UMin,
|
|
const Standard_Real UMax,
|
|
LProp_CurAndInf& Result)
|
|
{
|
|
isDone = Standard_True;
|
|
|
|
Standard_Real EpsH = 1.e-4*(UMax - UMin);
|
|
Standard_Real Tol = Precision::PConfusion();
|
|
|
|
// la premiere recherce se fait avec une tolerance assez grande
|
|
// car la derivee de la fonction est estimee assez grossierement.
|
|
|
|
Geom2dLProp_FuncCurExt F(C,EpsH);
|
|
Standard_Integer NbSamples = 100;
|
|
Standard_Boolean SolType;
|
|
|
|
math_FunctionRoots SolRoot (F,UMin,UMax,NbSamples,EpsH,EpsH,EpsH);
|
|
|
|
if (SolRoot.IsDone()) {
|
|
for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) {
|
|
Standard_Real Param = SolRoot.Value(j);
|
|
// la solution est affinee.
|
|
math_BracketedRoot BS (F,
|
|
Param - EpsH,
|
|
Param + EpsH,
|
|
Tol);
|
|
if (BS.IsDone()) {Param = BS.Root();}
|
|
SolType = F.IsMinKC(Param);
|
|
Result.AddExtCur(Param,SolType);
|
|
}
|
|
}
|
|
else {
|
|
isDone = Standard_False;
|
|
}
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : PerformInf
|
|
//purpose :
|
|
//=======================================================================
|
|
void Geom2dLProp_NumericCurInf2d::PerformInf(const Handle(Geom2d_Curve)& C,LProp_CurAndInf& Result)
|
|
{
|
|
PerformInf(C,Geom2dLProp_Curve2dTool::FirstParameter(C),Geom2dLProp_Curve2dTool::LastParameter(C),Result);
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : PerformInf
|
|
//purpose :
|
|
//=======================================================================
|
|
void Geom2dLProp_NumericCurInf2d::PerformInf(const Handle(Geom2d_Curve)& C,
|
|
const Standard_Real UMin,
|
|
const Standard_Real UMax,
|
|
LProp_CurAndInf& Result)
|
|
{
|
|
isDone = Standard_True;
|
|
Geom2dLProp_FuncCurNul F(C);
|
|
Standard_Real EpsX = 1.e-6;
|
|
Standard_Real EpsF = 1.e-6;
|
|
Standard_Integer NbSamples = 30;
|
|
|
|
math_FunctionRoots SolRoot (F,UMin,UMax,NbSamples,EpsX,EpsF,EpsX);
|
|
|
|
if (SolRoot.IsDone()) {
|
|
for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) {
|
|
Result.AddInflection(SolRoot.Value(j));
|
|
}
|
|
}
|
|
else {
|
|
isDone = Standard_False;
|
|
}
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : IsDone
|
|
//purpose :
|
|
//=======================================================================
|
|
Standard_Boolean Geom2dLProp_NumericCurInf2d::IsDone() const
|
|
{
|
|
return isDone;
|
|
}
|
|
|