1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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

30
src/ApproxInt/ApproxInt.cdl Executable file
View File

@@ -0,0 +1,30 @@
-- File: ApproxInt.cdl
-- Created: Fri Apr 23 15:59:20 1993
-- Author: Laurent BUCHARD
-- <lbr@phobox>
---Copyright: Matra Datavision 1993
package ApproxInt
uses
Standard,TCollection,math,gp,TColStd,TColgp,
IntImp,IntSurf,
AppParCurves,StdFail,Approx,MMgt
is
generic class WLine; -- Only on curves with ->NbPoles, ->IsNull and ->Pole Methods
deferred class SvSurfaces;
generic class PrmPrmSvSurfaces,TheInt2S;
generic class ImpPrmSvSurfaces,TheZerImpFunc;
generic class MultiLine;
generic class MultiLineTool;
generic class Approx,ThePrmPrmSvSurfaces,
TheImpPrmSvSurfaces,
TheMultiLine,
TheMultiLineTool,
TheComputeLine,
TheComputeLineBezier;
end ApproxInt;

View File

@@ -0,0 +1,170 @@
-- File: ApproxInt_Approx.cdl
-- Created: Wed Mar 17 10:55:07 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
generic class Approx from ApproxInt (
ThePSurface as any;
ThePSurfaceTool as any;
TheISurface as any;
TheISurfaceTool as any;
TheWLine as Transient)
uses
MCurvesToBSpCurve from Approx,
MultiBSpCurve from AppParCurves,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
ParametrizationType from Approx
raises
OutOfRange from Standard,
NotDone from StdFail
class ThePrmPrmSvSurfaces instantiates PrmPrmSvSurfaces from ApproxInt (
ThePSurface,
ThePSurfaceTool,
TheWLine);
class TheImpPrmSvSurfaces instantiates ImpPrmSvSurfaces from ApproxInt (
ThePSurface,
ThePSurfaceTool,
TheISurface,
TheISurfaceTool,
TheWLine);
class TheMultiLine instantiates MultiLine from ApproxInt (
TheWLine,
SvSurfaces from ApproxInt);
class TheMultiLineTool instantiates MultiLineTool from ApproxInt(
TheMultiLine,
SvSurfaces from ApproxInt);
class TheComputeLine instantiates BSplComputeLine from Approx (
TheMultiLine,
TheMultiLineTool);
class TheComputeLineBezier instantiates ComputeLine from Approx (
TheMultiLine,
TheMultiLineTool);
is
Create
returns Approx from ApproxInt;
Perform(me: in out;
Surf1,Surf2 : ThePSurface;
aLine : TheWLine;
ApproxXYZ : Boolean from Standard = Standard_True;
ApproxU1V1 : Boolean from Standard = Standard_True;
ApproxU2V2 : Boolean from Standard = Standard_True;
indicemin : Integer from Standard = 0;
indicemax : Integer from Standard = 0)
is static;
Perform(me: in out;
aLine : TheWLine;
ApproxXYZ : Boolean from Standard = Standard_True;
ApproxU1V1 : Boolean from Standard = Standard_True;
ApproxU2V2 : Boolean from Standard = Standard_True;
indicemin : Integer from Standard = 0;
indicemax : Integer from Standard = 0)
is static;
SetParameters(me: in out; Tol3d : Real from Standard;
Tol2d : Real from Standard;
DegMin : Integer from Standard;
DegMax : Integer from Standard;
NbIterMax : Integer from Standard;
ApproxWithTangency : Boolean from Standard = Standard_True;
Parametrization : ParametrizationType from Approx = Approx_ChordLength)
is static;
SetParameters(me: in out; Tol3d : Real from Standard;
Tol2d : Real from Standard;
RelativeTol : Boolean from Standard;
DegMin : Integer from Standard;
DegMax : Integer from Standard;
NbIterMax : Integer from Standard;
NbPntMax : Integer from Standard;
ApproxWithTangency : Boolean from Standard = Standard_True;
Parametrization : ParametrizationType from Approx = Approx_ChordLength)
is static;
Perform(me:in out)
is static;
TolReached3d(me) returns Real from Standard
is static;
TolReached2d(me) returns Real from Standard
is static;
IsDone(me) returns Boolean from Standard
is static;
NbMultiCurves(me) returns Integer from Standard
is static ;
Value(me; Index: Integer from Standard)
---C++: return const &
returns MultiBSpCurve from AppParCurves
is static;
---- private methods
Perform(me: in out ;Surf1 : ThePSurface;
Surf2 : TheISurface;
aLine : TheWLine;
ApproxXYZ : Boolean from Standard;
ApproxU1V1 : Boolean from Standard;
ApproxU2V2 : Boolean from Standard;
indicemin : Integer from Standard;
indicemax : Integer from Standard)
is static private;
Perform(me: in out ;Surf1 : TheISurface;
Surf2 : ThePSurface;
aLine : TheWLine;
ApproxXYZ : Boolean from Standard;
ApproxU1V1 : Boolean from Standard;
ApproxU2V2 : Boolean from Standard;
indicemin : Integer from Standard;
indicemax : Integer from Standard)
is static private;
UpdateTolReached(me: in out)
is static private;
fields
myComputeLine : TheComputeLine from ApproxInt;
myComputeLineBezier : TheComputeLineBezier from ApproxInt;
myBezToBSpl : MCurvesToBSpCurve from Approx;
myTolReached : Boolean from Standard;
myApproxBez : Boolean from Standard;
myWithTangency : Boolean from Standard;
myTol3d : Real from Standard;
myTol2d : Real from Standard;
myRelativeTol : Boolean from Standard;
myDegMin : Integer from Standard;
myDegMax : Integer from Standard;
myNbPntMax : Integer from Standard;
myNbIterMax : Integer from Standard;
myMinFactorXYZ : Real from Standard;
myMinFactorUV : Real from Standard;
myTolReached3d : Real from Standard;
myTolReached2d : Real from Standard;
end Approx;

