mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-06 10:36:12 +03:00
415 lines
12 KiB
Plaintext
Executable File
415 lines
12 KiB
Plaintext
Executable File
// Created on: 1992-01-20
|
|
// Created by: Remi GILET
|
|
// Copyright (c) 1992-1999 Matra Datavision
|
|
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
|
//
|
|
// The content of this file is subject to the Open CASCADE Technology Public
|
|
// License Version 6.5 (the "License"). You may not use the content of this file
|
|
// except in compliance with the License. Please obtain a copy of the License
|
|
// at http://www.opencascade.org and read it completely before using this file.
|
|
//
|
|
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
|
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
|
//
|
|
// The Original Code and all software distributed under the License is
|
|
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
|
// Initial Developer hereby disclaims all such warranties, including without
|
|
// limitation, any warranties of merchantability, fitness for a particular
|
|
// purpose or non-infringement. Please see the License for the specific terms
|
|
// and conditions governing the rights and limitations under the License.
|
|
|
|
|
|
#include <Standard_ConstructionError.hxx>
|
|
#include <ElCLib.hxx>
|
|
|
|
void GccIter_FunctionTanCuCuOnCu::
|
|
InitDerivative(const math_Vector& X,
|
|
gp_Pnt2d& Point1,
|
|
gp_Pnt2d& Point2,
|
|
gp_Pnt2d& Point3,
|
|
gp_Vec2d& Tan1,
|
|
gp_Vec2d& Tan2,
|
|
gp_Vec2d& Tan3,
|
|
gp_Vec2d& D21,
|
|
gp_Vec2d& D22,
|
|
gp_Vec2d& D23) {
|
|
switch (TheType) {
|
|
case GccIter_CuCuOnCu:
|
|
{
|
|
TheCurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
TheCurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_CiCuOnCu:
|
|
{
|
|
ElCLib::D2(X(1),Circ1,Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
TheCurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_LiCuOnCu:
|
|
{
|
|
ElCLib::D1(X(1),Lin1,Point1,Tan1);
|
|
D21 = gp_Vec2d(0.,0.);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
TheCurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_CuPtOnCu:
|
|
{
|
|
TheCurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
|
|
Point2 = Pnt2;
|
|
Tan2 = gp_Vec2d(0.,0.);
|
|
D22 = gp_Vec2d(0.,0.);
|
|
}
|
|
break;
|
|
case GccIter_CuCuOnCi:
|
|
{
|
|
TheCurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_CiCuOnCi:
|
|
{
|
|
ElCLib::D2(X(1),Circ1,Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_LiCuOnCi:
|
|
{
|
|
ElCLib::D1(X(1),Lin1,Point1,Tan1);
|
|
D21 = gp_Vec2d(0.,0.);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_CuPtOnCi:
|
|
{
|
|
TheCurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
|
|
Point2 = Pnt2;
|
|
Tan2 = gp_Vec2d(0.,0.);
|
|
D22 = gp_Vec2d(0.,0.);
|
|
ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
|
|
}
|
|
break;
|
|
case GccIter_CuCuOnLi:
|
|
{
|
|
TheCurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
ElCLib::D1(X(3),Linon,Point3,Tan3);
|
|
D23 = gp_Vec2d(0.,0.);
|
|
}
|
|
break;
|
|
case GccIter_CiCuOnLi:
|
|
{
|
|
ElCLib::D2(X(1),Circ1,Point1,Tan1,D21);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
ElCLib::D1(X(3),Linon,Point3,Tan3);
|
|
D23 = gp_Vec2d(0.,0.);
|
|
}
|
|
break;
|
|
case GccIter_LiCuOnLi:
|
|
{
|
|
ElCLib::D1(X(1),Lin1,Point1,Tan1);
|
|
TheCurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
|
|
D21 = gp_Vec2d(0.,0.);
|
|
ElCLib::D1(X(3),Linon,Point3,Tan3);
|
|
D23 = gp_Vec2d(0.,0.);
|
|
}
|
|
break;
|
|
case GccIter_CuPtOnLi:
|
|
{
|
|
TheCurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
|
|
Point2 = Pnt2;
|
|
Tan2 = gp_Vec2d(0.,0.);
|
|
D22 = gp_Vec2d(0.,0.);
|
|
ElCLib::D1(X(3),Linon,Point3,Tan3);
|
|
D23 = gp_Vec2d(0.,0.);
|
|
}
|
|
break;
|
|
default:
|
|
{
|
|
Standard_ConstructionError::Raise();
|
|
}
|
|
}
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const TheCurve& C1 ,
|
|
const TheCurve& C2 ,
|
|
const TheCurve& C3 ,
|
|
const Standard_Real Rad ) {
|
|
Curv1 = C1;
|
|
Curv2 = C2;
|
|
Curvon = C3;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuCuOnCu;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const gp_Circ2d& C1 ,
|
|
const TheCurve& C2 ,
|
|
const TheCurve& C3 ,
|
|
const Standard_Real Rad ) {
|
|
Circ1 = C1;
|
|
Curv2 = C2;
|
|
Curvon = C3;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CiCuOnCu;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const gp_Lin2d& L1 ,
|
|
const TheCurve& C2 ,
|
|
const TheCurve& C3 ,
|
|
const Standard_Real Rad ) {
|
|
Lin1 = L1;
|
|
Curv2 = C2;
|
|
Curvon = C3;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_LiCuOnCu;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const TheCurve& C1 ,
|
|
const gp_Pnt2d& P2 ,
|
|
const TheCurve& C3 ,
|
|
const Standard_Real Rad ) {
|
|
Curv1 = C1;
|
|
Pnt2 = P2;
|
|
Curvon = C3;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuPtOnCu;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const TheCurve& C1 ,
|
|
const TheCurve& C2 ,
|
|
const gp_Lin2d& OnLi ,
|
|
const Standard_Real Rad ) {
|
|
Curv1 = C1;
|
|
Curv2 = C2;
|
|
Linon = OnLi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuCuOnLi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const gp_Circ2d& C1 ,
|
|
const TheCurve& C2 ,
|
|
const gp_Lin2d& OnLi ,
|
|
const Standard_Real Rad ) {
|
|
Circ1 = C1;
|
|
Curv2 = C2;
|
|
Linon = OnLi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CiCuOnLi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const gp_Lin2d& L1 ,
|
|
const TheCurve& C2 ,
|
|
const gp_Lin2d& OnLi ,
|
|
const Standard_Real Rad ) {
|
|
Lin1 = L1;
|
|
Curv2 = C2;
|
|
Linon = OnLi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_LiCuOnLi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const TheCurve& C1 ,
|
|
const gp_Pnt2d& P2 ,
|
|
const gp_Lin2d& OnLi ,
|
|
const Standard_Real Rad ) {
|
|
Curv1 = C1;
|
|
Pnt2 = P2;
|
|
Linon = OnLi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuPtOnLi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const TheCurve& C1 ,
|
|
const TheCurve& C2 ,
|
|
const gp_Circ2d& OnCi ,
|
|
const Standard_Real Rad ) {
|
|
Curv1 = C1;
|
|
Curv2 = C2;
|
|
Circon = OnCi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuCuOnCi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const gp_Circ2d& C1 ,
|
|
const TheCurve& C2 ,
|
|
const gp_Circ2d& OnCi ,
|
|
const Standard_Real Rad ) {
|
|
Circ1 = C1;
|
|
Curv2 = C2;
|
|
Circon = OnCi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuCuOnCi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const gp_Lin2d& L1 ,
|
|
const TheCurve& C2 ,
|
|
const gp_Circ2d& OnCi ,
|
|
const Standard_Real Rad ) {
|
|
Lin1 = L1;
|
|
Curv2 = C2;
|
|
Circon = OnCi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_LiCuOnCi;
|
|
}
|
|
|
|
GccIter_FunctionTanCuCuOnCu::
|
|
GccIter_FunctionTanCuCuOnCu(const TheCurve& C1 ,
|
|
const gp_Pnt2d& P2 ,
|
|
const gp_Circ2d& OnCi ,
|
|
const Standard_Real Rad ) {
|
|
Curv1 = C1;
|
|
Pnt2 = P2;
|
|
Circon = OnCi;
|
|
FirstRad = Rad;
|
|
TheType = GccIter_CuPtOnCi;
|
|
}
|
|
|
|
Standard_Integer GccIter_FunctionTanCuCuOnCu::
|
|
NbVariables () const { return 4; }
|
|
|
|
Standard_Integer GccIter_FunctionTanCuCuOnCu::
|
|
NbEquations () const { return 4; }
|
|
|
|
Standard_Boolean GccIter_FunctionTanCuCuOnCu::
|
|
Value (const math_Vector& X ,
|
|
math_Vector& Fval ) {
|
|
gp_Pnt2d Point1,Point2,Point3;
|
|
gp_Vec2d Tan1,Tan2,Tan3,D21,D22,D23;
|
|
InitDerivative(X,Point1,Point2,Point3,Tan1,Tan2,Tan3,D21,D22,D23);
|
|
//pipj (normes) et PiPj (non Normes).
|
|
gp_Vec2d P1P2(Point1,Point2);
|
|
gp_Vec2d P2P3(Point2,Point3);
|
|
gp_Vec2d P3P1(Point3,Point1);
|
|
gp_Vec2d p1p2,p2p3,p3p1;
|
|
// if (FirstRad < 1.) {FirstRad = 1.; }
|
|
p1p2 = P1P2/FirstRad;
|
|
p2p3 = P2P3/FirstRad;
|
|
p3p1 = P3P1/FirstRad;
|
|
//norme des Tani.
|
|
Standard_Real nnor1 = Tan1.Magnitude();
|
|
Standard_Real nnor2 = Tan2.Magnitude();
|
|
// Fonctions Fui.
|
|
// ==============
|
|
Fval(1) = (P3P1.Dot(P3P1)-X(4)*X(4))/(FirstRad*FirstRad);
|
|
Fval(2) = (P2P3.Dot(P2P3)-X(4)*X(4))/(FirstRad*FirstRad);
|
|
Fval(3) = P3P1.Dot(Tan1)/(nnor1*FirstRad);
|
|
Fval(4) = P2P3.Dot(Tan2)/(nnor2*FirstRad);
|
|
return Standard_True;
|
|
}
|
|
|
|
Standard_Boolean GccIter_FunctionTanCuCuOnCu::
|
|
Derivatives (const math_Vector& X ,
|
|
math_Matrix& Deriv ) {
|
|
gp_Pnt2d Point1,Point2,Point3;
|
|
gp_Vec2d Tan1,Tan2,Tan3;
|
|
gp_Vec2d D21,D22,D23;
|
|
InitDerivative(X,Point1,Point2,Point3,Tan1,Tan2,Tan3,D21,D22,D23);
|
|
//pipj (normes) et PiPj (non Normes).
|
|
gp_Vec2d P1P2(Point1,Point2);
|
|
gp_Vec2d P2P3(Point2,Point3);
|
|
gp_Vec2d P3P1(Point3,Point1);
|
|
gp_Vec2d p1p2,p2p3,p3p1;
|
|
// if (FirstRad < 1.) {FirstRad = 1.; }
|
|
p1p2 = P1P2/FirstRad;
|
|
p2p3 = P2P3/FirstRad;
|
|
p3p1 = P3P1/FirstRad;
|
|
//normales au courbes normees Nori et non nromees nori et norme des nori.
|
|
Standard_Real nnor1 = Tan1.Magnitude();
|
|
Standard_Real nnor2 = Tan2.Magnitude();
|
|
// Derivees dFui/uj 1 <= ui <= 3 , 1 <= uj <= 3
|
|
// =============================================
|
|
Deriv(1,1) = 2.*Tan1.Dot(P3P1)/(FirstRad*FirstRad);
|
|
Deriv(1,2) = 0.;
|
|
Deriv(1,3) = -2.*Tan3.Dot(P3P1)/(FirstRad*FirstRad);
|
|
Deriv(1,4) = -2.*X(4)/(FirstRad*FirstRad);
|
|
|
|
Deriv(2,1) = 0.;
|
|
Deriv(2,2) = -2.*Tan2.Dot(P2P3)/(FirstRad*FirstRad);
|
|
Deriv(2,3) = 2.*Tan3.Dot(P2P3)/(FirstRad*FirstRad);
|
|
Deriv(2,4) = -2.*X(4)/(FirstRad*FirstRad);
|
|
|
|
Deriv(3,1) = (P3P1.Dot(D21)+Tan1.Dot(Tan1))/(FirstRad*nnor1)-
|
|
(P3P1.Dot(Tan1)*D21.Dot(Tan1))/(FirstRad*nnor1*nnor1*nnor1);
|
|
Deriv(3,2) = 0.;
|
|
Deriv(3,3) = -(Tan3.Dot(Tan1))/(FirstRad*nnor1);
|
|
Deriv(3,4) = 0.;
|
|
|
|
Deriv(4,1) = 0.;
|
|
Deriv(4,2) = (P2P3.Dot(D22)-Tan2.Dot(Tan2))/(FirstRad*nnor2)-
|
|
P2P3.Dot(Tan2)*Tan2.Dot(D22)/(FirstRad*nnor2*nnor2*nnor2);
|
|
Deriv(4,3) = Tan3.Dot(Tan2)/(FirstRad*nnor1);
|
|
Deriv(4,4) = 0.;
|
|
return Standard_True;
|
|
}
|
|
|
|
Standard_Boolean GccIter_FunctionTanCuCuOnCu::
|
|
Values (const math_Vector& X ,
|
|
math_Vector& Fval ,
|
|
math_Matrix& Deriv ) {
|
|
gp_Pnt2d Point1,Point2,Point3;
|
|
gp_Vec2d Tan1,Tan2,Tan3;
|
|
gp_Vec2d D21,D22,D23;
|
|
InitDerivative(X,Point1,Point2,Point3,Tan1,Tan2,Tan3,D21,D22,D23);
|
|
//pipj (normes) et PiPj (non Normes).
|
|
gp_Vec2d P1P2(Point1,Point2);
|
|
gp_Vec2d P2P3(Point2,Point3);
|
|
gp_Vec2d P3P1(Point3,Point1);
|
|
gp_Vec2d p1p2,p2p3,p3p1;
|
|
// if (FirstRad < 1.) {FirstRad = 1.; }
|
|
p1p2 = P1P2/FirstRad;
|
|
p2p3 = P2P3/FirstRad;
|
|
p3p1 = P3P1/FirstRad;
|
|
//normales au courbes normees Nori et non nromees nori et norme des nori.
|
|
Standard_Real nnor1 = Tan1.Magnitude();
|
|
Standard_Real nnor2 = Tan2.Magnitude();
|
|
// Fonctions Fui.
|
|
// ==============
|
|
Fval(1) = (P3P1.Dot(P3P1)-X(4)*X(4))/(FirstRad*FirstRad);
|
|
Fval(2) = (P2P3.Dot(P2P3)-X(4)*X(4))/(FirstRad*FirstRad);
|
|
Fval(3) = P3P1.Dot(Tan1)/(nnor1*FirstRad);
|
|
Fval(4) = P2P3.Dot(Tan2)/(nnor2*FirstRad);
|
|
// Derivees dFui/uj 1 <= ui <= 3 , 1 <= uj <= 3
|
|
// =============================================
|
|
Deriv(1,1) = 2.*Tan1.Dot(P3P1)/(FirstRad*FirstRad);
|
|
Deriv(1,2) = 0.;
|
|
Deriv(1,3) = -2.*Tan3.Dot(P3P1)/(FirstRad*FirstRad);
|
|
Deriv(1,4) = -2.*X(4)/(FirstRad*FirstRad);
|
|
|
|
Deriv(2,1) = 0.;
|
|
Deriv(2,2) = -2.*Tan2.Dot(P2P3)/(FirstRad*FirstRad);
|
|
Deriv(2,3) = 2.*Tan3.Dot(P2P3)/(FirstRad*FirstRad);
|
|
Deriv(2,4) = -2.*X(4)/(FirstRad*FirstRad);
|
|
|
|
Deriv(3,1) = (P3P1.Dot(D21)+Tan1.Dot(Tan1))/(FirstRad*nnor1)-
|
|
(P3P1.Dot(Tan1)*D21.Dot(Tan1))/(FirstRad*nnor1*nnor1*nnor1);
|
|
Deriv(3,2) = 0.;
|
|
Deriv(3,3) = -(Tan3.Dot(Tan1))/(FirstRad*nnor1);
|
|
Deriv(3,4) = 0.;
|
|
|
|
Deriv(4,1) = 0.;
|
|
Deriv(4,2) = (P2P3.Dot(D22)-Tan2.Dot(Tan2))/(FirstRad*nnor2)-
|
|
P2P3.Dot(Tan2)*Tan2.Dot(D22)/(FirstRad*nnor2*nnor2*nnor2);
|
|
Deriv(4,3) = Tan3.Dot(Tan2)/(FirstRad*nnor1);
|
|
Deriv(4,4) = 0.;
|
|
return Standard_True;
|
|
}
|
|
|