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

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

2
src/IntImp/FILES Executable file
View File

@@ -0,0 +1,2 @@
IntImp_ComputeTangence.cxx
IntImp_ComputeTangence.hxx

44
src/IntImp/IntImp.cdl Executable file
View File

@@ -0,0 +1,44 @@
-- File: IntImp.cdl
-- Created: Mon Apr 13 09:54:46 1992
-- Author: Isabelle GRIGNON
-- <isg@sdsun2>
---Copyright: Matra Datavision 1992
package IntImp
---Purpose:
uses Standard, TColStd, StdFail, math, gp, IntSurf
is
enumeration ConstIsoparametric is
UIsoparametricOnCaro1, VIsoparametricOnCaro1,
UIsoparametricOnCaro2, VIsoparametricOnCaro2;
deferred generic class PSurfaceTool;
deferred generic class ISurfaceTool;
deferred generic class CurveTool;
deferred generic class CSCurveTool;
deferred generic class COnSCurveTool;
generic class ZerImpFunc; -- inherits FunctionSetWithDerivatives
generic class ZerParFunc; -- inherits FunctionSetWithDerivatives
deferred generic class CSFunction; -- inherits FunctionSetWithDerivatives
generic class ZerCSParFunc; -- inherits FunctionSetWithDerivatives
generic class ZerCOnSSParFunc; -- inherits FunctionSetWithDerivatives
generic class Int2S,TheFunction;
generic class IntCS;
end IntImp;

View File

@@ -0,0 +1,36 @@
-- File: IntImp_COnSCurveTool.cdl
-- Created: Mon Feb 14 12:19:01 1994
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1994
deferred generic class COnSCurveTool from IntImp (Curve as any)
---Purpose: Template class for the methods on a curve on surface.
-- It is possible to implement this class with
-- an instantiation of the Curve2dTool from Adaptor3d.
uses Pnt2d from gp,
Vec2d from gp
is
FirstParameter(myclass;C : Curve ) returns Real;
LastParameter(myclass;C : Curve ) returns Real;
Value (myclass; C : Curve; U : Real) returns Pnt2d from gp;
D1(myclass; C : Curve ; U : Real;
P : out Pnt2d from gp; V : out Vec2d from gp);
Resolution(myclass; C : Curve; Tol3d: Real from Standard)
---Purpose : Returns the parametric resolution corresponding
-- to the space resolution Tol3d.
returns Real from Standard;
end COnSCurveTool;

View File

View File

@@ -0,0 +1,37 @@
-- File: IntImp_CSCurveTool.cdl
-- Created: Mon Feb 14 11:59:25 1994
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1994
deferred generic class CSCurveTool from IntImp (Curve as any)
---Purpose: Template class for the methods on a curve.
-- It is possible to implement this class with
-- an instantiation of the CurveTool from Adaptor3d.
uses Pnt from gp,
Vec from gp
is
FirstParameter(myclass;C : Curve ) returns Real;
LastParameter(myclass;C : Curve ) returns Real;
Value (myclass; C : Curve; U : Real) returns Pnt from gp;
D1(myclass; C : Curve ; U : Real;
P : out Pnt from gp; V : out Vec from gp);
Resolution(myclass; C : Curve; Tol3d: Real from Standard)
---Purpose : Returns the parametric resolution corresponding
-- to the space resolution Tol3d.
returns Real from Standard;
end CSCurveTool;

View File

View File

@@ -0,0 +1,74 @@
-- File: IntImp_CSFunction.cdl
-- Created: Mon Feb 14 11:50:41 1994
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1994
deferred generic class CSFunction from IntImp
(ThePSurface as any;
TheCurve as any
)
inherits FunctionSetWithDerivatives from math
---Purpose: This class is the template function for the intersection
-- between a curve and a surface.
-- It is possible to implement such a function with an
-- instantiation of :
-- - ZerCSParFunc for the intersection between a 3d curve
-- and a surface.
-- - ZerCOnSSParFunc for the intersection between a curve
-- on surface and another surface.
uses Vector from math,
Matrix from math,
Pnt from gp
is
NbVariables(me) returns Integer from Standard
---Purpose: Returns 3.
is static;
NbEquations(me) returns Integer from Standard
---Purpose: Returns 3.
is static;
Value(me : in out; X : in Vector from math;
F : out Vector from math)
returns Boolean from Standard
is static;
Derivatives(me : in out;X : in Vector from math;
D : out Matrix from math)
returns Boolean from Standard
is static;
Values(me : in out;
X : in Vector from math;
F : out Vector from math; D: out Matrix from math)
returns Boolean from Standard
is static;
Point(me)
---C++: return const&
returns Pnt from gp
is static;
Root(me) returns Real from Standard
is static;
AuxillarSurface(me)
---C++: return const&
returns ThePSurface
is static;
AuxillarCurve(me)
---C++: return const&
returns TheCurve
is static;
end CSFunction;

View File

View File

@@ -0,0 +1,159 @@
//-- File IntImp_ComputeTangence.cxx
#include <IntImp_ConstIsoparametric.hxx>
static const IntImp_ConstIsoparametric staticChoixRef [4] = {
IntImp_UIsoparametricOnCaro1,
IntImp_VIsoparametricOnCaro1,
IntImp_UIsoparametricOnCaro2,
IntImp_VIsoparametricOnCaro2,
};
Standard_EXPORT const IntImp_ConstIsoparametric *ChoixRef = staticChoixRef ;
#include <IntImp_ComputeTangence.hxx>
//Standard_EXPORT IntImp_ConstIsoparametric *ChoixRef = staticChoixRef ;
Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[],
const Standard_Real EpsUV[],
Standard_Real Tgduv[],
IntImp_ConstIsoparametric TabIso[])
// arguments d entree:
// DPuv [0] =derivee en u sur caro 1
// DPuv [1] =derivee en v sur caro 1
// DPuv [2] =derivee en u sur caro 2
// DPuv [3] =derivee en v sur caro 2
// EpsUV[0] tolerance en u sur caro1
// EpsUV[1] tolerance en v sur caro1
// EpsUV[2] tolerance en u sur caro2
// EpsUV[3] tolerance en v sur caro2
// arguments de sortie:
// Tgduv[0] composante sup dp/du de caro1 de la tangente a l intersection
// Tgduv[1] composante sup dp/dv de caro1 de la tangente a l intersection
// Tgduv[2] composante sup dp/du de caro2 de la tangente a l intersection
// Tgduv[3] composante sup dp/dv de caro2 de la tangente a l intersection
// TabIso[0...3] meilleure iso range par ordre decroissant candidate
// a l intersection
// algorithme
// calculer la tangente a l 'intersection ;en utilisant la propriete suivante
// du produit scalaire a^(b^c)=b(ac)-c(ab) on obtient les composantes de la
// tangente a l intersection dans les 2 plans tangents (t=n1^n2 ou n1 normale
// au premier carreau n2 au 2ieme)
// on s assurera que les plans tangents des 2 carreaux ne sont pas //
// les composantes de l intersection dans les plans tangents permettent de
//determiner l angle entre les isoparametriques d un carreau avec le carreau
//reciproque
//on triera par ordre croissant les cosinus :le plus petit cosinus determine le
// meilleure angle donc la meilleure iso a choisir pour trouver
// l intersection
{
Standard_Real NormDuv[4];
// Standard_Real Tampon;
// Standard_Integer Irang[4],i,j;
Standard_Integer i;
NormDuv[0] = DPuv[0].Magnitude();
if(NormDuv[0]<=1e-16) {
return(Standard_True);
}
NormDuv[1] = DPuv[1].Magnitude();
if(NormDuv[1]<=1e-16) {
return(Standard_True);
}
NormDuv[2] = DPuv[2].Magnitude();
if(NormDuv[2]<=1e-16) {
return(Standard_True);
}
NormDuv[3] = DPuv[3].Magnitude();
if(NormDuv[3]<=1e-16) {
return(Standard_True);
}
gp_Vec N1 = DPuv[0];
N1.Cross(DPuv[1]);
gp_Vec N2 = DPuv[2];
N2.Cross(DPuv[3]);
N1.Normalize();
N2.Normalize();
Tgduv[0] = -DPuv[1].Dot(N2);
Tgduv[1] = DPuv[0].Dot(N2);
Tgduv[2] = DPuv[3].Dot(N1);
Tgduv[3] = -DPuv[2].Dot(N1);
Standard_Boolean tangent = (Abs(Tgduv[0]) <= EpsUV[0]*NormDuv[1] &&
Abs(Tgduv[1]) <= EpsUV[1]*NormDuv[0] &&
Abs(Tgduv[2]) <= EpsUV[2]*NormDuv[3] &&
Abs(Tgduv[3]) <= EpsUV[3]*NormDuv[2] );
if(!tangent) {
Standard_Real t=N1.Dot(N2);
if(t<0.0) t=-t;
if(t>0.999999999) {
tangent=Standard_True;
}
}
if (!tangent) {
NormDuv[0] = Abs(Tgduv[1]) /NormDuv[0]; //iso u sur caro1
NormDuv[1] = Abs(Tgduv[0]) /NormDuv[1]; //iso v sur caro1
NormDuv[2] = Abs(Tgduv[3]) /NormDuv[2]; // iso u sur caro2
NormDuv[3] = Abs(Tgduv[2]) /NormDuv[3]; //iso v sur caro2
//-- Tri sur NormDuv ( en para. avec ChoixRef )
Standard_Boolean triOk = Standard_False;
Standard_Real t;
IntImp_ConstIsoparametric ti;
for ( i=0;i<=3;i++) TabIso[i] = ChoixRef[i];
do {
triOk = Standard_True;
for(i=1;i<=3;i++) {
if(NormDuv[i-1]>NormDuv[i]) {
triOk=Standard_False;
t=NormDuv[i];
NormDuv[i]=NormDuv[i-1];
NormDuv[i-1]=t;
ti = TabIso[i];
TabIso[i] = TabIso[i-1];
TabIso[i-1] = ti;
}
}
}
while(!triOk);
#if 0
// trier par ordre croissant le tableau NormDuv
Standard_Integer II;
for (j =0;j<=3;j++) Irang[j]=j;
for (j =0;j<=3;j++) {
Tampon = NormDuv[j];
II=j;
for (i =j+1;i<=3;i++) {
if (NormDuv[i] < Tampon) {
Tampon = NormDuv[i];
II = i;
}
}
Irang[j] = Irang[II];
Irang[II] = j;
NormDuv[II] = NormDuv[j];
NormDuv[j] = Tampon;
}
for (j=0; j<=3;j++) TabIso[j]=ChoixRef[Irang[j]];
#endif
}
return tangent;
}

