1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00
Files
occt/src/BlendFunc/BlendFunc_GenChamfInv.cxx
kgv c22b52d60e 0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSurface classes
Adaptor2d_Curve2d, Adaptor3d_Curve and Adaptor3d_Surface now inherit Standard_Transient.
Interfaces Adaptor2d_HCurve2d, Adaptor3d_HCurve, Adaptor3d_HSurface and their subclasses
are now aliases to Adaptor2d_Curve2d, Adaptor3d_Curve and Adaptor3d_Surface.
Removed numerous unsafe reinterpret casts.

Generic classes Adaptor3d_GenHCurve, Adaptor3d_GenHSurface, Adaptor2d_GenHCurve2d have been removed.
Several redundant .lxx files have been merged into .hxx.

Removed obsolete adaptor classes with H suffix.
2020-12-11 19:12:48 +03:00

142 lines
4.5 KiB
C++

// 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_Curve2d.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Adaptor3d_Surface.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_Surface)& S1,
const Handle(Adaptor3d_Surface)& S2,
const Handle(Adaptor3d_Curve)& C)
: surf1(S1),
surf2(S2),
curv(C),
choix(0),
first(Standard_False)
{
}
//=======================================================================
//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_Curve2d)& 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;
}