1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024734: Convertation of the generic classes to the non-generic. Part 4

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.
This commit is contained in:
dln
2014-03-27 16:29:16 +04:00
committed by apn
parent 04f7bd75e3
commit a104bb8fe2
29 changed files with 622 additions and 1159 deletions

View File

@@ -72,12 +72,6 @@ is
class AnalyticCurInf;
---Purpose: Computes the locals extremas of curvature of a gp curve.
private generic class FuncCurExt;
private generic class FuncCurNul;
generic class NumericCurInf, FCurExt, FCurNul;
---Purpose: Computes the locals extremas of curvature and the
-- inflections of a bounded curve in 2d.
private class SequenceOfCIType instantiates Sequence from TCollection
(CIType from LProp);

View File

@@ -1,51 +0,0 @@
-- Created on: 1994-09-02
-- 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.
private generic class FuncCurExt from LProp (Curve as any;
Vec as any; -- as Vec or Vec2d
Pnt as any; -- as Pnt or Pnt2d
Dir as any; -- as Dir or Dir2d Vec
Tool as any) -- as Tool(Curve, Pnt, Vec)
inherits FunctionWithDerivative from math
---Purpose: Function used to find the extremas of curvature in 2d.
is
Create ( C : Curve ; Tol : Real) returns FuncCurExt from LProp;
Value (me : in out; X : Real; F : out Real)
---Purpose: Returns the value for the variable <X>.
returns Boolean;
Derivative (me : in out; X : Real; D : out Real)
---Purpose: Returns the derivative for the variable <X>.
returns Boolean;
Values (me : in out ; X : Real; F : out Real; D : out Real)
---Purpose: Returns the value of the function and the derivative
-- for the variable <X>.
returns Boolean;
IsMinKC (me ; Param : Real)
---Purpose: True if Param corresponds to a minus
-- of the radius of curvature.
returns Boolean;
fields
theCurve : Curve;
epsX : Real from Standard;
end FuncCurExt;

View File

@@ -1,127 +0,0 @@
// Created on: 1994-09-06
// 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 <gp.hxx>
#include <Precision.hxx>
//=============================================================================
//function :
// purpose :
//=============================================================================
LProp_FuncCurExt::LProp_FuncCurExt(const Curve& C,
const Standard_Real Tol)
:theCurve(C)
{
epsX = Tol;
}
//=============================================================================
//function : Value
// purpose : KC = (V1^V2.Z) / ||V1||^3 avec V1 tangente etV2 derivee seconde.
// F = d KC/ dU.
//=============================================================================
Standard_Boolean LProp_FuncCurExt::Value (const Standard_Real X,
Standard_Real& F)
{
Pnt P1;
Vec V1,V2,V3;
Tool::D3(theCurve,X,P1,V1,V2,V3);
Standard_Real CPV1V2 = V1.Crossed(V2);
Standard_Real CPV1V3 = V1.Crossed(V3);
Standard_Real V1V2 = V1.Dot(V2);
Standard_Real V1V1 = V1.SquareMagnitude();
Standard_Real NV1 = Sqrt(V1V1);
Standard_Real V13 = V1V1*NV1;
Standard_Real V15 = V13*V1V1;
if (V15 < gp::Resolution()) {
return Standard_False;
}
F = CPV1V3/V13 - 3*CPV1V2*V1V2/V15;
return Standard_True;
}
//=============================================================================
//function : Derivative
// purpose :
//=============================================================================
Standard_Boolean LProp_FuncCurExt::Derivative(const Standard_Real X,
Standard_Real& D)
{
Standard_Real F;
return Values (X,F,D) ;
}
//=============================================================================
//function : Values
// purpose :
//=============================================================================
Standard_Boolean LProp_FuncCurExt::Values (const Standard_Real X,
Standard_Real& F,
Standard_Real& D)
{
Standard_Real F2;
Standard_Real Dx= epsX/100.;
if (X+Dx > Tool::LastParameter(theCurve)) {Dx = - Dx;}
Value (X,F);
Value (X+Dx,F2);
D = (F2 - F)/Dx;
return Standard_True;
}
//=============================================================================
//function : IsMinKC
// purpose : Teste si le parametere coorespond a un minimum du rayon de courbure
// par comparaison avec un point voisin.
//=============================================================================
Standard_Boolean LProp_FuncCurExt::IsMinKC (const Standard_Real X) const
{
Pnt P1;
Vec V1,V2,V3;
Standard_Real Dx= epsX;
Standard_Real KC,KP;
Tool::D3(theCurve,X,P1,V1,V2,V3);
Standard_Real CPV1V2 = V1.Crossed(V2);
Standard_Real V1V1 = V1.SquareMagnitude();
Standard_Real NV1 = Sqrt(V1V1);
Standard_Real V13 = V1V1*NV1;
if (V13 < gp::Resolution()) {return Standard_False;}
KC = CPV1V2/V13;
if (X+Dx > Tool::LastParameter(theCurve)) {Dx = - Dx;}
Tool::D3(theCurve,X+Dx,P1,V1,V2,V3);
CPV1V2 = V1.Crossed(V2);
V1V1 = V1.SquareMagnitude();
NV1 = Sqrt(V1V1);
V13 = V1V1*NV1;
if (V13 < gp::Resolution()) { return Standard_False;}
KP = CPV1V2/V13;
if (Abs(KC) > Abs(KP)) {return Standard_True ;}
else {return Standard_False;}
}

View File