View File

@@ -0,0 +1,20 @@
#include <gp_Vec.hxx>
#include <IntImp_ConstIsoparametric.hxx>
#if !defined(WNT) || defined(__ApproxInt_DLL) || defined(__IntImp_DLL) || defined(__IntWalk_DLL) || defined(__GeomInt_DLL) || defined(__IntPatch_DLL)
Standard_EXPORTEXTERN const IntImp_ConstIsoparametric *ChoixRef;
#else
Standard_IMPORT const IntImp_ConstIsoparametric *ChoixRef;
#endif
Standard_EXPORT Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[],
const Standard_Real EpsUV[],
Standard_Real Tgduv[],
IntImp_ConstIsoparametric TabIso[]);

31
src/IntImp/IntImp_CurveTool.cdl Executable file
View File

@@ -0,0 +1,31 @@
-- File: IntImp_CurveTool.cdl
-- Created: Tue Jan 26 11:34:54 1993
-- Author: Isabelle GRIGNON
-- <isg@sdsun2>
---Copyright: Matra Datavision 1993
deferred generic class CurveTool from IntImp (Curve as any)
---Purpose: Template class for the methods on a curve.
-- It is possible to implement this class with
-- an instantiation of the CurveTool from Adaptor3d.
uses Pnt from gp,
Vec from gp
is
FirstParameter(myclass;C : Curve ) returns Real;
LastParameter(myclass;C : Curve ) returns Real;
Resolution(myclass; C : Curve; Tol3d: Real from Standard)
---Purpose : Returns the parametric resolution corresponding
-- to the space resolution Tol3d.
returns Real from Standard;
end CurveTool;

View File

View File

@@ -0,0 +1,49 @@
-- File: ISurfaceTool.cdl
-- Created: Fri Mar 6 16:18:58 1992
-- Author: Isabelle GRIGNON
-- <isg@phobox>
---Copyright: Matra Datavision 1992
deferred generic class ISurfaceTool from IntImp
( ImplicitSurface as any)
---Purpose: Template class for a tool on an
-- implicit surface.
uses Vec from gp
is
Value(myclass; Is: ImplicitSurface;
X, Y, Z: Real from Standard)
---Purpose: Returns the value of the function.
returns Real from Standard;
Gradient(myclass; Is: ImplicitSurface;
X, Y, Z: Real from Standard ; V: out Vec from gp);
---Purpose: Returns the gradient of the function.
ValueAndGradient(myclass; Is: ImplicitSurface;
X, Y, Z: Real from Standard;
Val: out Real from Standard; Grad: out Vec from gp);
---Purpose: Returns the value and the gradient.
Tolerance(myclass; Is: ImplicitSurface )
---Purpose: returns the tolerance of the zero of the implicit function
returns Real from Standard;
end ISurfaceTool;

View File

236
src/IntImp/IntImp_Int2S.cdl Executable file
View File

@@ -0,0 +1,236 @@
-- File: Int2S.cdl
-- Created: Tue Apr 30 17:09:26 1991
-- Author: Isabelle GRIGNON
-- <isg@topsn3>
---Copyright: Matra Datavision 1991, 1992
generic class Int2S from IntImp
(ThePSurface as any;
ThePSurfaceTool as any) -- as PSurfaceTool from IntImp (ThePSurface)
---Purpose: Determination of the intersection between 2 surfaces
-- from an point close to the solution.
uses Array1OfReal from TColStd,
ConstIsoparametric from IntImp,
PntOn2S from IntSurf,
Dir from gp,
Dir2d from gp,
FunctionSetRoot from math
raises NotDone from StdFail,
DomainError from Standard,
ConstructionError from Standard,
UndefinedDerivative from StdFail
class TheFunction instantiates ZerParFunc from IntImp
(ThePSurface, ThePSurfaceTool);
is
Create
---Purpose: Raises Construction Error
returns Int2S from IntImp;
Create( Param: Array1OfReal from TColStd;
S1,S2: ThePSurface;
TolTangency: Real)
---Purpose: compute the solution point with the close point
returns Int2S from IntImp;
Create( S1,S2: ThePSurface;
TolTangency: Real from Standard)
---Purpose: initialize the parameters to compute the solution point
-- it 's possible to write to optimize:
-- IntImp_Int2S inter(S1,S2,Func,TolTangency);
-- math_FunctionSetRoot rsnld(inter.Function());
-- while ...{
-- Param(1)=...
-- Param(2)=...
-- param(3)=...
-- inter.Perform(Param,rsnld);
-- }
returns Int2S from IntImp;
Perform(me : in out; Param : Array1OfReal from TColStd;
Rsnld : in out FunctionSetRoot from math)
---Purpose: returns the best constant isoparametric to find
-- the next intersection's point +stores the solution
-- point (the solution point is found with the close point
-- to intersect the isoparametric with the other patch;
-- the choice of the isoparametic is calculated)
returns ConstIsoparametric from IntImp
is static;
Perform(me : in out;
Param : Array1OfReal from TColStd;
Rsnld : in out FunctionSetRoot from math;
ChoixIso : ConstIsoparametric from IntImp)
---Purpose: returns the best constant isoparametric to find
-- the next intersection's point +stores the solution
-- point (the solution point is found with the close point
-- to intersect the isoparametric with the other patch;
-- the choice of the isoparametic is given by ChoixIso)
returns ConstIsoparametric from IntImp
is static;
IsDone(me)
---Purpose: Returns TRUE if the creation completed without failure.
returns Boolean from Standard
---C++: inline
is static;
IsEmpty(me)
---Purpose: Returns TRUE when there is no solution to the problem.
returns Boolean from Standard
---C++: inline
raises NotDone from StdFail
is static;
Point(me)
---Purpose: Returns the intersection point.
returns PntOn2S from IntSurf
---C++: return const&
---C++: inline
raises NotDone from StdFail,
DomainError from Standard
-- The exception NotDone is raised if IsDone is false.
-- The exception DomainError is raised if IsEmpty is true.
is static;
IsTangent(me)
---Purpose: Returns True if the surfaces are tangent at the
-- intersection point.
returns Boolean from Standard
---C++: inline
raises NotDone from StdFail,
DomainError from Standard
-- The exception NotDone is raised if IsDone is false.
-- The exception DomainError is raised if IsEmpty is true.
is static;
Direction(me)
---Purpose: Returns the tangent at the intersection line.
returns Dir from gp
---C++: return const&
---C++: inline
raises NotDone from StdFail,
DomainError from Standard,
UndefinedDerivative from StdFail
-- The exception NotDone is raised if IsDone is false.
-- The exception DomainError is raised if IsEmpty is true.
-- The exception UndefinedDerivative is raised if IsTangent
-- returns True.
is static;
DirectionOnS1(me)
---Purpose: Returns the tangent at the intersection line in the
-- parametric space of the first surface.
returns Dir2d from gp
---C++: return const&
---C++: inline
raises NotDone from StdFail,
DomainError from Standard,
UndefinedDerivative from StdFail
-- The exception NotDone is raised if IsDone is false.
-- The exception DomainError is raised if IsEmpty is true.
-- The exception UndefinedDerivative is raised if IsTangent
-- returns True.
is static;
DirectionOnS2(me)
---Purpose: Returns the tangent at the intersection line in the
-- parametric space of the second surface.
returns Dir2d from gp
---C++: return const&
---C++: inline
raises NotDone from StdFail,
DomainError from Standard,
UndefinedDerivative from StdFail
-- The exception NotDone is raised if IsDone is false.
-- The exception DomainError is raised if IsEmpty is true.
-- The exception UndefinedDerivative is raised if IsTangent
-- returns True.
is static;
Function(me: in out)
---Purpose: return the math function which
-- is used to compute the intersection
returns TheFunction
---C++: return &
---C++: inline
is static;
fields
done : Boolean from Standard;
empty : Boolean from Standard;
pint : PntOn2S from IntSurf;
tangent : Boolean from Standard;
d3d : Dir from gp;
d2d1 : Dir2d from gp;
d2d2 : Dir2d from gp;
myZerParFunc : TheFunction;
tol : Real from Standard;
ua0,va0,ua1,va1 : Real from Standard; -- surf1
ub0,vb0,ub1,vb1 : Real from Standard; -- surf2
ures1,ures2,vres1,vres2 : Real from Standard; -- U et V Resolution
end Int2S;

235
src/IntImp/IntImp_Int2S.gxx Executable file
View File

