mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0028828: Modeling Algorithms - New functionalities of BRepFilletAPI_MakeChamfer algorithm
Two new functionalities have been added in BRepFilletAPI_MakeChamfer: - constant throat (the section of chamfer is isosceles triangle, its height is constant in all sections - this is the "throat" of the weld); - constant throat with penetration(the section of chamfer is right-angled triangle, the first of two surfaces (where is the top of the chamfer) is virtually moved inside the solid by offset operation, the apex of the section is on the intersection curve between moved surface and second surface, right angle is at the top of the chamfer, the length of the leg from apex to top is constant - this is the "throat" of the weld). - New abstract classes BlendFunc_GenChamfer and BlendFunc_GenChamfInv have been added; - Class BlendFunc_Chamfer is now descended from BlendFunc_GenChamfer, class BlendFunc_ChamfInv is now descended from BlendFunc_GenChamfInv. - New class BlendFunc_ConstThroat is descended from BlendFunc_GenChamfer, new class BlendFund_ConstThroatInv is descended from BlendFunc_GenChamfInv. - New class BlendFunc_ConstThroatWithPenetration is descended from BlendFunc_GenChamfer, new class BlendFund_ConstThroatWithPenetrationInv is descended from BlendFunc_GenChamfInv. - Class ChFi3d_ChBuilder has now mode of chamfer that can be ClassicChamfer, ConstThroatChamfer and ConstThroatWithPenetrationChamfer. - Two new DRAW Test Harness commands "chamf_throat" ant "chamf_throat_with_penetration" have been added for the second mode of ChBuilder. - The interface of DRAW Test Harness command "chamf" changed for symmetric case.
This commit is contained in:
@@ -27,10 +27,12 @@
|
||||
//function : BlendFunc_ChamfInv
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_ChamfInv::BlendFunc_ChamfInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
surf1(S1),surf2(S2),curv(C),corde1(surf1,curv),corde2(surf2,curv)
|
||||
const Handle(Adaptor3d_HCurve)& C)
|
||||
: BlendFunc_GenChamfInv(S1,S2,C),
|
||||
corde1(surf1,curv),corde2(surf2,curv)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -83,97 +85,6 @@ void BlendFunc_ChamfInv::Set(const Standard_Real Dist1, const Standard_Real Dist
|
||||
corde2.SetDist(dis2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_ChamfInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
@@ -207,7 +118,6 @@ Standard_Boolean BlendFunc_ChamfInv::IsSolution(const math_Vector& Sol, const St
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
@@ -324,15 +234,3 @@ Standard_Boolean BlendFunc_ChamfInv::Derivatives(const math_Vector& X, math_Matr
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
Value(X,F);
|
||||
Derivatives(X,D);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BlendFunc_Corde.hxx>
|
||||
#include <Blend_FuncInv.hxx>
|
||||
#include <BlendFunc_GenChamfInv.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
@@ -34,7 +34,9 @@ class math_Matrix;
|
||||
|
||||
|
||||
|
||||
class BlendFunc_ChamfInv : public Blend_FuncInv
|
||||
//! Class for a function used to compute a chamfer with two constant distances
|
||||
//! on a surface's boundary
|
||||
class BlendFunc_ChamfInv : public BlendFunc_GenChamfInv
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -43,17 +45,8 @@ public:
|
||||
|
||||
Standard_EXPORT BlendFunc_ChamfInv(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
Standard_EXPORT void Set (const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& COnSurf) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
|
||||
|
||||
//! returns the number of equations of the function.
|
||||
Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
|
||||
|
||||
//! computes the values <F> of the Functions for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
@@ -65,14 +58,12 @@ public:
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
using Blend_FuncInv::Set;
|
||||
|
||||
//! returns the values <F> of the functions and the derivatives
|
||||
//! <D> for the variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Set (const Standard_Real Dist1, const Standard_Real Dist2, const Standard_Integer Choix);
|
||||
Standard_EXPORT virtual void Set (const Standard_Real Dist1,
|
||||
const Standard_Real Dist2,
|
||||
const Standard_Integer Choix) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
@@ -87,12 +78,6 @@ private:
|
||||
|
||||
|
||||
|
||||
Handle(Adaptor3d_HSurface) surf1;
|
||||
Handle(Adaptor3d_HSurface) surf2;
|
||||
Handle(Adaptor3d_HCurve) curv;
|
||||
Handle(Adaptor2d_HCurve2d) csurf;
|
||||
Standard_Integer choix;
|
||||
Standard_Boolean first;
|
||||
BlendFunc_Corde corde1;
|
||||
BlendFunc_Corde corde2;
|
||||
|
||||
|
@@ -35,27 +35,15 @@
|
||||
//function : BlendFunc_Chamfer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_Chamfer::BlendFunc_Chamfer(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& CG) :
|
||||
surf1(S1),surf2(S2),
|
||||
curv(CG),
|
||||
distmin(RealLast()),
|
||||
corde1(S1,CG),corde2(S2,CG)
|
||||
const Handle(Adaptor3d_HCurve)& CG)
|
||||
: BlendFunc_GenChamfer(S1,S2,CG),
|
||||
corde1(S1,CG),corde2(S2,CG)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_Chamfer::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
@@ -80,54 +68,6 @@ void BlendFunc_Chamfer::Set(const Standard_Real Param)
|
||||
corde2.SetParam(Param);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Set(const Standard_Real, const Standard_Real)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = surf1->UResolution(Tol);
|
||||
Tolerance(2) = surf1->VResolution(Tol);
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = surf1->FirstUParameter();
|
||||
InfBound(2) = surf1->FirstVParameter();
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(1) = surf1->LastUParameter();
|
||||
SupBound(2) = surf1->LastVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
|
||||
for(Standard_Integer i = 1; i <= 4; i++){
|
||||
if(!Precision::IsInfinite(InfBound(i)) &&
|
||||
!Precision::IsInfinite(SupBound(i))) {
|
||||
const Standard_Real range = (SupBound(i) - InfBound(i));
|
||||
InfBound(i) -= range;
|
||||
SupBound(i) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
@@ -151,16 +91,6 @@ Standard_Boolean BlendFunc_Chamfer::IsSolution(const math_Vector& Sol, const Sta
|
||||
return issol;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BlendFunc_Chamfer::GetMinimalDistance() const
|
||||
{
|
||||
return distmin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
@@ -214,17 +144,6 @@ Standard_Boolean BlendFunc_Chamfer::Derivatives(const math_Vector& X, math_Matri
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
Standard_Boolean val = Value(X,F);
|
||||
return (val && Derivatives(X,D));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS1
|
||||
//purpose :
|
||||
@@ -343,41 +262,6 @@ void BlendFunc_Chamfer::Tangent(const Standard_Real U1,
|
||||
TgL.Reverse();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Section(const Standard_Real /*Param*/,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
Standard_Real& Pdeb,
|
||||
Standard_Real& Pfin,
|
||||
gp_Lin& C)
|
||||
{
|
||||
const gp_Pnt pts1 = surf1->Value(U1,V1);
|
||||
const gp_Pnt pts2 = surf2->Value(U2,V2);
|
||||
const gp_Dir dir( gp_Vec(pts1,pts2) );
|
||||
|
||||
C.SetLocation(pts1);
|
||||
C.SetDirection(dir);
|
||||
|
||||
Pdeb = 0.;
|
||||
Pfin = ElCLib::Parameter(C,pts2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsRational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::IsRational() const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionSize
|
||||
//purpose : Non implementee (non necessaire car non rationel)
|
||||
@@ -386,205 +270,3 @@ Standard_Real BlendFunc_Chamfer::GetSectionSize() const
|
||||
{
|
||||
throw Standard_NotImplemented("BlendFunc_Chamfer::GetSectionSize()");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_Chamfer::GetMinimalWeight(TColStd_Array1OfReal& Weights) const
|
||||
{
|
||||
Weights.Init(1);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_Chamfer::NbIntervals (const GeomAbs_Shape S) const
|
||||
{
|
||||
return curv->NbIntervals(BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
|
||||
{
|
||||
curv->Intervals(T, BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::GetShape (Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles2d)
|
||||
{
|
||||
NbPoles = 2;
|
||||
NbPoles2d = 2;
|
||||
NbKnots = 2;
|
||||
Degree = 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose : Determine les Tolerance a utiliser dans les approximations.
|
||||
//=======================================================================
|
||||
void BlendFunc_Chamfer::GetTolerance(const Standard_Real BoundTol,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
math_Vector& Tol3d,
|
||||
math_Vector&) const
|
||||
{
|
||||
Tol3d.Init(BoundTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Knots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Knots(TColStd_Array1OfReal& TKnots)
|
||||
{
|
||||
TKnots(1) = 0.;
|
||||
TKnots(2) = 1.;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Mults
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Mults(TColStd_Array1OfInteger& TMults)
|
||||
{
|
||||
TMults(1) = 2;
|
||||
TMults(2) = 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Section
|
||||
(const Blend_Point& /*P*/,
|
||||
TColgp_Array1OfPnt& /*Poles*/,
|
||||
TColgp_Array1OfVec& /*DPoles*/,
|
||||
TColgp_Array1OfVec& /*D2Poles*/,
|
||||
TColgp_Array1OfPnt2d& /*Poles2d*/,
|
||||
TColgp_Array1OfVec2d& /*DPoles2d*/,
|
||||
TColgp_Array1OfVec2d& /*D2Poles2d*/,
|
||||
TColStd_Array1OfReal& /*Weights*/,
|
||||
TColStd_Array1OfReal& /*DWeights*/,
|
||||
TColStd_Array1OfReal& /*D2Weights*/)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Section
|
||||
(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights)
|
||||
{
|
||||
math_Vector sol(1,4),valsol(1,4),secmember(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
Standard_Real prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
Standard_Boolean istgt;
|
||||
|
||||
P.ParametersOnS1(sol(1),sol(2));
|
||||
P.ParametersOnS2(sol(3),sol(4));
|
||||
|
||||
Set(prm);
|
||||
|
||||
Values(sol,valsol,gradsol);
|
||||
IsSolution(sol,tol);
|
||||
|
||||
istgt = IsTangencyPoint();
|
||||
|
||||
Poles2d(Poles2d.Lower()).SetCoord(sol(1),sol(2));
|
||||
Poles2d(Poles2d.Upper()).SetCoord(sol(3),sol(4));
|
||||
if (!istgt) {
|
||||
DPoles2d(Poles2d.Lower()).SetCoord(Tangent2dOnS1().X(),
|
||||
Tangent2dOnS1().Y());
|
||||
DPoles2d(Poles2d.Upper()).SetCoord(Tangent2dOnS2().X(),
|
||||
Tangent2dOnS2().Y());
|
||||
}
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
if (!istgt) {
|
||||
DPoles(low) = TangentOnS1();
|
||||
DPoles(upp) = TangentOnS2();
|
||||
DWeights(low) = 0.0;
|
||||
DWeights(upp) = 0.0;
|
||||
}
|
||||
|
||||
return (!istgt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2,prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
math_Vector X(1,4), F(1,4);
|
||||
|
||||
P.ParametersOnS1(u1,v1);
|
||||
P.ParametersOnS2(u2,v2);
|
||||
X(1)=u1;
|
||||
X(2)=v1;
|
||||
X(3)=u2;
|
||||
X(4)=v2;
|
||||
Poles2d(Poles2d.Lower()).SetCoord(u1,v1);
|
||||
Poles2d(Poles2d.Upper()).SetCoord(u2,v2);
|
||||
|
||||
Set(prm);
|
||||
Value(X,F);
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
}
|
||||
|
||||
void BlendFunc_Chamfer::Resolution(const Standard_Integer IC2d, const Standard_Real Tol,
|
||||
Standard_Real& TolU, Standard_Real& TolV) const
|
||||
{
|
||||
if(IC2d == 1){
|
||||
TolU = surf1->UResolution(Tol);
|
||||
TolV = surf1->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
TolU = surf2->UResolution(Tol);
|
||||
TolV = surf2->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <BlendFunc_Corde.hxx>
|
||||
#include <Blend_Function.hxx>
|
||||
#include <BlendFunc_GenChamfer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
@@ -45,7 +45,9 @@ class Blend_Point;
|
||||
|
||||
|
||||
|
||||
class BlendFunc_Chamfer : public Blend_Function
|
||||
//! Class for a function used to compute a "ordinary" chamfer:
|
||||
//! when distances from spine to surfaces are constant
|
||||
class BlendFunc_Chamfer : public BlendFunc_GenChamfer
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -54,9 +56,6 @@ public:
|
||||
|
||||
Standard_EXPORT BlendFunc_Chamfer(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& CG);
|
||||
|
||||
//! returns the number of equations of the function.
|
||||
Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
|
||||
|
||||
//! computes the values <F> of the Functions for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
@@ -69,26 +68,10 @@ public:
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <F> of the functions and the derivatives
|
||||
//! <D> for the variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the minimal Distance beetween two
|
||||
//! extremitys of calculed sections.
|
||||
Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
|
||||
@@ -110,56 +93,11 @@ public:
|
||||
Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the distances and the "quadrant".
|
||||
Standard_EXPORT void Set (const Standard_Real Dist1, const Standard_Real Dist2, const Standard_Integer Choix);
|
||||
|
||||
//! Returns False
|
||||
Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
|
||||
Standard_EXPORT void Set (const Standard_Real Dist1, const Standard_Real Dist2, const Standard_Integer Choix) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the length of the maximum section
|
||||
Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
|
||||
|
||||
//! Compute the minimal value of weight for each poles
|
||||
//! of all sections.
|
||||
Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
//! raises
|
||||
//! OutOfRange from Standard
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the tolerance to reach in approximation
|
||||
//! to respecte
|
||||
//! BoundTol error at the Boundary
|
||||
//! AngleTol tangent error at the Boundary
|
||||
//! SurfTol error inside the surface.
|
||||
Standard_EXPORT void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
|
||||
|
||||
//! Obsolete method
|
||||
Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Lin& C);
|
||||
|
||||
//! Used for the first and last section
|
||||
Standard_EXPORT Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
|
||||
|
||||
//! Used for the first and last section
|
||||
Standard_EXPORT Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
@@ -173,13 +111,6 @@ protected:
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(Adaptor3d_HSurface) surf1;
|
||||
Handle(Adaptor3d_HSurface) surf2;
|
||||
Handle(Adaptor3d_HCurve) curv;
|
||||
Standard_Integer choix;
|
||||
Standard_Real tol;
|
||||
Standard_Real distmin;
|
||||
BlendFunc_Corde corde1;
|
||||
BlendFunc_Corde corde2;
|
||||
|
||||
|
320
src/BlendFunc/BlendFunc_ConstThroat.cxx
Normal file
320
src/BlendFunc/BlendFunc_ConstThroat.cxx
Normal file
@@ -0,0 +1,320 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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 <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <Blend_Point.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <BlendFunc_ConstThroat.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#define Eps 1.e-15
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ConstThroat
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_ConstThroat::BlendFunc_ConstThroat(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C)
|
||||
: BlendFunc_GenChamfer(S1,S2,C)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ConstThroat::Set(const Standard_Real aThroat,
|
||||
const Standard_Real,
|
||||
const Standard_Integer Choix)
|
||||
{
|
||||
Throat = aThroat;
|
||||
choix = Choix;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ConstThroat::Set(const Standard_Real Param)
|
||||
{
|
||||
param = Param;
|
||||
curv->D2(param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroat::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
math_Vector secmember(1,4), valsol(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
Value(Sol, valsol);
|
||||
Derivatives(Sol, gradsol);
|
||||
|
||||
tol = Tol;
|
||||
|
||||
gp_Vec dnplan, temp1, temp2, tempmid;
|
||||
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol &&
|
||||
Abs(valsol(3)) <= Tol*Tol &&
|
||||
Abs(valsol(4)) <= Tol*Tol)
|
||||
{
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
|
||||
temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
|
||||
tempmid.SetXYZ((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ());
|
||||
surf1->D1(Sol(1),Sol(2),pts1,d1u1,d1v1);
|
||||
surf2->D1(Sol(3),Sol(4),pts2,d1u2,d1v2);
|
||||
|
||||
secmember(1) = nplan.Dot(d1gui) - dnplan.Dot(temp1);
|
||||
secmember(2) = nplan.Dot(d1gui) - dnplan.Dot(temp2);
|
||||
secmember(3) = 2.*d1gui.Dot(tempmid);
|
||||
secmember(4) = 2.*d1gui.Dot(temp2) - 2.*d1gui.Dot(temp1);
|
||||
|
||||
math_Gauss Resol(gradsol);
|
||||
if (Resol.IsDone()) {
|
||||
Resol.Solve(secmember);
|
||||
tg1.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1);
|
||||
tg2.SetLinearForm(secmember(3),d1u2,secmember(4),d1v2);
|
||||
tg12d.SetCoord(secmember(1),secmember(2));
|
||||
tg22d.SetCoord(secmember(3),secmember(4));
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else {
|
||||
istangent = Standard_True;
|
||||
}
|
||||
|
||||
distmin = Min(distmin, pts1.Distance(pts2));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroat::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
surf1->D0( X(1), X(2), pts1 );
|
||||
surf2->D0( X(3), X(4), pts2 );
|
||||
|
||||
F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
|
||||
F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
|
||||
|
||||
const gp_Pnt ptmid((pts1.XYZ() + pts2.XYZ())/2);
|
||||
const gp_Vec vmid(ptgui, ptmid);
|
||||
|
||||
F(3) = vmid.SquareMagnitude() - Throat*Throat;
|
||||
|
||||
const gp_Vec vref1(ptgui, pts1);
|
||||
const gp_Vec vref2(ptgui, pts2);
|
||||
|
||||
F(4) = vref1.SquareMagnitude() - vref2.SquareMagnitude();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroat::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
surf1->D1( X(1), X(2), pts1, d1u1, d1v1);
|
||||
surf2->D1( X(3), X(4), pts2, d1u2, d1v2);
|
||||
|
||||
D(1,1) = nplan.Dot(d1u1);
|
||||
D(1,2) = nplan.Dot(d1v1);
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
D(2,1) = 0.;
|
||||
D(2,2) = 0.;
|
||||
D(2,3) = nplan.Dot(d1u2);
|
||||
D(2,4) = nplan.Dot(d1v2);
|
||||
D(3,1) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u1);
|
||||
D(3,2) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v1);
|
||||
D(3,3) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u2);
|
||||
D(3,4) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v2);
|
||||
D(4,1) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
|
||||
D(4,2) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
|
||||
D(4,3) = -2.*gp_Vec(ptgui,pts2).Dot(d1u2);
|
||||
D(4,4) = -2.*gp_Vec(ptgui,pts2).Dot(d1v2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_ConstThroat::PointOnS1 () const
|
||||
{
|
||||
return pts1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_ConstThroat::PointOnS2 () const
|
||||
{
|
||||
return pts2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsTangencyPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroat::IsTangencyPoint () const
|
||||
{
|
||||
return istangent;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_ConstThroat::TangentOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroat::TangentOnS1");
|
||||
return tg1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_ConstThroat::TangentOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroat::TangentOnS2");
|
||||
return tg2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_ConstThroat::Tangent2dOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroat::Tangent2dOnS1");
|
||||
return tg12d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_ConstThroat::Tangent2dOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroat::Tangent2dOnS2");
|
||||
return tg22d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ConstThroat::Tangent(const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
gp_Vec& TgF,
|
||||
gp_Vec& TgL,
|
||||
gp_Vec& NmF,
|
||||
gp_Vec& NmL) const
|
||||
{
|
||||
gp_Pnt pt;
|
||||
gp_Vec d1u,d1v;
|
||||
Standard_Boolean revF = Standard_False;
|
||||
Standard_Boolean revL = Standard_False;
|
||||
|
||||
surf1->D1(U1,V1,pt,d1u,d1v);
|
||||
NmF = d1u.Crossed(d1v);
|
||||
|
||||
surf2->D1(U2,V2,pt,d1u,d1v);
|
||||
NmL = d1u.Crossed(d1v);
|
||||
|
||||
TgF = (nplan.Crossed(NmF)).Normalized();
|
||||
TgL = (nplan.Crossed(NmL)).Normalized();
|
||||
|
||||
if( (choix == 2)||(choix == 5) ){
|
||||
revF = Standard_True;
|
||||
revL = Standard_True;
|
||||
}
|
||||
if( (choix == 4)||(choix == 7) )
|
||||
revL = Standard_True;
|
||||
if( (choix == 3)||(choix == 8) )
|
||||
revF = Standard_True;
|
||||
|
||||
if( revF )
|
||||
TgF.Reverse();
|
||||
if( revL )
|
||||
TgL.Reverse();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BlendFunc_ConstThroat::GetSectionSize() const
|
||||
{
|
||||
throw Standard_NotImplemented("BlendFunc_ConstThroat::GetSectionSize()");
|
||||
}
|
138
src/BlendFunc/BlendFunc_ConstThroat.hxx
Normal file
138
src/BlendFunc/BlendFunc_ConstThroat.hxx
Normal file
@@ -0,0 +1,138 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
#ifndef _BlendFunc_ConstThroat_HeaderFile
|
||||
#define _BlendFunc_ConstThroat_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <BlendFunc_GenChamfer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfVec.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_Array1OfVec2d.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
class Adaptor3d_HCurve;
|
||||
class math_Matrix;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
class gp_Vec2d;
|
||||
class gp_Lin;
|
||||
class Blend_Point;
|
||||
|
||||
|
||||
//! Class for a function used to compute a symmetric chamfer
|
||||
//! with constant throat that is the height of isosceles triangle in section
|
||||
class BlendFunc_ConstThroat : public BlendFunc_GenChamfer
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BlendFunc_ConstThroat(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
|
||||
//! computes the values <F> of the Functions for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <D> of the derivatives for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec& TangentOnS1() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec& TangentOnS2() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the tangent vector at the section,
|
||||
//! at the beginning and the end of the section, and
|
||||
//! returns the normal (of the surfaces) at
|
||||
//! these points.
|
||||
Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the throat and the "quadrant".
|
||||
Standard_EXPORT void Set (const Standard_Real aThroat, const Standard_Real, const Standard_Integer Choix) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the length of the maximum section
|
||||
Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
gp_Pnt pts1;
|
||||
gp_Pnt pts2;
|
||||
gp_Vec d1u1;
|
||||
gp_Vec d1v1;
|
||||
gp_Vec d1u2;
|
||||
gp_Vec d1v2;
|
||||
Standard_Boolean istangent;
|
||||
gp_Vec tg1;
|
||||
gp_Vec2d tg12d;
|
||||
gp_Vec tg2;
|
||||
gp_Vec2d tg22d;
|
||||
Standard_Real param;
|
||||
Standard_Real Throat;
|
||||
|
||||
gp_Pnt ptgui;
|
||||
gp_Vec nplan;
|
||||
Standard_Real normtg;
|
||||
Standard_Real theD;
|
||||
gp_Vec d1gui;
|
||||
gp_Vec d2gui;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BlendFunc_ConstThroat_HeaderFile
|
250
src/BlendFunc/BlendFunc_ConstThroatInv.cxx
Normal file
250
src/BlendFunc/BlendFunc_ConstThroatInv.cxx
Normal file
@@ -0,0 +1,250 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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 <Adaptor2d_HCurve2d.hxx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <BlendFunc_ConstThroatInv.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ConstThroatInv
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_ConstThroatInv::BlendFunc_ConstThroatInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C)
|
||||
: BlendFunc_GenChamfInv(S1,S2,C)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ConstThroatInv::Set(const Standard_Real theThroat,
|
||||
const Standard_Real,
|
||||
const Standard_Integer Choix)
|
||||
{
|
||||
//Standard_Real dis1,dis2;
|
||||
|
||||
Throat = theThroat;
|
||||
|
||||
choix = Choix;
|
||||
switch (choix) {
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
sign1 = -1;
|
||||
sign2 = -1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
sign1 = 1;
|
||||
sign2 = -1;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
sign1 = 1;
|
||||
sign2 = 1;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
sign1 = -1;
|
||||
sign2 = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sign1 = -1;
|
||||
sign2 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatInv::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1,4);
|
||||
Value(Sol, valsol);
|
||||
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol &&
|
||||
Abs(valsol(3)) <= Tol*Tol &&
|
||||
Abs(valsol(4)) <= Tol*Tol)
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatInv::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
param = X(2);
|
||||
curv->D2(param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
|
||||
math_Vector XX(1,4);
|
||||
|
||||
if(first){
|
||||
XX(1) = p2d.X(); XX(2) = p2d.Y();
|
||||
XX(3) = X(3); XX(4) = X(4);
|
||||
}
|
||||
|
||||
else{
|
||||
XX(1) = X(3); XX(2) = X(4);
|
||||
XX(3) = p2d.X(); XX(4) = p2d.Y();
|
||||
}
|
||||
|
||||
surf1->D0( XX(1), XX(2), pts1 );
|
||||
surf2->D0( XX(3), XX(4), pts2 );
|
||||
|
||||
F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
|
||||
F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
|
||||
|
||||
const gp_Pnt ptmid((pts1.XYZ() + pts2.XYZ())/2);
|
||||
const gp_Vec vmid(ptgui, ptmid);
|
||||
|
||||
F(3) = vmid.SquareMagnitude() - Throat*Throat;
|
||||
|
||||
const gp_Vec vref1(ptgui, pts1);
|
||||
const gp_Vec vref2(ptgui, pts2);
|
||||
|
||||
F(4) = vref1.SquareMagnitude() - vref2.SquareMagnitude();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatInv::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
//Standard_Integer i, j;
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d; //, df1, df2;
|
||||
//gp_Pnt pts, ptgui;
|
||||
gp_Vec dnplan, temp, temp1, temp2, tempmid; //, d1u, d1v, nplan;
|
||||
math_Vector XX(1,4); //x1(1,2), x2(1,2);
|
||||
//math_Matrix d1(1,2,1,2), d2(1,2,1,2);
|
||||
|
||||
csurf->D1(X(1), p2d, v2d);
|
||||
//corde1.SetParam(X(2));
|
||||
//corde2.SetParam(X(2));
|
||||
param = X(2);
|
||||
curv->D2(param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
|
||||
temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
|
||||
tempmid.SetXYZ((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ());
|
||||
|
||||
//x1(1) = p2d.X(); x1(2) = p2d.Y();
|
||||
//x2(1) = X(3); x2(2) = X(4);
|
||||
if (first)
|
||||
{
|
||||
XX(1) = p2d.X(); XX(2) = p2d.Y();
|
||||
XX(3) = X(3); XX(4) = X(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
XX(1) = X(3); XX(2) = X(4);
|
||||
XX(3) = p2d.X(); XX(4) = p2d.Y();
|
||||
}
|
||||
|
||||
surf1->D1(XX(1), XX(2), pts1, d1u1, d1v1);
|
||||
surf2->D1(XX(3), XX(4), pts2, d1u2, d1v2);
|
||||
|
||||
if( first ){
|
||||
// p2d = pts est sur surf1
|
||||
//ptgui = corde1.PointOnGuide();
|
||||
//nplan = corde1.NPlan();
|
||||
temp.SetLinearForm(v2d.X(),d1u1, v2d.Y(),d1v1);
|
||||
|
||||
D(1,1) = nplan.Dot(temp);
|
||||
D(2,1) = 0.;
|
||||
D(3,1) = gp_Vec(ptgui,pts1).Dot(temp);
|
||||
D(4,1) = 2*(gp_Vec(ptgui,pts1).Dot(temp));
|
||||
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
D(2,3) = nplan.Dot(d1u2);
|
||||
D(2,4) = nplan.Dot(d1v2);
|
||||
D(3,3) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u2);
|
||||
D(3,4) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v2);
|
||||
D(4,3) = -2.*gp_Vec(ptgui,pts2).Dot(d1u2);
|
||||
D(4,4) = -2.*gp_Vec(ptgui,pts2).Dot(d1v2);
|
||||
|
||||
//surf1->D1(x1(1),x1(2),pts,d1u,d1v);
|
||||
}
|
||||
else{
|
||||
// p2d = pts est sur surf2
|
||||
//ptgui = corde2.PointOnGuide();
|
||||
//nplan = corde2.NPlan();
|
||||
temp.SetLinearForm(v2d.X(),d1u2, v2d.Y(),d1v2);
|
||||
|
||||
D(1,1) = 0.;
|
||||
D(2,1) = nplan.Dot(temp);
|
||||
D(3,1) = gp_Vec(ptgui,pts2).Dot(temp);
|
||||
D(4,1) = -2*(gp_Vec(ptgui,pts2).Dot(temp));
|
||||
|
||||
D(1,3) = nplan.Dot(d1u1);
|
||||
D(1,4) = nplan.Dot(d1v1);
|
||||
D(2,3) = 0.;
|
||||
D(2,4) = 0.;
|
||||
D(3,3) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u1);
|
||||
D(3,4) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v1);
|
||||
D(4,3) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
|
||||
D(4,4) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
|
||||
|
||||
//surf2->D1(x1(1),x1(2),pts,d1u,d1v);
|
||||
}
|
||||
|
||||
D(1,2) = dnplan.Dot(temp1) - nplan.Dot(d1gui);
|
||||
D(2,2) = dnplan.Dot(temp2) - nplan.Dot(d1gui);
|
||||
D(3,2) = -2.*d1gui.Dot(tempmid);
|
||||
D(4,2) = 2.*d1gui.Dot(temp1) - 2.*d1gui.Dot(temp2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
100
src/BlendFunc/BlendFunc_ConstThroatInv.hxx
Normal file
100
src/BlendFunc/BlendFunc_ConstThroatInv.hxx
Normal file
@@ -0,0 +1,100 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
#ifndef _BlendFunc_ConstThroatInv_HeaderFile
|
||||
#define _BlendFunc_ConstThroatInv_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BlendFunc_GenChamfInv.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
class Adaptor3d_HCurve;
|
||||
class Adaptor2d_HCurve2d;
|
||||
class math_Matrix;
|
||||
|
||||
|
||||
|
||||
//! Class for a function used to compute a ConstThroat chamfer on a surface's boundary
|
||||
class BlendFunc_ConstThroatInv : public BlendFunc_GenChamfInv
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BlendFunc_ConstThroatInv(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
|
||||
|
||||
//! computes the values <F> of the Functions for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <D> of the derivatives for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
using Blend_FuncInv::Set;
|
||||
|
||||
Standard_EXPORT virtual void Set (const Standard_Real theThroat,
|
||||
const Standard_Real,
|
||||
const Standard_Integer Choix) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Real Throat;
|
||||
|
||||
Standard_Real param;
|
||||
Standard_Real sign1;
|
||||
Standard_Real sign2;
|
||||
|
||||
gp_Pnt ptgui;
|
||||
gp_Vec nplan;
|
||||
Standard_Real normtg;
|
||||
Standard_Real theD;
|
||||
gp_Vec d1gui;
|
||||
gp_Vec d2gui;
|
||||
|
||||
gp_Pnt pts1;
|
||||
gp_Pnt pts2;
|
||||
gp_Vec d1u1;
|
||||
gp_Vec d1v1;
|
||||
gp_Vec d1u2;
|
||||
gp_Vec d1v2;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BlendFunc_ConstThroatInv_HeaderFile
|
217
src/BlendFunc/BlendFunc_ConstThroatWithPenetration.cxx
Normal file
217
src/BlendFunc/BlendFunc_ConstThroatWithPenetration.cxx
Normal file
@@ -0,0 +1,217 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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 <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <Blend_Point.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <BlendFunc_ConstThroatWithPenetration.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#define Eps 1.e-15
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ConstThroatWithPenetration
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_ConstThroatWithPenetration::
|
||||
BlendFunc_ConstThroatWithPenetration(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C)
|
||||
: BlendFunc_ConstThroat(S1,S2,C)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatWithPenetration::
|
||||
IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
math_Vector secmember(1,4), valsol(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
Value(Sol, valsol);
|
||||
Derivatives(Sol, gradsol);
|
||||
|
||||
tol = Tol;
|
||||
|
||||
gp_Vec dnplan, temp1, temp2, temp3;
|
||||
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol &&
|
||||
Abs(valsol(3)) <= Tol*Tol &&
|
||||
Abs(valsol(4)) <= Tol)
|
||||
{
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
|
||||
temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
|
||||
temp3.SetXYZ(pts2.XYZ() - pts1.XYZ());
|
||||
surf1->D1(Sol(1),Sol(2),pts1,d1u1,d1v1);
|
||||
surf2->D1(Sol(3),Sol(4),pts2,d1u2,d1v2);
|
||||
|
||||
secmember(1) = nplan.Dot(d1gui) - dnplan.Dot(temp1);
|
||||
secmember(2) = nplan.Dot(d1gui) - dnplan.Dot(temp2);
|
||||
secmember(3) = 2.*d1gui.Dot(temp1);
|
||||
secmember(4) = d1gui.Dot(temp3);
|
||||
|
||||
math_Gauss Resol(gradsol);
|
||||
if (Resol.IsDone()) {
|
||||
Resol.Solve(secmember);
|
||||
tg1.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1);
|
||||
tg2.SetLinearForm(secmember(3),d1u2,secmember(4),d1v2);
|
||||
tg12d.SetCoord(secmember(1),secmember(2));
|
||||
tg22d.SetCoord(secmember(3),secmember(4));
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else {
|
||||
istangent = Standard_True;
|
||||
}
|
||||
|
||||
distmin = Min(distmin, pts1.Distance(pts2));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatWithPenetration::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
{
|
||||
surf1->D0( X(1), X(2), pts1 );
|
||||
surf2->D0( X(3), X(4), pts2 );
|
||||
|
||||
F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
|
||||
F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
|
||||
|
||||
const gp_Vec vref(ptgui, pts1);
|
||||
|
||||
F(3) = vref.SquareMagnitude() - Throat*Throat;
|
||||
|
||||
const gp_Vec vec12(pts1, pts2);
|
||||
|
||||
F(4) = vref.Dot(vec12);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatWithPenetration::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
{
|
||||
surf1->D1( X(1), X(2), pts1, d1u1, d1v1);
|
||||
surf2->D1( X(3), X(4), pts2, d1u2, d1v2);
|
||||
|
||||
D(1,1) = nplan.Dot(d1u1);
|
||||
D(1,2) = nplan.Dot(d1v1);
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
D(2,1) = 0.;
|
||||
D(2,2) = 0.;
|
||||
D(2,3) = nplan.Dot(d1u2);
|
||||
D(2,4) = nplan.Dot(d1v2);
|
||||
D(3,1) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
|
||||
D(3,2) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
|
||||
D(3,3) = 0.;
|
||||
D(3,4) = 0.;
|
||||
D(4,1) = d1u1.Dot(gp_Vec(pts1,pts2)) - gp_Vec(ptgui,pts1).Dot(d1u1);
|
||||
D(4,2) = d1v1.Dot(gp_Vec(pts1,pts2)) - gp_Vec(ptgui,pts1).Dot(d1v1);
|
||||
D(4,3) = gp_Vec(ptgui,pts1).Dot(d1u2);
|
||||
D(4,4) = gp_Vec(ptgui,pts1).Dot(d1v2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_ConstThroatWithPenetration::TangentOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::TangentOnS1");
|
||||
return tg1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_ConstThroatWithPenetration::TangentOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::TangentOnS2");
|
||||
return tg2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_ConstThroatWithPenetration::Tangent2dOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::Tangent2dOnS1");
|
||||
return tg12d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_ConstThroatWithPenetration::Tangent2dOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::Tangent2dOnS2");
|
||||
return tg22d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BlendFunc_ConstThroatWithPenetration::GetSectionSize() const
|
||||
{
|
||||
throw Standard_NotImplemented("BlendFunc_ConstThroatWithPenetration::GetSectionSize()");
|
||||
}
|
125
src/BlendFunc/BlendFunc_ConstThroatWithPenetration.hxx
Normal file
125
src/BlendFunc/BlendFunc_ConstThroatWithPenetration.hxx
Normal file
@@ -0,0 +1,125 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
#ifndef _BlendFunc_ConstThroatWithPenetration_HeaderFile
|
||||
#define _BlendFunc_ConstThroatWithPenetration_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <BlendFunc_ConstThroat.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfVec.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_Array1OfVec2d.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
class Adaptor3d_HCurve;
|
||||
class math_Matrix;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
class gp_Vec2d;
|
||||
class gp_Lin;
|
||||
class Blend_Point;
|
||||
|
||||
|
||||
//! Class for a function used to compute a chamfer with constant throat:
|
||||
//! the section of chamfer is right-angled triangle,
|
||||
//! the first of two surfaces (where is the top of the chamfer)
|
||||
//! is virtually moved inside the solid by offset operation,
|
||||
//! the apex of the section is on the intersection curve between moved surface and second surface,
|
||||
//! right angle is at the top of the chamfer,
|
||||
//! the length of the leg from apex to top is constant - it is throat
|
||||
class BlendFunc_ConstThroatWithPenetration : public BlendFunc_ConstThroat
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BlendFunc_ConstThroatWithPenetration(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
|
||||
//! computes the values <F> of the Functions for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <D> of the derivatives for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
//Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
|
||||
|
||||
//Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
|
||||
|
||||
//Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
|
||||
|
||||
//Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec& TangentOnS1() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec& TangentOnS2() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the tangent vector at the section,
|
||||
//! at the beginning and the end of the section, and
|
||||
//! returns the normal (of the surfaces) at
|
||||
//! these points.
|
||||
//Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the throat and the "quadrant".
|
||||
//Standard_EXPORT void Set (const Standard_Real theThroat, const Standard_Real, const Standard_Integer Choix) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the length of the maximum section
|
||||
Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BlendFunc_ConstThroatWithPenetration_HeaderFile
|
213
src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.cxx
Normal file
213
src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.cxx
Normal file
@@ -0,0 +1,213 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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 <Adaptor2d_HCurve2d.hxx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <BlendFunc_ConstThroatWithPenetrationInv.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ConstThroatInv
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_ConstThroatWithPenetrationInv::
|
||||
BlendFunc_ConstThroatWithPenetrationInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C)
|
||||
: BlendFunc_ConstThroatInv(S1,S2,C)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatWithPenetrationInv::IsSolution(const math_Vector& Sol,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1,4);
|
||||
Value(Sol, valsol);
|
||||
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol &&
|
||||
Abs(valsol(3)) <= Tol*Tol &&
|
||||
Abs(valsol(4)) <= Tol)
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatWithPenetrationInv::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
{
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
param = X(2);
|
||||
curv->D2(param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
|
||||
math_Vector XX(1,4);
|
||||
|
||||
if(first){
|
||||
XX(1) = p2d.X(); XX(2) = p2d.Y();
|
||||
XX(3) = X(3); XX(4) = X(4);
|
||||
}
|
||||
|
||||
else{
|
||||
XX(1) = X(3); XX(2) = X(4);
|
||||
XX(3) = p2d.X(); XX(4) = p2d.Y();
|
||||
}
|
||||
|
||||
surf1->D0( XX(1), XX(2), pts1 );
|
||||
surf2->D0( XX(3), XX(4), pts2 );
|
||||
|
||||
F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
|
||||
F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
|
||||
|
||||
const gp_Vec vref(ptgui, pts1);
|
||||
|
||||
F(3) = vref.SquareMagnitude() - Throat*Throat;
|
||||
|
||||
const gp_Vec vec12(pts1, pts2);
|
||||
|
||||
F(4) = vref.Dot(vec12);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ConstThroatWithPenetrationInv::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
{
|
||||
//Standard_Integer i, j;
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d; //, df1, df2;
|
||||
//gp_Pnt pts, ptgui;
|
||||
gp_Vec dnplan, temp, temp1, temp2, temp3; //, d1u, d1v, nplan;
|
||||
math_Vector XX(1,4); //x1(1,2), x2(1,2);
|
||||
//math_Matrix d1(1,2,1,2), d2(1,2,1,2);
|
||||
|
||||
csurf->D1(X(1), p2d, v2d);
|
||||
//corde1.SetParam(X(2));
|
||||
//corde2.SetParam(X(2));
|
||||
param = X(2);
|
||||
curv->D2(param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
|
||||
temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
|
||||
temp3.SetXYZ(pts2.XYZ() - pts1.XYZ());
|
||||
|
||||
//x1(1) = p2d.X(); x1(2) = p2d.Y();
|
||||
//x2(1) = X(3); x2(2) = X(4);
|
||||
if (first)
|
||||
{
|
||||
XX(1) = p2d.X(); XX(2) = p2d.Y();
|
||||
XX(3) = X(3); XX(4) = X(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
XX(1) = X(3); XX(2) = X(4);
|
||||
XX(3) = p2d.X(); XX(4) = p2d.Y();
|
||||
}
|
||||
|
||||
surf1->D1(XX(1), XX(2), pts1, d1u1, d1v1);
|
||||
surf2->D1(XX(3), XX(4), pts2, d1u2, d1v2);
|
||||
|
||||
if( first ){
|
||||
// p2d = pts est sur surf1
|
||||
//ptgui = corde1.PointOnGuide();
|
||||
//nplan = corde1.NPlan();
|
||||
temp.SetLinearForm(v2d.X(),d1u1, v2d.Y(),d1v1);
|
||||
|
||||
D(1,1) = nplan.Dot(temp);
|
||||
D(2,1) = 0.;
|
||||
//D(3,1) = 2*gp_Vec(ptgui,pts1).Dot(temp);
|
||||
D(3,1) = 2*temp1.Dot(temp);
|
||||
//D(4,1) = temp.Dot(gp_Vec(pts1,pts2)) - temp.Dot(gp_Vec(ptgui,pts1));
|
||||
D(4,1) = temp.Dot(temp3) - temp.Dot(temp1);
|
||||
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
D(2,3) = nplan.Dot(d1u2);
|
||||
D(2,4) = nplan.Dot(d1v2);
|
||||
D(3,3) = 0.;
|
||||
D(3,4) = 0.;
|
||||
//D(4,3) = gp_Vec(ptgui,pts1).Dot(d1u2);
|
||||
D(4,3) = temp1.Dot(d1u2);
|
||||
//D(4,4) = gp_Vec(ptgui,pts1).Dot(d1v2);
|
||||
D(4,4) = temp1.Dot(d1v2);
|
||||
|
||||
//surf1->D1(x1(1),x1(2),pts,d1u,d1v);
|
||||
}
|
||||
else{
|
||||
// p2d = pts est sur surf2
|
||||
//ptgui = corde2.PointOnGuide();
|
||||
//nplan = corde2.NPlan();
|
||||
temp.SetLinearForm(v2d.X(),d1u2, v2d.Y(),d1v2);
|
||||
|
||||
D(1,1) = 0.;
|
||||
D(2,1) = nplan.Dot(temp);
|
||||
D(3,1) = 0.;
|
||||
//D(4,1) = gp_Vec(ptgui,pts1).Dot(temp);
|
||||
D(4,1) = temp1.Dot(temp);
|
||||
|
||||
D(1,3) = nplan.Dot(d1u1);
|
||||
D(1,4) = nplan.Dot(d1v1);
|
||||
D(2,3) = 0.;
|
||||
D(2,4) = 0.;
|
||||
//D(3,3) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
|
||||
D(3,3) = 2.*temp1.Dot(d1u1);
|
||||
//D(3,4) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
|
||||
D(3,4) = 2.*temp1.Dot(d1v1);
|
||||
//D(4,3) = d1u1.Dot(gp_Vec(pts1,pts2)) - d1u1.Dot(gp_Vec(ptgui,pts1));
|
||||
D(4,3) = d1u1.Dot(temp3) - d1u1.Dot(temp1);
|
||||
D(4,4) = d1v1.Dot(temp3) - d1v1.Dot(temp1);
|
||||
|
||||
//surf2->D1(x1(1),x1(2),pts,d1u,d1v);
|
||||
}
|
||||
|
||||
D(1,2) = dnplan.Dot(temp1) - nplan.Dot(d1gui);
|
||||
D(2,2) = dnplan.Dot(temp2) - nplan.Dot(d1gui);
|
||||
//D(3,2) = -2.*gp_Vec(ptgui,pts1).Dot(d1gui);
|
||||
D(3,2) = -2.*d1gui.Dot(temp1);
|
||||
//D(4,2) = -(gp_Vec(pts1,pts2).Dot(d1gui));
|
||||
D(4,2) = -d1gui.Dot(temp3);
|
||||
|
||||
return Standard_True;
|
||||
}
|
77
src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.hxx
Normal file
77
src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.hxx
Normal file
@@ -0,0 +1,77 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
#ifndef _BlendFunc_ConstThroatWithPenetrationInv_HeaderFile
|
||||
#define _BlendFunc_ConstThroatWithPenetrationInv_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BlendFunc_ConstThroatInv.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
class Adaptor3d_HCurve;
|
||||
class Adaptor2d_HCurve2d;
|
||||
class math_Matrix;
|
||||
|
||||
|
||||
|
||||
//! Class for a function used to compute a ConstThroatWithPenetration chamfer
|
||||
//! on a surface's boundary
|
||||
class BlendFunc_ConstThroatWithPenetrationInv : public BlendFunc_ConstThroatInv
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BlendFunc_ConstThroatWithPenetrationInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
|
||||
|
||||
//! computes the values <F> of the Functions for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <D> of the derivatives for the
|
||||
//! variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BlendFunc_ConstThroatWithPenetrationInv_HeaderFile
|
137
src/BlendFunc/BlendFunc_GenChamfInv.cxx
Normal file
137
src/BlendFunc/BlendFunc_GenChamfInv.cxx
Normal file
@@ -0,0 +1,137 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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 <Adaptor2d_HCurve2d.hxx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <BlendFunc_ChamfInv.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_GenChamfInv
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BlendFunc_GenChamfInv::BlendFunc_GenChamfInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
surf1(S1),surf2(S2),curv(C)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_GenChamfInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_GenChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
Value(X,F);
|
||||
Derivatives(X,D);
|
||||
return Standard_True;
|
||||
}
|
94
src/BlendFunc/BlendFunc_GenChamfInv.hxx
Normal file
94
src/BlendFunc/BlendFunc_GenChamfInv.hxx
Normal file
@@ -0,0 +1,94 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
#ifndef _BlendFunc_GenChamfInv_HeaderFile
|
||||
#define _BlendFunc_GenChamfInv_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BlendFunc_Corde.hxx>
|
||||
#include <Blend_FuncInv.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
class Adaptor3d_HCurve;
|
||||
class Adaptor2d_HCurve2d;
|
||||
class math_Matrix;
|
||||
|
||||
|
||||
|
||||
//! Deferred class for a function used to compute a general chamfer on a surface's boundary
|
||||
class BlendFunc_GenChamfInv : public Blend_FuncInv
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT BlendFunc_GenChamfInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C);
|
||||
|
||||
Standard_EXPORT virtual void Set (const Standard_Boolean OnFirst,
|
||||
const Handle(Adaptor2d_HCurve2d)& COnSurf) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetTolerance (math_Vector& Tolerance,
|
||||
const Standard_Real Tol) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetBounds (math_Vector& InfBound,
|
||||
math_Vector& SupBound) const Standard_OVERRIDE;
|
||||
|
||||
//! returns the number of equations of the function.
|
||||
Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <F> of the functions and the derivatives
|
||||
//! <D> for the variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Values (const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Set (const Standard_Real Dist1,
|
||||
const Standard_Real Dist2,
|
||||
const Standard_Integer Choix) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Adaptor3d_HSurface) surf1;
|
||||
Handle(Adaptor3d_HSurface) surf2;
|
||||
Handle(Adaptor3d_HCurve) curv;
|
||||
Handle(Adaptor2d_HCurve2d) csurf;
|
||||
Standard_Integer choix;
|
||||
Standard_Boolean first;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BlendFunc_GenChamfInv_HeaderFile
|
356
src/BlendFunc/BlendFunc_GenChamfer.cxx
Normal file
356
src/BlendFunc/BlendFunc_GenChamfer.cxx
Normal file
@@ -0,0 +1,356 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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 <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <Blend_Point.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <BlendFunc_Chamfer.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_GenChamfer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BlendFunc_GenChamfer::BlendFunc_GenChamfer(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& CG)
|
||||
: surf1(S1),surf2(S2),curv(CG),
|
||||
distmin(RealLast())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_GenChamfer::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::Set(const Standard_Real, const Standard_Real)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = surf1->UResolution(Tol);
|
||||
Tolerance(2) = surf1->VResolution(Tol);
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = surf1->FirstUParameter();
|
||||
InfBound(2) = surf1->FirstVParameter();
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(1) = surf1->LastUParameter();
|
||||
SupBound(2) = surf1->LastVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
|
||||
for(Standard_Integer i = 1; i <= 4; i++){
|
||||
if(!Precision::IsInfinite(InfBound(i)) &&
|
||||
!Precision::IsInfinite(SupBound(i))) {
|
||||
const Standard_Real range = (SupBound(i) - InfBound(i));
|
||||
InfBound(i) -= range;
|
||||
SupBound(i) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BlendFunc_GenChamfer::GetMinimalDistance() const
|
||||
{
|
||||
return distmin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_GenChamfer::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
Standard_Boolean val = Value(X,F);
|
||||
return (val && Derivatives(X,D));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::Section(const Standard_Real /*Param*/,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
Standard_Real& Pdeb,
|
||||
Standard_Real& Pfin,
|
||||
gp_Lin& C)
|
||||
{
|
||||
const gp_Pnt pts1 = surf1->Value(U1,V1);
|
||||
const gp_Pnt pts2 = surf2->Value(U2,V2);
|
||||
const gp_Dir dir( gp_Vec(pts1,pts2) );
|
||||
|
||||
C.SetLocation(pts1);
|
||||
C.SetDirection(dir);
|
||||
|
||||
Pdeb = 0.;
|
||||
Pfin = ElCLib::Parameter(C,pts2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsRational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_GenChamfer::IsRational() const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_GenChamfer::GetMinimalWeight(TColStd_Array1OfReal& Weights) const
|
||||
{
|
||||
Weights.Init(1);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_GenChamfer::NbIntervals (const GeomAbs_Shape S) const
|
||||
{
|
||||
return curv->NbIntervals(BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
|
||||
{
|
||||
curv->Intervals(T, BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::GetShape (Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles2d)
|
||||
{
|
||||
NbPoles = 2;
|
||||
NbPoles2d = 2;
|
||||
NbKnots = 2;
|
||||
Degree = 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose : Determine les Tolerance a utiliser dans les approximations.
|
||||
//=======================================================================
|
||||
void BlendFunc_GenChamfer::GetTolerance(const Standard_Real BoundTol,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
math_Vector& Tol3d,
|
||||
math_Vector&) const
|
||||
{
|
||||
Tol3d.Init(BoundTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Knots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::Knots(TColStd_Array1OfReal& TKnots)
|
||||
{
|
||||
TKnots(1) = 0.;
|
||||
TKnots(2) = 1.;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Mults
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::Mults(TColStd_Array1OfInteger& TMults)
|
||||
{
|
||||
TMults(1) = 2;
|
||||
TMults(2) = 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_GenChamfer::Section
|
||||
(const Blend_Point& /*P*/,
|
||||
TColgp_Array1OfPnt& /*Poles*/,
|
||||
TColgp_Array1OfVec& /*DPoles*/,
|
||||
TColgp_Array1OfVec& /*D2Poles*/,
|
||||
TColgp_Array1OfPnt2d& /*Poles2d*/,
|
||||
TColgp_Array1OfVec2d& /*DPoles2d*/,
|
||||
TColgp_Array1OfVec2d& /*D2Poles2d*/,
|
||||
TColStd_Array1OfReal& /*Weights*/,
|
||||
TColStd_Array1OfReal& /*DWeights*/,
|
||||
TColStd_Array1OfReal& /*D2Weights*/)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_GenChamfer::Section
|
||||
(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights)
|
||||
{
|
||||
math_Vector sol(1,4),valsol(1,4),secmember(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
Standard_Real prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
Standard_Boolean istgt;
|
||||
|
||||
P.ParametersOnS1(sol(1),sol(2));
|
||||
P.ParametersOnS2(sol(3),sol(4));
|
||||
|
||||
Set(prm);
|
||||
|
||||
Values(sol,valsol,gradsol);
|
||||
IsSolution(sol,tol);
|
||||
|
||||
istgt = IsTangencyPoint();
|
||||
|
||||
Poles2d(Poles2d.Lower()).SetCoord(sol(1),sol(2));
|
||||
Poles2d(Poles2d.Upper()).SetCoord(sol(3),sol(4));
|
||||
if (!istgt) {
|
||||
DPoles2d(Poles2d.Lower()).SetCoord(Tangent2dOnS1().X(),
|
||||
Tangent2dOnS1().Y());
|
||||
DPoles2d(Poles2d.Upper()).SetCoord(Tangent2dOnS2().X(),
|
||||
Tangent2dOnS2().Y());
|
||||
}
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
if (!istgt) {
|
||||
DPoles(low) = TangentOnS1();
|
||||
DPoles(upp) = TangentOnS2();
|
||||
DWeights(low) = 0.0;
|
||||
DWeights(upp) = 0.0;
|
||||
}
|
||||
|
||||
return (!istgt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_GenChamfer::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2,prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
math_Vector X(1,4), F(1,4);
|
||||
|
||||
P.ParametersOnS1(u1,v1);
|
||||
P.ParametersOnS2(u2,v2);
|
||||
X(1)=u1;
|
||||
X(2)=v1;
|
||||
X(3)=u2;
|
||||
X(4)=v2;
|
||||
Poles2d(Poles2d.Lower()).SetCoord(u1,v1);
|
||||
Poles2d(Poles2d.Upper()).SetCoord(u2,v2);
|
||||
|
||||
Set(prm);
|
||||
Value(X,F);
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
}
|
||||
|
||||
void BlendFunc_GenChamfer::Resolution(const Standard_Integer IC2d, const Standard_Real Tol,
|
||||
Standard_Real& TolU, Standard_Real& TolV) const
|
||||
{
|
||||
if(IC2d == 1){
|
||||
TolU = surf1->UResolution(Tol);
|
||||
TolV = surf1->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
TolU = surf2->UResolution(Tol);
|
||||
TolV = surf2->VResolution(Tol);
|
||||
}
|
||||
}
|
200
src/BlendFunc/BlendFunc_GenChamfer.hxx
Normal file
200
src/BlendFunc/BlendFunc_GenChamfer.hxx
Normal file
@@ -0,0 +1,200 @@
|
||||
// Created by: Julia GERASIMOVA
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
#ifndef _BlendFunc_GenChamfer_HeaderFile
|
||||
#define _BlendFunc_GenChamfer_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <BlendFunc_Corde.hxx>
|
||||
#include <Blend_Function.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfVec.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_Array1OfVec2d.hxx>
|
||||
class Adaptor3d_HSurface;
|
||||
class Adaptor3d_HCurve;
|
||||
class math_Matrix;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
class gp_Vec2d;
|
||||
class gp_Lin;
|
||||
class Blend_Point;
|
||||
|
||||
|
||||
|
||||
//! Deferred class for a function used to compute a general chamfer
|
||||
class BlendFunc_GenChamfer : public Blend_Function
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT BlendFunc_GenChamfer(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& CG);
|
||||
|
||||
//! returns the number of equations of the function.
|
||||
Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
|
||||
|
||||
//! returns the values <F> of the functions and the derivatives
|
||||
//! <D> for the variable <X>.
|
||||
//! Returns True if the computation was done successfully,
|
||||
//! False otherwise.
|
||||
Standard_EXPORT Standard_Boolean Values (const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value of the parameter along the guide line.
|
||||
//! This determines the plane in which the solution has
|
||||
//! to be found.
|
||||
Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE = 0;
|
||||
|
||||
//! Sets the bounds of the parametric interval on
|
||||
//! the guide line.
|
||||
//! This determines the derivatives in these values if the
|
||||
//! function is not Cn.
|
||||
Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetTolerance (math_Vector& Tolerance,
|
||||
const Standard_Real Tol) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetBounds (math_Vector& InfBound,
|
||||
math_Vector& SupBound) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the minimal Distance beetween two
|
||||
//! extremitys of calculed sections.
|
||||
Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the distances and the "quadrant".
|
||||
Standard_EXPORT virtual void Set (const Standard_Real Dist1,
|
||||
const Standard_Real Dist2,
|
||||
const Standard_Integer Choix) = 0;
|
||||
|
||||
//! Returns False
|
||||
Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
|
||||
|
||||
//! Compute the minimal value of weight for each poles
|
||||
//! of all sections.
|
||||
Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
//! raises
|
||||
//! OutOfRange from Standard
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void GetShape (Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles2d) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the tolerance to reach in approximation
|
||||
//! to respecte
|
||||
//! BoundTol error at the Boundary
|
||||
//! AngleTol tangent error at the Boundary
|
||||
//! SurfTol error inside the surface.
|
||||
Standard_EXPORT void GetTolerance (const Standard_Real BoundTol,
|
||||
const Standard_Real SurfTol,
|
||||
const Standard_Real AngleTol,
|
||||
math_Vector& Tol3d,
|
||||
math_Vector& Tol1D) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
|
||||
|
||||
//! Obsolete method
|
||||
Standard_EXPORT void Section (const Standard_Real Param,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
Standard_Real& Pdeb,
|
||||
Standard_Real& Pfin,
|
||||
gp_Lin& C);
|
||||
|
||||
//! Used for the first and last section
|
||||
Standard_EXPORT Standard_Boolean Section (const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfVec& D2Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColgp_Array1OfVec2d& D2Poles2d,
|
||||
TColStd_Array1OfReal& Weigths,
|
||||
TColStd_Array1OfReal& DWeigths,
|
||||
TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
|
||||
|
||||
//! Used for the first and last section
|
||||
Standard_EXPORT Standard_Boolean Section (const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weigths,
|
||||
TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Section (const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Resolution (const Standard_Integer IC2d,
|
||||
const Standard_Real Tol,
|
||||
Standard_Real& TolU,
|
||||
Standard_Real& TolV) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Adaptor3d_HSurface) surf1;
|
||||
Handle(Adaptor3d_HSurface) surf2;
|
||||
Handle(Adaptor3d_HCurve) curv;
|
||||
Standard_Integer choix;
|
||||
Standard_Real tol;
|
||||
Standard_Real distmin;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BlendFunc_GenChamfer_HeaderFile
|
@@ -1,5 +1,9 @@
|
||||
BlendFunc.cxx
|
||||
BlendFunc.hxx
|
||||
BlendFunc_GenChamfer.cxx
|
||||
BlendFunc_GenChamfer.hxx
|
||||
BlendFunc_GenChamfInv.cxx
|
||||
BlendFunc_GenChamfInv.hxx
|
||||
BlendFunc_Chamfer.cxx
|
||||
BlendFunc_Chamfer.hxx
|
||||
BlendFunc_ChamfInv.cxx
|
||||
@@ -30,3 +34,11 @@ BlendFunc_SectionShape.hxx
|
||||
BlendFunc_Tensor.cxx
|
||||
BlendFunc_Tensor.hxx
|
||||
BlendFunc_Tensor.lxx
|
||||
BlendFunc_ConstThroat.cxx
|
||||
BlendFunc_ConstThroat.hxx
|
||||
BlendFunc_ConstThroatInv.cxx
|
||||
BlendFunc_ConstThroatInv.hxx
|
||||
BlendFunc_ConstThroatWithPenetration.cxx
|
||||
BlendFunc_ConstThroatWithPenetration.hxx
|
||||
BlendFunc_ConstThroatWithPenetrationInv.cxx
|
||||
BlendFunc_ConstThroatWithPenetrationInv.hxx
|
||||
|
Reference in New Issue
Block a user