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

@@ -30,22 +30,21 @@ is
class Curve2dTool;
class CLProps2d from Geom2dLProp
instantiates CLProps from LProp(Curve from Geom2d,
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
Curve2dTool from Geom2dLProp);
class CLProps2d from Geom2dLProp instantiates
CLProps from LProp(Curve from Geom2d,
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
Curve2dTool from Geom2dLProp);
class CurAndInf2d;
private class NumericCurInf2d instantiates NumericCurInf from LProp(
Curve from Geom2d,
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
Curve2dTool from Geom2dLProp);
end Geom2dLProp;
private class FuncCurExt;
private class FuncCurNul;
class NumericCurInf2d;
---Purpose: Computes the locals extremas of curvature and the
-- inflections of a bounded curve in 2d.
end Geom2dLProp;

View File

@@ -0,0 +1,52 @@
-- 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 class FuncCurExt from Geom2dLProp inherits FunctionWithDerivative from math
---Purpose: Function used to find the extremas of curvature in 2d.
uses Curve from Geom2d,
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
Curve2dTool from Geom2dLProp
is
Create ( C : Curve from Geom2d ; Tol : Real) returns FuncCurExt from Geom2dLProp;
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 from Geom2d;
epsX : Real from Standard;
end FuncCurExt;

View File

@@ -0,0 +1,132 @@
// 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 <Geom2dLProp_FuncCurExt.ixx>
#include <gp_Pnt2d.hxx>
#include <Geom2dLProp_Curve2dTool.hxx>
#include <gp.hxx>
#include <Precision.hxx>
//=============================================================================
//function :
// purpose :
//=============================================================================
Geom2dLProp_FuncCurExt::Geom2dLProp_FuncCurExt(const Handle(Geom2d_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 Geom2dLProp_FuncCurExt::Value (const Standard_Real X,
Standard_Real& F)
{
gp_Pnt2d P1;
gp_Vec2d V1,V2,V3;
Geom2dLProp_Curve2dTool::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 Geom2dLProp_FuncCurExt::Derivative(const Standard_Real X,
Standard_Real& D)
{
Standard_Real F;
return Values (X,F,D) ;
}
//=============================================================================
//function : Values
// purpose :
//=============================================================================
Standard_Boolean Geom2dLProp_FuncCurExt::Values (const Standard_Real X,
Standard_Real& F,
Standard_Real& D)
{
Standard_Real F2;
Standard_Real Dx= epsX/100.;
if (X+Dx > Geom2dLProp_Curve2dTool::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 Geom2dLProp_FuncCurExt::IsMinKC (const Standard_Real X) const
{
gp_Pnt2d P1;
gp_Vec2d V1,V2,V3;
Standard_Real Dx= epsX;
Standard_Real KC,KP;
Geom2dLProp_Curve2dTool::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 > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) {Dx = - Dx;}
Geom2dLProp_Curve2dTool::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

@@ -0,0 +1,47 @@
-- 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 class FuncCurNul from Geom2dLProp inherits FunctionWithDerivative from math
---Purpose: Function used to find the inflections in 2d.
uses
Curve from Geom2d,
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
Curve2dTool from Geom2dLProp
is
Create ( C : Curve from Geom2d) returns FuncCurNul from Geom2dLProp;
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 from Geom2d;
end FuncCurNul;

View File

@@ -0,0 +1,95 @@
// 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_FuncCurNul.ixx>
#include <gp_Pnt2d.hxx>
#include <Geom2dLProp_Curve2dTool.hxx>
#include <gp.hxx>
#include <Precision.hxx>
//=============================================================================
//function :
// purpose :
//=============================================================================
Geom2dLProp_FuncCurNul::Geom2dLProp_FuncCurNul(const Handle(Geom2d_Curve)& C)
:theCurve(C)
{
}
//=============================================================================
//function : Value
// purpose : F = (V1^V2.Z)/||V1||*||V2||
//=============================================================================
Standard_Boolean Geom2dLProp_FuncCurNul::Value (const Standard_Real X,
Standard_Real& F)
{
Standard_Real D;
return Values(X,F,D);
}
//=============================================================================
//function : Derivative
// purpose :
//=============================================================================
Standard_Boolean Geom2dLProp_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 Geom2dLProp_FuncCurNul::Values (const Standard_Real X,
Standard_Real& F,
Standard_Real& D)
{
gp_Pnt2d P1;
gp_Vec2d V1,V2,V3;
Geom2dLProp_Curve2dTool::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

@@ -0,0 +1,67 @@
-- 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.
class NumericCurInf2d from Geom2dLProp
---Purpose: Computes the locals extremas of curvature and the
-- inflections of a bounded curve in 2d.
uses
CurAndInf from LProp,
Curve from Geom2d,
Vec2d from gp,
Pnt2d from gp,
Dir2d from gp,
Curve2dTool from Geom2dLProp
is
Create;
PerformCurExt (me : in out; C : Curve from Geom2d; Result : in out CurAndInf)
---Purpose: Computes the locals extremas of curvature.
is static;
PerformInf (me : in out; C : Curve from Geom2d; Result : in out CurAndInf)
---Purpose: Computes the inflections.
is static;
PerformCurExt (me : in out;
C : Curve from Geom2d ;
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 from Geom2d ;
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 NumericCurInf2d;

View File

@@ -0,0 +1,128 @@
// 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;
}