@@ -0,0 +1,235 @@
//-- File IntImp_Int2S.gxx
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <IntImp_ComputeTangence.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_Vector.hxx>
#include <IntImp_ConstIsoparametric.hxx>
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
//Standard_IMPORT extern IntImp_ConstIsoparametric *ChoixRef;
IntImp_Int2S::IntImp_Int2S() {
Standard_ConstructionError::Raise(" Empty Constructor : IntImp_Int2S");
}
IntImp_Int2S::IntImp_Int2S(const ThePSurface& surf1,
const ThePSurface& surf2,
const Standard_Real TolTangency ) :
done(Standard_True),
empty(Standard_True),
myZerParFunc(surf1,surf2),
tol(TolTangency*TolTangency)
{
ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
va0 = ThePSurfaceTool::FirstVParameter(surf1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
ua1 = ThePSurfaceTool::LastUParameter(surf1); //-- ThePSurfaceTool::UIntervalLast(surf1);
va1 = ThePSurfaceTool::LastVParameter(surf1); //-- ThePSurfaceTool::VIntervalLast(surf1);
ub0 = ThePSurfaceTool::FirstUParameter(surf2); //-- ThePSurfaceTool::UIntervalFirst(surf2);
vb0 = ThePSurfaceTool::FirstVParameter(surf2); //-- ThePSurfaceTool::VIntervalFirst(surf2);
ub1 = ThePSurfaceTool::LastUParameter(surf2); //-- ThePSurfaceTool::UIntervalLast(surf2);
vb1 = ThePSurfaceTool::LastVParameter(surf2); //-- ThePSurfaceTool::VIntervalLast(surf2);
ures1 = ThePSurfaceTool::UResolution(surf1,Precision::Confusion());
vres1 = ThePSurfaceTool::VResolution(surf1,Precision::Confusion());
ures2 = ThePSurfaceTool::UResolution(surf2,Precision::Confusion());
vres2 = ThePSurfaceTool::VResolution(surf2,Precision::Confusion());
}
IntImp_Int2S::IntImp_Int2S(const TColStd_Array1OfReal& Param,
const ThePSurface& surf1,
const ThePSurface& surf2,
const Standard_Real TolTangency ) :
done(Standard_True),
empty(Standard_True),
myZerParFunc(surf1,surf2),
tol(TolTangency*TolTangency)
{
math_FunctionSetRoot Rsnld(myZerParFunc,15); //-- Modif lbr 18 MAI ?????????????
ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
va0 = ThePSurfaceTool::FirstVParameter(surf1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
ua1 = ThePSurfaceTool::LastUParameter(surf1); //-- ThePSurfaceTool::UIntervalLast(surf1);
va1 = ThePSurfaceTool::LastVParameter(surf1); //-- ThePSurfaceTool::VIntervalLast(surf1);
ub0 = ThePSurfaceTool::FirstUParameter(surf2); //-- ThePSurfaceTool::UIntervalFirst(surf2);
vb0 = ThePSurfaceTool::FirstVParameter(surf2); //-- ThePSurfaceTool::VIntervalFirst(surf2);
ub1 = ThePSurfaceTool::LastUParameter(surf2); //-- ThePSurfaceTool::UIntervalLast(surf2);
vb1 = ThePSurfaceTool::LastVParameter(surf2); //-- ThePSurfaceTool::VIntervalLast(surf2);
ures1 = ThePSurfaceTool::UResolution(surf1,Precision::Confusion());
vres1 = ThePSurfaceTool::VResolution(surf1,Precision::Confusion());
ures2 = ThePSurfaceTool::UResolution(surf2,Precision::Confusion());
vres2 = ThePSurfaceTool::VResolution(surf2,Precision::Confusion());
Perform(Param,Rsnld);
}
IntImp_ConstIsoparametric IntImp_Int2S::
Perform(const TColStd_Array1OfReal& Param,
math_FunctionSetRoot& Rsnld,
const IntImp_ConstIsoparametric ChoixIso )
{
static math_Vector BornInf(1,3),BornSup(1,3),Tolerance(1,3),UVap(1,3);
static TColStd_Array1OfReal Uvres(1,4);
IntImp_ConstIsoparametric BestChoix;
myZerParFunc.ComputeParameters(ChoixIso,Param,UVap,
BornInf,BornSup,Tolerance);
Rsnld.SetTolerance(Tolerance);
Rsnld.Perform(myZerParFunc,UVap,BornInf,BornSup);
BestChoix = ChoixIso;
if (Rsnld.IsDone()) {
if (Abs(myZerParFunc.Root()) <= tol) { //distance des 2 points
// dans la tolerance
Rsnld.Root(UVap);
empty = Standard_False;
tangent = myZerParFunc.IsTangent(UVap,Uvres,BestChoix);
pint.SetValue(myZerParFunc.Point(),Uvres(1),Uvres(2),Uvres(3),Uvres(4));
if (!tangent) {
d3d = myZerParFunc.Direction();
d2d1 = myZerParFunc.DirectionOnS1();
d2d2 = myZerParFunc.DirectionOnS2();
}
}
else {
empty = Standard_True;
}
}
else {
empty = Standard_True;
}
return BestChoix;
}
IntImp_ConstIsoparametric IntImp_Int2S:: Perform(
const TColStd_Array1OfReal& Param,
math_FunctionSetRoot& Rsnld)
{
gp_Vec DPUV[4];
gp_Pnt P1,P2;
Standard_Real Epsuv[4];
static TColStd_Array1OfReal Duv(1,4);
Standard_Real UVd[4],UVf[4];
IntImp_ConstIsoparametric ChoixIso[4];
IntImp_ConstIsoparametric BestChoix=ChoixRef[0];
const ThePSurface& Caro1 = myZerParFunc.AuxillarSurface1();
const ThePSurface& Caro2 = myZerParFunc.AuxillarSurface2();
ThePSurfaceTool::D1(Caro1, Param(1),Param(2),P1,DPUV[0],DPUV[1]);
ThePSurfaceTool::D1(Caro2, Param(3),Param(4),P2,DPUV[2],DPUV[3]);
Epsuv[0] = ThePSurfaceTool::UResolution(Caro1,Precision::Confusion());
Epsuv[1] = ThePSurfaceTool::VResolution(Caro1,Precision::Confusion());
Epsuv[2] = ThePSurfaceTool::UResolution(Caro2,Precision::Confusion());
Epsuv[3] = ThePSurfaceTool::VResolution(Caro2,Precision::Confusion());
for (Standard_Integer j=0;j<=3;j++) UVd[j] = Param(j+1);
empty = Standard_True;
Standard_Boolean Tangent = IntImp_ComputeTangence(DPUV,Epsuv,UVd,ChoixIso);
if (Tangent) return BestChoix;
Standard_Integer i=0;
IntImp_ConstIsoparametric CurrentChoix = BestChoix; //-- Modif 17 Mai 93
while (empty && i<= 3) {
CurrentChoix = Perform(Param,Rsnld,ChoixIso[i]);
if(!empty) {
BestChoix = CurrentChoix;
}
i++;
}
if (!empty) { // verifier que l on ne deborde pas les frontieres
pint.Parameters(Duv(1),Duv(2),Duv(3),Duv(4));
UVd[0] = ua0; //-- ThePSurfaceTool::UIntervalFirst(Caro1);
UVd[1] = va0; //-- ThePSurfaceTool::VIntervalFirst(Caro1);
UVf[0] = ua1; //-- ThePSurfaceTool::UIntervalLast(Caro1);
UVf[1] = va1; //-- ThePSurfaceTool::VIntervalLast(Caro1);
UVd[2] = ub0; //-- ThePSurfaceTool::UIntervalFirst(Caro2);
UVd[3] = vb0; //-- ubThePSurfaceTool::VIntervalFirst(Caro2);
UVf[2] = ub1; //-- ThePSurfaceTool::UIntervalLast(Caro2);
UVf[3] = vb1; //-- ThePSurfaceTool::VIntervalLast(Caro2);
Standard_Integer Nc,Iiso;
if (Duv(1) <= UVd[0]-Epsuv[0]) {
Duv(1) = UVd[0];
Nc =0;
Iiso=0;
}
else if (Duv(1) >= UVf[0]+ Epsuv[0]) {
Duv(1) = UVf[0];
Nc =0;
Iiso=0;
}
else if (Duv(2) <= UVd[1] -Epsuv[1]) {
Duv(2) = UVd[1];
Nc =0;
Iiso=1;
}
else if (Duv(2) >= UVf[1]+Epsuv[1]) {
Duv(2) = UVf[1];
Nc =0;
Iiso=1;
}
else if (Duv(3) <= UVd[2]-Epsuv[2]) {
Duv(3) = UVd[2];
Nc =2;
Iiso = 2;
}
else if (Duv(3) >= UVf[2]+Epsuv[2]) {
Duv(3) = UVf[2];
Nc =2;
Iiso = 2;
}
else if (Duv(4) <= UVd[3]-Epsuv[3]) {
Duv(4) = UVd[3];
Nc =2;
Iiso = 3;
}
else if (Duv(4) >= UVf[3]+Epsuv[3]) {
Duv(4) = UVf[3];
Nc =2;
Iiso =3;
}
else return BestChoix; // on a gagne
empty = Standard_True;
BestChoix = ChoixRef[Iiso]; //en attendant
BestChoix = Perform(Duv,Rsnld,BestChoix);
if (!empty) { // verification si l on ne deborde pas sur le carreau
// reciproque
Nc =3-Nc;
if (Duv(Nc) <= UVd[Nc-1]-Epsuv[Nc-1]) Duv(Nc)=UVd[Nc-1];
else if (Duv(Nc) >=UVf[Nc-1]+Epsuv[Nc-1]) Duv(Nc)=UVf[Nc-1];
else if (Duv(Nc+1) <= UVd[Nc]) {
Nc = Nc +1;
Duv(Nc)=UVd[Nc-1];
}
else if (Duv(Nc+1) >=UVf[Nc]) {
Nc = Nc +1;
Duv(Nc)=UVf[Nc-1];
}
else return BestChoix;
empty = Standard_True;
BestChoix = ChoixRef[Nc]; //en attendant
BestChoix = Perform(Duv,Rsnld,BestChoix);
}
}
return BestChoix;
}

59
src/IntImp/IntImp_Int2S.lxx Executable file
View File

@@ -0,0 +1,59 @@
#include <StdFail_NotDone.hxx>
#include <StdFail_UndefinedDerivative.hxx>
#include <Standard_DomainError.hxx>
inline Standard_Boolean IntImp_Int2S::IsDone()const { return done;}
inline Standard_Boolean IntImp_Int2S::IsEmpty() const
{
if (!done) StdFail_NotDone::Raise(" IntImp_Int2S::IsEmpty() ");
return empty;
}
inline const IntSurf_PntOn2S& IntImp_Int2S::Point() const
{
if (!done) StdFail_NotDone::Raise(" IntImp_Int2S::Point() ");
if (empty) Standard_DomainError::Raise(" IntImp_Int2S::Point() ");
return pint;
}
inline Standard_Boolean IntImp_Int2S::IsTangent () const {
if (!done) StdFail_NotDone::Raise(" IntImp_Int2S::IsTangent () ");
if (empty) Standard_DomainError::Raise(" IntImp_Int2S::IsTangent () ");
return tangent;
}
inline const gp_Dir& IntImp_Int2S::Direction () const {
if (!done) StdFail_NotDone::Raise(" IntImp_Int2S::Direction () ");
if (empty) Standard_DomainError::Raise(" IntImp_Int2S::Direction () ");
if (tangent) StdFail_UndefinedDerivative::Raise
(" IntImp_Int2S::Direction () ");
return d3d;
}
inline const gp_Dir2d& IntImp_Int2S::DirectionOnS1 () const {
if (!done) StdFail_NotDone::Raise(" IntImp_Int2S::DirectionOnS1 () ");
if (empty) Standard_DomainError::Raise(" IntImp_Int2S::DirectionOnS1 () ");
if (tangent) StdFail_UndefinedDerivative::Raise
(" IntImp_Int2S::DirectionOnS1 () ");
return d2d1;
}
inline const gp_Dir2d& IntImp_Int2S::DirectionOnS2 () const {
if (!done) StdFail_NotDone::Raise(" IntImp_Int2S::DirectionOnS2 () ");
if (empty) Standard_DomainError::Raise(" IntImp_Int2S::DirectionOnS2 () ");
if (tangent) StdFail_UndefinedDerivative::Raise
(" IntImp_Int2S::DirectionOnS2 () ");
return d2d2;
}
inline IntImp_TheFunction& IntImp_Int2S::Function() {
return myZerParFunc;
}

127
src/IntImp/IntImp_IntCS.cdl Executable file
View File

@@ -0,0 +1,127 @@
-- File: IntImp_IntCS.cdl
-- Created: Thu Jan 14 14:14:13 1993
-- Author: Isabelle GRIGNON
-- <isg@sdsun2>
---Copyright: Matra Datavision 1993
generic class IntCS from IntImp
(ThePSurface as any;
ThePSurfaceTool as any; --as PSurfaceTool from IntImp(ThePSurface)
TheCurve as any;
TheCurveTool as any; --as CurveTool from IntImp(TheCurve)
TheFunction as any --as CSFunction from IntImp
)
---Purpose: intersection between a curve and a surface with a close
-- point
uses Pnt from gp,
FunctionSetRoot from math
raises NotDone from StdFail,
DomainError from Standard
is
Create( U,V,W : Real from Standard;
F : TheFunction;
TolTangency : Real;
MarginCoef : Real = 0.0)
---Purpose: compute the solution point with the close point
-- MarginCoef is the coefficient for extension of UV bounds.
-- Ex., UFirst -= MarginCoef*(ULast-UFirst)
returns IntCS from IntImp;
Create( F : TheFunction;
TolTangency : Real from Standard)
---Purpose: initialize the parameters to compute the solution
returns IntCS from IntImp;
Perform(me : in out; U,V,W : Real from Standard;
Rsnld : in out FunctionSetRoot from math;
u0,v0,u1,v1,w0,w1 : Real from Standard)
---Purpose: compute the solution
-- it's possible to write to optimize:
-- IntImp_IntCS inter(S1,C1,Toltangency)
-- math_FunctionSetRoot rsnld(Inter.function())
-- while ...{
-- u=...
-- v=...
-- w=...
-- inter.Perform(u,v,w,rsnld)
-- }
-- or
-- IntImp_IntCS inter(Toltangency)
-- inter.SetSurface(S);
-- math_FunctionSetRoot rsnld(Inter.function())
-- while ...{
-- C=...
-- inter.SetCurve(C);
-- u=...
-- v=...
-- w=...
-- inter.Perform(u,v,w,rsnld)
-- }
--
is static;
IsDone(me) returns Boolean from Standard
---Purpose: Returns TRUE if the creation completed without failure.
is static;
IsEmpty(me) returns Boolean from Standard
raises NotDone from StdFail
is static;
Point(me)
---Purpose: returns the intersection point
-- The exception NotDone is raised if IsDone is false.
-- The exception DomainError is raised if IsEmpty is true.
returns Pnt from gp
---C++: return const &
raises NotDone from StdFail,
DomainError from Standard
is static;
ParameterOnCurve(me) returns Real from Standard
raises NotDone from StdFail,
DomainError from Standard
is static;
ParameterOnSurface(me;U,V : out Real from Standard)
raises NotDone from StdFail,
DomainError from Standard
is static;
Function(me: in out )
---Purpose: return the math function which
-- is used to compute the intersection
---C++: return &
returns TheFunction
is static;
fields
done : Boolean from Standard;
empty : Boolean from Standard;
myFunction : TheFunction;
w : Real from Standard;
u : Real from Standard;
v : Real from Standard;
tol : Real from Standard;
end IntCS;

151
src/IntImp/IntImp_IntCS.gxx Executable file
View File

@@ -0,0 +1,151 @@
//-- File: IntImp_IntCS.gxx
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <StdFail_NotDone.hxx>
#include <Standard_DomainError.hxx>
#include <IntImp_ComputeTangence.hxx>
#include <math_FunctionSetRoot.hxx>
#include <Precision.hxx>
IntImp_IntCS::IntImp_IntCS(const Standard_Real U,
const Standard_Real V,
const Standard_Real W,
const TheFunction& F,
const Standard_Real TolTangency,
const Standard_Real MarginCoef) :
done(Standard_True),
empty(Standard_True),
myFunction(F),
tol(TolTangency*TolTangency)
{
if(tol<1e-13) { tol=1e-13; }
math_FunctionSetRoot Rsnld(myFunction);
Standard_Real u0,u1,v0,v1,w0,w1;
const ThePSurface& S = myFunction.AuxillarSurface();
const TheCurve& C = myFunction.AuxillarCurve();
w0 = TheCurveTool::FirstParameter(C);
w1 = TheCurveTool::LastParameter(C);
u0 = ThePSurfaceTool::FirstUParameter(S);
v0 = ThePSurfaceTool::FirstVParameter(S);
u1 = ThePSurfaceTool::LastUParameter(S);
v1 = ThePSurfaceTool::LastVParameter(S);
if (MarginCoef > 0.) {
if (!Precision::IsInfinite(u0) && !Precision::IsInfinite(u1)) {
Standard_Real marg = (u1-u0)*MarginCoef;
if (u0 > u1) marg = -marg;
u0 -= marg; u1 += marg;
}
if (!Precision::IsInfinite(v0) && !Precision::IsInfinite(v1)) {
Standard_Real marg = (v1-v0)*MarginCoef;
if (v0 > v1) marg = -marg;
v0 -= marg; v1 += marg;
}
}
Perform(U,V,W,Rsnld,u0,u1,v0,v1,w0,w1);
}
IntImp_IntCS::IntImp_IntCS(const TheFunction& F,
const Standard_Real TolTangency) :
done(Standard_True),
empty(Standard_True),
myFunction(F),
tol(TolTangency*TolTangency)
{
}
void IntImp_IntCS::Perform(const Standard_Real U,
const Standard_Real V,
const Standard_Real W,
math_FunctionSetRoot& Rsnld,
const Standard_Real u0,
const Standard_Real u1,
const Standard_Real v0,
const Standard_Real v1,
const Standard_Real w0,
const Standard_Real w1) {
done = Standard_True;
static math_Vector UVap(1,3);
static math_Vector BornInf(1,3);
static math_Vector BornSup(1,3);
static math_Vector Tolerance(1,3);
UVap(1) = U;
UVap(2) = V;
UVap(3) = W;
const ThePSurface& S = myFunction.AuxillarSurface();
const TheCurve& C = myFunction.AuxillarCurve();
BornInf(1) = u0; BornInf(2) = v0;
BornSup(1) = u1; BornSup(2) = v1;
BornInf(3) = w0; BornSup(3) = w1;
Tolerance(1) = ThePSurfaceTool::UResolution(S,Precision::Confusion());
Tolerance(2) = ThePSurfaceTool::VResolution(S,Precision::Confusion());
Tolerance(3) = TheCurveTool::Resolution(C,Precision::Confusion());
Rsnld.SetTolerance(Tolerance);
Standard_Integer autretentative=0;
done=Standard_False;
do {
if(autretentative==1) {
UVap(3)=w0;
}
else if(autretentative==2) {
UVap(3)=w1;
}
autretentative++;
Rsnld.Perform(myFunction,UVap,BornInf,BornSup);
if (Rsnld.IsDone()) {
Standard_Real AbsmyFunctionRoot = Abs(myFunction.Root());
if (AbsmyFunctionRoot <= tol) {
Rsnld.Root(UVap);
u = UVap(1);
v = UVap(2);
w = UVap(3);
empty = Standard_False;
done=Standard_True;
}
}
}
while(done==Standard_False && autretentative<3);
}
Standard_Boolean IntImp_IntCS::IsDone() const { return done;}
Standard_Boolean IntImp_IntCS::IsEmpty()const {
if (!done) StdFail_NotDone::Raise();
return empty;
}
const gp_Pnt& IntImp_IntCS::Point() const
{
if (!done) StdFail_NotDone::Raise();
if (empty) Standard_DomainError::Raise();
return myFunction.Point();
}
void IntImp_IntCS::ParameterOnSurface(Standard_Real& U,
Standard_Real& V) const
{
if (!done) StdFail_NotDone::Raise();
if (empty) Standard_DomainError::Raise();
U=u;
V=v;
}
Standard_Real IntImp_IntCS::ParameterOnCurve() const
{
if (!done) StdFail_NotDone::Raise();
if (empty) Standard_DomainError::Raise();
return w;
}
TheFunction& IntImp_IntCS::Function() {return myFunction;}

View File

@@ -0,0 +1,79 @@
-- File: PSurfaceTool.cdl
-- Created: Fri Mar 6 16:32:01 1992
-- Author: Isabelle GRIGNON
-- <isg@phobox>
---Copyright: Matra Datavision 1992
deferred generic class PSurfaceTool from IntImp
(Surface as any)
---Purpose: Template class for a tool on a bi-parametrised surface.
-- It is possible to implement this tool with an
-- instantiation of the SurfaceTool from Adaptor3d.
uses Pnt from gp,
Vec from gp
is
UIntervalFirst(myclass ; S: Surface)
---Purpose: Returns the first U parameter of the surface.
returns Real from Standard;
VIntervalFirst(myclass ; S: Surface)
---Purpose: Returns the first V parameter of the surface.
returns Real from Standard;
UIntervalLast(myclass ; S: Surface)
---Purpose: Returns the last U parameter of the surface.
returns Real from Standard;
VIntervalLast(myclass ; S: Surface)
---Purpose: Returns the last V parameter of the surface.
returns Real from Standard;
Value (myclass ; S: Surface; U,V : Real from Standard)
---Purpose: Returns the point of parameter (U,V) on the surface.
returns Pnt from gp;
D1(myclass; S: Surface; U,V: Real from Standard;
P: out Pnt from gp; D1U,D1V: out Vec from gp);
---Purpose: Returns the point of parameter (U,V) on the surface,
-- and the first derivatives in the directions u and v.
UResolution(myclass; S : Surface; Tol3d: Real from Standard)
---Purpose: Returns the numerical resolution in the U direction,
-- for a given resolution in 3d space.
returns Real from Standard;
VResolution(myclass; S : Surface; Tol3d: Real from Standard)
---Purpose: Returns the numerical resolution in the V direction,
-- for a given resolution in 3d space.
returns Real from Standard;
end PSurfaceTool;

View File

View File

@@ -0,0 +1,83 @@
-- File: IntImp_ZerCOnSSParFunc.cdl
-- Created: Mon Feb 14 12:15:50 1994
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1994
generic class ZerCOnSSParFunc from IntImp
(ThePSurface as any;
ThePSurfaceTool as any; --as PSurfaceTool from IntImp(ThePSurface)
TheCurveOnSurf as any;
TheCurveTool as any --as COnSCurveTool from IntImp(TheCurve)
)
inherits FunctionSetWithDerivatives from math
---Purpose: this function is associated to the intersection between
-- a curve on surface and a surface .
uses Vector from math,
Matrix from math,
Pnt from gp
is
Create( S1 : ThePSurface;
C : TheCurveOnSurf;
S2 : ThePSurface )
---Purpose: S1 is the surface on which the intersection is searched.
-- C is a curve on the surface S2.
returns ZerCOnSSParFunc from IntImp;
NbVariables(me) returns Integer from Standard
is static;
NbEquations(me) returns Integer from Standard
is static;
Value(me : in out; X : in Vector from math;
F : out Vector from math)
returns Boolean from Standard
is static;
Derivatives(me : in out;X : in Vector from math;
D : out Matrix from math)
returns Boolean from Standard
is static;
Values(me : in out;
X : in Vector from math;
F : out Vector from math; D: out Matrix from math)
returns Boolean from Standard
is static;
Point(me)
---C++: return const&
returns Pnt from gp
is static;
Root(me) returns Real from Standard
is static;
AuxillarSurface(me)
---C++: return const&
returns ThePSurface
is static;
AuxillarCurve(me)
---C++: return const&
returns TheCurveOnSurf
is static;
fields
curve : Address from Standard; --- TheCurveOnSurf;
surface1 : Address from Standard; --- ThePSurface;
surface2 : Address from Standard; --- ThePSurface;
p : Pnt from gp;
f : Real from Standard;
end ZerCOnSSParFunc;

View File

@@ -0,0 +1,113 @@
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#define SURFACE1 (*((ThePSurface *)(surface1)))
#define SURFACE2 (*((ThePSurface *)(surface2)))
#define CURVE (*((TheCurveOnSurf *)(curve)))
IntImp_ZerCOnSSParFunc::IntImp_ZerCOnSSParFunc(const ThePSurface& S1,
const TheCurveOnSurf& C,
const ThePSurface& S2)
{
surface1 = (Standard_Address)(&S1);
surface2 = (Standard_Address)(&S2);
curve = (Standard_Address)(&C);
}
Standard_Integer IntImp_ZerCOnSSParFunc::NbVariables()const { return 3;}
Standard_Integer IntImp_ZerCOnSSParFunc::NbEquations()const { return 3;}
Standard_Boolean IntImp_ZerCOnSSParFunc::Value(const math_Vector& X,
math_Vector& F){
gp_Pnt Psurf(ThePSurfaceTool::Value(SURFACE1,X(1),X(2)));
gp_Pnt2d p2d(TheCurveTool::Value(CURVE,X(3)));
gp_Pnt Pcurv(ThePSurfaceTool::Value(SURFACE2,p2d.X(),p2d.Y()));
F(1) = Psurf.X()-Pcurv.X();
F(2) = Psurf.Y()-Pcurv.Y();
F(3) = Psurf.Z()-Pcurv.Z();
f = F(1)*F(1)+ F(2)*F(2)+ F(3)*F(3);
p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())/2.);
return Standard_True;
}
Standard_Boolean IntImp_ZerCOnSSParFunc::Derivatives ( const math_Vector& X,
math_Matrix& D) {
gp_Pnt Psurf,Pcurv;
gp_Vec D1u,D1v,D1w;
gp_Pnt2d p2d;
gp_Vec2d d2d;
gp_Vec d1u,d1v;
ThePSurfaceTool::D1(SURFACE1,X(1),X(2),Psurf,D1u,D1v);
TheCurveTool::D1(CURVE,X(3),p2d,d2d);
ThePSurfaceTool::D1(SURFACE2,p2d.X(),p2d.Y(),Pcurv,d1u,d1v);
D1w.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
D(1,1) = D1u.X();
D(1,2) = D1v.X();
D(1,3) = -D1w.X();
D(2,1) = D1u.Y();
D(2,2) = D1v.Y();
D(2,3) = -D1w.Y();
D(3,1) = D1u.Z();
D(3,2) = D1v.Z();
D(3,3) = -D1w.Z();
return Standard_True;
}
Standard_Boolean IntImp_ZerCOnSSParFunc::Values( const math_Vector& X,
math_Vector& F,
math_Matrix& D) {
gp_Pnt Psurf,Pcurv;
gp_Vec D1u,D1v,D1w;
gp_Pnt2d p2d;
gp_Vec2d d2d;
gp_Vec d1u,d1v;
ThePSurfaceTool::D1(SURFACE1,X(1),X(2),Psurf,D1u,D1v);
TheCurveTool::D1(CURVE,X(3),p2d,d2d);
ThePSurfaceTool::D1(SURFACE2,p2d.X(),p2d.Y(),Pcurv,d1u,d1v);
D1w.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
D(1,1) = D1u.X();
D(1,2) = D1v.X();
D(1,3) = -D1w.X();
D(2,1) = D1u.Y();
D(2,2) = D1v.Y();
D(2,3) = -D1w.Y();
D(3,1) = D1u.Z();
D(3,2) = D1v.Z();
D(3,3) = -D1w.Z();
F(1) = Psurf.X()-Pcurv.X();
F(2) = Psurf.Y()-Pcurv.Y();
F(3) = Psurf.Z()-Pcurv.Z();
f = F(1)*F(1)+ F(2)*F(2)+ F(3)*F(3);
p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())/2.);
return Standard_True;
}
const gp_Pnt& IntImp_ZerCOnSSParFunc::Point() const { return p;}
Standard_Real IntImp_ZerCOnSSParFunc::Root() const { return f;}
const ThePSurface& IntImp_ZerCOnSSParFunc::AuxillarSurface() const {
return SURFACE1;}
const TheCurveOnSurf& IntImp_ZerCOnSSParFunc::AuxillarCurve() const {
return CURVE;}
#undef SURFACE1
#undef SURFACE2
#undef CURVE