@@ -1,45 +0,0 @@
-- Created on: 1994-09-02
-- 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.
private generic class FuncCurNul from LProp (Curve as any;
Vec as any; -- as Vec or Vec2d
Pnt as any; -- as Pnt or Pnt2d
Dir as any; -- as Dir or Dir2d Vec
Tool as any) -- as Tool(Curve, Pnt, Vec)
inherits FunctionWithDerivative from math
---Purpose: Function used to find the inflections in 2d.
is
Create ( C : Curve) returns FuncCurNul from LProp;
Value (me : in out; X : Real; F : out Real)
---Purpose: Returns the value for the variable <X>.
returns Boolean;
Derivative(me : in out; X : Real; D : out Real)
---Purpose: Returns the derivative for the variable <X>
returns Boolean;
Values(me : in out ; X : Real; F : out Real; D : out Real)
---Purpose: Returns the value of the function and the derivative
-- for the variable <X>.
returns Boolean;
fields
theCurve : Curve;
end FuncCurNul;

View File

@@ -1,90 +0,0 @@
// 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 <gp.hxx>
#include <Precision.hxx>
//=============================================================================
//function :
// purpose :
//=============================================================================
LProp_FuncCurNul::LProp_FuncCurNul(const Curve& C)
:theCurve(C)
{
}
//=============================================================================
//function : Value
// purpose : F = (V1^V2.Z)/||V1||*||V2||
//=============================================================================
Standard_Boolean LProp_FuncCurNul::Value (const Standard_Real X,
Standard_Real& F)
{
Standard_Real D;
return Values(X,F,D);
}
//=============================================================================
//function : Derivative
// purpose :
//=============================================================================
Standard_Boolean LProp_FuncCurNul::Derivative(const Standard_Real X,
Standard_Real& D)
{
Standard_Real F;
return Values(X,F,D);
}
//=============================================================================
//function : Values
// purpose : F = (V1^V2.Z)/||V1||*||V2||
//=============================================================================
Standard_Boolean LProp_FuncCurNul::Values (const Standard_Real X,
Standard_Real& F,
Standard_Real& D)
{
Pnt P1;
Vec V1,V2,V3;
Tool::D3(theCurve,X,P1,V1,V2,V3);
Standard_Real CP1 = V1.Crossed(V2);
Standard_Real CP2 = V1.Crossed(V3);
Standard_Real V1V2 = V1.Dot(V2);
Standard_Real V2V3 = V2.Dot(V3);
Standard_Real NV1 = V1.Magnitude();
Standard_Real NV2 = V2.Magnitude();
F = 0. ;
D = 0. ;
/*
if (Abs(CP1) < 1.e-4) {
return Standard_True;
} else */
if (NV2 < 1.e-4) {
return Standard_True;
} else if (NV1*NV2 < gp::Resolution()) {
return Standard_False;
} else {
F = CP1/(NV1*NV2);
D = (CP2 - CP1*V1V2/(NV1*NV1) - CP1*V2V3/(NV2*NV2))/(NV1*NV2);
}
return Standard_True;
}

View File

@@ -1,68 +0,0 @@
-- Created on: 1994-09-02
-- 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.
generic class NumericCurInf from LProp (Curve as any;
Vec as any; -- as Vec or Vec2d
Pnt as any; -- as Pnt or Pnt2d
Dir as any; -- as Dir or Dir2d Vec
Tool as any) -- as Tool(Curve, Pnt, Vec)
---Purpose: Computes the locals extremas of curvature and the
-- inflections of a bounded curve in 2d.
uses
CurAndInf from LProp
private class FCurExt instantiates FuncCurExt from LProp (Curve,Vec,Pnt,Dir,Tool);
private class FCurNul instantiates FuncCurNul from LProp (Curve,Vec,Pnt,Dir,Tool);
is
Create;
PerformCurExt (me : in out; C : Curve; Result : in out CurAndInf)
---Purpose: Computes the locals extremas of curvature.
is static;
PerformInf (me : in out; C : Curve; Result : in out CurAndInf)
---Purpose: Computes the inflections.
is static;
PerformCurExt (me : in out;
C : Curve ;
UMin : Real;
UMax : Real;
Result : in out CurAndInf)
---Purpose: Computes the locals extremas of curvature.
-- in the interval of parmeters [UMin,UMax].
is static;
PerformInf (me : in out;
C : Curve ;
UMin : Real;
UMax : Real;
Result : in out CurAndInf)
---Purpose: Computes the inflections in the interval of
-- parmeters [UMin,UMax].
is static;
IsDone (me) returns Boolean
---Purpose: True if the solutions are found.
is static;
fields
isDone : Boolean from Standard;
end NumericCurInf;

View File

@@ -1,122 +0,0 @@
// 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 <math_FunctionRoots.hxx>
#include <math_BracketedRoot.hxx>
#include <Precision.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
LProp_NumericCurInf::LProp_NumericCurInf()
{
}
//=======================================================================
//function : PerformCurExt
//purpose :
//=======================================================================
void LProp_NumericCurInf::PerformCurExt (const Curve& C,LProp_CurAndInf& Result)
{
PerformCurExt(C,Tool::FirstParameter(C),Tool::LastParameter(C),Result);
}
//=======================================================================
//function : PerformCurExt
//purpose :
//=======================================================================
void LProp_NumericCurInf::PerformCurExt (const 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.
LProp_FCurExt 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 LProp_NumericCurInf::PerformInf(const Curve& C,LProp_CurAndInf& Result)
{
PerformInf(C,Tool::FirstParameter(C),Tool::LastParameter(C),Result);
}
//=======================================================================
//function : PerformInf
//purpose :
//=======================================================================
void LProp_NumericCurInf::PerformInf(const Curve& C,
const Standard_Real UMin,
const Standard_Real UMax,
LProp_CurAndInf& Result)
{
isDone = Standard_True;
LProp_FCurNul 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 LProp_NumericCurInf::IsDone() const
{
return isDone;
}