1197
src/ApproxInt/ApproxInt_Approx.gxx Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,85 @@
-- File: ApproxInt_ImpPrmSvSurfaces.cdl
-- Created: Wed Mar 17 12:19:46 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
generic class ImpPrmSvSurfaces from ApproxInt (
ThePSurface as any;
ThePSurfaceTool as any;
TheISurface as any;
TheISurfaceTool as any; -- as ISurfaceTool from IntImp
TheLine as Transient)
inherits SvSurfaces from ApproxInt
uses
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp
class TheZerImpFunc instantiates ZerImpFunc from IntImp(
ThePSurface,ThePSurfaceTool,TheISurface,TheISurfaceTool);
is
Create(Surf1: ThePSurface; Surf2: TheISurface);
Create(Surf1: TheISurface; Surf2: ThePSurface);
Compute(me: in out;
u1,v1,u2,v2: in out Real from Standard;
Pt: out Pnt from gp;
Tg: out Vec from gp;
Tguv1,Tguv2: out Vec2d from gp)
---Purpose: returns True if Tg,Tguv1 Tguv2 can be computed.
returns Boolean from Standard is static;
Pnt(me: in out;
u1,v1,u2,v2: in Real from Standard;
P: out Pnt from gp) is static;
Tangency(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec from gp)
returns Boolean from Standard is static;
TangencyOnSurf1(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is static;
TangencyOnSurf2(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is static;
fields
MyParOnS1 : Pnt2d from gp;
MyParOnS2 : Pnt2d from gp;
MyPnt : Pnt from gp;
MyTguv1 : Vec2d from gp;
MyTguv2 : Vec2d from gp;
MyTg : Vec from gp;
MyIsTangent : Boolean from Standard;
MyHasBeenComputed : Boolean from Standard;
MyParOnS1bis : Pnt2d from gp;
MyParOnS2bis : Pnt2d from gp;
MyPntbis : Pnt from gp;
MyTguv1bis : Vec2d from gp;
MyTguv2bis : Vec2d from gp;
MyTgbis : Vec from gp;
MyIsTangentbis : Boolean from Standard;
MyHasBeenComputedbis : Boolean from Standard;
MyImplicitFirst : Boolean from Standard;
MyZerImpFunc : TheZerImpFunc from ApproxInt;
end ImpPrmSvSurfaces;

View File

@@ -0,0 +1,439 @@
// File: ApproxInt_ImpPrmSvSurfaces.gxx
// Created: Wed Mar 17 12:42:28 1993
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <TColStd_Array1OfReal.hxx>
#include <math_FunctionSetRoot.hxx>
#include <StdFail_NotDone.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <Precision.hxx>
#define ComputeParametersOnImplicitSurface(MyISurf,P,u,v) MyISurf.Parameters(P,u,v)
#define Debug(expr) cout<<" expr :"<<expr;
#define MyISurf MyZerImpFunc.ISurface()
#define MyPSurf MyZerImpFunc.PSurface()
//--------------------------------------------------------------------------------
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const TheISurface& ISurf
,const ThePSurface& PSurf):
MyHasBeenComputed(Standard_False),
MyHasBeenComputedbis(Standard_False),
MyImplicitFirst(Standard_True),
MyZerImpFunc(PSurf,ISurf)
{
}
//--------------------------------------------------------------------------------
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
,const TheISurface& ISurf):
MyHasBeenComputed(Standard_False),
MyHasBeenComputedbis(Standard_False),
MyImplicitFirst(Standard_False),
MyZerImpFunc(PSurf,ISurf)
{
}
//--------------------------------------------------------------------------------
void ApproxInt_ImpPrmSvSurfaces::Pnt(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Pnt& P) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
#ifdef DEB
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
#else
this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
#endif
P=MyPnt;
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Tangency(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Vec& T) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
T=MyTg;
return(t);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_ImpPrmSvSurfaces::TangencyOnSurf1(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Vec2d& T) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
T=MyTguv1;
return(t);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_ImpPrmSvSurfaces::TangencyOnSurf2(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Vec2d& T) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
T=MyTguv2;
return(t);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1
,Standard_Real& v1
,Standard_Real& u2
,Standard_Real& v2
,gp_Pnt& P
,gp_Vec& Tg
,gp_Vec2d& Tguv1
,gp_Vec2d& Tguv2) {
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
if(MyHasBeenComputed) {
if( (MyParOnS1.X()==u1)&&(MyParOnS1.Y()==v1)
&&(MyParOnS2.X()==u2)&&(MyParOnS2.Y()==v2)) {
return(MyIsTangent);
}
else if(MyHasBeenComputedbis == Standard_False) {
MyTgbis = MyTg;
MyTguv1bis = MyTguv1;
MyTguv2bis = MyTguv2;
MyPntbis = MyPnt;
MyParOnS1bis = MyParOnS1;
MyParOnS2bis = MyParOnS2;
MyIsTangentbis = MyIsTangent;
MyHasBeenComputedbis = MyHasBeenComputed;
}
}
if(MyHasBeenComputedbis) {
if( (MyParOnS1bis.X()==u1)&&(MyParOnS1bis.Y()==v1)
&&(MyParOnS2bis.X()==u2)&&(MyParOnS2bis.Y()==v2)) {
gp_Vec TV(MyTg);
gp_Vec2d TV1(MyTguv1);
gp_Vec2d TV2(MyTguv2);
gp_Pnt TP(MyPnt);
gp_Pnt2d TP1(MyParOnS1);
gp_Pnt2d TP2(MyParOnS2);
Standard_Boolean TB=MyIsTangent;
MyTg = MyTgbis;
MyTguv1 = MyTguv1bis;
MyTguv2 = MyTguv2bis;
MyPnt = MyPntbis;
MyParOnS1 = MyParOnS1bis;
MyParOnS2 = MyParOnS2bis;
MyIsTangent = MyIsTangentbis;
MyTgbis = TV;
MyTguv1bis = TV1;
MyTguv2bis = TV2;
MyPntbis = TP;
MyParOnS1bis = TP1;
MyParOnS2bis = TP2;
MyIsTangentbis = TB;
return(MyIsTangent);
}
}
static math_Vector BornInf(1,2),BornSup(1,2),F(1,1),X(1,2),Tolerance(1,2);
static math_Matrix D(1, 1, 1, 2);
Standard_Real binfu,bsupu,binfv,bsupv;
binfu = ThePSurfaceTool::FirstUParameter(MyPSurf);
binfv = ThePSurfaceTool::FirstVParameter(MyPSurf);
bsupu = ThePSurfaceTool::LastUParameter(MyPSurf);
bsupv = ThePSurfaceTool::LastVParameter(MyPSurf);
BornInf(1) = binfu; BornSup(1) = bsupu;
BornInf(2) = binfv; BornSup(2) = bsupv;
//--- ThePSurfaceTool::GetResolution(MyPSurf,Tolerance(1),Tolerance(2));
Tolerance(1) = 1.0e-8; Tolerance(2) = 1.0e-8;
Standard_Real TranslationU=0.0;
Standard_Real TranslationV=0.0;
math_FunctionSetRoot Rsnld(MyZerImpFunc);
Rsnld.SetTolerance(Tolerance);
if(MyImplicitFirst) {
if(u2<binfu-0.0000000001) {
if(ThePSurfaceTool::IsUPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::UPeriod(MyPSurf);
do { TranslationU+=d; } while(u2+TranslationU < binfu);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
else if(u2>bsupu+0.0000000001) {
if(ThePSurfaceTool::IsUPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::UPeriod(MyPSurf);
do { TranslationU-=d; } while(u2+TranslationU > bsupu);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
if(v2<binfv-0.0000000001) {
if(ThePSurfaceTool::IsVPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::VPeriod(MyPSurf);
do { TranslationV+=d; } while(v2+TranslationV < binfv);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
else if(v2>bsupv+0.0000000001) {
if(ThePSurfaceTool::IsVPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::VPeriod(MyPSurf);
do { TranslationV-=d; } while(v2+TranslationV > bsupv);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
X(1) = u2+TranslationU;
X(2) = v2+TranslationV;
}
else {
if(u1<binfu-0.0000000001) {
if(ThePSurfaceTool::IsUPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::UPeriod(MyPSurf);
do { TranslationU+=d; } while(u1+TranslationU < binfu);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
else if(u1>bsupu+0.0000000001) {
if(ThePSurfaceTool::IsUPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::UPeriod(MyPSurf);
do { TranslationU-=d; } while(u1+TranslationU > bsupu);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
if(v1<binfv-0.0000000001) {
if(ThePSurfaceTool::IsVPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::VPeriod(MyPSurf);
do { TranslationV+=d; } while(v1+TranslationV < binfv);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
else if(v1>bsupv+0.0000000001) {
if(ThePSurfaceTool::IsVPeriodic(MyPSurf)) {
Standard_Real d = ThePSurfaceTool::VPeriod(MyPSurf);
do { TranslationV-=d; } while(v1+TranslationV > bsupv);
}
else {
MyIsTangent=MyIsTangentbis=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
X(1) = u1+TranslationU;
X(2) = v1+TranslationV;
}
//----------------------------------------------------
//-- Pour eviter de coller le point de depart de la
//-- recherche sur une des bornes (Rsnld -> NotDone)
//--
if(X(1)-0.0000000001 <= binfu) X(1)=X(1)+0.0000001;
if(X(1)+0.0000000001 >= bsupu) X(1)=X(1)-0.0000001;
if(X(2)-0.0000000001 <= binfv) X(2)=X(2)+0.0000001;
if(X(2)+0.0000000001 >= bsupv) X(2)=X(2)-0.0000001;
Standard_Real PourTesterU = X(1);
Standard_Real PourTesterV = X(2);
/* ***************************************************************
cout<<" Envoi a Rsnld : "; Debug(X(1)); Debug(X(2));
Debug(BornInf(1)); Debug(BornInf(2));
Debug(BornSup(1)); Debug(BornSup(2)); cout<<endl;
Debug(u1); Debug(v1); Debug(u2); Debug(v2); Debug(MyImplicitFirst);
cout<<endl;
**************************************************************** */
Rsnld.Perform(MyZerImpFunc,X,BornInf,BornSup);
if(Rsnld.IsDone()) {
MyHasBeenComputed = Standard_True;
Rsnld.Root(X);
Standard_Real DistAvantApresU = Abs(PourTesterU-X(1));
Standard_Real DistAvantApresV = Abs(PourTesterV-X(2));
MyPnt = P = ThePSurfaceTool::Value(MyPSurf,X(1),X(2));
if( (DistAvantApresV <= 0.001 )
&& (DistAvantApresU <= 0.001 )) {
gp_Vec PD1U,PD1V;
gp_Vec ID1U,ID1V;
if(MyImplicitFirst) {
u2 = X(1)-TranslationU;
v2 = X(2)-TranslationV;
ComputeParametersOnImplicitSurface(MyISurf,P,u1,v1);
if(MyISurf.TypeQuadric() != GeomAbs_Plane) {
while(u1-tu1>PI) u1-=PI+PI;
while(tu1-u1>PI) u1+=PI+PI;
}
MyParOnS1.SetCoord(tu1,tv1);
MyParOnS2.SetCoord(tu2,tv2);
ThePSurfaceTool::D1(MyPSurf,X(1),X(2),P,PD1U,PD1V);
MyISurf.D1(u1,v1,P,ID1U,ID1V);
}
else {
u1 = X(1)-TranslationU;
v1 = X(2)-TranslationV;
ComputeParametersOnImplicitSurface(MyISurf,P,u2,v2);
if(MyISurf.TypeQuadric() != GeomAbs_Plane) {
while(u2-tu2>PI) u2-=PI+PI;
while(tu2-u2>PI) u2+=PI+PI;
}
MyParOnS1.SetCoord(tu1,tv1);
MyParOnS2.SetCoord(tu2,tu2);
ThePSurfaceTool::D1(MyPSurf,X(1),X(2),P,PD1U,PD1V);
MyISurf.D1(u2,v2,P,ID1U,ID1V);
}
gp_Vec VNormaleImp = MyISurf.Normale(MyPnt);
gp_Vec VNormalePrm = PD1U.Crossed(PD1V);
if( VNormaleImp.SquareMagnitude() <= gp::Resolution()
|| VNormalePrm.SquareMagnitude() <= gp::Resolution()) {
MyIsTangent = Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
gp_Dir NormaleImp(VNormaleImp);
gp_Dir NormalePrm(VNormalePrm);
gp_Vec VNImp(NormaleImp);
gp_Vec VNPrm(NormalePrm);
MyTg = VNImp.Crossed(VNPrm);
Standard_Real NmyTg = MyTg.Magnitude();
if(NmyTg < 0.000001) {
MyIsTangent = Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
MyTg.SetCoord(MyTg.X()/NmyTg,MyTg.Y()/NmyTg,MyTg.Z()/NmyTg);
MyTg = NormaleImp.Crossed(NormalePrm);
Tg = MyTg;
Standard_Real TUTV,TgTU,TgTV,TUTU,TVTV,DIS;
Standard_Real DeltaU,DeltaV;
TUTU = PD1U.Dot(PD1U);
TVTV = PD1V.Dot(PD1V);
TUTV = PD1U.Dot(PD1V);
TgTU = MyTg.Dot(PD1U);
TgTV = MyTg.Dot(PD1V);
DIS = TUTU * TVTV - TUTV * TUTV;
if(DIS<1e-10 && DIS>-1e-10) {
MyIsTangent = Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
if(MyImplicitFirst) {
MyTguv1.SetCoord( MyTg.Dot(ID1U)/(ID1U.Dot(ID1U))
,MyTg.Dot(ID1V)/(ID1V.Dot(ID1V)));
MyTguv2.SetCoord(DeltaU,DeltaV);
Tguv1 = MyTguv1;
Tguv2 = MyTguv2;
}
else {
MyTguv1.SetCoord(DeltaU,DeltaV);
MyTguv2.SetCoord( MyTg.Dot(ID1U)/(ID1U.Dot(ID1U))
,MyTg.Dot(ID1V)/(ID1V.Dot(ID1V)));
Tguv1 = MyTguv1;
Tguv2 = MyTguv2;
}
MyIsTangent=Standard_True;
return(Standard_True);
}
else {
//-- cout<<" ApproxInt_ImpImpSvSurfaces.gxx : Distance apres recadrage Trop Grande "<<endl;
MyIsTangent=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
else {
MyIsTangent = Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
}
//--------------------------------------------------------------------------------

View File

@@ -0,0 +1,139 @@
-- File: ApproxInt_MultiLine.cdl
-- Created: Thu Mar 18 12:40:05 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
generic class MultiLine from ApproxInt (
TheLine as Transient;
TheSvSurfaces as any)
uses Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec from TColgp,
Array1OfVec2d from TColgp,
Status from Approx,
Trsf from gp,
Trsf2d from gp
is
Create(line : TheLine;
PtrSvSurfaces : Address from Standard;
NbP3d : Integer from Standard;
NbP2d : Integer from Standard;
xo,ax,yo,ay,zo,az : Real from Standard;
u1o,a1u,v1o,a1v : Real from Standard;
u2o,a2u,v2o,a2v : Real from Standard;
P2DOnFirst : Boolean from Standard;
IndMin : Integer from Standard = 0;
IndMax : Integer from Standard = 0)
returns MultiLine from ApproxInt;
---Purpose: The class SvSurfaces is used when the
-- approximation algorithm needs some extra points on
-- the line <line>. A New line is then created which
-- shares the same surfaces and functions.
--
-- SvSurfaces is a deferred class which allows
-- several implementations of this algorithm with
-- different surfaces (bi-parametric ones, or
-- implicit and biparametric ones)
Create(line : TheLine;
NbP3d : Integer from Standard;
NbP2d : Integer from Standard;
xo,ax,yo,ay,zo,az : Real from Standard;
u1o,a1u,v1o,a1v : Real from Standard;
u2o,a2u,v2o,a2v : Real from Standard;
P2DOnFirst : Boolean from Standard;
IndMin : Integer from Standard = 0;
IndMax : Integer from Standard = 0)
---Purpose: No Extra points will be added on the current line
--
returns MultiLine from ApproxInt;
FirstPoint(me) returns Integer from Standard is static;
LastPoint(me) returns Integer from Standard is static;
NbP2d(me) returns Integer is static;
---Purpose: Returns the number of 2d points of a TheLine.
--
NbP3d(me) returns Integer is static;
---Purpose: Returns the number of 3d points of a TheLine.
--
WhatStatus(me) returns Status from Approx is static;
Value(me; MPointIndex: Integer; tabPt: out Array1OfPnt) is static;
---Purpose: returns the 3d points of the multipoint <MPointIndex>
-- when only 3d points exist.
Value(me; MPointIndex: Integer;
tabPt2d: out Array1OfPnt2d) is static;
---Purpose: returns the 2d points of the multipoint <MPointIndex>
-- when only 2d points exist.
Value(me; MPointIndex: Integer;
tabPt: out Array1OfPnt; tabPt2d: out Array1OfPnt2d from TColgp) is static;
---Purpose: returns the 3d and 2d points of the multipoint
-- <MPointIndex>.
Tangency(me; MPointIndex: Integer; tabV: out Array1OfVec from TColgp)
returns Boolean is static;
---Purpose: returns the 3d points of the multipoint <MPointIndex>
-- when only 3d points exist.
Tangency(me; MPointIndex: Integer;
tabV2d: out Array1OfVec2d)
returns Boolean is static;
---Purpose: returns the 2d tangency points of the multipoint
-- <MPointIndex> only when 2d points exist.
Tangency(me; MPointIndex: Integer;
tabV: out Array1OfVec from TColgp; tabV2d: out Array1OfVec2d from TColgp)
returns Boolean is static;
---Purpose: returns the 3d and 2d points of the multipoint
-- <MPointIndex>.
--
MakeMLBetween(me; Low,High,NbPointsToInsert: Integer from Standard)
returns MultiLine from ApproxInt is static;
--------------------------------------------------------------------------------
fields
PtrOnmySvSurfaces : Address from Standard;
myLine : TheLine;
indicemin : Integer from Standard;
indicemax : Integer from Standard;
nbp3d : Integer from Standard;
nbp2d : Integer from Standard;
p2donfirst : Boolean from Standard;
--- The Points of the line <TheLine> are transformed
-- as follow :
-- Modified_X = Xo + Ax * TheLine.Point().X()
-- Modified_Y = Yo + Ay * TheLine.Point().Y()
-- Modified_Z = Zo + Az * TheLine.Point().Z()
-- Modified_U1 = U1o + A1u * TheLine.Point().u1()
-- Modified_V1 = V1o + A1v * TheLine.Point().v1()
-- Modified_U2 = U2o + A2u * TheLine.Point().u2()
-- Modified_V2 = V2o + A2v * TheLine.Point().v2()
Xo,Ax,Yo,Ay,Zo,Az : Real from Standard;
U1o,A1u,V1o,A1v : Real from Standard;
U2o,A2u,V2o,A2v : Real from Standard;
end MultiLine;

View File

@@ -0,0 +1,592 @@
// File: ApproxInt_MultiLine.gxx
// Created: Wed Mar 22 9:55:23 1993
// Author: Laurent BUCHARD
// <lbr@topsn3>
#define DEBUG 0
#include <TColStd_Array1OfReal.hxx>
#include <IntSurf_LineOn2S.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Vec.hxx>
ApproxInt_MultiLine::ApproxInt_MultiLine(const Handle_TheLine& line,
const Standard_Address svsurf,
const Standard_Integer NbP3d,
const Standard_Integer NbP2d,
const Standard_Real xo,
const Standard_Real ax,
const Standard_Real yo,
const Standard_Real ay,
const Standard_Real zo,
const Standard_Real az,
const Standard_Real u1o,
const Standard_Real a1u,
const Standard_Real v1o,
const Standard_Real a1v,
const Standard_Real u2o,
const Standard_Real a2u,
const Standard_Real v2o,
const Standard_Real a2v,
const Standard_Boolean P2DOnFirst,
const Standard_Integer IndMin,
const Standard_Integer IndMax):
PtrOnmySvSurfaces(svsurf),
myLine(line),
indicemin(IndMin),
indicemax(IndMax),
nbp3d(NbP3d),
nbp2d(NbP2d),
p2donfirst(P2DOnFirst),
Xo(xo),Ax(ax),Yo(yo),Ay(ay),Zo(zo),Az(az),
U1o(u1o),A1u(a1u),V1o(v1o),A1v(a1v),
U2o(u2o),A2u(a2u),V2o(v2o),A2v(a2v)
{
#if DEBUG
if(indicemin>=indicemax) {
cout<<"\n********************************************";
cout<<"\n***** ApproxInt_MultiLine ********";
cout<<"\n***** indicemin = indicemax = "<<indicemin;
cout<<"\n********************************************"<<endl;
}
#endif
}
//--------------------------------------------------------------------------------
ApproxInt_MultiLine::ApproxInt_MultiLine(const Handle_TheLine& line,
const Standard_Integer NbP3d,
const Standard_Integer NbP2d,
const Standard_Real xo,
const Standard_Real ax,
const Standard_Real yo,
const Standard_Real ay,
const Standard_Real zo,
const Standard_Real az,
const Standard_Real u1o,
const Standard_Real a1u,
const Standard_Real v1o,
const Standard_Real a1v,
const Standard_Real u2o,
const Standard_Real a2u,
const Standard_Real v2o,
const Standard_Real a2v,
const Standard_Boolean P2DOnFirst,
const Standard_Integer IndMin,
const Standard_Integer IndMax):
PtrOnmySvSurfaces(0),
myLine(line),
indicemin(IndMin),
indicemax(IndMax),
nbp3d(NbP3d),
nbp2d(NbP2d),
p2donfirst(P2DOnFirst),
Xo(xo),Ax(ax),Yo(yo),Ay(ay),Zo(zo),Az(az),
U1o(u1o),A1u(a1u),V1o(v1o),A1v(a1v),
U2o(u2o),A2u(a2u),V2o(v2o),A2v(a2v)
{
if(indicemin>=indicemax) {
#if DEBUG
cout<<"\n********************************************";
cout<<"\n***** ApproxInt_MultiLine ********";
cout<<"\n***** indicemin = indicemax = "<<indicemin;
cout<<"\n********************************************"<<endl;
#endif
}
}
//--------------------------------------------------------------------------------
Standard_Integer ApproxInt_MultiLine::FirstPoint() const {
return(indicemin);
}
//--------------------------------------------------------------------------------
Standard_Integer ApproxInt_MultiLine::LastPoint() const {
return(indicemax);
}
//--------------------------------------------------------------------------------
Approx_Status ApproxInt_MultiLine::WhatStatus() const {
if(PtrOnmySvSurfaces)
return(Approx_PointsAdded);
else
return(Approx_NoPointsAdded);
}
//--------------------------------------------------------------------------------
Standard_Integer ApproxInt_MultiLine::NbP3d() const {
return(nbp3d);
}
//--------------------------------------------------------------------------------
Standard_Integer ApproxInt_MultiLine::NbP2d() const {
return(nbp2d);
}
//================================================================================
void ApproxInt_MultiLine::Value(const Standard_Integer Index,
TColgp_Array1OfPnt& TabPnt) const
{
IntSurf_PntOn2S POn2S(myLine->Point(Index));
Standard_Real X = POn2S.Value().X();
Standard_Real Y = POn2S.Value().Y();
Standard_Real Z = POn2S.Value().Z();
TabPnt(1) = gp_Pnt(X*Ax + Xo, Y*Ay + Yo, Z*Az + Zo);
}
//--------------------------------------------------------------------------------
void ApproxInt_MultiLine::Value( const Standard_Integer Index
,TColgp_Array1OfPnt2d& TabPnt2d) const
{
IntSurf_PntOn2S POn2S(myLine->Point(Index));
Standard_Real u1,u2,v1,v2;
POn2S.Parameters(u1,v1,u2,v2);
if(nbp2d==1) {
if(p2donfirst) {
TabPnt2d(1) = gp_Pnt2d(u1 * A1u + U1o , v1 * A1v + V1o);
}
else {
TabPnt2d(1) = gp_Pnt2d(u2 * A2u + U2o , v2 * A2v + V2o);
}
}
else {
TabPnt2d(1) = gp_Pnt2d(u1 * A1u + U1o , v1 * A1v + V1o);
if(TabPnt2d.Length()>=2) {
TabPnt2d(2) = gp_Pnt2d(u2 * A2u + U2o , v2 * A2v + V2o);
}
}
}
//--------------------------------------------------------------------------------
void ApproxInt_MultiLine::Value( const Standard_Integer Index
,TColgp_Array1OfPnt& TabPnt
,TColgp_Array1OfPnt2d& TabPnt2d) const
{
IntSurf_PntOn2S POn2S(myLine->Point(Index));
Standard_Real u1,u2,v1,v2;
POn2S.Parameters(u1,v1,u2,v2);
if(nbp2d==1) {
if(p2donfirst) {
TabPnt2d(1) = gp_Pnt2d(u1 * A1u + U1o , v1 * A1v + V1o);
}
else {
TabPnt2d(1) = gp_Pnt2d(u2 * A2u + U2o , v2 * A2v + V2o);
}
}
else {
TabPnt2d(1) = gp_Pnt2d(u1 * A1u + U1o , v1 * A1v + V1o);
if(TabPnt2d.Length()>=2) {
TabPnt2d(2) = gp_Pnt2d(u2 * A2u + U2o , v2 * A2v + V2o);
}
}
Standard_Real X = POn2S.Value().X();
Standard_Real Y = POn2S.Value().Y();
Standard_Real Z = POn2S.Value().Z();
TabPnt(1) = gp_Pnt(X * Ax + Xo, Y * Ay + Yo, Z * Az + Zo);
}
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_MultiLine::Tangency( const Standard_Integer Index
,TColgp_Array1OfVec& TabVec) const
{
if(PtrOnmySvSurfaces==NULL)
return(Standard_False);
IntSurf_PntOn2S POn2S(myLine->Point(Index));
Standard_Real u1,u2,v1,v2;
gp_Vec Tg;
POn2S.Parameters(u1,v1,u2,v2);
Standard_Boolean ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->Tangency( u1,v1,u2,v2,Tg);
if(ret) {
Standard_Real X = Tg.X();
Standard_Real Y = Tg.Y();
Standard_Real Z = Tg.Z();
TabVec(1) = gp_Vec(X * Ax, Y * Ay, Z * Az);
}
else
TabVec(1) = gp_Vec(0.0,0.0,0.0);
return(ret);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_MultiLine::Tangency( const Standard_Integer Index
,TColgp_Array1OfVec2d& TabVec2d) const
{
if(PtrOnmySvSurfaces==NULL)
return(Standard_False);
IntSurf_PntOn2S POn2S(myLine->Point(Index));
Standard_Real u1,u2,v1,v2,U,V;
gp_Vec2d Tg2d;
Standard_Boolean ret;
POn2S.Parameters(u1,v1,u2,v2);
if(nbp2d==1) {
Standard_Real Au = A1u;
Standard_Real Av = A1v;
if(p2donfirst) {
ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf1( u1,v1,u2,v2,Tg2d);
}
else {
ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf2( u1,v1,u2,v2,Tg2d);
Au = A2u;
Av = A2v;
}
if(ret) {
U = Tg2d.X();
V = Tg2d.Y();
TabVec2d(1) = gp_Vec2d(U * Au, V * Av);
}
else {
TabVec2d(1) = gp_Vec2d(0.0,0.0);
}
}
else {
ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf1( u1,v1,u2,v2,Tg2d);
if(ret) {
U = Tg2d.X();
V = Tg2d.Y();
TabVec2d(1) = gp_Vec2d(U * A1u, V * A1v);
if(TabVec2d.Length()>=2) {
ret&=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf2( u1,v1,u2,v2,Tg2d);
U = Tg2d.X();
V = Tg2d.Y();
TabVec2d(2) = gp_Vec2d(U * A2u, V * A2v);
}
else {
TabVec2d(1) = gp_Vec2d(0.0,0.0);
if(TabVec2d.Length()>=2) {
TabVec2d(2) = gp_Vec2d(0.0,0.0);
}
}
}
}
return(ret);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_MultiLine::Tangency( const Standard_Integer Index
,TColgp_Array1OfVec& TabVec
,TColgp_Array1OfVec2d& TabVec2d) const
{
if(PtrOnmySvSurfaces==NULL)
return(Standard_False);
IntSurf_PntOn2S POn2S(myLine->Point(Index));
Standard_Real u1,u2,v1,v2,U,V;
gp_Vec2d Tg2d;
gp_Vec Tg;
Standard_Boolean ret;
POn2S.Parameters(u1,v1,u2,v2);
if(nbp2d==1) {
Standard_Real Au = A1u;
Standard_Real Av = A1v;
if(p2donfirst) {
ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf1( u1,v1,u2,v2,Tg2d);
}
else {
ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf2( u1,v1,u2,v2,Tg2d);
Au = A2u;
Av = A2v;
}
if(ret) {
U = Tg2d.X();
V = Tg2d.Y();
TabVec2d(1) = gp_Vec2d(U * Au, V * Av);
}
else {
TabVec2d(1) = gp_Vec2d(0.0,0.0);
}
}
else {
ret=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf1( u1,v1,u2,v2,Tg2d);
if(ret) {
U = Tg2d.X();
V = Tg2d.Y();
TabVec2d(1) = gp_Vec2d(U * A1u, V * A1v);
if(TabVec2d.Length()>=2) {
ret&=((TheSvSurfaces *)PtrOnmySvSurfaces)->TangencyOnSurf2( u1,v1,u2,v2,Tg2d);
U = Tg2d.X();
V = Tg2d.Y();
TabVec2d(2) = gp_Vec2d(U * A2u, V * A2v);
}
}
else {
TabVec2d(1) = gp_Vec2d(0.0,0.0);
if(TabVec2d.Length()>=2) {
TabVec2d(2) = gp_Vec2d(0.0,0.0);
}
}
}
if(ret) {
ret&=((TheSvSurfaces *)PtrOnmySvSurfaces)->Tangency( u1,v1,u2,v2,Tg);
Standard_Real X = Tg.X();
Standard_Real Y = Tg.Y();
Standard_Real Z = Tg.Z();
TabVec(1) = gp_Vec(X * Ax, Y * Ay, Z * Az);
}
else {
TabVec(1) = gp_Vec(0.0,0.0,0.0);
}
return(ret);
}
//--------------------------------------------------------------------------------
//================================================================================
ApproxInt_MultiLine ApproxInt_MultiLine::MakeMLBetween(const Standard_Integer Low,
const Standard_Integer High,
const Standard_Integer aNbPntsToInsert)
const {
if(PtrOnmySvSurfaces==NULL) {
//-- cout<<"\n Erreur dans : ApproxInt_MultiLine ApproxInt_MultiLine::MakeMLBetween "<<endl;
Handle(IntSurf_LineOn2S) vide1 = new IntSurf_LineOn2S();
Handle(TheLine) vide = new TheLine(vide1,Standard_False);
return(ApproxInt_MultiLine(vide,
NULL,
nbp3d,
nbp2d,
Xo,Ax,Yo,Ay,Zo,Az,
U1o,A1u,V1o,A1v,
U2o,A2u,V2o,A2v,
p2donfirst,
1,1));
//-- return(*this);
}
Standard_Integer NbPntsToInsert=aNbPntsToInsert;
if(NbPntsToInsert<(High-Low)) NbPntsToInsert=(High-Low);
Standard_Integer NbPnts = NbPntsToInsert + High - Low + 1;
Standard_Integer NbPntsmin = High-Low;
NbPntsmin+=NbPntsmin;
if(NbPnts<NbPntsmin) NbPnts=NbPntsmin;
gp_Vec T;
gp_Vec2d TS1,TS2;
gp_Pnt P;
//-----------------------l-------------------------------------------
//-- Indice : Low Low+1 I I+1 High --
//-- --
//-- Abs.Curv. : S(Low) S(I) S(I+1) S(High) --
//-- --
//-- On echantillonne a abcisse curviligne --
//-- constante. --
//-- L abcisse est calculee sur les params U1,V1 --
//------------------------------------------------------------------
TColStd_Array1OfReal U1(Low,High);
TColStd_Array1OfReal V1(Low,High);
TColStd_Array1OfReal U2(Low,High);
TColStd_Array1OfReal V2(Low,High);
TColStd_Array1OfReal AC(Low,High);
Standard_Real s,ds;
//------------------------------------------------------------
//-- Creation des Tableaux U1 .. V2 et AC
//--
Standard_Real u1,v1,u2,v2;
Standard_Integer i ;
myLine->Point(Low).Parameters(u1,v1,u2,v2);
U1(Low) = u1;
V1(Low) = v1;
U2(Low) = u2;
V2(Low) = v2;
AC(Low) =0.0;
#if 0
for( i=Low+1; i<=High; i++) {
myLine->Point(i).Parameters(u1,v1,u2,v2);
U1(i) = u1;
V1(i) = v1;
U2(i) = u2;
V2(i) = v2;
Standard_Real du1=u1-U1(i-1);
Standard_Real dv1=v1-V1(i-1);
AC(i) = AC(i-1) + sqrt((du1*du1)+(dv1*dv1));
}
#else
//-- Essai du 19 juin 96 (parametrage selon abs curv en XYZ)
for( i=Low+1; i<=High; i++) {
myLine->Point(i).Parameters(u1,v1,u2,v2);
U1(i) = u1;
V1(i) = v1;
U2(i) = u2;
V2(i) = v2;
AC(i) = AC(i-1)
+ (myLine->Point(i-1).Value()).Distance(myLine->Point(i).Value());
}
#endif
//-------------------------------------------------------------
//-- Creation des structures contenant les resultats
Handle(IntSurf_LineOn2S) ResultPntOn2SLine
= new IntSurf_LineOn2S();
IntSurf_PntOn2S StartPOn2S;
TColStd_Array1OfReal StartParams(1,4);
ds = AC(High) / (NbPnts-1);
Standard_Integer Indice = Low;
Standard_Boolean HasBeenInserted = Standard_False;
Standard_Real dsmin = ds*0.3;
Standard_Real smax = AC(High);
for(i=2,s=ds; (s<smax) ; i++,s+=ds) {
//----------------------------------------------------------
//-- Recherche des indices des points --
//-- Point : 2 i NbPnts-1 --
//-- s s --
//-- Current Indice tel que AC(Indice)<= s < AC(Indice+1) --
//----------------------------------------------------------
while(AC(Indice+1) <= s) {
if(!HasBeenInserted) ResultPntOn2SLine->Add(myLine->Point(Indice));
HasBeenInserted = Standard_False;
Indice++;
}
if(!HasBeenInserted && AC(Indice) <= s) {
ResultPntOn2SLine->Add(myLine->Point(Indice));
HasBeenInserted = Standard_True;
}
Standard_Real a = s - AC(Indice);
Standard_Real b = AC(Indice+1) - s;
Standard_Real nab = 1.0/(a+b);
//----------------------------------------------------------
//-- Verification : Si Dist au prochain point < dsmin --
//-- Si Dist au precedent point < dsmin --
//-- --
//----------------------------------------------------------
if((a>dsmin) && (b>dsmin)) {
u1 = (U1(Indice) * b + U1(Indice+1) * a) * nab;
v1 = (V1(Indice) * b + V1(Indice+1) * a) * nab;
u2 = (U2(Indice) * b + U2(Indice+1) * a) * nab;
v2 = (V2(Indice) * b + V2(Indice+1) * a) * nab;
if(((TheSvSurfaces *)PtrOnmySvSurfaces)->Compute(u1,v1,u2,v2,P,T,TS1,TS2)) {
StartPOn2S.SetValue(P,u1,v1,u2,v2);
//-- cout<<" Insertion du point calcule : "<<u1<<","<<v1<<","<<u2<<","<<v2<<",";
//-- cout<<P.X()<<","<<P.Y()<<","<<P.Z()<<endl;
ResultPntOn2SLine->Add(StartPOn2S);
}
else {
//-- cout<<" Probleme Non Traite ds ApproxInt_ApproxIntIntersection "<<endl;
}
}
else {
//-- Point non situe a distance suffisante de 2 pts existants
//-- avec le point p[indice] deja insere
if(b<0.0) {
while(AC(Indice+1) <= s) {
if(!HasBeenInserted) ResultPntOn2SLine->Add(myLine->Point(Indice));
//-- cout<<" Insertion du point :"<<Indice<<endl;
HasBeenInserted = Standard_False;
Indice++;
}
if(!HasBeenInserted && AC(Indice) <= s) {
ResultPntOn2SLine->Add(myLine->Point(Indice));
HasBeenInserted = Standard_True;
}
}
else {
s+=dsmin - ds;
}
}
}
ResultPntOn2SLine->Add(myLine->Point(High)); //-- Point NbPnts
Handle(TheLine) temp = new TheLine(ResultPntOn2SLine,Standard_False);
//-- Verification a posteriori
//-- On verifie qu il n y a pas de virage trop important en 2d et en 3d
temp->Point(1).Parameters(u1,v1,u2,v2);
gp_Pnt2d P1A(u1,v1);
gp_Pnt2d P2A(u2,v2);
temp->Point(2).Parameters(u1,v1,u2,v2);
gp_Pnt2d P1B(u1,v1);
gp_Pnt2d P2B(u2,v2);
gp_Pnt2d P1C,P2C;
Standard_Integer CodeErreur=0;
for(i=3,NbPnts=temp->NbPnts();CodeErreur==0 && i<=NbPnts; i++) {
Standard_Real d,du,dv,duv2;
temp->Point(i).Parameters(u1,v1,u2,v2);
//-- Virage P1A P1B P1C
P1C.SetCoord(u1,v1);
du = P1B.X()-P1A.X();
dv = P1B.Y()-P1A.Y();
duv2= 0.25*(du*du+dv*dv);
u1 = P1B.X() + du;
v1 = P1B.Y() + dv;
du = P1C.X() - u1;
dv = P1C.Y() - v1;
d = du*du+dv*dv;
if(d>duv2) {
CodeErreur = 1;
CodeErreur = 1;
break;
}
//-- Virage P2A P2B P2C
P2C.SetCoord(u2,v2);
du = P2B.X()-P2A.X();
dv = P2B.Y()-P2A.Y();
duv2= 0.25*(du*du+dv*dv);
u2 = P2B.X() + du;
v2 = P2B.Y() + dv;
du = P2C.X() - u2;
dv = P2C.Y() - v2;
d = du*du+dv*dv;
if(d>duv2) {
CodeErreur = 2;
break;
}
P1A=P1B;
P2A=P2B;
P1B=P1C;
P2B=P2C;
}
#if DEBUG
if (temp->NbPnts() < NbPntsToInsert + High - Low + 1) {
cout<<" *** Pas assez de points entre :"<<Low<<" et "<<High<<" -> "<<temp->NbPnts()<<endl;
}
if(CodeErreur) {
cout<<" *** CodeErreur : "<<CodeErreur<<endl;
}
#endif
if((temp->NbPnts() >= NbPntsToInsert + High - Low + 1)
&& (CodeErreur==0)) {
return(ApproxInt_MultiLine(temp,
(High-Low>10)? PtrOnmySvSurfaces : NULL,
nbp3d,
nbp2d,
Xo,Ax,Yo,Ay,Zo,Az,
U1o,A1u,V1o,A1v,
U2o,A2u,V2o,A2v,
p2donfirst,
1,ResultPntOn2SLine->NbPoints()));
}
else {
//-- cout<<" ApproxInt_MultiLine "<<endl;
//-- cout<<" Pas de Rajout de points ds1min = "<<minds1<<" ds2min = "<<minds2<<endl;
Handle(IntSurf_LineOn2S) vide1 = new IntSurf_LineOn2S();
Handle(TheLine) vide = new TheLine(vide1,Standard_False);
return(ApproxInt_MultiLine(vide,
NULL,
nbp3d,
nbp2d,
Xo,Ax,Yo,Ay,Zo,Az,
U1o,A1u,V1o,A1v,
U2o,A2u,V2o,A2v,
p2donfirst,
1,1));
}
}
//======================================================================

View File

@@ -0,0 +1,121 @@
-- File: ApproxInt_MultiLineTool.cdl
-- Created: Fri Mar 26 10:54:51 1993
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1993
generic class MultiLineTool from ApproxInt (TheMultiLine as any;
TheMultiMPoint as any)
uses
Status from Approx,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec from TColgp,
Array1OfVec2d from TColgp
is
FirstPoint(myclass; ML: TheMultiLine) returns Integer;
---C++:inline
---Purpose: Returns the number of multipoints of the TheMultiLine.
LastPoint(myclass; ML: TheMultiLine) returns Integer;
---C++:inline
---Purpose: Returns the number of multipoints of the TheMultiLine.
NbP2d(myclass; ML: TheMultiLine) returns Integer;
---C++:inline
---Purpose: Returns the number of 2d points of a TheMultiLine.
NbP3d(myclass; ML: TheMultiLine) returns Integer;
---C++:inline
---Purpose: Returns the number of 3d points of a TheMultiLine.
Value(myclass; ML: TheMultiLine; MPointIndex: Integer; tabPt: out Array1OfPnt);
---C++:inline
---Purpose: returns the 3d points of the multipoint <MPointIndex>
-- when only 3d points exist.
Value(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabPt2d: out Array1OfPnt2d from TColgp);
---C++:inline
---Purpose: returns the 2d points of the multipoint <MPointIndex>
-- when only 2d points exist.
Value(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabPt: out Array1OfPnt from TColgp; tabPt2d: out Array1OfPnt2d);
---C++:inline
---Purpose: returns the 3d and 2d points of the multipoint
-- <MPointIndex>.
Tangency(myclass; ML: TheMultiLine; MPointIndex: Integer; tabV: out Array1OfVec from TColgp)
returns Boolean;
---C++:inline
---Purpose: returns the 3d points of the multipoint <MPointIndex>
-- when only 3d points exist.
Tangency(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabV2d: out Array1OfVec2d from TColgp)
returns Boolean;
---C++:inline
---Purpose: returns the 2d tangency points of the multipoint
-- <MPointIndex> only when 2d points exist.
Tangency(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabV: out Array1OfVec from TColgp; tabV2d: out Array1OfVec2d from TColgp)
returns Boolean;
---C++:inline
---Purpose: returns the 3d and 2d points of the multipoint
-- <MPointIndex>.
--- methods not used but necessary
Curvature(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabV: out Array1OfVec from TColgp)
returns Boolean;
---C++:inline
---Purpose: returns the 3d curvature of the multipoint <MPointIndex>
-- when only 3d points exist.
Curvature(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabV2d: out Array1OfVec2d from TColgp)
returns Boolean;
---C++:inline
---Purpose: returns the 2d curvature points of the multipoint
-- <MPointIndex> only when 2d points exist.
Curvature(myclass; ML: TheMultiLine; MPointIndex: Integer;
tabV: out Array1OfVec from TColgp;
tabV2d: out Array1OfVec2d from TColgp)
returns Boolean;
---C++:inline
---Purpose: returns the 3d and 2d curvature of the multipoint
-- <MPointIndex>.
MakeMLBetween(myclass; ML: TheMultiLine; I1, I2: Integer;
NbPMin: Integer)
returns TheMultiLine;
---C++:inline
---Purpose: Is called if WhatStatus returned "PointsAdded".
WhatStatus(myclass; ML: TheMultiLine; I1, I2: Integer)
---C++:inline
returns Status from Approx;
end MultiLineTool;

View File

@@ -0,0 +1,11 @@
// File: ApproxInt_ApproxInt_MultiLineTool.gxx
// Created: Tue Mar 30 17:05:43 1993
// Author: Laurent BUCHARD
// <lbr@topsn3>
//-- Standard_Integer Approx_NbP3d = 1;
//-- Standard_Integer Approx_NbP2d = 2;

View File

@@ -0,0 +1,108 @@
// File: ApproxInt_ApproxInt_MultiLineTool.lxx
// Created: Tue Mar 30 17:05:43 1993
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include TheMultiLine_hxx
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColgp_Array1OfVec.hxx>
#include <TColgp_Array1OfVec2d.hxx>
#include <Approx_Status.hxx>
//================================================================================
inline Standard_Integer ApproxInt_MultiLineTool::NbP2d(const TheMultiLine& ML) {
return(ML.NbP2d());
}
//--------------------------------------------------------------------------------
inline Standard_Integer ApproxInt_MultiLineTool::NbP3d(const TheMultiLine& ML) {
return(ML.NbP3d());
}
//--------------------------------------------------------------------------------
inline Standard_Integer ApproxInt_MultiLineTool::FirstPoint(const TheMultiLine& ML) {
return(ML.FirstPoint());
}
//--------------------------------------------------------------------------------
inline Standard_Integer ApproxInt_MultiLineTool::LastPoint(const TheMultiLine& ML) {
return(ML.LastPoint());
}
//--------------------------------------------------------------------------------
inline void ApproxInt_MultiLineTool::Value( const TheMultiLine& ML
,const Standard_Integer Index
,TColgp_Array1OfPnt& TabPnt) {
ML.Value(Index,TabPnt);
}
//--------------------------------------------------------------------------------
inline void ApproxInt_MultiLineTool::Value( const TheMultiLine& ML
,const Standard_Integer Index
,TColgp_Array1OfPnt2d& TabPnt2d) {
ML.Value(Index,TabPnt2d);
}
//--------------------------------------------------------------------------------
inline void ApproxInt_MultiLineTool::Value( const TheMultiLine& ML
,const Standard_Integer Index
,TColgp_Array1OfPnt& TabPnt
,TColgp_Array1OfPnt2d& TabPnt2d) {
ML.Value(Index,TabPnt,TabPnt2d);
}
//--------------------------------------------------------------------------------
inline Standard_Boolean ApproxInt_MultiLineTool::Tangency( const TheMultiLine& ML
,const Standard_Integer Index
,TColgp_Array1OfVec& TabVec) {
return(ML.Tangency(Index,TabVec));
}
//--------------------------------------------------------------------------------
inline Standard_Boolean ApproxInt_MultiLineTool::Tangency( const TheMultiLine& ML
,const Standard_Integer Index
,TColgp_Array1OfVec2d& TabVec2d) {
return(ML.Tangency(Index,TabVec2d));
}
//--------------------------------------------------------------------------------
inline Standard_Boolean ApproxInt_MultiLineTool::Tangency( const TheMultiLine& ML
,const Standard_Integer Index
,TColgp_Array1OfVec& TabVec
,TColgp_Array1OfVec2d& TabVec2d) {
return(ML.Tangency(Index,TabVec,TabVec2d));
}
//--------------------------------------------------------------------------------
inline Standard_Boolean ApproxInt_MultiLineTool::Curvature( const TheMultiLine& //ML
,const Standard_Integer //Index
,TColgp_Array1OfVec& ) { //TabVec
return Standard_False;
}
//--------------------------------------------------------------------------------
inline Standard_Boolean ApproxInt_MultiLineTool::Curvature( const TheMultiLine& //ML
,const Standard_Integer //Index
,TColgp_Array1OfVec2d& ) { //TabVec2d
return Standard_False;
}
//--------------------------------------------------------------------------------
inline Standard_Boolean ApproxInt_MultiLineTool::Curvature( const TheMultiLine& //ML
,const Standard_Integer //Index
,TColgp_Array1OfVec& //TabVec
,TColgp_Array1OfVec2d& ) { //TabVec2d
return Standard_False;
}
//--------------------------------------------------------------------------------
inline Approx_Status ApproxInt_MultiLineTool::WhatStatus(const TheMultiLine& ML
,const Standard_Integer
,const Standard_Integer) {
//-- PointsAdded,
//-- NoPointsAdded,
//-- NoApproximation
//-- Approx_PointsAdded
return(ML.WhatStatus());
}
//--------------------------------------------------------------------------------
inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& ML,
const Standard_Integer I1,
const Standard_Integer I2,
const Standard_Integer NbPMin) {
return(ML.MakeMLBetween(I1,I2,NbPMin));
}
//================================================================================

View File

@@ -0,0 +1,77 @@
-- File: ApproxInt_SvSurfaces.cdl
-- Created: Wed Mar 17 12:19:46 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
generic class PrmPrmSvSurfaces from ApproxInt (
ThePSurface as any;
ThePSurfaceTool as any;
TheLine as Transient)
inherits SvSurfaces from ApproxInt
uses
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp
class TheInt2S instantiates Int2S from IntImp(
ThePSurface,ThePSurfaceTool);
is
Create(Surf1,Surf2: ThePSurface);
Compute(me: in out;
u1,v1,u2,v2: in out Real from Standard;
Pt: out Pnt from gp;
Tg: out Vec from gp;
Tguv1,Tguv2: out Vec2d from gp)
---Purpose: returns True if Tg,Tguv1 Tguv2 can be computed.
returns Boolean from Standard is static;
Pnt(me: in out;
u1,v1,u2,v2: in Real from Standard;
P: out Pnt from gp) is static;
Tangency(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec from gp)
returns Boolean from Standard is static;
TangencyOnSurf1(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is static;
TangencyOnSurf2(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is static;
fields
MyParOnS1 : Pnt2d from gp;
MyParOnS2 : Pnt2d from gp;
MyPnt : Pnt from gp;
MyTguv1 : Vec2d from gp;
MyTguv2 : Vec2d from gp;
MyTg : Vec from gp;
MyIsTangent : Boolean from Standard;
MyHasBeenComputed : Boolean from Standard;
MyParOnS1bis : Pnt2d from gp;
MyParOnS2bis : Pnt2d from gp;
MyPntbis : Pnt from gp;
MyTguv1bis : Vec2d from gp;
MyTguv2bis : Vec2d from gp;
MyTgbis : Vec from gp;
MyIsTangentbis : Boolean from Standard;
MyHasBeenComputedbis : Boolean from Standard;
MyIntersectionOn2S : TheInt2S;
end PrmPrmSvSurfaces;

View File

@@ -0,0 +1,306 @@
// File: ApproxInt_PrmPrmSvSurfaces.gxx
// Created: Wed Mar 17 12:42:28 1993
// Author: Laurent BUCHARD
// <lbr@topsn3>
#define TOLTANGENCY 0.0000000001
#include <TColStd_Array1OfReal.hxx>
#include <math_FunctionSetRoot.hxx>
#define Debug(expr) cout<<" expr :"<<expr;
#define MySurf1 MyIntersectionOn2S.Function().AuxillarSurface1()
#define MySurf2 MyIntersectionOn2S.Function().AuxillarSurface2()
//--------------------------------------------------------------------------------
ApproxInt_PrmPrmSvSurfaces::ApproxInt_PrmPrmSvSurfaces( const ThePSurface& Surf1
,const ThePSurface& Surf2):
MyHasBeenComputed(Standard_False),
MyHasBeenComputedbis(Standard_False),
MyIntersectionOn2S(Surf1,Surf2,TOLTANGENCY)
{
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1
,Standard_Real& v1
,Standard_Real& u2
,Standard_Real& v2
,gp_Pnt& P
,gp_Vec& Tg
,gp_Vec2d& Tguv1
,gp_Vec2d& Tguv2) {
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
if(MyHasBeenComputed) {
if( (MyParOnS1.X()==u1)&&(MyParOnS1.Y()==v1)
&&(MyParOnS2.X()==u2)&&(MyParOnS2.Y()==v2)) {
return(MyIsTangent);
}
else if(MyHasBeenComputedbis == Standard_False) {
MyTgbis = MyTg;
MyTguv1bis = MyTguv1;
MyTguv2bis = MyTguv2;
MyPntbis = MyPnt;
MyParOnS1bis = MyParOnS1;
MyParOnS2bis = MyParOnS2;
MyIsTangentbis = MyIsTangent;
MyHasBeenComputedbis = MyHasBeenComputed;
}
}
if(MyHasBeenComputedbis) {
if( (MyParOnS1bis.X()==u1)&&(MyParOnS1bis.Y()==v1)
&&(MyParOnS2bis.X()==u2)&&(MyParOnS2bis.Y()==v2)) {
gp_Vec TV(MyTg);
gp_Vec2d TV1(MyTguv1);
gp_Vec2d TV2(MyTguv2);
gp_Pnt TP(MyPnt);
gp_Pnt2d TP1(MyParOnS1);
gp_Pnt2d TP2(MyParOnS2);
Standard_Boolean TB=MyIsTangent;
MyTg = MyTgbis;
MyTguv1 = MyTguv1bis;
MyTguv2 = MyTguv2bis;
MyPnt = MyPntbis;
MyParOnS1 = MyParOnS1bis;
MyParOnS2 = MyParOnS2bis;
MyIsTangent = MyIsTangentbis;
MyTgbis = TV;
MyTguv1bis = TV1;
MyTguv2bis = TV2;
MyPntbis = TP;
MyParOnS1bis = TP1;
MyParOnS2bis = TP2;
MyIsTangentbis = TB;
return(MyIsTangent);
}
}
MyIsTangent = Standard_True;
static TColStd_Array1OfReal Param(1,4);
Param(1) = u1; Param(2) = v1;
Param(3) = u2; Param(4) = v2;
math_FunctionSetRoot Rsnld(MyIntersectionOn2S.Function());
#ifdef DEB
IntImp_ConstIsoparametric ChoixIso = MyIntersectionOn2S.Perform(Param,Rsnld);
#else
MyIntersectionOn2S.Perform(Param,Rsnld);
#endif
if (!MyIntersectionOn2S.IsDone()) {
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
if (MyIntersectionOn2S.IsEmpty()) {
MyIsTangent=Standard_False;
//cout<<"\n----- Parametree Parametree : IsEmpty ds Compute "<<endl;
//Debug(u1); Debug(u2); Debug(v1); Debug(v2); cout<<endl;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
MyHasBeenComputed = Standard_True;
MyPnt = P = MyIntersectionOn2S.Point().Value();
MyIntersectionOn2S.Point().Parameters(u1,v1,u2,v2);
MyParOnS1.SetCoord(tu1,tv1);
MyParOnS2.SetCoord(tu2,tv2);
if(MyIntersectionOn2S.IsTangent()) {
MyIsTangent=Standard_False;
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
return(Standard_False);
}
MyTg = Tg = MyIntersectionOn2S.Direction();
MyTguv1 = Tguv1 = MyIntersectionOn2S.DirectionOnS1();
MyTguv2 = Tguv2 = MyIntersectionOn2S.DirectionOnS2();
//----------------------------------------------------------------------
//-- Si ( Tg ) TU et TV sont normes
//--
//-- On a Tg = DeltaU * TU + DeltaV * TV
//--
//-- soit : Tg.TU = DeltaU TU.TU + DeltaV TU.TV
//-- Tg.TV = DeltaU TV.TU + DeltaV TV.TV
//--
//-- Donc :
//--
//-- Tg.TU TV.TV - Tg.TV * TU.TV
//-- DeltaU = -------------------------------
//-- TU.TU TV.TV - (TU.TV)**2
//--
//-- Tg.TV TU.TU - Tg.TU * TU.TV
//-- DeltaV = -------------------------------
//-- TU.TU TV.TV - (TU.TV)**2
//--
//--
Tg.Normalize(); MyTg = Tg;
Standard_Real DeltaU,DeltaV;
gp_Vec TU,TV;
gp_Pnt Pbid;
Standard_Real TUTV,TgTU,TgTV,TUTU,TVTV,DIS;
//------------------------------------------------------------
//-- Calcul de Tguv1
//--
ThePSurfaceTool::D1(MySurf1,u1,v1,Pbid,TU,TV);
TUTU = TU.Dot(TU);
TVTV = TV.Dot(TV);
TUTV = TU.Dot(TV);
TgTU = Tg.Dot(TU);
TgTV = Tg.Dot(TV);
DIS = TUTU * TVTV - TUTV * TUTV;
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
Tguv1.SetCoord(DeltaU,DeltaV); MyTguv1 = Tguv1;
//------------------------------------------------------------
//-- Calcul de Tguv2
//--
ThePSurfaceTool::D1(MySurf2,u2,v2,Pbid,TU,TV);
TUTU = TU.Dot(TU);
TVTV = TV.Dot(TV);
TUTV = TU.Dot(TV);
TgTU = Tg.Dot(TU);
TgTV = Tg.Dot(TV);
DIS = TUTU * TVTV - TUTV * TUTV;
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
Tguv2.SetCoord(DeltaU,DeltaV); MyTguv2 = Tguv2;
return(Standard_True);
}
//--------------------------------------------------------------------------------
void ApproxInt_PrmPrmSvSurfaces::Pnt(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Pnt& P) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
#ifdef DEB
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
#else
this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
#endif
P=MyPnt;
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Tangency(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Vec& T) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
T=MyTg;
return(t);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::TangencyOnSurf1(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Vec2d& T) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
T=MyTguv1;
return(t);
}
//--------------------------------------------------------------------------------
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::TangencyOnSurf2(const Standard_Real u1,
const Standard_Real v1,
const Standard_Real u2,
const Standard_Real v2,
gp_Vec2d& T) {
gp_Pnt aP;
gp_Vec aT;
gp_Vec2d aTS1,aTS2;
Standard_Real tu1=u1;
Standard_Real tu2=u2;
Standard_Real tv1=v1;
Standard_Real tv2=v2;
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
T=MyTguv2;
return(t);
}
//--------------------------------------------------------------------------------
#if 0
//------------------------------------------------------------
//-- Calcul de Tguv1
//--
ThePSurfaceTool::D1(MySurf1,u1,v1,P,TU,TV);
TUTV = TU.Dot(TV);
TgTU = Tg.Dot(TU);
TgTV = Tg.Dot(TV);
UmTUTV2 = 1.0 - TUTV * TUTV;
DeltaU = (TgTU - TgTV * TUTV ) / UmTUTV2 ;
DeltaV = (TgTV - TgTU * TUTV ) / UmTUTV2 ;
Delta = 1.0 / Sqrt(DeltaU * DeltaU + DeltaV * DeltaV);
Tguv1.Multiplied(Delta); MyTguv1 = Tguv1;
//------------------------------------------------------------
//-- Calcul de Tguv2
//--
ThePSurfaceTool::D1(MySurf2,u2,v2,P,TU,TV);
TUTV = TU.Dot(TV);
TgTU = Tg.Dot(TU);
TgTV = Tg.Dot(TV);
UmTUTV2 = 1.0 - TUTV * TUTV;
DeltaU = (TgTU - TgTV * TUTV ) / UmTUTV2 ;
DeltaV = (TgTV - TgTU * TUTV ) / UmTUTV2 ;
Delta = 1.0 / Sqrt(DeltaU * DeltaU + DeltaV * DeltaV);
Tguv2.Multiplied(Delta); MyTguv2 = Tguv2;
return(Standard_True);
}
#endif

View File

@@ -0,0 +1,50 @@
-- File: ApproxInt_SvSurfaces.cdl
-- Created: Wed Mar 17 12:19:46 1993
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1993
deferred class SvSurfaces from ApproxInt
uses
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp
is
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~ApproxInt_SvSurfaces(){Delete() ; }"
Compute(me: in out;
u1,v1,u2,v2: in out Real from Standard;
Pt: out Pnt from gp;
Tg: out Vec from gp;
Tguv1,Tguv2: out Vec2d from gp)
---Purpose: returns True if Tg,Tguv1 Tguv2 can be computed.
returns Boolean from Standard is deferred;
Pnt(me: in out;
u1,v1,u2,v2: in Real from Standard;
P: out Pnt from gp) is deferred;
Tangency(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec from gp)
returns Boolean from Standard is deferred;
TangencyOnSurf1(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is deferred;
TangencyOnSurf2(me: in out;
u1,v1,u2,v2: in Real from Standard;
Tg: out Vec2d from gp)
returns Boolean from Standard is deferred;
end SvSurfaces;

View File

@@ -0,0 +1,6 @@
#include <ApproxInt_SvSurfaces.ixx>
void ApproxInt_SvSurfaces::Delete()
{}

View File

@@ -0,0 +1,50 @@
-- File: ApproxInt_WLine.cdl
-- Created: Mon Nov 8 10:44:58 1993
-- Author: Laurent BUCHARD
-- <lbr@nonox>
---Copyright: Matra Datavision 1993
generic class WLine from ApproxInt (
TheCurve as any;
TheCurveTool as any;
TheCurve2d as any;
TheCurveTool2d as any)
inherits TShared from MMgt
uses PntOn2S from IntSurf,
LineOn2S from IntSurf
is
Create(CurveXYZ: TheCurve;
CurveUV1: TheCurve2d;
CurveUV2: TheCurve2d)
returns mutable WLine from ApproxInt;
Create(lin: LineOn2S from IntSurf; Tang: Boolean from Standard)
returns mutable WLine from ApproxInt;
NbPnts(me)
returns Integer from Standard
is static;
Point(me: mutable; Index: Integer from Standard)
returns PntOn2S from IntSurf
is static;
fields
curvxyz : TheCurve;
curvuv1 : TheCurve2d;
curvuv2 : TheCurve2d;
pnton2s : PntOn2S from IntSurf;
linon2s : LineOn2S from IntSurf;
end WLine;

View File

@@ -0,0 +1,56 @@
// File: ApproxInt_WLine.gxx
// Created: Mon Nov 8 10:00:00 1993
// Author: lbr
// Copyright: Matra Datavision 1993
ApproxInt_WLine::ApproxInt_WLine(const TheCurve& CurveXYZ,
const TheCurve2d& CurveUV1,
const TheCurve2d& CurveUV2) {
curvxyz = CurveXYZ;
curvuv1 = CurveUV1;
curvuv2 = CurveUV2;
}
ApproxInt_WLine::ApproxInt_WLine(const Handle(IntSurf_LineOn2S)& lin,
const Standard_Boolean )
:linon2s(lin)
{
}
Standard_Integer ApproxInt_WLine::NbPnts() const {
if(!curvxyz.IsNull())
return(curvxyz->NbPoles());
if(!curvuv1.IsNull())
return(curvuv1->NbPoles());
if(!curvuv2.IsNull())
return(curvuv2->NbPoles());
return(linon2s->NbPoints());
}
IntSurf_PntOn2S ApproxInt_WLine::Point(const Standard_Integer Index) {
if(!linon2s.IsNull()) {
if(linon2s->NbPoints()) {
return(linon2s->Value(Index));
}
}
gp_Pnt2d P1,P2;
gp_Pnt P;
if(!curvxyz.IsNull())
P = curvxyz->Pole(Index);
if(!curvuv1.IsNull())
P1 = curvuv1->Pole(Index);
if(!curvuv2.IsNull())
P2 = curvuv2->Pole(Index);
pnton2s.SetValue(P,
P1.X(),
P1.Y(),
P2.X(),
P2.Y());
return(pnton2s);
}

2
src/ApproxInt/FILES Executable file
View File

@@ -0,0 +1,2 @@
ApproxInt_MultiLineTool.gxx