View File

@@ -0,0 +1,77 @@
-- File: IntImp_ZerCSParFunc.cdl
-- Created: Thu Jan 14 11:50:55 1993
-- Author: Isabelle GRIGNON
-- <isg@sdsun2>
---Copyright: Matra Datavision 1993
generic class ZerCSParFunc from IntImp
(ThePSurface as any;
ThePSurfaceTool as any; --as PSurfaceTool from IntImp(ThePSurface)
TheCurve as any;
TheCurveTool as any --as CSCurveTool from IntImp(TheCurve)
)
inherits FunctionSetWithDerivatives from math
---Purpose: this function is associated to the intersection between
-- a curve in 3d space and a surface
uses Vector from math,
Matrix from math,
Pnt from gp
is
Create( S : ThePSurface;
C : TheCurve) returns ZerCSParFunc from IntImp;
NbVariables(me) returns Integer from Standard
is static;
NbEquations(me) returns Integer from Standard
is static;
Value(me : in out; X : in Vector from math;
F : out Vector from math)
returns Boolean from Standard
is static;
Derivatives(me : in out;X : in Vector from math;
D : out Matrix from math)
returns Boolean from Standard
is static;
Values(me : in out;
X : in Vector from math;
F : out Vector from math; D: out Matrix from math)
returns Boolean from Standard
is static;
Point(me)
---C++: return const&
returns Pnt from gp
is static;
Root(me) returns Real from Standard
is static;
AuxillarSurface(me)
---C++: return const&
returns ThePSurface
is static;
AuxillarCurve(me)
---C++: return const&
returns TheCurve
is static;
fields
surface : ThePSurface;
curve : TheCurve;
p : Pnt from gp;
f : Real from Standard;
end ZerCSParFunc;

View File

@@ -0,0 +1,88 @@
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
IntImp_ZerCSParFunc::IntImp_ZerCSParFunc(const ThePSurface& S,
const TheCurve& C) {
surface = S;
curve = C;
p = gp_Pnt(0.0,0.0,0.0);
f = 0.0;
}
Standard_Integer IntImp_ZerCSParFunc::NbVariables()const { return 3;}
Standard_Integer IntImp_ZerCSParFunc::NbEquations()const { return 3;}
Standard_Boolean IntImp_ZerCSParFunc::Value(const math_Vector& X,
math_Vector& F){
gp_Pnt Psurf = ThePSurfaceTool::Value(surface,X(1),X(2));
gp_Pnt Pcurv = TheCurveTool::Value(curve,X(3));
Standard_Real f1,f2,f3;
F(1) = f1 = Psurf.X()-Pcurv.X();
F(2) = f2 = Psurf.Y()-Pcurv.Y();
F(3) = f3 = Psurf.Z()-Pcurv.Z();
f = f1*f1 + f2*f2 + f3*f3;
p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5);
return Standard_True;
}
Standard_Boolean IntImp_ZerCSParFunc::Derivatives ( const math_Vector& X,
math_Matrix& D) {
gp_Pnt Psurf,Pcurv;
gp_Vec D1u,D1v,D1w;
ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v);
TheCurveTool::D1(curve,X(3),Pcurv,D1w);
D(1,1) = D1u.X();
D(1,2) = D1v.X();
D(1,3) = -D1w.X();
D(2,1) = D1u.Y();
D(2,2) = D1v.Y();
D(2,3) = -D1w.Y();
D(3,1) = D1u.Z();
D(3,2) = D1v.Z();
D(3,3) = -D1w.Z();
return Standard_True;
}
Standard_Boolean IntImp_ZerCSParFunc::Values( const math_Vector& X,
math_Vector& F,
math_Matrix& D) {
gp_Pnt Psurf,Pcurv;
gp_Vec D1u,D1v,D1w;
ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v);
TheCurveTool::D1(curve,X(3),Pcurv,D1w);
D(1,1) = D1u.X();
D(1,2) = D1v.X();
D(1,3) = -D1w.X();
D(2,1) = D1u.Y();
D(2,2) = D1v.Y();
D(2,3) = -D1w.Y();
D(3,1) = D1u.Z();
D(3,2) = D1v.Z();
D(3,3) = -D1w.Z();
Standard_Real f1,f2,f3;
F(1) = f1 = Psurf.X()-Pcurv.X();
F(2) = f2 = Psurf.Y()-Pcurv.Y();
F(3) = f3 = Psurf.Z()-Pcurv.Z();
f = f1*f1 + f2*f2 + f3*f3;
p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5);
return Standard_True;
}
const gp_Pnt& IntImp_ZerCSParFunc::Point() const { return p;}
Standard_Real IntImp_ZerCSParFunc::Root() const { return f;}
const ThePSurface& IntImp_ZerCSParFunc::AuxillarSurface() const {
return surface;}
const TheCurve& IntImp_ZerCSParFunc::AuxillarCurve() const {
return curve;}

196
src/IntImp/IntImp_ZerImpFunc.cdl Executable file
View File

@@ -0,0 +1,196 @@
-- File: ZerImpFunc.cdl
-- Created: Fri Mar 27 09:15:20 1992
-- Author: Isabelle GRIGNON
-- <isg@phobox>
---Copyright: Matra Datavision 1992
generic class ZerImpFunc from IntImp
(ThePSurface as any;
ThePSurfaceTool as any; -- as PSurfaceTool from IntImp(ThePSurface)
TheISurface as any;
TheISurfaceTool as any) -- as ISurfaceTool from IntImp(TheISurface)
inherits FunctionSetWithDerivatives from math
---Purpose: this function is associated to IWalking
-- it's the function : F(x,y,z)=0
-- where x=X(u,v), y=Y(u,v), z=Z(u,v)
uses Vector from math,
Matrix from math,
Pnt from gp,
Vec from gp,
Dir2d from gp
raises UndefinedDerivative from StdFail
is
Create
returns ZerImpFunc from IntImp;
Create(PS: ThePSurface;
IS: TheISurface)
returns ZerImpFunc from IntImp;
Create(IS: TheISurface)
returns ZerImpFunc from IntImp;
Set(me: in out; PS: ThePSurface)
---C++: inline
is static;
SetImplicitSurface(me: in out; IS: TheISurface)
---C++: inline
is static;
Set(me: in out; Tolerance: Real from Standard)
---C++: inline
is static;
NbVariables(me)
returns Integer from Standard
is static;
NbEquations(me)
returns Integer from Standard
is static;
Value(me : in out; X : Vector from math;
F : out Vector from math)
returns Boolean from Standard
is static;
Derivatives(me : in out; X : Vector from math;
D : out Matrix from math)
returns Boolean from Standard
is static;
Values(me : in out; X : Vector from math;
F : out Vector from math;
D : out Matrix from math)
returns Boolean from Standard
is static;
Root(me)
returns Real from Standard
---C++: inline
is static;
Tolerance(me)
---Purpose: Returns the value Tol so that if Abs(Func.Root())<Tol
-- the function is considered null.
--
---C++: inline
returns Real from Standard
is static;
Point(me)
returns Pnt from gp
---C++: return const&
---C++: inline
is static;
IsTangent(me : in out)
returns Boolean from Standard
is static;
Direction3d(me: in out)
returns Vec from gp
---C++: return const&
---C++: inline
raises UndefinedDerivative from StdFail
is static;
Direction2d(me: in out)
returns Dir2d from gp
---C++: return const&
---C++: inline
raises UndefinedDerivative from StdFail
is static;
PSurface(me)
returns ThePSurface
---C++: return const&
---C++: inline
is static;
ISurface(me)
returns TheISurface
---C++: return const&
---C++: inline
is static;
fields
surf : Address from Standard; --- ThePSurface;
func : Address from Standard; --- TheISurface;
u : Real from Standard;
v : Real from Standard;
tol : Real from Standard;
pntsol : Pnt from gp;
valf : Real from Standard;
computed : Boolean from Standard;
tangent : Boolean from Standard;
tgdu : Real from Standard;
tgdv : Real from Standard;
gradient : Vec from gp;
derived : Boolean from Standard;
d1u : Vec from gp;
d1v : Vec from gp;
d3d : Vec from gp;
d2d : Dir2d from gp;
end ZerImpFunc;

124
src/IntImp/IntImp_ZerImpFunc.gxx Executable file
View File

@@ -0,0 +1,124 @@
//-- File IntImp_ZerImpFunc.gxx
#define EpsAng 1.e-8
#define EpsAng2 1.e-16
#define Tolpetit 1.e-16
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#define SURF (*((ThePSurface *)(surf)))
#define FUNC (*((TheISurface *)(func)))
IntImp_ZerImpFunc::IntImp_ZerImpFunc() :
computed(Standard_False),
derived(Standard_False)
{
}
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const ThePSurface& PS ,
const TheISurface& IS) :
computed(Standard_False),
derived(Standard_False)
{
surf = (Standard_Address)(&PS);
func = (Standard_Address)(&IS);
}
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const TheISurface& IS) :
computed(Standard_False),
derived(Standard_False)
{
func = (Standard_Address)(&IS);
}
Standard_Integer IntImp_ZerImpFunc::NbVariables() const
{
return 2;
}
Standard_Integer IntImp_ZerImpFunc::NbEquations() const
{
return 1;
}
Standard_Boolean IntImp_ZerImpFunc::Value(const math_Vector& X,
math_Vector& F)
{
u = X(1);
v = X(2);
pntsol = ThePSurfaceTool::Value(SURF, u, v);
valf = TheISurfaceTool::Value(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z());
F(1) = valf;
computed = Standard_False;
derived = Standard_False;
return Standard_True;
}
Standard_Boolean IntImp_ZerImpFunc::Derivatives(const math_Vector& X,
math_Matrix& D)
{
u = X(1);
v = X(2);
ThePSurfaceTool::D1(SURF, u, v, pntsol, d1u, d1v);
TheISurfaceTool::Gradient(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z(),gradient);
D(1,1) = d1u.Dot(gradient);
D(1,2) = d1v.Dot(gradient);
computed = Standard_False;
derived = Standard_True;
return Standard_True;
}
Standard_Boolean IntImp_ZerImpFunc::Values(const math_Vector& X,
math_Vector& F,
math_Matrix& D)
{
u = X(1);
v = X(2);
ThePSurfaceTool::D1(SURF, u, v, pntsol, d1u, d1v);
TheISurfaceTool::ValueAndGradient(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z(),
valf, gradient);
F(1) = valf;
D(1,1) = d1u.Dot(gradient);
D(1,2) = d1v.Dot(gradient);
computed = Standard_False;
derived = Standard_True;
return Standard_True;
}
Standard_Boolean IntImp_ZerImpFunc::IsTangent()
{
if (!computed) {
computed = Standard_True;
if(!derived) {
ThePSurfaceTool::D1(SURF, u, v, pntsol, d1u, d1v);
derived = Standard_True;
}
tgdu = gradient.Dot(d1v);
tgdv = -gradient.Dot(d1u);
Standard_Real N2grad = gradient.SquareMagnitude();
Standard_Real N2grad_EpsAng2 = N2grad * EpsAng2;
Standard_Real N2d1u = d1u.SquareMagnitude();
Standard_Real N2d1v = d1v.SquareMagnitude();
tangent =(tgdu * tgdu <= N2grad_EpsAng2 * N2d1v) &&
(tgdv * tgdv <= N2grad_EpsAng2 * N2d1u);
if(!tangent) {
d3d.SetLinearForm(tgdu,d1u,tgdv,d1v);
d2d = gp_Dir2d(tgdu, tgdv);
if (d3d.Magnitude() <= Tolpetit) { // jag
tangent = Standard_True;
}
}
}
return tangent;
}
#undef EpsAng
#undef EpsAng2
#undef Tolpetit
#undef FUNC
#undef SURF

View File

@@ -0,0 +1,54 @@
#include <StdFail_UndefinedDerivative.hxx>
inline void IntImp_ZerImpFunc::Set (const ThePSurface& PS)
{
surf = (Standard_Address)(&PS);
}
inline void IntImp_ZerImpFunc::SetImplicitSurface (const TheISurface& IS)
{
func = (Standard_Address)(&IS);
}
inline void IntImp_ZerImpFunc::Set (const Standard_Real Tol)
{
tol = Tol;
}
inline Standard_Real IntImp_ZerImpFunc::Root() const
{
return valf;
}
inline Standard_Real IntImp_ZerImpFunc::Tolerance() const
{
return tol;
}
inline const gp_Pnt& IntImp_ZerImpFunc::Point() const
{
return pntsol;
}
inline const gp_Vec& IntImp_ZerImpFunc::Direction3d()
{
if (IsTangent()) StdFail_UndefinedDerivative::Raise();
return d3d;
}
inline const gp_Dir2d& IntImp_ZerImpFunc::Direction2d()
{
if (IsTangent()) StdFail_UndefinedDerivative::Raise();
return d2d;
}
inline const ThePSurface& IntImp_ZerImpFunc::PSurface() const
{
return (*((ThePSurface *)(surf)));
}
inline const TheISurface& IntImp_ZerImpFunc::ISurface() const
{
return (*((TheISurface *)(func)));
}

179
src/IntImp/IntImp_ZerParFunc.cdl Executable file
View File

@@ -0,0 +1,179 @@
-- File: ZerParFunc.cdl
-- Created: Fri Mar 27 09:15:20 1992
-- Author: Isabelle GRIGNON
-- <isg@phobox>
---Copyright: Matra Datavision 1992
generic class ZerParFunc from IntImp
(ThePSurface as any;
ThePSurfaceTool as any) -- as PSurfaceTool from IntImp (ThePSurface)
inherits FunctionSetWithDerivatives from math
---Purpose: this function is associated to IWalking
-- it's the definition of the line F(x,y,z)=0
-- where x=X(u,v),y=Y(u,v),z=Z(u,v)
uses Pnt from gp,
Dir from gp,
Vec from gp,
Dir2d from gp,
ConstIsoparametric from IntImp,
Array1OfReal from TColStd,
Vector from math,
Matrix from math
raises UndefinedDerivative from StdFail,
ConstructionError from Standard
is
Create
---Purpose: Raises Construction Error
--
returns ZerParFunc from IntImp;
Create( S1,S2 : ThePSurface )
returns ZerParFunc from IntImp;
NbVariables(me)
returns Integer from Standard
is static;
NbEquations(me)
returns Integer from Standard
is static;
Value(me : in out;X : in Vector from math;
F : out Vector from math)
returns Boolean from Standard
is static;
Derivatives(me : in out;X : in Vector from math;
D : out Matrix from math)
returns Boolean from Standard
is static;
Values(me : in out;
X: in Vector from math;
F: out Vector from math; D: out Matrix from math)
returns Boolean from Standard
is static;
ComputeParameters(me : in out;
ChoixIso: ConstIsoparametric from IntImp;
Param: Array1OfReal from TColStd;
UVap,BornInf,BornSup,Tolerance : out Vector from math)
is static;
Root(me)
---Purpose: returns somme des fi*fi
returns Real from Standard
---C++: inline
is static;
Point(me)
returns Pnt from gp
---C++: inline
is static;
IsTangent(me : in out; UVap : Vector from math;
Param : out Array1OfReal from TColStd;
BestChoix : out ConstIsoparametric from IntImp)
returns Boolean from Standard
is static;
Direction(me)
returns Dir from gp
---C++: inline
raises UndefinedDerivative from StdFail
is static;
DirectionOnS1(me)
returns Dir2d from gp
---C++: inline
raises UndefinedDerivative from StdFail
is static;
DirectionOnS2(me)
returns Dir2d from gp
---C++: inline
raises UndefinedDerivative from StdFail
is static;
AuxillarSurface1(me)
returns ThePSurface
---C++: return const&
---C++: inline
is static;
AuxillarSurface2(me)
returns ThePSurface
---C++: return const&
---C++: inline
is static;
fields
surf1 : Address from Standard; --- ThePSurface;
surf2 : Address from Standard; --- ThePSurface;
pntsol1 : Pnt from gp; --point solution=milieu(pntsol1,pntsol2)
pntsol2 : Pnt from gp;
f : Real from Standard[3]; -- equations
compute : Boolean from Standard; --indicateur si tangence calculee
tangent : Boolean from Standard; --indicateur si tangente
tgduv : Real from Standard[4] ; --composante en u,en v de la
-- tangente ds plan tg du 1 ier et 2ieme caro
dpuv : Vec from gp[4]; -- dp/du,dp/dv sur 1ier et 2 ieme
-- caro
chxIso : ConstIsoparametric from IntImp; -- indicateur sur l'iso
-- constante
paramConst : Real from Standard; -- parametre de l iso
ua0,va0,ua1,va1 : Real from Standard; -- surf1
ub0,vb0,ub1,vb1 : Real from Standard; -- surf2
ures1,ures2,vres1,vres2 : Real from Standard; -- U et V Resolution
end ZerParFunc;

394
src/IntImp/IntImp_ZerParFunc.gxx Executable file
View File

@@ -0,0 +1,394 @@
//-- File IntImp_ZerParFunc.gxx
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <IntImp_ComputeTangence.hxx>
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
#define SURF1 (*((ThePSurface *)(surf1)))
#define SURF2 (*((ThePSurface *)(surf2)))
IntImp_ZerParFunc::IntImp_ZerParFunc() {
Standard_ConstructionError::Raise(" Empty Constructor : IntImp_ZerParFunc");
}
IntImp_ZerParFunc::IntImp_ZerParFunc(const ThePSurface& S1 ,
const ThePSurface& S2) {
surf1 = (Standard_Address)(&S1);
surf2 = (Standard_Address)(&S2);
ua0 = ThePSurfaceTool::FirstUParameter(SURF1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
va0 = ThePSurfaceTool::FirstVParameter(SURF1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
ua1 = ThePSurfaceTool::LastUParameter(SURF1); //-- ThePSurfaceTool::UIntervalLast(surf1);
va1 = ThePSurfaceTool::LastVParameter(SURF1); //-- ThePSurfaceTool::VIntervalLast(surf1);
ub0 = ThePSurfaceTool::FirstUParameter(SURF2); //-- ThePSurfaceTool::UIntervalFirst(SURF2);
vb0 = ThePSurfaceTool::FirstVParameter(SURF2); //-- ThePSurfaceTool::VIntervalFirst(surf2);
ub1 = ThePSurfaceTool::LastUParameter(SURF2); //-- ThePSurfaceTool::UIntervalLast(surf2);
vb1 = ThePSurfaceTool::LastVParameter(SURF2); //-- ThePSurfaceTool::VIntervalLast(surf2);
ures1 = ThePSurfaceTool::UResolution(SURF1,Precision::Confusion());
vres1 = ThePSurfaceTool::VResolution(SURF1,Precision::Confusion());
ures2 = ThePSurfaceTool::UResolution(SURF2,Precision::Confusion());
vres2 = ThePSurfaceTool::VResolution(SURF2,Precision::Confusion());
compute = Standard_False;
tangent = Standard_False;
}
Standard_Integer IntImp_ZerParFunc::NbVariables() const { return 3;}
Standard_Integer IntImp_ZerParFunc::NbEquations() const { return 3;}
Standard_Boolean IntImp_ZerParFunc::Value(const math_Vector& X,
math_Vector& F) {
switch (chxIso) {
case IntImp_UIsoparametricOnCaro1:
{
pntsol1= ThePSurfaceTool::Value(SURF1,paramConst,X(1));
pntsol2= ThePSurfaceTool::Value(SURF2,X(2),X(3));
}
break;
case IntImp_VIsoparametricOnCaro1:
{
pntsol1= ThePSurfaceTool::Value(SURF1,X(1),paramConst);
pntsol2= ThePSurfaceTool::Value(SURF2,X(2),X(3));
}
break;
case IntImp_UIsoparametricOnCaro2:
{
pntsol1= ThePSurfaceTool::Value(SURF1,X(1),X(2));
pntsol2= ThePSurfaceTool::Value(SURF2,paramConst,X(3));
}
break;
case IntImp_VIsoparametricOnCaro2:
{
pntsol1= ThePSurfaceTool::Value(SURF1,X(1),X(2));
pntsol2= ThePSurfaceTool::Value(SURF2,X(3),paramConst);
}
break;
}
f[0] = F(1) = pntsol1.X() - pntsol2.X();
f[1] = F(2) = pntsol1.Y() - pntsol2.Y();
f[2] = F(3) = pntsol1.Z() - pntsol2.Z();
return Standard_True;
}
Standard_Boolean IntImp_ZerParFunc::Derivatives (const math_Vector& X,
math_Matrix& D) {
switch (chxIso) {
case IntImp_UIsoparametricOnCaro1:
{
ThePSurfaceTool::D1(SURF1,paramConst,X(1),pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[1].X();
D(1,2) =-dpuv[2].X();
D(1,3) =-dpuv[3].X();
D(2,1) = dpuv[1].Y();
D(2,2) =-dpuv[2].Y();
D(2,3) =-dpuv[3].Y();
D(3,1) = dpuv[1].Z();
D(3,2) =-dpuv[2].Z();
D(3,3) =-dpuv[3].Z();
}
break;
case IntImp_VIsoparametricOnCaro1:
{
ThePSurfaceTool::D1(SURF1,X(1),paramConst,pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[0].X();
D(1,2) =-dpuv[2].X();
D(1,3) =-dpuv[3].X();
D(2,1) = dpuv[0].Y();
D(2,2) =-dpuv[2].Y();
D(2,3) =-dpuv[3].Y();
D(3,1) = dpuv[0].Z();
D(3,2) =-dpuv[2].Z();
D(3,3) =-dpuv[3].Z();
}
break;
case IntImp_UIsoparametricOnCaro2:
{
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,paramConst,X(3),pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[0].X();
D(1,2) = dpuv[1].X();
D(1,3) =-dpuv[3].X();
D(2,1) = dpuv[0].Y();
D(2,2) = dpuv[1].Y();
D(2,3) =-dpuv[3].Y();
D(3,1) = dpuv[0].Z();
D(3,2) = dpuv[1].Z();
D(3,3) =-dpuv[3].Z();
}
break;
case IntImp_VIsoparametricOnCaro2:
{
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,X(3),paramConst,pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[0].X();
D(1,2) = dpuv[1].X();
D(1,3) =-dpuv[2].X();
D(2,1) = dpuv[0].Y();
D(2,2) = dpuv[1].Y();
D(2,3) =-dpuv[2].Y();
D(3,1) = dpuv[0].Z();
D(3,2) = dpuv[1].Z();
D(3,3) =-dpuv[2].Z();
}
break;
}
return Standard_True;
}
Standard_Boolean IntImp_ZerParFunc::Values( const math_Vector& X,
math_Vector& F,
math_Matrix& D) {
switch (chxIso) {
case IntImp_UIsoparametricOnCaro1:
{
ThePSurfaceTool::D1(SURF1,paramConst,X(1),pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[1].X();
D(1,2) =-dpuv[2].X();
D(1,3) =-dpuv[3].X();
D(2,1) = dpuv[1].Y();
D(2,2) =-dpuv[2].Y();
D(2,3) =-dpuv[3].Y();
D(3,1) = dpuv[1].Z();
D(3,2) =-dpuv[2].Z();
D(3,3) =-dpuv[3].Z();
}
break;
case IntImp_VIsoparametricOnCaro1:
{
ThePSurfaceTool::D1(SURF1,X(1),paramConst,pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[0].X();
D(1,2) =-dpuv[2].X();
D(1,3) =-dpuv[3].X();
D(2,1) = dpuv[0].Y();
D(2,2) =-dpuv[2].Y();
D(2,3) =-dpuv[3].Y();
D(3,1) = dpuv[0].Z();
D(3,2) =-dpuv[2].Z();
D(3,3) =-dpuv[3].Z();
}
break;
case IntImp_UIsoparametricOnCaro2:
{
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,paramConst,X(3),pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[0].X();
D(1,2) = dpuv[1].X();
D(1,3) =-dpuv[3].X();
D(2,1) = dpuv[0].Y();
D(2,2) = dpuv[1].Y();
D(2,3) =-dpuv[3].Y();
D(3,1) = dpuv[0].Z();
D(3,2) = dpuv[1].Z();
D(3,3) =-dpuv[3].Z();
}
break;
case IntImp_VIsoparametricOnCaro2:
{
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
ThePSurfaceTool::D1(SURF2,X(3),paramConst,pntsol2,dpuv[2],dpuv[3]);
D(1,1) = dpuv[0].X();
D(1,2) = dpuv[1].X();
D(1,3) =-dpuv[2].X();
D(2,1) = dpuv[0].Y();
D(2,2) = dpuv[1].Y();
D(2,3) =-dpuv[2].Y();
D(3,1) = dpuv[0].Z();
D(3,2) = dpuv[1].Z();
D(3,3) =-dpuv[2].Z();
}
break;
}
f[0] = F(1) = pntsol1.X() - pntsol2.X();
f[1] = F(2) = pntsol1.Y() - pntsol2.Y();
f[2] = F(3) = pntsol1.Z() - pntsol2.Z();
return Standard_True;
}
void IntImp_ZerParFunc::ComputeParameters(
const IntImp_ConstIsoparametric ChoixIso,
const TColStd_Array1OfReal& Param,
math_Vector& UVap,
math_Vector& BornInf,
math_Vector& BornSup,
math_Vector& Tolerance ) {
chxIso = ChoixIso;
switch (chxIso) {
case IntImp_UIsoparametricOnCaro1:
{
paramConst = Param(1);
UVap(1) = Param(2);
UVap(2) = Param(3);
UVap(3) = Param(4);
BornInf(1) = va0;
BornSup(1) = va1;
BornInf(2) = ub0;
BornInf(3) = vb0;
BornSup(2) = ub1;
BornSup(3) = vb1;
Tolerance(1)= vres1;
Tolerance(2)= ures2;
Tolerance(3)= vres2;
}
break;
case IntImp_VIsoparametricOnCaro1:
{
paramConst = Param(2);
UVap(1) = Param(1);
UVap(2) = Param(3);
UVap(3) = Param(4);
BornInf(1) = ua0;
BornSup(1) = ua1;
BornInf(2) = ub0;
BornSup(2) = ub1;
BornInf(3) = vb0;
BornSup(3) = vb1;
Tolerance(1)= ures1;
Tolerance(2)= ures2;
Tolerance(3)= vres2;
}
break;
case IntImp_UIsoparametricOnCaro2:
{
paramConst = Param(3);
UVap(1) = Param(1);
UVap(2) = Param(2);
UVap(3) = Param(4);
BornInf(1) = ua0;
BornSup(1) = ua1;
BornInf(2) = va0;
BornSup(2) = va1;
BornInf(3) = vb0;
BornSup(3) = vb1;
Tolerance(1)= ures1;
Tolerance(2)= vres1;
Tolerance(3)= vres2;
}
break;
case IntImp_VIsoparametricOnCaro2:
{
paramConst = Param(4);
UVap(1) = Param(1);
UVap(2) = Param(2);
UVap(3) = Param(3);
BornInf(1) = ua0;
BornSup(1) = ua1;
BornInf(2) = va0;
BornSup(2) = va1;
BornInf(3) = ub0;
BornSup(3) = ub1;
Tolerance(1)= ures1;
Tolerance(2)= vres1;
Tolerance(3)= ures2;
}
break;
}
Standard_Real Incr1 = (BornSup(1)-BornInf(1))*0.01;
Standard_Real Incr2 = (BornSup(2)-BornInf(2))*0.01;
Standard_Real Incr3 = (BornSup(3)-BornInf(3))*0.01;
BornInf(1) -= Incr1;
BornSup(1) += Incr1;
BornInf(2) -= Incr2;
BornSup(2) += Incr2;
BornInf(3) -= Incr3;
BornSup(3) += Incr3;
}
Standard_Boolean IntImp_ZerParFunc::IsTangent(
const math_Vector& UVap,
TColStd_Array1OfReal& Param,
IntImp_ConstIsoparametric& BestChoix)
{
switch (chxIso) {
case IntImp_UIsoparametricOnCaro1:
{
Param(1) = paramConst;
Param(2) = UVap(1) ;
Param(3) = UVap(2) ;
Param(4) = UVap(3) ;
}
break;
case IntImp_VIsoparametricOnCaro1:
{
Param(2) = paramConst;
Param(1) = UVap(1) ;
Param(3) = UVap(2) ;
Param(4) = UVap(3) ;
}
break;
case IntImp_UIsoparametricOnCaro2:
{
Param(3) = paramConst;
Param(1) = UVap(1) ;
Param(2) = UVap(2) ;
Param(4) = UVap(3) ;
}
break;
case IntImp_VIsoparametricOnCaro2:
{
Param(4) = paramConst;
Param(1) = UVap(1) ;
Param(2) = UVap(2) ;
Param(3) = UVap(3) ;
}
break;
}
IntImp_ConstIsoparametric TabIso[4];
Standard_Real EpsUV[4];
EpsUV[0] = ures1;
EpsUV[1] = vres1;
EpsUV[2] = ures2;
EpsUV[3] = vres2;
tangent = IntImp_ComputeTangence(dpuv,EpsUV,tgduv,TabIso);
if (!tangent)
chxIso = TabIso[0];
BestChoix = chxIso;
return tangent;
}
#undef SURF1
#undef SURF2

View File

@@ -0,0 +1,46 @@
#include <StdFail_UndefinedDerivative.hxx>
#ifndef gp_Pnt_HeaderFile
#include <gp_Pnt.hxx>
#endif
#ifndef gp_Dir2d_HeaderFile
#include <gp_Dir2d.hxx>
#endif
#ifndef gp_Dir_HeaderFile
#include <gp_Dir.hxx>
#endif
inline Standard_Real IntImp_ZerParFunc::Root() const {
return f[0]*f[0]+f[1]*f[1]+f[2]*f[2];
}
inline gp_Pnt IntImp_ZerParFunc::Point() const {
return gp_Pnt((pntsol1.XYZ()+ pntsol2.XYZ())/2.);
}
inline gp_Dir IntImp_ZerParFunc::Direction() const {
if (tangent ) StdFail_UndefinedDerivative::Raise();
return gp_Dir(tgduv[0]*dpuv[0].XYZ() + tgduv[1]*dpuv[1].XYZ());
}
inline gp_Dir2d IntImp_ZerParFunc::DirectionOnS1() const {
if (tangent ) StdFail_UndefinedDerivative::Raise();
return gp_Dir2d(tgduv[0],tgduv[1]);
}
inline gp_Dir2d IntImp_ZerParFunc::DirectionOnS2() const {
if (tangent ) StdFail_UndefinedDerivative::Raise();
return gp_Dir2d(tgduv[2],tgduv[3]);
}
inline const ThePSurface& IntImp_ZerParFunc::AuxillarSurface1() const {
return (*((const ThePSurface * const)(surf1)));
}
inline const ThePSurface& IntImp_ZerParFunc::AuxillarSurface2() const {
return (*((const ThePSurface * const)(surf2)));
}