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

85
src/Blend/Blend.cdl Executable file
View File

@@ -0,0 +1,85 @@
-- File: Blend.cdl
-- Created: Thu Dec 2 10:37:10 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
package Blend
uses IntSurf,
TColgp,
TColStd,
Adaptor2d,
gp,
TopAbs,
math,
TCollection,
MMgt,
StdFail,
GeomAbs
is
-- deferred generic class SurfaceTool;
generic class Iterator; -- template class
deferred class AppFunction; -- inherits FunctionSetWithDerivatives from math
deferred class Function; -- inherits AppFunction from Blend
deferred class FuncInv; -- inherits FunctionSetWithDerivatives from math
deferred class CSFunction; -- inherits AppFunction from Blend
deferred class SurfRstFunction; -- inherits AppFunction from Blend
deferred class SurfPointFuncInv; -- inherits FunctionSetWithDerivatives from math
deferred class SurfCurvFuncInv; -- inherits FunctionSetWithDerivatives from math
deferred class RstRstFunction; -- inherits AppFunction from Blend
deferred class CurvPointFuncInv; -- inherits FunctionSetWithDerivatives from math
class Point;
generic class Extremity;
generic class PointOnRst;
generic class Line;
generic class Walking;
generic class CSWalking;
class SequenceOfPoint instantiates Sequence from TCollection
(Point from Blend);
enumeration Status is
StepTooLarge,
StepTooSmall,
Backward,
SamePoints,
OnRst1,
OnRst2,
OnRst12,
OK
end Status;
enumeration DecrochStatus is
NoDecroch,
DecrochRst1,
DecrochRst2,
DecrochBoth
end Status;
end Blend;

257
src/Blend/Blend_AppFunction.cdl Executable file
View File

@@ -0,0 +1,257 @@
-- File: Blend_AppFunction.cdl
-- Created: Mon Sep 13 16:54:05 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred class AppFunction from Blend
inherits FunctionSetWithDerivatives from math
---Purpose: Deferred class for a function used to compute a blending
-- surface between two surfaces, using a guide line.
-- The vector <X> used in Value, Values and Derivatives methods
-- has to be the vector of the parametric coordinates U1,V1,
-- U2,V2, of the extremities of a section on the first and
-- second surface.
uses Vector from math,
Matrix from math,
Pnt from gp,
Shape from GeomAbs,
Point from Blend,
Array1OfPnt from TColgp,
Array1OfVec from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd
raises DomainError from Standard
is
NbVariables(me)
---Purpose: returns the number of variables of the function.
returns Integer from Standard
is deferred;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; Param: Real from Standard)
---Purpose: Sets the value of the parameter along the guide line.
-- This determines the plane in which the solution has
-- to be found.
is deferred;
Set(me: in out; First, Last: Real from Standard)
---Purpose: Sets the bounds of the parametric interval on
-- the guide line.
-- This determines the derivatives in these values if the
-- function is not Cn.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 4 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 4 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 4 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
-- The computation is made at the current value of
-- the parameter on the guide line.
returns Boolean from Standard
is deferred;
GetMinimalDistance(me)
---Purpose: Returns the minimal Distance beetween two
-- extremitys of calculed sections.
returns Real from Standard
is deferred;
Pnt1(me)
---Purpose: Returns the point on the first support.
---C++: return const &
returns Pnt from gp
is deferred;
Pnt2(me)
---Purpose: Returns the point on the first support.
---C++: return const &
returns Pnt from gp
is deferred;
-- Methods for the approximation
--
IsRational(me) returns Boolean
---Purpose: Returns if the section is rationnal
is deferred;
GetSectionSize(me) returns Real
---Purpose: Returns the length of the maximum section
is deferred;
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
---Purpose: Compute the minimal value of weight for each poles
-- of all sections.
is deferred;
NbIntervals(me; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(me) >= <S>
is deferred;
Intervals(me; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
--
-- The array must provide enough room to accomodate
-- for the parameters. i.e. T.Length() > NbIntervals()
-- raises
-- OutOfRange from Standard
is deferred;
GetShape(me: in out;
NbPoles : out Integer from Standard;
NbKnots : out Integer from Standard;
Degree : out Integer from Standard;
NbPoles2d : out Integer from Standard)
is deferred;
GetTolerance(me;
BoundTol, SurfTol, AngleTol : Real;
Tol3d : out Vector;
Tol1D : out Vector )
---Purpose: Returns the tolerance to reach in approximation
-- to respecte
-- BoundTol error at the Boundary
-- AngleTol tangent error at the Boundary
-- SurfTol error inside the surface.
is deferred;
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
is deferred;
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
Weigths : out Array1OfReal from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
D2Poles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
D2Poles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd;
D2Weigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Resolution(me;
IC2d : Integer from Standard;
Tol : Real from Standard;
TolU, TolV : out Real from Standard)
is deferred;
-- Static function for approx
Parameter(me; P: Point from Blend)
---Purpose: Returns the parameter of the point P. Used to
-- impose the parameters in the approximation.
returns Real from Standard
is static;
end AppFunction;

15
src/Blend/Blend_AppFunction.cxx Executable file
View File

@@ -0,0 +1,15 @@
#include <Blend_AppFunction.ixx>
//=======================================================================
//function : Parameter
//purpose :
//=======================================================================
Standard_Real Blend_AppFunction::Parameter(const Blend_Point& P) const
{
return P.Parameter();
}

327
src/Blend/Blend_CSFunction.cdl Executable file
View File

@@ -0,0 +1,327 @@
-- File: Blend_CSFunction.cdl
-- Created: Mon Sep 13 16:54:05 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred class CSFunction from Blend
inherits AppFunction from Blend
---Purpose: Deferred class for a function used to compute a blending
-- surface between a surface and a curve, using a guide line.
-- The vector <X> used in Value, Values and Derivatives methods
-- may be the vector of the parametric coordinates U,V,
-- W of the extremities of a section on the surface and
-- the curve.
uses Vector from math,
Matrix from math,
Vec from gp,
Vec2d from gp,
Pnt from gp,
Pnt2d from gp,
Point from Blend,
Array1OfPnt from TColgp,
Array1OfVec from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd
raises DomainError from Standard
is
NbVariables(me)
---Purpose: Returns 3 (default value). Can be redefined.
returns Integer from Standard
is virtual;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; Param: Real from Standard)
---Purpose: Sets the value of the parameter along the guide line.
-- This determines the plane in which the solution has
-- to be found.
is deferred;
Set(me: in out; First, Last: Real from Standard)
---Purpose: Sets the bounds of the parametric interval on
-- the guide line.
-- This determines the derivatives in these values if the
-- function is not Cn.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 3 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 3 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 3 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
-- The computation is made at the current value of
-- the parameter on the guide line.
returns Boolean from Standard
is deferred;
GetMinimalDistance(me)
---Purpose: Returns the minimal Distance beetween two
-- extremitys of calculed sections.
returns Real from Standard
is redefined;
--- TheFollowing methods are called only when
-- IsSolution returns Standard_True.
Pnt1(me)
---Purpose: Returns the point on the first support.
---See Also: PointOnC
---C++: return const &
returns Pnt from gp
is redefined static;
Pnt2(me)
---Purpose: Returns the point on the seconde support.
---See Also: PointOnS
---C++: return const &
returns Pnt from gp
is redefined static;
PointOnS(me)
---Purpose: Returns the point on the surface.
returns Pnt from gp
---C++: return const&
is deferred;
PointOnC(me)
---Purpose: Returns the point on the curve.
returns Pnt from gp
---C++: return const&
is deferred;
Pnt2d(me)
---Purpose: Returns U,V coordinates of the point on the surface.
returns Pnt2d from gp
---C++: return const&
is deferred;
ParameterOnC(me)
---Purpose: Returns parameter of the point on the curve.
returns Real from Standard
is deferred;
IsTangencyPoint(me)
---Purpose: Returns True when it is not possible to compute
-- the tangent vectors at PointOnS and/or PointOnC.
returns Boolean from Standard
is deferred;
TangentOnS(me)
---Purpose: Returns the tangent vector at PointOnS, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2d(me)
---Purpose: Returns the tangent vector at PointOnS, in the
-- parametric space of the first surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
TangentOnC(me)
---Purpose: Returns the tangent vector at PointOnC, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent(me; U,V: Real from Standard;
TgS,NormS: out Vec from gp)
---Purpose: Returns the tangent vector at the section,
-- at the beginning and the end of the section, and
-- returns the normal (of the surfaces) at
-- these points.
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
-- Methods for the approximation
--
GetShape(me: in out;
NbPoles : out Integer from Standard;
NbKnots : out Integer from Standard;
Degree : out Integer from Standard;
NbPoles2d : out Integer from Standard)
is deferred;
GetTolerance(me;
BoundTol, SurfTol, AngleTol : Real;
Tol3d : out Vector;
Tol1D : out Vector )
---Purpose: Returns the tolerance to reach in approximation
-- to respecte
-- BoundTol error at the Boundary
-- AngleTol tangent error at the Boundary
-- SurfTol error inside the surface.
is deferred;
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
is deferred;
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
Weigths : out Array1OfReal from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
D2Poles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
D2Poles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd;
D2Weigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is redefined;
end CSFunction;

37
src/Blend/Blend_CSFunction.cxx Executable file
View File

@@ -0,0 +1,37 @@
#include <Blend_CSFunction.ixx>
#include <Standard_NotImplemented.hxx>
Standard_Integer Blend_CSFunction::NbVariables () const
{
return 3;
}
const gp_Pnt& Blend_CSFunction::Pnt1() const
{
return PointOnC();
}
const gp_Pnt& Blend_CSFunction::Pnt2() const
{
return PointOnS();
}
Standard_Boolean Blend_CSFunction::Section(const Blend_Point& P,
TColgp_Array1OfPnt& Poles,
TColgp_Array1OfVec& DPoles,
TColgp_Array1OfVec& D2Poles,
TColgp_Array1OfPnt2d& Poles2d,
TColgp_Array1OfVec2d& DPoles2d,
TColgp_Array1OfVec2d& D2Poles2d,
TColStd_Array1OfReal& Weigths,
TColStd_Array1OfReal& DWeigths,
TColStd_Array1OfReal& D2Weigths)
{
return Standard_False;
}
Standard_Real Blend_CSFunction::GetMinimalDistance() const
{
Standard_NotImplemented::Raise("Blend_CSFunction::GetMinimalDistance");
return RealLast();
}

188
src/Blend/Blend_CSWalking.cdl Executable file
View File

@@ -0,0 +1,188 @@
-- File: Blend_CSWalking.cdl
-- Created: Thu Dec 2 11:33:03 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
generic class CSWalking from Blend
(TheVertex as any;
TheArc as any;
TheSurface as any;
TheCurve as any;
TheVertexTool as any;
TheArcTool as any;
TheSurfaceTool as any;
TheCurveTool as any;
TheTopolTool as Transient;
TheBlendTool as any;
ThePointOnRst as any; -- as PointOnRst from Blend(TheArc)
TheSeqPointOnRst as any; -- as Iterator from Blend(ThePointOnRst)
TheExtremity as any; -- as Extremity from Blend(TheVertex,TheArc,
-- ThePointOnRst,TheSeqPointOnRst)
TheLine as Transient) -- as Line from Blend(TheVertex,TheArc,
-- ThePointOnRst,TheSeqPointOnRst,
-- TheExtremity)
---Purpose:
uses Point from Blend,
Status from Blend,
Vector from math,
Matrix from math,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
HArray1OfReal from TColStd,
Transition from IntSurf,
CSFunction from Blend
-- CSFuncInv from Blend
raises NotDone from StdFail
is
Create(Curv : TheCurve; Surf: TheSurface; Domain: TheTopolTool)
returns CSWalking from Blend;
Perform(me: in out; F : in out CSFunction from Blend;
-- FInv : in out CSFuncInv from Blend;
Pdep : Real from Standard;
Pmax : Real from Standard;
MaxStep : Real from Standard;
TolGuide: Real from Standard;
Soldep : Vector from math;
Tolesp : Real from Standard;
Fleche : Real from Standard;
Appro : Boolean from Standard = Standard_False)
is static;
Complete(me: in out;F : in out CSFunction from Blend;
-- FInv : in out FuncInv from Blend;
Pmin : Real from Standard)
returns Boolean from Standard
raises NotDone from StdFail
is static;
InternalPerform (me: in out;F : in out CSFunction from Blend;
-- FInv : in out CSFuncInv from Blend;
Sol : in out Vector from math;
Bound : Real from Standard)
is static private;
IsDone(me)
returns Boolean from Standard
---C++: inline
is static;
Line(me)
returns TheLine
---C++: inline
---C++: return const&
raises NotDone from StdFail
is static;
-- Recadre(me: in out; FInv : in out CSFuncInv from Blend;
-- Sol: Vector from math;
-- Solrst : out Vector from math;
-- Indexsol: out Integer from Standard;
-- IsVtx: out Boolean from Standard;
-- Vtx: out TheVertex)
-- returns Boolean from Standard
-- is static private;
Transition(me:in out; A: TheArc; Param: Real from Standard;
TLine,TArc: out Transition from IntSurf)
is static private;
MakeExtremity(me:in out; Extrem : in out TheExtremity;
Index : Integer from Standard;
Param : Real from Standard;
IsVtx : Boolean from Standard;
Vtx : TheVertex)
is static private;
CheckDeflectionOnSurf(me: in out; Psurf : Pnt from gp;
Ponsurf : Pnt2d from gp;
Tgsurf : Vec from gp;
Tgonsurf: Vec2d from gp)
returns Status from Blend
is static private;
CheckDeflectionOnCurv(me: in out; Pcurv : Pnt from gp;
Poncurv : Real from Standard;
Tgcurv : Vec from gp)
returns Status from Blend
is static private;
TestArret(me: in out; F : in out CSFunction from Blend;
Sol : Vector from math;
TestDeflection : Boolean from Standard;
State: Status from Blend)
returns Status from Blend
is static private;
fields
done : Boolean from Standard;
line : TheLine;
surf : TheSurface;
curv : TheCurve;
domain : TheTopolTool;
tolesp : Real from Standard;
tolgui : Real from Standard;
pasmax : Real from Standard;
fleche : Real from Standard;
param : Real from Standard;
firstparam : Real from Standard;
firstsol : HArray1OfReal from TColStd;
previousP : Point from Blend;
rebrou : Boolean from Standard;
iscomplete : Boolean from Standard;
comptra : Boolean from Standard;
sens : Real from Standard;
end CSWalking;

63
src/Blend/Blend_CSWalking.gxx Executable file
View File

@@ -0,0 +1,63 @@
#include <math_FunctionSetRoot.hxx>
#include <math_Gauss.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <IntSurf.hxx>
#include <Adaptor2d_HCurve2d.hxx>
#include <Precision.hxx>
#ifdef DEB
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Geom_BSplineCurve.hxx>
#ifdef DRAW
#include <DrawTrSurf.hxx>
#endif
//POP pour NT
#include <stdio.h>
static Standard_Integer IndexOfSection = 0;
extern Standard_Boolean Blend_GettraceDRAWSECT();
// Pour debug : visualisation de la section
static void Drawsect(const TheSurface& surf,
const TheCurve& curv,
const Standard_Real param,
Blend_CSFunction& Func)
{
gp_Pnt2d p2d = Func.Pnt2d();
Standard_Real pc = Func.ParameterOnC();
Blend_Point BP(TheSurfaceTool::Value(surf,p2d.X(),p2d.Y()),
TheCurveTool::Value(curv,pc),
param,p2d.X(),p2d.Y(),pc);
Standard_Integer hp,hk,hd,hp2d;
Func.GetShape(hp,hk,hd,hp2d);
TColStd_Array1OfReal TK(1,hk);
Func.Knots(TK);
TColStd_Array1OfInteger TMul(1,hk);
Func.Mults(TMul);
TColgp_Array1OfPnt TP(1,hp);
TColgp_Array1OfPnt2d TP2d(1,hp2d);
TColStd_Array1OfReal TW(1,hp);
Func.Section(BP,TP,TP2d,TW);
Handle(Geom_BSplineCurve) sect = new Geom_BSplineCurve
(TP,TW,TK,TMul,hd);
IndexOfSection++;
//POP pour NT
//char name[100];
char* name = new char[100];
sprintf(name,"%s_%d","Section",IndexOfSection);
#ifdef DRAW
DrawTrSurf::Set(name,sect);
#endif
}
#endif
#include <Blend_CSWalking_1.gxx>
#include <Blend_CSWalking_2.gxx>
#include <Blend_CSWalking_3.gxx>
#include <Blend_CSWalking_4.gxx>

12
src/Blend/Blend_CSWalking.lxx Executable file
View File

@@ -0,0 +1,12 @@
#include <StdFail_NotDone.hxx>
inline Standard_Boolean Blend_CSWalking::IsDone () const
{
return done;
}
inline const Handle(TheLine)& Blend_CSWalking::Line () const
{
if (!done) {StdFail_NotDone::Raise();}
return line;
}

158
src/Blend/Blend_CSWalking_1.gxx Executable file
View File

@@ -0,0 +1,158 @@
Blend_CSWalking::Blend_CSWalking(const TheCurve& Curv,
const TheSurface& Surf,
const Handle(TheTopolTool)& Domain):
done(Standard_False),surf(Surf),
curv(Curv)
{
domain = Domain;
}
void Blend_CSWalking::Perform(Blend_CSFunction& Func,
// Blend_CSFuncInv& FuncInv,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
const Standard_Real TolGuide,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Fleche,
const Standard_Boolean Appro)
{
done = Standard_False;
iscomplete = Standard_False;
comptra = Standard_False;
line = new TheLine ();
Standard_Integer Nbvar = Func.NbVariables();
tolesp = Abs(Tolesp);
tolgui = Abs(TolGuide);
fleche = Abs(Fleche);
rebrou = Standard_False;
pasmax = Abs(MaxStep);
math_Vector sol(1,Nbvar);
firstsol = new TColStd_HArray1OfReal(1,Nbvar);
if (Pmax-Pdep >= 0.) {
sens = 1.;
}
else {
sens = -1.;
}
Blend_Status State;
TheExtremity ptf1,ptf2;
param = Pdep;
firstparam = Pdep;
Func.Set(param);
if (Appro) {
TopAbs_State situ;
// math_Vector tolerance(1,3),infbound(1,3),supbound(1,3);
math_Vector tolerance(1,Nbvar),infbound(1,Nbvar),supbound(1,Nbvar);
Func.GetTolerance(tolerance,tolesp);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
rsnld.Perform(Func,ParDep,infbound,supbound);
if (!rsnld.IsDone()) {
return;
}
rsnld.Root(sol);
// situ1 = TheTopolTool::Classify(surf1,gp_Pnt2d(sol(1),sol(2)),
// Max(tolerance(1),tolerance(2)));
// situ2 = TheTopolTool::Classify(surf2,gp_Pnt2d(sol(3),sol(4)),
// Max(tolerance(3),tolerance(4)));
/*
situ = domain->Classify(gp_Pnt2d(sol(1),sol(2)),
Min(tolerance(1),tolerance(2)));
*/
situ = domain->Classify(Func.Pnt2d(),
Min(tolerance(1),tolerance(2)));
if (situ != TopAbs_IN ) {
return;
}
}
else {
sol = ParDep;
}
for (Standard_Integer i=1; i<= Nbvar; i++) {
firstsol->ChangeValue(i) = sol(i);
}
State = TestArret(Func,sol,Standard_False,Blend_OK);
if (State!=Blend_OK) {
return;
}
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf,curv,param,Func);
}
#endif
// Mettre a jour la ligne.
line->Append(previousP);
Standard_Real U,V,W;
previousP.ParametersOnS(U,V);
W = previousP.ParameterOnC();
TheExtremity P1(previousP.PointOnS(),U,V,previousP.Parameter(),tolesp);
TheExtremity P2(previousP.PointOnC(),W,previousP.Parameter(),tolesp);
if (sens>0.) {
line->SetStartPoints(P1,P2);
}
else {
line->SetEndPoints(P1,P2);
}
// InternalPerform(Func,FuncInv,Pmax);
InternalPerform(Func,sol,Pmax);
done = Standard_True;
}
Standard_Boolean Blend_CSWalking::Complete(Blend_CSFunction& Func,
// Blend_CSFuncInv& FuncInv,
const Standard_Real Pmin)
{
if (!done) {StdFail_NotDone::Raise();}
if (iscomplete) {return Standard_True;}
/*
if (sens >0.) {
previousP = line->Point(1);
}
else {
previousP = line->Point(line->NbPoints());
}
*/
sens = -sens;
/*
param = previousP.Parameter();
previousP.ParametersOnS(sol(1),sol(2));
sol(3) = previousP.ParameterOnC();
*/
Standard_Integer Nbvar = Func.NbVariables();
math_Vector sol(1,Nbvar);
for (Standard_Integer i =1; i<= Nbvar; i++) {
sol(i) = firstsol->Value(i);
}
param = firstparam;
// InternalPerform(Func,FuncInv,Pmin);
InternalPerform(Func,sol,Pmin);
sens = -sens;
iscomplete = Standard_True;
return Standard_True;
}

342
src/Blend/Blend_CSWalking_2.gxx Executable file
View File

@@ -0,0 +1,342 @@
Blend_Status Blend_CSWalking::TestArret(Blend_CSFunction& Function,
const math_Vector& Sol,
const Standard_Boolean TestDefl,
const Blend_Status State)
// On regarde si le point donne est solution.
// Si c est le cas,
// On verifie le critere de fleche sur surf et curv
// Si OK, on classifie les point sur surf
// Si le point est dedans : on retourne Blend_OK
// sinon on resout le pb inverse sur la surface
// sinon (fleche non OK)
// on renvoie Blend_StepTooLarge.
// sinon on renvoie Blend_StepTooLarge.
//
{
gp_Pnt pt1,pt2;
gp_Vec V1,V2;
gp_Vec Tgp1,Nor1;
gp_Vec2d V12d;
gp_Pnt2d pt2d;
Standard_Real pOnC;
Blend_Status State1,State2;
#ifndef DEB
IntSurf_TypeTrans tras = IntSurf_Undecided;
#else
IntSurf_TypeTrans tras;
#endif
if (Function.IsSolution(Sol,tolesp)) {
pt1 = Function.PointOnS();
pt2 = Function.PointOnC();
pt2d = Function.Pnt2d();
pOnC = Function.ParameterOnC();
V1 = Function.TangentOnS();
V2 = Function.TangentOnC();
V12d = Function.Tangent2d();
if (TestDefl) {
// Verification du critere de fleche sur chaque surface
//et sur la ligne guide
State1 = CheckDeflectionOnSurf(pt1,
// gp_Pnt2d(sol(1),sol(2)),
pt2d,
V1,V12d);
// State2 = CheckDeflectionOnCurv(pt2,sol(3),V2);
// Pour des pb dans les cheminements point/face on met
// temporairement le test sur la courbe au placard.
// State2 = CheckDeflectionOnCurv(pt2,pOnC,V2);
State2 = Blend_StepTooSmall;
}
else {
State1 = Blend_OK;
State2 = Blend_OK;
}
if (State1 == Blend_Backward) {
State1 = Blend_StepTooLarge;
rebrou= Standard_True;
}
if (State2 == Blend_Backward) {
State2 = Blend_StepTooLarge;
rebrou = Standard_True;
}
if (State1 == Blend_StepTooLarge ||
State2 == Blend_StepTooLarge) {
return Blend_StepTooLarge;
}
if (!comptra) {
// Function.Tangent(sol(1),sol(2),Tgp1,Nor1);
Function.Tangent(pt2d.X(),pt2d.Y(),Tgp1,Nor1);
Standard_Real testra = Tgp1.Dot(Nor1.Crossed(V1));
if (Abs(testra) > Precision::Confusion()) {
if (testra < 0.) {
tras = IntSurf_In;
}
else if (testra >0.) {
tras = IntSurf_Out;
}
comptra = Standard_True;
line->Set(tras);
}
}
if (State1 == Blend_OK ||
State2 == Blend_OK ) {
previousP.SetValue(Function.PointOnS(),
Function.PointOnC(),
param,
// sol(1),sol(2),
// sol(3),
pt2d.X(),pt2d.Y(),
pOnC,
V1,V2,
V12d);
return State;
}
if (State1 == Blend_StepTooSmall &&
State2 == Blend_StepTooSmall) {
previousP.SetValue(Function.PointOnS(),
Function.PointOnC(),
param,
// sol(1),sol(2),
// sol(3),
pt2d.X(),pt2d.Y(),
pOnC,
V1,V2,
V12d);
if (State == Blend_OK) {
return Blend_StepTooSmall;
}
else {
return State;
}
}
if (State == Blend_OK) {
return Blend_SamePoints;
}
else {
return State;
}
}
else {
return Blend_StepTooLarge;
}
}
Blend_Status Blend_CSWalking::CheckDeflectionOnSurf
(const gp_Pnt& Psurf,
const gp_Pnt2d& Ponsurf,
const gp_Vec& Tgsurf,
const gp_Vec2d& Tgonsurf)
{
// regle par tests dans U4 correspond a 11.478 d
const Standard_Real CosRef3D = 0.98;
const Standard_Real CosRef2D = 0.88; // correspond a 25 d
Standard_Real Norme, prevNorme, Cosi, Cosi2; // JAG MODIF 25.04.94
Standard_Real FlecheCourante;
Standard_Real Du,Dv,Duv,SqrtDuv;
Standard_Real paramu,paramv,tolu,tolv;
// TColgp_Array1OfPnt Poles(1,4);
// gp_Pnt POnCurv,Milieu;
gp_Pnt prevP;
gp_Vec prevTg;
gp_Vec2d previousd2d;
prevP = previousP.PointOnS();
prevTg = previousP.TangentOnS();
tolu = TheSurfaceTool::UResolution(surf,tolesp);
tolv = TheSurfaceTool::VResolution(surf,tolesp);
gp_Vec Corde(prevP,Psurf);
Norme = Corde.SquareMagnitude();
prevNorme = prevTg.SquareMagnitude(); // JAG MODIF 25.04.94
if (Norme <= tolesp*tolesp || prevNorme <= tolesp*tolesp) { // JAG MODIF 25.04.94
// il faudra peut etre forcer meme point JAG MODIF 25.04.94
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;
if (Cosi <0.) { // angle 3d>pi/2. --> retour arriere
return Blend_Backward;
}
Cosi2 = Cosi * Cosi / prevNorme / Norme;
if (Cosi2 < CosRef3D) {
return Blend_StepTooLarge;
}
previousP.ParametersOnS(paramu,paramv);
previousd2d = previousP.Tangent2d();
Du = Ponsurf.X() - paramu;
Dv = Ponsurf.Y() - paramv;
Duv = Du * Du + Dv * Dv;
SqrtDuv = Sqrt(Duv);
if ((Abs(Du) < tolu && Abs(Dv) < tolv) || // JAG MODIF 25.04.94
(Abs(previousd2d.X()) < tolu && Abs(previousd2d.Y()) < tolv)){
// il faudra peut etre forcer meme point JAG MODIF 25.04.94
return Blend_SamePoints; //point confondu 2d
}
Cosi = sens*(Du * previousd2d.X() + Dv * previousd2d.Y());
if (Cosi < 0) {
return Blend_Backward;
}
// Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
Cosi = sens*Corde*Tgsurf;
Cosi2 = Cosi * Cosi / Tgsurf.SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D || Cosi < 0.) {
return Blend_StepTooLarge;
}
// Voir s il faut faire le controle sur le signe de Cosi
Cosi = sens*(Du * Tgonsurf.X() + Dv * Tgonsurf.Y())/Tgonsurf.Magnitude();
Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D || Cosi <0.) {
return Blend_StepTooLarge;
}
// Estimation de la fleche courante
/*
Norme = Sqrt(Norme)/3.;
Poles(1) = prevP;
Poles(4) = Psurf;
Poles(2) = Poles(1).XYZ() + sens*Norme* prevTg.Normalized().XYZ();
Poles(3) = Poles(4).XYZ() - sens*Norme* Tgsurf.Normalized().XYZ();
BzCLib::PntPole(0.5,Poles,POnCurv);
Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5;
FlecheCourante = Milieu.Distance(POnCurv);
if (FlecheCourante <= 0.5*fleche) {
*/
FlecheCourante = (prevTg.Normalized().XYZ()-Tgsurf.Normalized().XYZ()).SquareModulus()*Norme/64.;
if (FlecheCourante <= 0.25*fleche*fleche) {
return Blend_StepTooSmall;
}
if (FlecheCourante > fleche*fleche) {
// pas trop grand : commentaire interessant
return Blend_StepTooLarge;
}
return Blend_OK;
}
Blend_Status Blend_CSWalking::CheckDeflectionOnCurv
(const gp_Pnt& Pcurv,
const Standard_Real Param,
const gp_Vec& Tgcurv)
{
// regle par tests dans U4 correspond a 11.478 d
const Standard_Real CosRef3D = 0.98;
Standard_Real Norme, prevNorme, Cosi, Cosi2; // JAG MODIF 25.04.94
Standard_Real FlecheCourante;
Standard_Real Du,paramu,tolu;
// TColgp_Array1OfPnt Poles(1,4);
// gp_Pnt POnCurv,Milieu;
gp_Pnt prevP;
gp_Vec prevTg;
prevP = previousP.PointOnC();
prevTg = previousP.TangentOnC();
tolu = TheCurveTool::Resolution(curv,tolesp);
gp_Vec Corde(prevP,Pcurv);
Norme = Corde.SquareMagnitude();
prevNorme = prevTg.SquareMagnitude(); // JAG MODIF 25.04.94
// if (Norme <= tolesp*tolesp || prevNorme <= tolesp*tolesp) { // JAG MODIF 25.04.94
if (Norme <= tolesp*tolesp) { // le 95.01.10
// il faudra peut etre forcer meme point JAG MODIF 25.04.94
return Blend_SamePoints;
}
else if (prevNorme > tolesp*tolesp) {
Cosi = sens*Corde*prevTg;
if (Cosi <0.) { // angle 3d>pi/2. --> retour arriere
return Blend_Backward;
}
Cosi2 = Cosi * Cosi / prevNorme / Norme;
if (Cosi2 < CosRef3D) {
return Blend_StepTooLarge;
}
}
paramu = previousP.ParameterOnC();
Du = Param - paramu;
if (Abs(Du) < tolu){
// il faudra peut etre forcer meme point JAG MODIF 25.04.94
return Blend_SamePoints; //point confondu 2d
}
// Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
if (Tgcurv.Magnitude() <= tolesp) {
return Blend_SamePoints; // GROS BOBARD EN ATTENDANT
}
Cosi = sens*Corde*Tgcurv;
Cosi2 = Cosi * Cosi / Tgcurv.SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D || Cosi < 0.) {
return Blend_StepTooLarge;
}
if (prevNorme > tolesp*tolesp) {
// Estimation de la fleche courante
/*
Norme = Sqrt(Norme)/3.;
Poles(1) = prevP;
Poles(4) = Pcurv;
Poles(2) = Poles(1).XYZ() + sens*Norme* prevTg.Normalized().XYZ();
Poles(3) = Poles(4).XYZ() - sens*Norme* Tgcurv.Normalized().XYZ();
BzCLib::PntPole(0.5,Poles,POnCurv);
Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5;
FlecheCourante = Milieu.Distance(POnCurv);
if (FlecheCourante <= 0.5*fleche) {
*/
FlecheCourante = (prevTg.Normalized().XYZ()-Tgcurv.Normalized().XYZ()).SquareModulus()*Norme/64.;
if (FlecheCourante <= 0.25*fleche*fleche) {
return Blend_StepTooSmall;
}
if (FlecheCourante > fleche*fleche) {
// pas trop grand : commentaire interessant
return Blend_StepTooLarge;
}
}
return Blend_OK;
}

234
src/Blend/Blend_CSWalking_3.gxx Executable file
View File

@@ -0,0 +1,234 @@
/*
Standard_Boolean Blend_CSWalking::Recadre(Blend_FuncInv& FuncInv,
const Standard_Boolean OnFirst,
const math_Vector& sol,
math_Vector& solrst,
Standard_Integer& Indexsol,
Standard_Boolean& IsVtx,
TheVertex& Vtx)
{
Standard_Integer nbarc;
Standard_Boolean ok,yamin;
Standard_Real dist,distmin,prm,pmin;
gp_Pnt2d pt2d;
math_Vector toler(1,4),infb(1,4),supb(1,4),valsol(1,4);
Handle(TheTopolTool) Iter;
TopAbs_State situ;
yamin = Standard_False;
nbarc = 0;
distmin = RealLast();
if (OnFirst) {
pt2d.SetCoord(sol(1),sol(2));
Iter = domain1;
}
else {
pt2d.SetCoord(sol(3),sol(4));
Iter = domain2;
}
Iter->Init();
while (Iter->More()) {
nbarc++;
if (OnFirst) {
ok = TheBlendTool::Project(pt2d,surf1,Iter->Value(),prm,dist);
}
else {
ok = TheBlendTool::Project(pt2d,surf2,Iter->Value(),prm,dist);
}
if (ok) {
if (dist<distmin) {
yamin = Standard_True;
distmin = dist;
pmin = prm;
Indexsol = nbarc;
}
}
Iter->Next();
}
IsVtx = Standard_False;
if (!yamin) {
return Standard_False;
}
Iter->Init();
nbarc = 1;
while (nbarc < Indexsol) {
nbarc++;
Iter->Next();
}
TheArc thearc = Iter->Value();
Handle(Adaptor2d_HCurve2d) thecur;
if (OnFirst) {
thecur = TheBlendTool::CurveOnSurf(thearc,surf1);
}
else {
thecur = TheBlendTool::CurveOnSurf(thearc,surf2);
}
FuncInv.Set(OnFirst,thecur);
FuncInv.GetTolerance(toler,tolesp);
FuncInv.GetBounds(infb,supb);
solrst(1) = pmin;
solrst(2) = param;
if (OnFirst) {
solrst(3) = sol(3);
solrst(4) = sol(4);
}
else {
solrst(3) = sol(1);
solrst(4) = sol(2);
}
math_FunctionSetRoot rsnld(FuncInv,toler,30);
rsnld.Perform(FuncInv,solrst,infb,supb);
if (!rsnld.IsDone()) {
cout << "RSNLD not done "<< endl << endl;
return Standard_False;
}
// On doit verifier la valeur de la fonction
rsnld.Root(solrst);
if (FuncInv.IsSolution(solrst,tolesp)) {
// if (OnFirst) {
// situ = TheTopolTool::Classify(surf2,gp_Pnt2d(solrst(3),solrst(4)),
// Max(toler(3),toler(4)));
//
// }
// else {
// situ = TheTopolTool::Classify(surf1,gp_Pnt2d(solrst(3),solrst(4)),
// Max(toler(3),toler(4)));
// }
if (OnFirst) {
situ = domain2->Classify(gp_Pnt2d(solrst(3),solrst(4)),
Min(toler(3),toler(4)));
}
else {
situ = domain1->Classify(gp_Pnt2d(solrst(3),solrst(4)),
Min(toler(3),toler(4)));
}
if ((situ != TopAbs_IN) && (situ != TopAbs_ON)) {
return Standard_False;
}
Iter->Initialize(thearc);
Iter->InitVertexIterator();
IsVtx = !Iter->MoreVertex();
while (!IsVtx) {
Vtx = Iter->Vertex();
if (Abs(TheBlendTool::Parameter(Vtx,thearc)-solrst(1)) <=
TheBlendTool::Tolerance(Vtx,thearc)) {
IsVtx = Standard_True;
}
else {
Iter->NextVertex();
IsVtx = !Iter->MoreVertex();
}
}
if (!Iter->MoreVertex()) {
IsVtx = Standard_False;
}
return Standard_True;
}
return Standard_False;
}
*/
void Blend_CSWalking::Transition(const TheArc& A,
const Standard_Real Param,
IntSurf_Transition& TLine,
IntSurf_Transition& TArc)
{
gp_Pnt2d p2d;
gp_Vec2d dp2d;
gp_Pnt pbid;
gp_Vec d1u,d1v,normale,tgrst;
TheArcTool::D1(A,Param,p2d,dp2d);
TheSurfaceTool::D1(surf,p2d.X(),p2d.Y(),pbid,d1u,d1v);
tgrst.SetLinearForm(dp2d.X(),d1u,dp2d.Y(),d1v);
normale = d1u.Crossed(d1v);
IntSurf::MakeTransition(previousP.TangentOnS(),tgrst,normale,TLine,TArc);
}
void Blend_CSWalking::MakeExtremity(TheExtremity& Extrem,
const Standard_Integer Index,
const Standard_Real Param,
const Standard_Boolean IsVtx,
const TheVertex& Vtx)
{
IntSurf_Transition Tline,Tarc;
Standard_Real prm,U,V;
Standard_Integer nbarc;
Handle(TheTopolTool) Iter;
// Extrem.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
previousP.ParametersOnS(U,V);
Extrem.SetValue(previousP.PointOnS(),U,V,previousP.Parameter(),tolesp);
Iter = domain;
Iter->Init();
nbarc = 1;
if (!IsVtx) {
while (nbarc < Index) {
nbarc++;
Iter->Next();
}
Transition(Iter->Value(),Param,Tline,Tarc);
Extrem.AddArc(Iter->Value(),Param,Tline,Tarc);
}
else {
Extrem.SetVertex(Vtx);
while (Iter->More()) {
TheArc arc = Iter->Value();
if (nbarc != Index) {
Iter->Initialize(arc);
Iter->InitVertexIterator();
while (Iter->MoreVertex()) {
// if (TheTopolTool::Identical(Vtx,Iter.Vertex())) {
if (Iter->Identical(Vtx,Iter->Vertex())) {
prm = TheBlendTool::Parameter(Vtx,arc);
Transition(arc,prm,Tline,Tarc);
Extrem.AddArc(arc,prm,Tline,Tarc);
}
Iter->NextVertex();
}
}
else {
Transition(arc,Param,Tline,Tarc);
Extrem.AddArc(arc,Param,Tline,Tarc);
}
nbarc++;
Iter->Next();
}
}
}

279
src/Blend/Blend_CSWalking_4.gxx Executable file
View File

@@ -0,0 +1,279 @@
void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
// Blend_CSFuncInv& FuncInv,
math_Vector& sol,
const Standard_Real Bound)
{
Standard_Real stepw = pasmax;
Standard_Real parprec = param;
Blend_Status State;
TopAbs_State situ;
Standard_Real w,U,V;
Standard_Integer nbarc;
#ifndef DEB
Standard_Integer Index = 0;
Standard_Boolean Isvtx = Standard_False;
#else
Standard_Integer Index;
Standard_Boolean Isvtx;
#endif
Standard_Integer Nbvar = Func.NbVariables();
Standard_Boolean Arrive,recad,echecrecad;
gp_Pnt2d p2d;
// math_Vector tolerance(1,3),infbound(1,3),supbound(1,3),parinit(1,3);
// math_Vector solrst(1,3);
math_Vector tolerance(1,Nbvar),infbound(1,Nbvar),supbound(1,Nbvar),
parinit(1,Nbvar);
math_Vector solrst(1,Nbvar);
TheVertex Vtx;
TheExtremity Exts,Extc;
//IntSurf_Transition Tline,Tarc;
Func.GetTolerance(tolerance,tolesp);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
parinit = sol;
param = parprec + sens*stepw;
Arrive = (sens *(param - Bound) > 0.) ;
// if (Arrive) {
// line->Clear();
// }
while (!Arrive) {
Func.Set(param);
rsnld.Perform(Func,parinit,infbound,supbound);
if (!rsnld.IsDone()) {
State = Blend_StepTooLarge;
}
else {
rsnld.Root(sol);
// situ1 = TheTopolTool::Classify(surf1,gp_Pnt2d(sol(1),sol(2)),
// Max(tolerance(1),tolerance(2)));
// situ2 = TheTopolTool::Classify(surf2,gp_Pnt2d(sol(3),sol(4)),
// Max(tolerance(3),tolerance(4)));
/*
situ = domain->Classify(gp_Pnt2d(sol(1),sol(2)),
Min(tolerance(1),tolerance(2)));
*/
situ = domain->Classify(Func.Pnt2d(),
Min(tolerance(1),tolerance(2)));
w = Bound;
recad = Standard_False;
echecrecad = Standard_False;
if (situ == TopAbs_OUT || situ == TopAbs_ON) {
// pb inverse sur surf
// recad = Recadre(FuncInv,sol,solrst,Index,Isvtx,Vtx);
Isvtx = Standard_False; // en attendant Recadre
if (recad) {
w = solrst(2);
}
else {
echecrecad = Standard_True;
}
}
if (!echecrecad) {
if (recad) {
// sol sur surf
State = Blend_OnRst1;
param = w;
domain->Init();
nbarc = 1;
while (nbarc < Index) {
nbarc++;
domain->Next();
}
p2d = TheArcTool::Value(domain->Value(),solrst(1));
sol(1) = p2d.X();
sol(2) = p2d.Y();
sol(3) = solrst(3);
Func.Set(param);
}
else {
State = Blend_OK;
}
State = TestArret(Func,sol,Standard_True,State);
}
else {
// Echec recadrage. On sort avec PointsConfondus
State = Blend_SamePoints;
}
}
switch (State) {
case Blend_OK :
{
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf,curv,param,Func);
}
#endif
// Mettre a jour la ligne.
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
parinit = sol;
parprec = param;
if (param == Bound) {
Arrive = Standard_True;
/*
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
// Indiquer que fin sur Bound.
}
else {
param = param + sens*stepw;
if (sens*(param - Bound) > - tolgui) {
param = Bound;
}
}
}
break;
case Blend_StepTooLarge :
{
stepw = stepw/2.;
if (Abs(stepw) < tolgui) {
/*
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
Extc.SetValue(previousP.PointOnC(),sol(3),sol(4),tolesp);
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
Arrive = Standard_True;
if (line->NbPoints()>=2) {
// Indiquer qu on s arrete en cours de cheminement
}
// else {
// line->Clear();
// }
}
else {
param = parprec + sens*stepw; // on ne risque pas de depasser Bound.
}
}
break;
case Blend_StepTooSmall :
{
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf,curv,param,Func);
}
#endif
// Mettre a jour la ligne.
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
parinit = sol;
parprec = param;
stepw = Min(1.5*stepw,pasmax);
if (param == Bound) {
Arrive = Standard_True;
/*
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
// Indiquer que fin sur Bound.
}
else {
param = param + sens*stepw;
if (sens*(param - Bound) > - tolgui) {
param = Bound;
}
}
}
break;
case Blend_OnRst1 :
{
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf,curv,param,Func);
}
#endif
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
MakeExtremity(Exts,Index,solrst(1),Isvtx,Vtx);
// Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
Arrive = Standard_True;
}
break;
case Blend_SamePoints :
{
// On arrete
cout << " Points confondus dans le cheminement" << endl;
/*
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
Arrive = Standard_True;
}
break;
#ifndef DEB
default:
break;
#endif
}
if (Arrive) {
if (sens > 0.) {
line->SetEndPoints(Exts,Extc);
}
else {
line->SetStartPoints(Exts,Extc);
}
}
}
}

View File

@@ -0,0 +1,90 @@
-- File: Blend_CurvPointFuncInv.cdl
-- Created: Wed Feb 12 11:16:58 1997
-- Author: Laurent BOURESCHE
-- <lbo@pomalox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
deferred class CurvPointFuncInv from Blend
---Purpose: Deferred class for a function used to compute a
-- blending surface between a surface and a curve, using
-- a guide line. This function is used to find a
-- solution on a done point of the curve.
-- The vector <X> used in Value, Values and Derivatives
-- methods has to be the vector of the parametric
-- coordinates w, U, V where w is the parameter on the
-- guide line, U,V are the parametric coordinates of a
-- point on the partner surface.
inherits FunctionSetWithDerivatives from math
uses
Pnt from gp,
Vector from math,
Matrix from math
is
NbVariables(me)
---Purpose: Returns 3.
returns Integer from Standard
is static;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; P : Pnt from gp)
---Purpose: Set the Point on which a solution has to be found.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 3 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 3 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 3 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
returns Boolean from Standard
is deferred;
end CurvPointFuncInv;

View File

@@ -0,0 +1,19 @@
// File: Blend_CurvPointFuncInv.cxx
// Created: Wed Feb 12 14:01:00 1997
// Author: Laurent BOURESCHE
// <lbo@pomalox.paris1.matra-dtv.fr>
#include <Blend_CurvPointFuncInv.ixx>
//=======================================================================
//function : NbVariables
//purpose :
//=======================================================================
Standard_Integer Blend_CurvPointFuncInv::NbVariables() const
{
return 2;
}

39
src/Blend/Blend_Debug.cxx Executable file
View File

@@ -0,0 +1,39 @@
// File: Blend_Debug.cxx
// Created: Mon Oct 3 10:15:31 1994
// Author: Laurent BOURESCHE
// <lbo@phylox>
#include <Standard_Boolean.hxx>
#ifndef __Blend_API
# if defined(WNT) && !defined(HAVE_NO_DLL)
# ifdef __Blend_DLL
# define __Blend_API __declspec( dllexport )
# else
# define __Blend_API __declspec( dllimport )
# endif /*__Blend_DLL*/
# else
# define __Blend_API
# endif /*WNT*/
#endif /*__Blend_API*/
//*************************************************
// recuperation des surfaces des conges approximes.
//*************************************************
static Standard_Boolean Blend_traceDRAWSECT = Standard_False;
__Blend_API extern void Blend_SettraceDRAWSECT(const Standard_Boolean b)
{ Blend_traceDRAWSECT = b; }
__Blend_API extern Standard_Boolean Blend_GettraceDRAWSECT()
{ return Blend_traceDRAWSECT; }
//*************************************************
// Contexte sans test de deflexion
//*************************************************
static Standard_Boolean Blend_contextNOTESTDEFL = Standard_False;
__Blend_API extern void Blend_SetcontextNOTESTDEFL(const Standard_Boolean b)
{ Blend_contextNOTESTDEFL = b; }
__Blend_API extern Standard_Boolean Blend_GetcontextNOTESTDEFL()
{ return Blend_contextNOTESTDEFL; }

233
src/Blend/Blend_Extremity.cdl Executable file
View File

@@ -0,0 +1,233 @@
-- File: Blend_Extremity.cdl
-- Created: Tue Jan 25 10:00:47 1994
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1994
generic class Extremity from Blend
(TheVertex as any;
TheArc as any;
ThePointOnRst as any; -- as PointOnRst from Blend(TheArc)
TheSequenceOfPointOnRst as any) -- as Iterator from Blend(ThePointOnRst)
---Purpose:
uses Pnt from gp,
Vec from gp,
Transition from IntSurf
raises DomainError from Standard,
OutOfRange from Standard
is
Create
returns Extremity from Blend;
Create(P: Pnt from gp;
U,V,Param: Real from Standard; Tol: Real from Standard)
---Purpose: Creates an extremity on a surface
returns Extremity from Blend;
Create(P: Pnt from gp;
U,V,Param: Real from Standard; Tol: Real from Standard;
Vtx: TheVertex)
---Purpose: Creates an extremity on a surface. This extremity matches
-- the vertex <Vtx>.
returns Extremity from Blend;
Create(P: Pnt from gp;
W, Param: Real from Standard; Tol: Real from Standard)
---Purpose: Creates an extremity on a curve
returns Extremity from Blend;
SetValue(me: in out; P: Pnt from gp;
U,V,Param : Real from Standard;
Tol: Real from Standard)
---Purpose: Set the values for an extremity on a surface.
is static;
SetValue(me: in out; P: Pnt from gp;
U,V,Param: Real from Standard;
Tol: Real from Standard; Vtx: TheVertex)
---Purpose: Set the values for an extremity on a surface.This
-- extremity matches the vertex <Vtx>.
is static;
SetValue(me: in out; P: Pnt from gp;
W,Param: Real from Standard;
Tol: Real from Standard)
---Purpose: Set the values for an extremity on curve.
is static;
Value(me)
---Purpose: This method returns the value of the point in 3d space.
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
SetTangent(me: in out; Tangent : Vec from gp)
---Purpose: Set the tangent vector for an extremity on a
-- surface.
---C++: inline
is static;
HasTangent(me)
---Purpose: Returns TRUE if the Tangent is stored.
returns Boolean from Standard
---C++: inline
is static;
Tangent(me)
---Purpose: This method returns the value of tangent in 3d
-- space.
returns Vec from gp
---C++: inline
---C++: return const&
is static;
Tolerance(me)
---Purpose: This method returns the fuzziness on the point
-- in 3d space.
returns Real from Standard
---C++: inline
is static;
-- methods for an extremity on a surface
SetVertex(me: in out; V: TheVertex)
---Purpose: Set the values for an extremity on a curve.
is static;
AddArc(me: in out; A: TheArc; Param: Real from Standard;
TLine, TArc: Transition from IntSurf)
---Purpose: Sets the values of a point which is on the arc
-- A, at parameter Param.
is static;
Parameters(me; U,V: out Real from Standard)
---Purpose: This method returns the parameters of the point
-- on the concerned surface.
---C++: inline
is static;
IsVertex(me)
---Purpose: Returns Standard_True when the point coincide with
-- an existing vertex.
returns Boolean from Standard
---C++: inline
is static;
Vertex(me)
---Purpose: Returns the vertex when IsVertex returns Standard_True.
returns any TheVertex
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsVertex returns Standard_False
is static;
NbPointOnRst(me)
---Purpose: Returns the number of arc containing the extremity.
-- If the method returns 0, the point is inside the
-- surface.
-- Otherwise, the extremity lies on at least 1 arc,
-- and all the information (arc, parameter, transitions)
-- are given by the point on restriction (PointOnRst)
-- returned by the next method.
returns Integer from Standard
---C++: inline
is static;
PointOnRst(me; Index: Integer from Standard)
---Purpose:
returns any ThePointOnRst
---C++: inline
---C++: return const&
raises OutOfRange from Standard
--- The exception is raised when Index <=0 or Index > NbPointOnRst
is static;
-- method for an extremity on a curve
Parameter(me)
returns Real from Standard
---C++: inline
is static;
-- method for the parameter on the guide
ParameterOnGuide(me)
returns Real from Standard
---C++: inline
is static;
fields
vtx : TheVertex;
seqpt : TheSequenceOfPointOnRst;
pt : Pnt from gp;
tang : Vec from gp;
param : Real from Standard;
u : Real from Standard;
v : Real from Standard;
tol : Real from Standard;
isvtx : Boolean from Standard;
hastang: Boolean from Standard;
end Extremity;

106
src/Blend/Blend_Extremity.gxx Executable file
View File

@@ -0,0 +1,106 @@
Blend_Extremity::Blend_Extremity ():
pt(gp_Pnt(0,0,0)),
tang(gp_Vec(0,0,0)),
param(0.0), u(0.0), v(0.0), tol(0.0),
isvtx(Standard_False), hastang(Standard_False)
{
}
Blend_Extremity::Blend_Extremity (const gp_Pnt& P,
const Standard_Real U,
const Standard_Real V,
const Standard_Real Param,
const Standard_Real Tol) :
pt(P),
tang(gp_Vec(0,0,0)),
param(Param),u(U),v(V),tol(Tol),isvtx(Standard_False),
hastang(Standard_False)
{
}
Blend_Extremity::Blend_Extremity (const gp_Pnt& P,
const Standard_Real U,
const Standard_Real V,
const Standard_Real Param,
const Standard_Real Tol,
const TheVertex& Vtx) :
vtx(Vtx),pt(P),
tang(gp_Vec(0,0,0)),
param(Param),u(U),v(V),tol(Tol),isvtx(Standard_True),
hastang(Standard_False)
{}
Blend_Extremity::Blend_Extremity (const gp_Pnt& P,
const Standard_Real W,
const Standard_Real Param,
const Standard_Real Tol) :
pt(P),
tang(gp_Vec(0,0,0)),
param(Param),u(W),tol(Tol),isvtx(Standard_False),
hastang(Standard_False)
{}
void Blend_Extremity::SetValue (const gp_Pnt& P,
const Standard_Real U,
const Standard_Real V,
const Standard_Real Param,
const Standard_Real Tol)
{
pt = P;
u = U;
v = V;
param = Param;
tol = Tol;
isvtx = Standard_False;
seqpt.Clear();
}
void Blend_Extremity::SetValue (const gp_Pnt& P,
const Standard_Real U,
const Standard_Real V,
const Standard_Real Param,
const Standard_Real Tol,
const TheVertex& Vtx)
{
pt = P;
u = U;
v = V;
param = Param;
tol = Tol;
isvtx = Standard_True;
vtx = Vtx;
seqpt.Clear();
}
void Blend_Extremity::SetValue (const gp_Pnt& P,
const Standard_Real W,
const Standard_Real Param,
const Standard_Real Tol)
{
pt = P;
u = W;
param = Param;
tol = Tol;
isvtx = Standard_False;
seqpt.Clear();
}
void Blend_Extremity::SetVertex (const TheVertex& V)
{
isvtx = Standard_True;
vtx = V;
}
void Blend_Extremity::AddArc (const TheArc& A,
const Standard_Real Param,
const IntSurf_Transition& TLine,
const IntSurf_Transition& TArc)
{
seqpt.Append(ThePointOnRst(A,Param,TLine,TArc));
}

72
src/Blend/Blend_Extremity.lxx Executable file
View File

@@ -0,0 +1,72 @@
#include <Standard_DomainError.hxx>
inline const gp_Pnt& Blend_Extremity::Value () const
{
return pt;
}
inline void Blend_Extremity::SetTangent(const gp_Vec& Tangent)
{
hastang = Standard_True;
tang = Tangent;
}
inline Standard_Boolean Blend_Extremity::HasTangent () const
{
return hastang;
}
inline const gp_Vec& Blend_Extremity::Tangent () const
{
if (!hastang) {Standard_DomainError::Raise();}
return tang;
}
inline void Blend_Extremity::Parameters(Standard_Real& U,
Standard_Real& V) const
{
U = u;
V = v;
}
inline Standard_Real Blend_Extremity::Tolerance() const
{
return tol;
}
inline Standard_Boolean Blend_Extremity::IsVertex() const
{
return isvtx;
}
inline const TheVertex& Blend_Extremity::Vertex () const
{
if (!isvtx) {Standard_DomainError::Raise();}
return vtx;
}
inline Standard_Integer Blend_Extremity::NbPointOnRst () const
{
return seqpt.Length();
}
inline const ThePointOnRst& Blend_Extremity::PointOnRst
(const Standard_Integer Index) const
{
return seqpt(Index);
}
inline Standard_Real Blend_Extremity::Parameter() const
{
return u;
}
inline Standard_Real Blend_Extremity::ParameterOnGuide() const
{
return param;
}

112
src/Blend/Blend_FuncInv.cdl Executable file
View File

@@ -0,0 +1,112 @@
-- File: Blend_FuncInv.cdl
-- Created: Thu Dec 2 18:28:48 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred class FuncInv from Blend
inherits FunctionSetWithDerivatives from math
---Purpose: Deferred class for a function used to compute a blending
-- surface between two surfaces, using a guide line.
-- This function is used to find a solution on a restriction
-- of one of the surface.
-- The vector <X> used in Value, Values and Derivatives methods
-- has to be the vector of the parametric coordinates t,w,U,V
-- where t is the parameter on the curve on surface,
-- w is the parameter on the guide line,
-- U,V are the parametric coordinates of a point on the
-- partner surface.
uses Vector from math,
Matrix from math,
HCurve2d from Adaptor2d
is
NbVariables(me)
---Purpose: Returns 4.
returns Integer from Standard
is static;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; OnFirst: Boolean from Standard;
COnSurf: HCurve2d from Adaptor2d)
---Purpose: Sets the CurveOnSurface on which a solution has
-- to be found. If <OnFirst> is set to Standard_True,
-- the curve will be on the first surface, otherwise the
-- curve is on the second one.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 4 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 4 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 4 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
returns Boolean from Standard
is deferred;
end FuncInv;

6
src/Blend/Blend_FuncInv.cxx Executable file
View File

@@ -0,0 +1,6 @@
#include <Blend_FuncInv.ixx>
Standard_Integer Blend_FuncInv::NbVariables () const
{
return 4;
}

324
src/Blend/Blend_Function.cdl Executable file
View File

@@ -0,0 +1,324 @@
-- File: Blend_Function.cdl
-- Created: Mon Sep 13 16:54:05 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred class Function from Blend
inherits AppFunction from Blend
---Purpose: Deferred class for a function used to compute a blending
-- surface between two surfaces, using a guide line.
-- The vector <X> used in Value, Values and Derivatives methods
-- has to be the vector of the parametric coordinates U1,V1,
-- U2,V2, of the extremities of a section on the first and
-- second surface.
uses Vector from math,
Matrix from math,
Vec from gp,
Vec2d from gp,
Pnt from gp,
Point from Blend,
Array1OfPnt from TColgp,
Array1OfVec from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd
raises DomainError from Standard
is
NbVariables(me)
---Purpose: Returns 4.
returns Integer from Standard ;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; Param: Real from Standard)
---Purpose: Sets the value of the parameter along the guide line.
-- This determines the plane in which the solution has
-- to be found.
is deferred;
Set(me: in out; First, Last: Real from Standard)
---Purpose: Sets the bounds of the parametric interval on
-- the guide line.
-- This determines the derivatives in these values if the
-- function is not Cn.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 4 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 4 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 4 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
-- The computation is made at the current value of
-- the parameter on the guide line.
returns Boolean from Standard
is deferred;
--- TheFollowing methods are called only when
-- IsSolution returns Standard_True.
Pnt1(me)
---Purpose: Returns the point on the first support.
---See Also: PointOnS1
---C++: return const &
returns Pnt from gp
is redefined static;
Pnt2(me)
---Purpose: Returns the point on the seconde support.
---See Also: PointOnS2
---C++: return const &
returns Pnt from gp
is redefined static;
PointOnS1(me)
---Purpose: Returns the point on the first surface, at parameter
-- Sol(1),Sol(2) (Sol is the vector used in the call of
-- IsSolution.
returns Pnt from gp
---C++: return const&
is deferred;
PointOnS2(me)
---Purpose: Returns the point on the second surface, at parameter
-- Sol(3),Sol(4) (Sol is the vector used in the call of
-- IsSolution.
returns Pnt from gp
---C++: return const&
is deferred;
IsTangencyPoint(me)
---Purpose: Returns True when it is not possible to compute
-- the tangent vectors at PointOnS1 and/or PointOnS2.
returns Boolean from Standard
is deferred;
TangentOnS1(me)
---Purpose: Returns the tangent vector at PointOnS1, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2dOnS1(me)
---Purpose: Returns the tangent vector at PointOnS1, in the
-- parametric space of the first surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
TangentOnS2(me)
---Purpose: Returns the tangent vector at PointOnS2, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2dOnS2(me)
---Purpose: Returns the tangent vector at PointOnS2, in the
-- parametric space of the second surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent(me; U1,V1,U2,V2: Real from Standard;
TgFirst,TgLast,NormFirst,NormLast: out Vec from gp)
---Purpose: Returns the tangent vector at the section,
-- at the beginning and the end of the section, and
-- returns the normal (of the surfaces) at
-- these points.
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
TwistOnS1(me)
returns Boolean from Standard
is virtual;
TwistOnS2(me)
returns Boolean from Standard
is virtual;
-- Methods for the approximation
--
GetShape(me: in out;
NbPoles : out Integer from Standard;
NbKnots : out Integer from Standard;
Degree : out Integer from Standard;
NbPoles2d : out Integer from Standard)
is deferred;
GetTolerance(me;
BoundTol, SurfTol, AngleTol : Real;
Tol3d : out Vector;
Tol1D : out Vector )
---Purpose: Returns the tolerance to reach in approximation
-- to respecte
-- BoundTol error at the Boundary
-- AngleTol tangent error at the Boundary
-- SurfTol error inside the surface.
is deferred;
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
is deferred;
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
Weigths : out Array1OfReal from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
D2Poles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
D2Poles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd;
D2Weigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False
returns Boolean from Standard
is redefined;
end Function;

40
src/Blend/Blend_Function.cxx Executable file
View File

@@ -0,0 +1,40 @@
#include <Blend_Function.ixx>
Standard_Integer Blend_Function::NbVariables () const
{
return 4;
}
const gp_Pnt& Blend_Function::Pnt1() const
{
return PointOnS1();
}
const gp_Pnt& Blend_Function::Pnt2() const
{
return PointOnS2();
}
Standard_Boolean Blend_Function::TwistOnS1() const
{
return Standard_False;
}
Standard_Boolean Blend_Function::TwistOnS2() const
{
return Standard_False;
}
Standard_Boolean Blend_Function::Section(const Blend_Point& P,
TColgp_Array1OfPnt& Poles,
TColgp_Array1OfVec& DPoles,
TColgp_Array1OfVec& D2Poles,
TColgp_Array1OfPnt2d& Poles2d,
TColgp_Array1OfVec2d& DPoles2d,
TColgp_Array1OfVec2d& D2Poles2d,
TColStd_Array1OfReal& Weigths,
TColStd_Array1OfReal& DWeigths,
TColStd_Array1OfReal& D2Weigths)
{
return Standard_False;
}

50
src/Blend/Blend_Iterator.cdl Executable file
View File

@@ -0,0 +1,50 @@
-- File: Blend_Iterator.cdl
-- Created: Thu Dec 2 16:13:15 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
generic class Iterator from Blend (Item as any)
---Purpose: Template class for an iterator.
-- A Sequence from TCollection can implement this iterator.
is
Create
---Purpose: Creates an empty iterator.
returns Iterator;
Clear(me: in out);
---Purpose: Clears the content of the iterator.
Append(me: in out; I: Item);
---Purpose: Adds an element in the iterator.
Length(me: in out)
---Purpose: Returns the number of elements in the iterator.
returns Integer;
Value(me: in out; Index: Integer from Standard)
---Purpose: Returns the element of range Index.
returns any Item;
---C++: return const&
---C++: alias operator()
end Iterator;

0
src/Blend/Blend_Iterator.gxx Executable file
View File

235
src/Blend/Blend_Line.cdl Executable file
View File

@@ -0,0 +1,235 @@
-- File: Blend_Line.cdl
-- Created: Thu Dec 2 15:48:17 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
generic class Line from Blend
(TheVertex as any;
TheArc as any;
ThePointOnRst as any; -- as PointOnRst from Blend(TheArc)
TheSequenceOfPointOnRst as any;
TheExtremity as any) -- as Extremity from Blend (TheVertex,TheArc,
-- ThePointOnRst,TheSequenceOfPointOnRst)
inherits TShared from MMgt
uses Point from Blend,
SequenceOfPoint from Blend,
TypeTrans from IntSurf
raises OutOfRange from Standard
is
Create
returns mutable Line from Blend;
Clear(me: mutable)
---Purpose: Clears the content of the line.
is static;
Append(me: mutable; P: Point from Blend)
---Purpose: Adds a point in the line.
---C++: inline
is static;
Prepend(me: mutable; P: Point from Blend)
---Purpose: Adds a point in the line at the first place.
---C++: inline
is static;
InsertBefore(me : mutable;
Index : Integer from Standard;
P : Point from Blend)
---Purpose: Adds a point in the line at the first place.
---C++: inline
is static;
Remove(me: mutable; FromIndex,ToIndex: Integer from Standard)
---Purpose: Removes from <me> all the items of
-- positions between <FromIndex> and <ToIndex>.
-- Raises an exception if the indices are out of bounds.
---C++: inline
raises OutOfRange from Standard
is static;
Set(me: mutable; TranS1,TranS2: TypeTrans from IntSurf)
---Purpose: Sets the value of the transition of the line on S1 and
-- the line on S2.
is static;
Set(me: mutable; Trans: TypeTrans from IntSurf)
---Purpose: Sets the value of the transition of the line on a surface
is static;
SetStartPoints(me: mutable; StartPt1,StartPt2: TheExtremity)
---Purpose: Sets the values of the start points for the line.
---C++: inline
is static;
SetEndPoints(me: mutable; EndPt1,EndPt2: TheExtremity)
---Purpose: Sets tne values of the end points for the line.
---C++: inline
is static;
NbPoints(me)
---Purpose: Returns the number of points in the line.
returns Integer from Standard
---C++: inline
is static;
Point(me; Index: Integer from Standard)
---Purpose: Returns the point of range Index.
returns Point from Blend
---C++: inline
---C++: return const&
raises OutOfRange from Standard
--- The exception OutOfRange is raised when Index <=0 or
-- Index > NbPoints
is static;
TransitionOnS1(me)
---Purpose: Returns the type of the transition of the line defined
-- on the first surface. The transition is "constant"
-- along the line.
-- The transition is IN if the line is oriented in such
-- a way that the system of vectors (N,DRac,T) is
-- right-handed, where
-- N is the normal to the first surface at a point P,
-- DRac is a vector tangent to the blending patch,
-- oriented towards the valid part of this patch,
-- T is the tangent to the line on S1 at P.
-- The transitioon is OUT when the system of vectors is
-- left-handed.
returns TypeTrans from IntSurf
---C++: inline
is static;
TransitionOnS2(me)
---Purpose: Returns the type of the transition of the line defined
-- on the second surface. The transition is "constant"
-- along the line.
returns TypeTrans from IntSurf
---C++: inline
is static;
StartPointOnFirst(me)
---Purpose: Returns the start point on S1.
returns TheExtremity
---C++: inline
---C++: return const&
is static;
StartPointOnSecond(me)
---Purpose: Returns the start point on S2
returns TheExtremity
---C++: inline
---C++: return const&
is static;
EndPointOnFirst(me)
---Purpose: Returns the end point on S1.
returns TheExtremity
---C++: inline
---C++: return const&
is static;
EndPointOnSecond(me)
---Purpose: Returns the point on S2.
returns TheExtremity
---C++: inline
---C++: return const&
is static;
TransitionOnS(me)
---Purpose: Returns the type of the transition of the line defined
-- on the surface.
returns TypeTrans from IntSurf
---C++: inline
is static;
fields
seqpt : SequenceOfPoint from Blend;
tras1 : TypeTrans from IntSurf;
tras2 : TypeTrans from IntSurf;
stp1 : TheExtremity;
stp2 : TheExtremity;
endp1 : TheExtremity;
endp2 : TheExtremity;
hass1 : Boolean from Standard;
hass2 : Boolean from Standard;
end;

31
src/Blend/Blend_Line.gxx Executable file
View File

@@ -0,0 +1,31 @@
Blend_Line::Blend_Line ():
tras1(IntSurf_Undecided),tras2(IntSurf_Undecided),
hass1(Standard_False),hass2(Standard_False)
{}
void Blend_Line::Clear ()
{
seqpt.Clear();
hass1 = Standard_False;
hass2 = Standard_False;
tras1 = IntSurf_Undecided;
tras2 = IntSurf_Undecided;
}
void Blend_Line::Set(const IntSurf_TypeTrans TranS1,
const IntSurf_TypeTrans TranS2)
{
hass1 = Standard_True;
hass2 = Standard_True;
tras1 = TranS1;
tras2 = TranS2;
}
void Blend_Line::Set(const IntSurf_TypeTrans Trans)
{
hass1 = Standard_True;
hass2 = Standard_False;
tras1 = Trans;
}

91
src/Blend/Blend_Line.lxx Executable file
View File

@@ -0,0 +1,91 @@
#include <Blend_SequenceOfPoint.hxx>
#include <Standard_DomainError.hxx>
inline void Blend_Line::Append(const Blend_Point& P)
{
seqpt.Append(P);
}
inline void Blend_Line::Prepend(const Blend_Point& P)
{
seqpt.Prepend(P);
}
inline void Blend_Line::InsertBefore(const Standard_Integer Index,
const Blend_Point& P)
{
seqpt.InsertBefore(Index, P);
}
inline void Blend_Line::Remove(const Standard_Integer FromIndex,
const Standard_Integer ToIndex)
{
seqpt.Remove(FromIndex,ToIndex);
}
inline void Blend_Line::SetStartPoints(const TheExtremity& StartPtOnS1,
const TheExtremity& StartPtOnS2)
{
stp1 = StartPtOnS1;
stp2 = StartPtOnS2;
}
inline void Blend_Line::SetEndPoints(const TheExtremity& EndPtOnS1,
const TheExtremity& EndPtOnS2)
{
endp1 = EndPtOnS1;
endp2 = EndPtOnS2;
}
inline Standard_Integer Blend_Line::NbPoints () const
{
return seqpt.Length();
}
inline const Blend_Point& Blend_Line::Point(const Standard_Integer Index) const
{
return seqpt(Index);
}
inline IntSurf_TypeTrans Blend_Line::TransitionOnS1 () const
{
if (!hass1) {Standard_DomainError::Raise();}
return tras1;
}
inline IntSurf_TypeTrans Blend_Line::TransitionOnS2 () const
{
if (!hass2) {Standard_DomainError::Raise();}
return tras2;
}
inline const TheExtremity& Blend_Line::StartPointOnFirst() const
{
return stp1;
}
inline const TheExtremity& Blend_Line::StartPointOnSecond() const
{
return stp2;
}
inline const TheExtremity& Blend_Line::EndPointOnFirst() const
{
return endp1;
}
inline const TheExtremity& Blend_Line::EndPointOnSecond() const
{
return endp2;
}
inline IntSurf_TypeTrans Blend_Line::TransitionOnS () const
{
if (!hass1) {Standard_DomainError::Raise();}
return tras1;
}

341
src/Blend/Blend_Point.cdl Executable file
View File

@@ -0,0 +1,341 @@
-- File: Blend_Point.cdl
-- Created: Thu Dec 2 12:23:09 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
class Point from Blend
---Purpose:
uses Pnt from gp,
Vec from gp,
Vec2d from gp
raises DomainError from Standard
is
Create returns Point from Blend;
Create(Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
Tg1,Tg2 : Vec from gp;
Tg12d,Tg22d : Vec2d from gp)
---Purpose: Creates a point on 2 surfaces, with tangents.
returns Point from Blend;
Create(Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard)
---Purpose: Creates a point on 2 surfaces, without tangents.
returns Point from Blend;
Create(Pts,Ptc : Pnt from gp;
Param : Real from Standard;
U,V,W : Real from Standard;
Tgs,Tgc : Vec from gp;
Tg2d : Vec2d from gp)
---Purpose: Creates a point on a surface and a curve, with tangents.
returns Point from Blend;
Create(Pts,Ptc : Pnt from gp;
Param : Real from Standard;
U,V,W : Real from Standard)
---Purpose: Creates a point on a surface and a curve, without tangents.
returns Point from Blend;
Create(Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC : Real from Standard;
Tg1,Tg2 : Vec from gp;
Tg12d,Tg22d : Vec2d from gp)
---Purpose: Creates a point on a surface and a curve on surface,
-- with tangents.
returns Point from Blend;
Create(Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC : Real from Standard)
---Purpose: Creates a point on a surface and a curve on surface,
-- without tangents.
returns Point from Blend;
Create(Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC1,PC2 : Real from Standard;
Tg1,Tg2 : Vec from gp;
Tg12d,Tg22d : Vec2d from gp)
---Purpose: Creates a point on two curves on surfaces, with tangents.
returns Point from Blend;
Create(Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC1,PC2 : Real from Standard)
---Purpose: Creates a point on two curves on surfaces, with tangents.
returns Point from Blend;
SetValue(me: in out;Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
Tg1,Tg2 : Vec from gp;
Tg12d,Tg22d : Vec2d from gp)
---Purpose: Set the values for a point on 2 surfaces, with tangents.
is static;
SetValue(me: in out;Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard)
---Purpose: Set the values for a point on 2 surfaces, without tangents.
is static;
SetValue(me: in out;Pts,Ptc : Pnt from gp;
Param : Real from Standard;
U,V,W : Real from Standard;
Tgs,Tgc : Vec from gp;
Tg2d : Vec2d from gp)
---Purpose: Set the values for a point on a surface and a curve,
-- with tangents.
is static;
SetValue(me: in out;Pts,Ptc : Pnt from gp;
Param : Real from Standard;
U,V,W : Real from Standard)
---Purpose: Set the values for a point on a surface and a curve,
-- without tangents.
is static;
SetValue(me : in out;
Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC : Real from Standard;
Tg1,Tg2 : Vec from gp;
Tg12d,Tg22d : Vec2d from gp);
---Purpose: Creates a point on a surface and a curve on surface,
-- with tangents.
SetValue(me : in out;
Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC : Real from Standard);
---Purpose: Creates a point on a surface and a curve on surface,
-- without tangents.
SetValue(me : in out;
Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC1,PC2 : Real from Standard;
Tg1,Tg2 : Vec from gp;
Tg12d,Tg22d : Vec2d from gp);
---Purpose: Creates a point on two curves on surfaces, with tangents.
SetValue(me : in out;
Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
U1,V1,U2,V2 : Real from Standard;
PC1,PC2 : Real from Standard);
---Purpose: Creates a point on two curves on surfaces, without tangents.
SetValue(me : in out;
Pt1,Pt2 : Pnt from gp;
Param : Real from Standard;
PC1,PC2 : Real from Standard);
---Purpose: Creates a point on two curves.
Parameter(me)
returns Real from Standard
---C++: inline
is static;
IsTangencyPoint(me)
---Purpose: Returns Standard_True if it was not possible to compute
-- the tangent vectors at PointOnS1 and/or PointOnS2.
---C++: inline
returns Boolean from Standard
is static;
-- methods for a point on 2 surfaces
PointOnS1(me)
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
PointOnS2(me)
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
ParametersOnS1(me; U,V: out Real from Standard)
---C++: inline
is static;
ParametersOnS2(me; U,V: out Real from Standard)
---C++: inline
is static;
TangentOnS1(me)
returns Vec from gp
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
TangentOnS2(me)
returns Vec from gp
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
Tangent2dOnS1(me)
returns Vec2d from gp
---C++: inline
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
Tangent2dOnS2(me)
returns Vec2d from gp
---C++: inline
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
-- methods for a point on a surface and a curve
PointOnS(me)
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
PointOnC(me)
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
ParametersOnS(me; U,V: out Real from Standard)
---C++: inline
is static;
ParameterOnC(me)
returns Real from Standard
---C++: inline
is static;
TangentOnS(me)
returns Vec from gp
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
TangentOnC(me)
returns Vec from gp
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
Tangent2d(me)
returns Vec2d from gp
---C++: inline
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
-- methods for a point on two curves
PointOnC1(me)
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
PointOnC2(me)
returns Pnt from gp
---C++: inline
---C++: return const&
is static;
ParameterOnC1(me)
returns Real from Standard
---C++: inline
is static;
ParameterOnC2(me)
returns Real from Standard
---C++: inline
is static;
TangentOnC1(me)
returns Vec from gp
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
TangentOnC2(me)
returns Vec from gp
---C++: inline
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is static;
fields
pt1 : Pnt from gp;
pt2 : Pnt from gp;
tg1 : Vec from gp;
tg2 : Vec from gp;
prm : Real from Standard;
u1 : Real from Standard;
v1 : Real from Standard;
u2 : Real from Standard;
v2 : Real from Standard;
pc1 : Real from Standard;
pc2 : Real from Standard;
utg12d : Real from Standard;
vtg12d : Real from Standard;
utg22d : Real from Standard;
vtg22d : Real from Standard;
hass1 : Boolean from Standard;
hass2 : Boolean from Standard;
hasc1 : Boolean from Standard;
hasc2 : Boolean from Standard;
istgt : Boolean from Standard;
end Point;

388
src/Blend/Blend_Point.cxx Executable file
View File

@@ -0,0 +1,388 @@
#include <Blend_Point.ixx>
Blend_Point::Blend_Point ():istgt(Standard_True) {}
Blend_Point::Blend_Point(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const gp_Vec& Tg1,
const gp_Vec& Tg2,
const gp_Vec2d& Tg12d,
const gp_Vec2d& Tg22d) :
pt1(P1),pt2(P2),tg1(Tg1),tg2(Tg2),prm(Param),
u1(U1),v1(V1),u2(U2),v2(V2),
utg12d(Tg12d.X()),vtg12d(Tg12d.Y()),
utg22d(Tg22d.X()),vtg22d(Tg22d.Y()),
hass1(Standard_True), hass2(Standard_True),
hasc1(Standard_False),hasc2(Standard_False),
istgt(Standard_False)
{}
Blend_Point::Blend_Point(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2) :
pt1(P1),pt2(P2),prm(Param),
u1(U1),v1(V1),u2(U2),v2(V2),
hass1(Standard_True),hass2(Standard_True),
hasc1(Standard_False),hasc2(Standard_False),
istgt(Standard_True)
{}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const gp_Vec& Tg1,
const gp_Vec& Tg2,
const gp_Vec2d& Tg12d,
const gp_Vec2d& Tg22d)
{
pt1 = P1;
pt2 = P2;
prm = Param;
u1 = U1;
v1 = V1;
hass1 = Standard_True;
u2 = U2;
v2 = V2;
hass2 = Standard_True;
hasc1 = Standard_False;
hasc2 = Standard_False;
istgt = Standard_False;
tg1 = Tg1;
tg2 = Tg2;
utg12d = Tg12d.X();
vtg12d = Tg12d.Y();
utg22d = Tg22d.X();
vtg22d = Tg22d.Y();
}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2)
{
pt1 = P1;
pt2 = P2;
prm = Param;
u1 = U1;
v1 = V1;
hass1 = Standard_True;
u2 = U2;
v2 = V2;
hass2 = Standard_True;
hasc1 = Standard_False;
hasc2 = Standard_False;
istgt = Standard_True;
}
Blend_Point::Blend_Point(const gp_Pnt& Ps,
const gp_Pnt& Pc,
const Standard_Real Param,
const Standard_Real U,
const Standard_Real V,
const Standard_Real W,
const gp_Vec& Tgs,
const gp_Vec& Tgc,
const gp_Vec2d& Tg2d) :
pt1(Ps),pt2(Pc),tg1(Tgs),tg2(Tgc),prm(Param),
u1(U),v1(V),pc2(W),
utg12d(Tg2d.X()),vtg12d(Tg2d.Y()),
hass1(Standard_True),
hass2(Standard_False),
hasc1(Standard_False),
hasc2(Standard_True),
istgt(Standard_False)
{}
Blend_Point::Blend_Point(const gp_Pnt& Ps,
const gp_Pnt& Pc,
const Standard_Real Param,
const Standard_Real U,
const Standard_Real V,
const Standard_Real W) :
pt1(Ps),pt2(Pc),prm(Param),
u1(U),v1(V), pc2(W),
hass1(Standard_True),
hass2(Standard_False),
hasc1(Standard_False),hasc2(Standard_True),
istgt(Standard_True)
{}
void Blend_Point::SetValue(const gp_Pnt& Ps,
const gp_Pnt& Pc,
const Standard_Real Param,
const Standard_Real U,
const Standard_Real V,
const Standard_Real W,
const gp_Vec& Tgs,
const gp_Vec& Tgc,
const gp_Vec2d& Tg2d)
{
pt1 = Ps;
pt2 = Pc;
prm = Param;
u1 = U;
v1 = V;
hass1 = Standard_True;
hass2 = Standard_False;
hasc1 = Standard_False;
pc2 = W;
hasc2 = Standard_True;
istgt = Standard_False;
tg1 = Tgs;
tg2 = Tgc;
utg12d = Tg2d.X();
vtg12d = Tg2d.Y();
}
void Blend_Point::SetValue(const gp_Pnt& Ps,
const gp_Pnt& Pc,
const Standard_Real Param,
const Standard_Real U,
const Standard_Real V,
const Standard_Real W)
{
pt1 = Ps;
pt2 = Pc;
prm = Param;
u1 = U;
v1 = V;
hass1 = Standard_True;
hass2 = Standard_False;
hasc1 = Standard_False;
pc2 = W;
hasc2 = Standard_True;
istgt = Standard_True;
}
Blend_Point::Blend_Point(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC,
const gp_Vec& Tg1,
const gp_Vec& Tg2,
const gp_Vec2d& Tg12d,
const gp_Vec2d& Tg22d) :
pt1(P1),pt2(P2),tg1(Tg1),tg2(Tg2),prm(Param),
u1(U1),v1(V1),
u2(U2),v2(V2),pc2(PC),
utg12d(Tg12d.X()),vtg12d(Tg12d.Y()),
utg22d(Tg22d.X()),vtg22d(Tg22d.Y()),
hass1(Standard_True),hass2(Standard_True),
hasc1(Standard_False),
hasc2(Standard_True),
istgt(Standard_False)
{}
Blend_Point::Blend_Point(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC) :
pt1(P1),pt2(P2),prm(Param),
u1(U1),v1(V1),
u2(U2),v2(V2),pc2(PC),hass1(Standard_True),hass2(Standard_True),
hasc1(Standard_False),
hasc2(Standard_True),
istgt(Standard_True)
{}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC,
const gp_Vec& Tg1,
const gp_Vec& Tg2,
const gp_Vec2d& Tg12d,
const gp_Vec2d& Tg22d)
{
pt1 = P1;
pt2 = P2;
prm = Param;
u1 = U1;
v1 = V1;
hass1 = Standard_True;
u2 = U2;
v2 = V2;
hass2 = Standard_True;
hasc1 = Standard_False;
pc2 = PC;
hasc2 = Standard_True;
istgt = Standard_False;
tg1 = Tg1;
tg2 = Tg2;
utg12d = Tg12d.X();
vtg12d = Tg12d.Y();
utg22d = Tg22d.X();
vtg22d = Tg22d.Y();
}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC)
{
pt1 = P1;
pt2 = P2;
prm = Param;
u1 = U1;
v1 = V1;
hass1 = Standard_True;
u2 = U2;
v2 = V2;
hass2 = Standard_True;
hasc1 = Standard_False;
pc2 = PC;
hasc2 = Standard_True;
istgt = Standard_True;
}
Blend_Point::Blend_Point(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC1,
const Standard_Real PC2,
const gp_Vec& Tg1,
const gp_Vec& Tg2,
const gp_Vec2d& Tg12d,
const gp_Vec2d& Tg22d) :
pt1(P1),pt2(P2),tg1(Tg1),tg2(Tg2),prm(Param),
u1(U1),v1(V1),u2(U2),v2(V2),
pc1(PC1),pc2(PC2),
utg12d(Tg12d.X()),vtg12d(Tg12d.Y()),
utg22d(Tg22d.X()),vtg22d(Tg22d.Y()),
hass1(Standard_True),hass2(Standard_True),
hasc1(Standard_True),hasc2(Standard_True),
istgt(Standard_False)
{}
Blend_Point::Blend_Point(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC1,
const Standard_Real PC2) :
pt1(P1),pt2(P2),prm(Param),
u1(U1),v1(V1),
u2(U2),v2(V2),pc1(PC1),pc2(PC2),
hass1(Standard_True),hass2(Standard_True),
hasc1(Standard_True),hasc2(Standard_True),
istgt(Standard_True)
{}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC1,
const Standard_Real PC2,
const gp_Vec& Tg1,
const gp_Vec& Tg2,
const gp_Vec2d& Tg12d,
const gp_Vec2d& Tg22d)
{
pt1 = P1;
pt2 = P2;
prm = Param;
u1 = U1;
v1 = V1;
hass1 = Standard_True;
u2 = U2;
v2 = V2;
hass2 = Standard_True;
pc1 = PC1;
hasc1 = Standard_True;
pc2 = PC2;
hasc2 = Standard_True;
istgt = Standard_False;
tg1 = Tg1;
tg2 = Tg2;
utg12d = Tg12d.X();
vtg12d = Tg12d.Y();
utg22d = Tg22d.X();
vtg22d = Tg22d.Y();
}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real U1,
const Standard_Real V1,
const Standard_Real U2,
const Standard_Real V2,
const Standard_Real PC1,
const Standard_Real PC2)
{
pt1 = P1;
pt2 = P2;
prm = Param;
u1 = U1;
v1 = V1;
hass1 = Standard_True;
u2 = U2;
v2 = V2;
hass2 = Standard_True;
pc1 = PC1;
hasc1 = Standard_True;
pc2 = PC2;
hasc2 = Standard_True;
istgt = Standard_True;
}
void Blend_Point::SetValue(const gp_Pnt& P1,
const gp_Pnt& P2,
const Standard_Real Param,
const Standard_Real PC1,
const Standard_Real PC2)
{
pt1 = P1;
pt2 = P2;
prm = Param;
hass1 = Standard_False;
hass2 = Standard_False;
pc1 = PC1;
hasc1 = Standard_True;
pc2 = PC2;
hasc2 = Standard_True;
istgt = Standard_True;
}

140
src/Blend/Blend_Point.lxx Executable file
View File

@@ -0,0 +1,140 @@
#include <Standard_DomainError.hxx>
#include <gp_Vec2d.hxx>
inline const gp_Pnt& Blend_Point::PointOnS1 () const
{
return pt1;
}
inline const gp_Pnt& Blend_Point::PointOnS2 () const
{
return pt2;
}
inline Standard_Real Blend_Point::Parameter () const
{
return prm;
}
inline void Blend_Point::ParametersOnS1 (Standard_Real& U1,
Standard_Real& V1) const
{
if (!hass1) {Standard_DomainError::Raise();}
U1 = u1;
V1 = v1;
}
inline void Blend_Point::ParametersOnS2 (Standard_Real& U2,
Standard_Real& V2) const
{
if (!hass2) {Standard_DomainError::Raise();}
U2 = u2;
V2 = v2;
}
inline Standard_Boolean Blend_Point::IsTangencyPoint () const
{
return istgt;
}
inline const gp_Vec& Blend_Point::TangentOnS1 () const
{
if (istgt) {Standard_DomainError::Raise();}
return tg1;
}
inline const gp_Vec& Blend_Point::TangentOnS2 () const
{
if (istgt) {Standard_DomainError::Raise();}
return tg2;
}
inline gp_Vec2d Blend_Point::Tangent2dOnS1 () const
{
if (istgt || !hass1) {Standard_DomainError::Raise();}
return gp_Vec2d(utg12d,vtg12d);
}
inline gp_Vec2d Blend_Point::Tangent2dOnS2 () const
{
if (istgt || !hass2) {Standard_DomainError::Raise();}
return gp_Vec2d(utg22d,vtg22d);
}
inline const gp_Pnt& Blend_Point::PointOnS () const
{
return pt1;
}
inline const gp_Pnt& Blend_Point::PointOnC () const
{
return pt2;
}
inline void Blend_Point::ParametersOnS (Standard_Real& U1,
Standard_Real& V1) const
{
if (!hass1) {Standard_DomainError::Raise();}
U1 = u1;
V1 = v1;
}
inline Standard_Real Blend_Point::ParameterOnC () const
{
if (!hasc2) {Standard_DomainError::Raise();}
return pc2;
}
inline const gp_Vec& Blend_Point::TangentOnS () const
{
if (istgt || !hass1) {Standard_DomainError::Raise();}
return tg1;
}
inline const gp_Vec& Blend_Point::TangentOnC () const
{
if (istgt) {Standard_DomainError::Raise();}
return tg2;
}
inline gp_Vec2d Blend_Point::Tangent2d () const
{
if (istgt || !hass1) {Standard_DomainError::Raise();}
return gp_Vec2d(utg12d,vtg12d);
}
inline const gp_Pnt& Blend_Point::PointOnC1 () const
{
return pt1;
}
inline const gp_Pnt& Blend_Point::PointOnC2 () const
{
return pt2;
}
inline Standard_Real Blend_Point::ParameterOnC1 () const
{
if (!hasc1) {Standard_DomainError::Raise();}
return pc1;
}
inline Standard_Real Blend_Point::ParameterOnC2 () const
{
if (!hasc2) {Standard_DomainError::Raise();}
return pc2;
}
inline const gp_Vec& Blend_Point::TangentOnC1 () const
{
if (istgt || !hass1) {Standard_DomainError::Raise();}
return tg1;
}
inline const gp_Vec& Blend_Point::TangentOnC2 () const
{
if (istgt) {Standard_DomainError::Raise();}
return tg2;
}

109
src/Blend/Blend_PointOnRst.cdl Executable file
View File

@@ -0,0 +1,109 @@
-- File: Blend_PointOnRst.cdl
-- Created: Thu Dec 2 16:00:09 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
generic class PointOnRst from Blend
(TheArc as any)
---Purpose: Definition of an intersection point between a line
-- and a restriction on a surface.
-- Such a point is contains geometrical informations (see
-- the Value method) and logical informations.
uses Transition from IntSurf
raises DomainError from Standard
is
Create
---Purpose: Empty constructor.
returns PointOnRst from Blend;
Create( A: TheArc; Param: Real from Standard;
TLine, TArc: Transition from IntSurf)
---Purpose: Creates the PointOnRst on the arc A, at parameter Param,
-- with the transition TLine on the walking line, and
-- TArc on the arc A.
returns PointOnRst from Blend;
SetArc(me: in out; A: TheArc; Param: Real from Standard;
TLine, TArc: Transition from IntSurf)
---Purpose: Sets the values of a point which is on the arc
-- A, at parameter Param.
is static;
Arc(me)
---Purpose: Returns the arc of restriction containing the
-- vertex.
returns any TheArc
---C++: return const&
---C++: inline
is static;
TransitionOnLine(me)
---Purpose: Returns the transition of the point on the
-- line on surface.
returns Transition from IntSurf
---C++: return const&
---C++: inline
is static;
TransitionOnArc(me)
---Purpose: Returns the transition of the point on the arc
-- returned by Arc().
returns Transition from IntSurf
---C++: return const&
---C++: inline
is static;
ParameterOnArc(me)
---Purpose: Returns the parameter of the point on the
-- arc returned by the method Arc().
returns Real from Standard
---C++: inline
is static;
fields
arc : TheArc;
traline : Transition from IntSurf;
traarc : Transition from IntSurf;
prm : Real from Standard;
end PointOnRst;

22
src/Blend/Blend_PointOnRst.gxx Executable file
View File

@@ -0,0 +1,22 @@
Blend_PointOnRst::Blend_PointOnRst () {}
Blend_PointOnRst::Blend_PointOnRst(const TheArc& A,
const Standard_Real Param,
const IntSurf_Transition& TLine,
const IntSurf_Transition& TArc):
arc(A),traline(TLine),traarc(TArc),prm(Param)
{}
void Blend_PointOnRst::SetArc(const TheArc& A,
const Standard_Real Param,
const IntSurf_Transition& TLine,
const IntSurf_Transition& TArc)
{
arc = A;
prm = Param;
traline = TLine;
traarc = TArc;
}

22
src/Blend/Blend_PointOnRst.lxx Executable file
View File

@@ -0,0 +1,22 @@
#include <Standard_DomainError.hxx>
inline const TheArc& Blend_PointOnRst::Arc () const
{
return arc;
}
inline const IntSurf_Transition& Blend_PointOnRst::TransitionOnLine () const
{
return traline;
}
inline const IntSurf_Transition& Blend_PointOnRst::TransitionOnArc () const
{
return traarc;
}
inline Standard_Real Blend_PointOnRst::ParameterOnArc () const
{
return prm;
}

View File

@@ -0,0 +1,315 @@
-- File: Blend_RstRstFunction.cdl Created: Thu Feb 6 17:10:17 1997
-- Author: Jacques GOUSSARD Author: Laurent BOURESCHE --
-- <lbo@pomalox.paris1.matra-dtv.fr>
-- Modify by jlr : Ajout de la methode GetTolerance pour l'approx
--
---Copyright: Matra Datavision 1997
deferred class RstRstFunction from Blend
inherits AppFunction from Blend
---Purpose: Deferred class for a function used to compute a blending
-- surface between a surface and a pcurve on an other Surface,
-- using a guide line.
-- The vector <X> used in Value, Values and Derivatives methods
-- may be the vector of the parametric coordinates U,V,
-- W of the extremities of a section on the surface and
-- the curve.
uses Vector from math,
Matrix from math,
Vec from gp,
Vec2d from gp,
Pnt from gp,
Pnt2d from gp,
Shape from GeomAbs,
Point from Blend,
Array1OfPnt from TColgp,
Array1OfVec from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
DecrochStatus from Blend
raises DomainError from Standard
is
NbVariables(me)
---Purpose: Returns 2 (default value). Can be redefined.
returns Integer from Standard
is deferred;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; Param: Real from Standard)
---Purpose: Sets the value of the parameter along the guide line.
-- This determines the plane in which the solution has
-- to be found.
is deferred;
Set(me: in out; First, Last: Real from Standard)
---Purpose: Sets the bounds of the parametric interval on
-- the guide line.
-- This determines the derivatives in these values if the
-- function is not Cn.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each variable;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 3 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
-- The computation is made at the current value of
-- the parameter on the guide line.
returns Boolean from Standard
is deferred;
GetMinimalDistance(me)
---Purpose: Returns the minimal Distance beetween two
-- extremitys of calculed sections.
returns Real from Standard;
--- TheFollowing methods are called only when
-- IsSolution returns Standard_True.
Pnt1(me)
---Purpose: Returns the point on the first support.
---C++: return const &
returns Pnt from gp;
Pnt2(me)
---Purpose: Returns the point on the seconde support.
---C++: return const &
returns Pnt from gp;
PointOnRst1(me)
---Purpose: Returns the point on the surface.
returns Pnt from gp
---C++: return const&
is deferred;
PointOnRst2(me)
---Purpose: Returns the point on the curve.
returns Pnt from gp
---C++: return const&
is deferred;
Pnt2dOnRst1(me)
---Purpose: Returns U,V coordinates of the point on the surface.
returns Pnt2d from gp
---C++: return const&
is deferred;
Pnt2dOnRst2(me)
---Purpose: Returns U,V coordinates of the point on the curve on
-- surface.
returns Pnt2d from gp
---C++: return const&
is deferred;
ParameterOnRst1(me)
---Purpose: Returns parameter of the point on the curve.
returns Real from Standard
is deferred;
ParameterOnRst2(me)
---Purpose: Returns parameter of the point on the curve.
returns Real from Standard
is deferred;
IsTangencyPoint(me)
---Purpose: Returns True when it is not possible to compute
-- the tangent vectors at PointOnS and/or PointOnRst.
returns Boolean from Standard
is deferred;
TangentOnRst1(me)
---Purpose: Returns the tangent vector at PointOnS, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2dOnRst1(me)
---Purpose: Returns the tangent vector at PointOnS, in the
-- parametric space of the first surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
TangentOnRst2(me)
---Purpose: Returns the tangent vector at PointOnC, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2dOnRst2(me)
---Purpose: Returns the tangent vector at PointOnRst, in the
-- parametric space of the second surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Decroch(me;
Sol : Vector from math;
NRst1, TgRst1 : out Vec from gp;
NRst2, TgRst2 : out Vec from gp)
---Purpose: Enables to implement a criterion of decrochage
-- specific to the function.
-- Warning: Can be called without previous call of issolution
-- but the values calculated can be senseless.
returns DecrochStatus from Blend
is deferred;
-- Methods for the approximation
--
IsRational(me) returns Boolean
---Purpose: Returns if the section is rationnal
is deferred;
GetSectionSize(me) returns Real
---Purpose: Returns the length of the maximum section
is deferred;
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
---Purpose: Compute the minimal value of weight for each poles
-- of all sections.
is deferred;
NbIntervals(me; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(me) >= <S>
is deferred;
Intervals(me; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
--
-- The array must provide enough room to accomodate
-- for the parameters. i.e. T.Length() > NbIntervals()
is deferred;
GetShape(me: in out;
NbPoles : out Integer from Standard;
NbKnots : out Integer from Standard;
Degree : out Integer from Standard;
NbPoles2d : out Integer from Standard)
is deferred;
GetTolerance(me;
BoundTol, SurfTol, AngleTol : Real;
Tol3d : out Vector;
Tol1D : out Vector )
---Purpose: Returns the tolerance to reach in approximation
-- to respecte
-- BoundTol error at the Boundary
-- AngleTol tangent error at the Boundary
-- SurfTol error inside the surface.
is deferred;
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
is deferred;
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
Weigths : out Array1OfReal from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
D2Poles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
D2Poles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd;
D2Weigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
end RstRstFunction;

View File

@@ -0,0 +1,28 @@
// File: Blend_RstRstFunction.cxx
// Created: Fri Feb 7 15:53:16 1997
// Author: Laurent BOURESCHE
// <lbo@pomalox.paris1.matra-dtv.fr>
#include <Blend_RstRstFunction.ixx>
#include <Standard_NotImplemented.hxx>
const gp_Pnt& Blend_RstRstFunction::Pnt1() const
{
return PointOnRst1();
}
const gp_Pnt& Blend_RstRstFunction::Pnt2() const
{
return PointOnRst2();
}
Standard_Real Blend_RstRstFunction::GetMinimalDistance() const
{
Standard_NotImplemented::Raise("Blend_RstRstFunction::GetMinimalDistance");
return RealLast();
}

View File

@@ -0,0 +1,91 @@
-- File: Blend_SurfCurvFuncInv.cdl
-- Created: Fri Feb 21 14:07:50 1997
-- Author: Laurent BOURESCHE
-- <lbo@pomalox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
deferred class SurfCurvFuncInv from Blend
inherits FunctionSetWithDerivatives from math
---Purpose: Deferred class for a function used to compute a
-- blending surface between a surface and a curve, using
-- a guide line. This function is used to find a
-- solution on a done restriction of the surface.
--
-- The vector <X> used in Value, Values and Derivatives
-- methods has to be the vector of the parametric
-- coordinates wguide, wcurv, wrst where wguide is the
-- parameter on the guide line, wcurv is the parameter on
-- the curve, wrst is the parameter on the restriction on
-- the surface.
uses
HCurve2d from Adaptor2d,
Vector from math,
Matrix from math
is
NbVariables(me)
---Purpose: Returns 3.
returns Integer from Standard
is static;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; Rst : HCurve2d from Adaptor2d)
---Purpose: Set the Point on which a solution has to be found.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 3 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 3 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 3 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
returns Boolean from Standard
is deferred;
end SurfCurvFuncInv;

View File

@@ -0,0 +1,18 @@
// File: Blend_SurfCurvFuncInv.cxx
// Created: Fri Feb 21 14:16:51 1997
// Author: Laurent BOURESCHE
// <lbo@pomalox.paris1.matra-dtv.fr>
#include <Blend_SurfCurvFuncInv.ixx>
//=======================================================================
//function : NbVariables
//purpose :
//=======================================================================
Standard_Integer Blend_SurfCurvFuncInv::NbVariables() const
{
return 3;
}

View File

@@ -0,0 +1,90 @@
-- File: Blend_SurfPointFuncInv.cdl
-- Created: Wed Feb 12 11:16:58 1997
-- Author: Laurent BOURESCHE
-- <lbo@pomalox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
deferred class SurfPointFuncInv from Blend
inherits FunctionSetWithDerivatives from math
---Purpose: Deferred class for a function used to compute a
-- blending surface between a surface and a curve, using
-- a guide line. This function is used to find a
-- solution on a done point of the curve.
--
-- The vector <X> used in Value, Values and Derivatives
-- methods has to be the vector of the parametric
-- coordinates w, U, V where w is the parameter on the
-- guide line, U,V are the parametric coordinates of a
-- point on the partner surface.
uses
Pnt from gp,
Vector from math,
Matrix from math
is
NbVariables(me)
---Purpose: Returns 3.
returns Integer from Standard
is static;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; P : Pnt from gp)
---Purpose: Set the Point on which a solution has to be found.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each of the 3 variables;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each of the 3 variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 3 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
returns Boolean from Standard
is deferred;
end SurfPointFuncInv;

View File

@@ -0,0 +1,19 @@
// File: Blend_SurfPointFuncInv.cxx
// Created: Wed Feb 12 14:01:00 1997
// Author: Laurent BOURESCHE
// <lbo@pomalox.paris1.matra-dtv.fr>
#include <Blend_SurfPointFuncInv.ixx>
//=======================================================================
//function : NbVariables
//purpose :
//=======================================================================
Standard_Integer Blend_SurfPointFuncInv::NbVariables() const
{
return 3;
}

View File

@@ -0,0 +1,304 @@
-- File: Blend_SurfRstFunction.cdl Created: Thu Feb 6 17:10:17 1997
-- Author: Jacques GOUSSARD Author: Laurent BOURESCHE --
-- <lbo@pomalox.paris1.matra-dtv.fr>
-- Modify by jlr : Ajout de la methode GetTolerance pour l'approx
--
---Copyright: Matra Datavision 1997
deferred class SurfRstFunction from Blend
inherits AppFunction from Blend
---Purpose: Deferred class for a function used to compute a blending
-- surface between a surface and a pcurve on an other Surface,
-- using a guide line.
-- The vector <X> used in Value, Values and Derivatives methods
-- may be the vector of the parametric coordinates U,V,
-- W of the extremities of a section on the surface and
-- the curve.
uses Vector from math,
Matrix from math,
Vec from gp,
Vec2d from gp,
Pnt from gp,
Pnt2d from gp,
Shape from GeomAbs,
Point from Blend,
Array1OfPnt from TColgp,
Array1OfVec from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd
raises DomainError from Standard
is
NbVariables(me)
---Purpose: Returns 3 (default value). Can be redefined.
returns Integer from Standard
is deferred;
NbEquations(me)
---Purpose: returns the number of equations of the function.
returns Integer from Standard
is deferred;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- Returns True if the computation was done successfully,
-- False otherwise.
returns Boolean from Standard
is deferred;
Set(me: in out; Param: Real from Standard)
---Purpose: Sets the value of the parameter along the guide line.
-- This determines the plane in which the solution has
-- to be found.
is deferred;
Set(me: in out; First, Last: Real from Standard)
---Purpose: Sets the bounds of the parametric interval on
-- the guide line.
-- This determines the derivatives in these values if the
-- function is not Cn.
is deferred;
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
---Purpose: Returns in the vector Tolerance the parametric tolerance
-- for each variable;
-- Tol is the tolerance used in 3d space.
is deferred;
GetBounds(me; InfBound,SupBound: out Vector from math)
---Purpose: Returns in the vector InfBound the lowest values allowed
-- for each variables.
-- Returns in the vector SupBound the greatest values allowed
-- for each of the 3 variables.
is deferred;
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
---Purpose: Returns Standard_True if Sol is a zero of the function.
-- Tol is the tolerance used in 3d space.
-- The computation is made at the current value of
-- the parameter on the guide line.
returns Boolean from Standard
is deferred;
GetMinimalDistance(me)
---Purpose: Returns the minimal Distance beetween two
-- extremitys of calculed sections.
returns Real from Standard;
--- TheFollowing methods are called only when
-- IsSolution returns Standard_True.
Pnt1(me)
---Purpose: Returns the point on the first support.
---C++: return const &
returns Pnt from gp;
Pnt2(me)
---Purpose: Returns the point on the seconde support.
---C++: return const &
returns Pnt from gp;
PointOnS(me)
---Purpose: Returns the point on the surface.
returns Pnt from gp
---C++: return const&
is deferred;
PointOnRst(me)
---Purpose: Returns the point on the curve.
returns Pnt from gp
---C++: return const&
is deferred;
Pnt2dOnS(me)
---Purpose: Returns U,V coordinates of the point on the surface.
returns Pnt2d from gp
---C++: return const&
is deferred;
Pnt2dOnRst(me)
---Purpose: Returns U,V coordinates of the point on the curve on
-- surface.
returns Pnt2d from gp
---C++: return const&
is deferred;
ParameterOnRst(me)
---Purpose: Returns parameter of the point on the curve.
returns Real from Standard
is deferred;
IsTangencyPoint(me)
---Purpose: Returns True when it is not possible to compute
-- the tangent vectors at PointOnS and/or PointOnRst.
returns Boolean from Standard
is deferred;
TangentOnS(me)
---Purpose: Returns the tangent vector at PointOnS, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2dOnS(me)
---Purpose: Returns the tangent vector at PointOnS, in the
-- parametric space of the first surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
TangentOnRst(me)
---Purpose: Returns the tangent vector at PointOnC, in 3d space.
returns Vec from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Tangent2dOnRst(me)
---Purpose: Returns the tangent vector at PointOnRst, in the
-- parametric space of the second surface.
returns Vec2d from gp
---C++: return const&
raises DomainError from Standard
--- The exception is raised when IsTangencyPoint
-- returns Standard_True.
is deferred;
Decroch(me;
Sol : Vector from math;
NS,TgS : out Vec from gp)
---Purpose: Enables implementation of a criterion of decrochage
-- specific to the function.
---Warning: Can be called without previous call of issolution
-- but the calculated values might be senseless.
returns Boolean from Standard
is deferred;
-- Methods for the approximation
--
IsRational(me) returns Boolean
---Purpose: Returns if the section is rationnal
is deferred;
GetSectionSize(me) returns Real
---Purpose: Returns the length of the maximum section
is deferred;
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
---Purpose: Compute the minimal value of weight for each poles
-- of all sections.
is deferred;
NbIntervals(me; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(me) >= <S>
is deferred;
Intervals(me; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
--
-- The array must provide enough room to accomodate
-- for the parameters. i.e. T.Length() > NbIntervals()
is deferred;
GetShape(me: in out;
NbPoles : out Integer from Standard;
NbKnots : out Integer from Standard;
Degree : out Integer from Standard;
NbPoles2d : out Integer from Standard)
is deferred;
GetTolerance(me;
BoundTol, SurfTol, AngleTol : Real;
Tol3d : out Vector;
Tol1D : out Vector )
---Purpose: Returns the tolerance to reach in approximation
-- to respecte
-- BoundTol error at the Boundary
-- AngleTol tangent error at the Boundary
-- SurfTol error inside the surface.
is deferred;
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
is deferred;
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
DPoles : out Array1OfVec from TColgp;
D2Poles : out Array1OfVec from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
DPoles2d : out Array1OfVec2d from TColgp;
D2Poles2d : out Array1OfVec2d from TColgp;
Weigths : out Array1OfReal from TColStd;
DWeigths : out Array1OfReal from TColStd;
D2Weigths : out Array1OfReal from TColStd)
---Purpose: Used for the first and last section
-- The method returns Standard_True if the derivatives
-- are computed, otherwise it returns Standard_False.
returns Boolean from Standard
is deferred;
Section(me: in out; P: Point from Blend;
Poles : out Array1OfPnt from TColgp;
Poles2d : out Array1OfPnt2d from TColgp;
Weigths : out Array1OfReal from TColStd)
is deferred;
end SurfRstFunction;

View File

@@ -0,0 +1,24 @@
// File: Blend_SurfRstFunction.cxx
// Created: Fri Feb 7 15:53:16 1997
// Author: Laurent BOURESCHE
// <lbo@pomalox.paris1.matra-dtv.fr>
#include <Blend_SurfRstFunction.ixx>
#include <Standard_NotImplemented.hxx>
const gp_Pnt& Blend_SurfRstFunction::Pnt1() const
{
return PointOnS();
}
const gp_Pnt& Blend_SurfRstFunction::Pnt2() const
{
return PointOnRst();
}
Standard_Real Blend_SurfRstFunction::GetMinimalDistance() const
{
Standard_NotImplemented::Raise("Blend_SurfRstFunction::GetMinimalDistance");
return RealLast();
}

280
src/Blend/Blend_Walking.cdl Executable file
View File

@@ -0,0 +1,280 @@
-- File: Blend_Walking.cdl
-- Created: Thu Dec 2 11:33:03 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
generic class Walking from Blend
(TheVertex as any;
TheArc as any;
TheSurface as any;
TheCurve as any;
TheVertexTool as any;
TheArcTool as any;
TheSurfaceTool as any;
TheCurveTool as any;
TheTopolTool as Transient;
TheBlendTool as any;
ThePointOnRst as any; -- as PointOnRst from Blend(TheArc)
TheSeqPointOnRst as any; -- as Iterator from Blend(ThePointOnRst)
TheExtremity as any; -- as Extremity from Blend(TheVertex,TheArc,
-- ThePointOnRst,TheSeqPointOnRst)
TheLine as Transient) -- as Line from Blend(TheVertex,TheArc,
-- ThePointOnRst,TheSeqPointOnRst,
-- TheExtremity)
---Purpose:
uses Point from Blend,
SequenceOfPoint from Blend,
Status from Blend,
Vector from math,
Matrix from math,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
Transition from IntSurf,
Function from Blend,
FuncInv from Blend,
State from TopAbs
raises NotDone from StdFail
is
Create(Surf1,Surf2: TheSurface; Domain1,Domain2: TheTopolTool)
returns Walking from Blend;
SetDomainsToRecadre(me : in out; RecDomain1, RecDomain2: TheTopolTool);
---Purpose: To define different domains for control and clipping.
AddSingularPoint(me : in out; P : Point from Blend);
---Purpose: To define singular points computed before walking.
Perform(me: in out; F : in out Function from Blend;
FInv : in out FuncInv from Blend;
Pdep : Real from Standard;
Pmax : Real from Standard;
MaxStep : Real from Standard;
TolGuide: Real from Standard;
Soldep : Vector from math;
Tolesp : Real from Standard;
Fleche : Real from Standard;
Appro : Boolean from Standard = Standard_False)
is static;
PerformFirstSection(me : in out;
F : in out Function from Blend;
Pdep : Real from Standard;
ParDep : in out Vector from math;
Tolesp : Real from Standard;
TolGuide : Real from Standard;
Pos1, Pos2 : out State from TopAbs)
returns Boolean from Standard
is static;
PerformFirstSection(me: in out;
F : in out Function from Blend;
FInv : in out FuncInv from Blend;
Pdep : Real from Standard;
Pmax : Real from Standard;
ParDep : Vector from math;
Tolesp : Real from Standard;
TolGuide : Real from Standard;
RecOnS1 : Boolean from Standard;
RecOnS2 : Boolean from Standard;
Psol : out Real from Standard;
ParSol : out Vector from math)
returns Boolean from Standard
is static;
Continu(me: in out;F : in out Function from Blend;
FInv : in out FuncInv from Blend;
P : Real from Standard)
returns Boolean from Standard
raises NotDone from StdFail
is static;
Continu(me: in out;F : in out Function from Blend;
FInv : in out FuncInv from Blend;
P : Real from Standard;
OnS1 : Boolean from Standard)
returns Boolean from Standard
raises NotDone from StdFail
is static;
Complete(me: in out;F : in out Function from Blend;
FInv : in out FuncInv from Blend;
Pmin : Real from Standard)
returns Boolean from Standard
raises NotDone from StdFail
is static;
ClassificationOnS1(me : in out;
C : Boolean from Standard)
is static;
ClassificationOnS2(me : in out;
C : Boolean from Standard)
is static;
Check2d(me : in out;
C : Boolean from Standard)
is static;
Check(me : in out;
C : Boolean from Standard)
is static;
TwistOnS1(me) returns Boolean from Standard
---C++: inline
is static;
TwistOnS2(me) returns Boolean from Standard
---C++: inline
is static;
InternalPerform (me: in out;F : in out Function from Blend;
FInv : in out FuncInv from Blend;
Bound : Real from Standard)
is static private;
IsDone(me)
returns Boolean from Standard
---C++: inline
is static;
Line(me)
returns TheLine
---C++: inline
---C++: return const&
raises NotDone from StdFail
is static;
ArcToRecadre(me: in out;
OnFirst: Boolean from Standard;
Sol: Vector from math;
PrevIndex : Integer;
lpt2d : out Pnt2d from gp;
pt2d : out Pnt2d from gp;
ponarc : out Real)
returns Integer from Standard
is static private;
Recadre(me: in out; FInv : in out FuncInv from Blend;
OnFirst: Boolean from Standard;
Sol: Vector from math;
Solrst : out Vector from math;
Indexsol: out Integer from Standard;
IsVtx: out Boolean from Standard;
Vtx: out TheVertex;
Extrap : Real = 0.0)
returns Boolean from Standard
is static private;
Transition(me:in out; OnFirst: Boolean from Standard;
A: TheArc; Param: Real from Standard;
TLine,TArc: out Transition from IntSurf)
is static private;
MakeExtremity(me:in out; Extrem : in out TheExtremity;
OnFirst: Boolean from Standard;
Index : Integer from Standard;
Param : Real from Standard;
IsVtx : Boolean from Standard;
Vtx : TheVertex)
is static private;
MakeSingularExtremity(me:in out;
Extrem : in out TheExtremity;
OnFirst: Boolean from Standard;
Vtx : TheVertex)
is static private;
CheckDeflection(me: in out; OnFirst : Boolean from Standard;
CurPoint : Point from Blend)
returns Status from Blend
is static private;
TestArret(me: in out; F : in out Function from Blend;
State: Status from Blend;
TestDeflection : Boolean = Standard_True;
TestSolution : Boolean = Standard_True;
TestLengthStep : Boolean = Standard_False)
returns Status from Blend
is static private;
fields
previousP : Point from Blend;
line : TheLine;
sol : Vector from math;
jalons : SequenceOfPoint from Blend;
surf1 : TheSurface;
surf2 : TheSurface;
domain1 : TheTopolTool;
domain2 : TheTopolTool;
recdomain1 : TheTopolTool;
recdomain2 : TheTopolTool;
tolesp : Real from Standard;
tolgui : Real from Standard;
pasmax : Real from Standard;
fleche : Real from Standard;
param : Real from Standard;
sens : Real from Standard;
done : Boolean from Standard;
rebrou : Boolean from Standard;
iscomplete : Boolean from Standard;
comptra : Boolean from Standard;
clasonS1 : Boolean from Standard;
clasonS2 : Boolean from Standard;
check2d : Boolean from Standard;
check : Boolean from Standard;
twistflag1 : Boolean from Standard;
twistflag2 : Boolean from Standard;
end Walking;

94
src/Blend/Blend_Walking.gxx Executable file
View File

@@ -0,0 +1,94 @@
#include <math_FunctionSetRoot.hxx>
#include <math_Gauss.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfVec.hxx>
#include <IntSurf.hxx>
#include <Adaptor2d_HCurve2d.hxx>
#include <CSLib.hxx>
#include <CSLib_NormalStatus.hxx>
#include <Precision.hxx>
#ifdef DEB
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Geom_BSplineCurve.hxx>
#ifdef DRAW
#include <Draw.hxx>
#include <DrawTrSurf_BSplineCurve.hxx>
#endif
//POP pour NT
#include <stdio.h>
static Standard_Boolean sectioncalculee;
static Standard_Integer IndexOfSection = 0;
static Standard_Integer IndexOfRejection = 0;
static Standard_Integer nbcomputedsection;
extern Standard_Boolean Blend_GettraceDRAWSECT();
extern Standard_Boolean Blend_GetcontextNOTESTDEFL();
// Pour debug : visualisation de la section
static void Drawsect(const TheSurface& surf1,
const TheSurface& surf2,
const math_Vector& sol,
const Standard_Real param,
Blend_Function& Func,
const Blend_Status State)
{
// if(!sectioncalculee) return;
Blend_Point BP(TheSurfaceTool::Value(surf1,sol(1),sol(2)),
TheSurfaceTool::Value(surf2,sol(3),sol(4)),
param,sol(1),sol(2),sol(3),sol(4));
Standard_Integer hp,hk,hd,hp2d;
Func.GetShape(hp,hk,hd,hp2d);
TColStd_Array1OfReal TK(1,hk);
Func.Knots(TK);
TColStd_Array1OfInteger TMul(1,hk);
Func.Mults(TMul);
TColgp_Array1OfPnt TP(1,hp);
TColgp_Array1OfPnt2d TP2d(1,hp2d);
TColStd_Array1OfReal TW(1,hp);
Func.Section(BP,TP,TP2d,TW);
Handle(Geom_BSplineCurve) sect = new Geom_BSplineCurve
(TP,TW,TK,TMul,hd);
//POP pour NT
//char name[100];
char* name = new char[100];
if ((State==Blend_StepTooLarge) ||(State==Blend_SamePoints)) {
IndexOfRejection ++;
sprintf(name,"%s_%d","Rejection",IndexOfRejection);
}
else {
IndexOfSection++;
sprintf(name,"%s_%d","Section",IndexOfSection);
}
#ifdef DRAW
Handle(DrawTrSurf_BSplineCurve) BS
= new (DrawTrSurf_BSplineCurve)(sect);
BS->ClearPoles();
BS->ClearKnots();
if (State==Blend_StepTooLarge) BS->SetColor(Draw_violet);
if (State==Blend_SamePoints) BS->SetColor(Draw_rose);
Draw::Set(name,BS);
#endif
}
static void Drawsect(const TheSurface& surf1,
const TheSurface& surf2,
const math_Vector& sol,
const Standard_Real param,
Blend_Function& Func)
{
Drawsect(surf1, surf2, sol, param, Func, Blend_OK);
}
#endif
#include <Blend_Walking_1.gxx>
#include <Blend_Walking_2.gxx>
#include <Blend_Walking_3.gxx>
#include <Blend_Walking_4.gxx>

22
src/Blend/Blend_Walking.lxx Executable file
View File

@@ -0,0 +1,22 @@
#include <StdFail_NotDone.hxx>
inline Standard_Boolean Blend_Walking::IsDone () const
{
return done;
}
inline Standard_Boolean Blend_Walking::TwistOnS1() const
{
return twistflag1;
}
inline Standard_Boolean Blend_Walking::TwistOnS2() const
{
return twistflag2;
}
inline const Handle(TheLine)& Blend_Walking::Line () const
{
if (!done) {StdFail_NotDone::Raise();}
return line;
}

559
src/Blend/Blend_Walking_1.gxx Executable file
View File

@@ -0,0 +1,559 @@
Blend_Walking::Blend_Walking(const TheSurface& Surf1,
const TheSurface& Surf2,
const Handle(TheTopolTool)& Domain1,
const Handle(TheTopolTool)& Domain2):
sol(1,4),surf1(Surf1),surf2(Surf2),
done(Standard_False),
clasonS1(Standard_True),clasonS2(Standard_True),
check2d(Standard_True),check(Standard_True),
twistflag1(Standard_False),twistflag2(Standard_False)
{
domain1 = Domain1;
domain2 = Domain2;
recdomain1 = Domain1;
recdomain2 = Domain2;
}
void Blend_Walking::SetDomainsToRecadre(const Handle(TheTopolTool)& Domain1,
const Handle(TheTopolTool)& Domain2)
{
recdomain1 = Domain1;
recdomain2 = Domain2;
}
void Blend_Walking::AddSingularPoint(const Blend_Point& P)
{
if (jalons.Length() == 0) {
jalons.Append(P);
}
else {
Standard_Integer ii, jj;
Standard_Real tp = P.Parameter(),
ti=jalons.First().Parameter();
for (jj=1, ii=1; ii<=jalons.Length() && tp>ti; ii++) {
jj = ii;
ti = jalons.Value(jj).Parameter();
}
if (tp > ti) jalons.InsertAfter(jj, P);
else jalons.InsertBefore(jj, P);
}
}
void Blend_Walking::Perform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
const Standard_Real TolGuide,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Fleche,
const Standard_Boolean Appro)
{
done = Standard_False;
iscomplete = Standard_False;
comptra = Standard_False;
Standard_Boolean doextremities = 1;
if(line.IsNull()) line = new TheLine ();
else {line->Clear();doextremities = 0;}
tolesp = Abs(Tolesp);
tolgui = Abs(TolGuide);
fleche = Abs(Fleche);
rebrou = Standard_False;
pasmax = Abs(MaxStep);
if (Pmax-Pdep >= 0.) {
sens = 1.;
}
else {
sens = -1.;
}
Blend_Status State;
TheExtremity ptf1,ptf2;
param = Pdep;
Func.Set(param);
if (Appro) {
TopAbs_State situ1,situ2;
math_Vector tolerance(1,4),infbound(1,4),supbound(1,4);
Func.GetTolerance(tolerance,tolesp);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
rsnld.Perform(Func,ParDep,infbound,supbound);
if (!rsnld.IsDone()) {
return;
}
rsnld.Root(sol);
if(clasonS1) situ1 = domain1->Classify(gp_Pnt2d(sol(1),sol(2)),
Min(tolerance(1),tolerance(2)),0);
else situ1 = TopAbs_IN;
if(clasonS2) situ2 = domain2->Classify(gp_Pnt2d(sol(3),sol(4)),
Min(tolerance(3),tolerance(4)),0);
else situ2 = TopAbs_IN;
if (situ1 != TopAbs_IN || situ2 != TopAbs_IN) {
return;
}
}
else {
sol = ParDep;
}
#ifdef DEB
sectioncalculee = 0;
#endif
State = TestArret(Func, Blend_OK, Standard_False);
if (State!=Blend_OK) {
return;
}
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf1,surf2,sol,param,Func);
}
nbcomputedsection = 1;
#endif
// Mettre a jour la ligne.
line->Append(previousP);
if(doextremities){
TheExtremity ptf1 (previousP.PointOnS1(),
sol(1),sol(2),tolesp);
TheExtremity ptf2 (previousP.PointOnS2(),
sol(3),sol(4),tolesp);
if (!previousP.IsTangencyPoint()) {
ptf1.SetTangent(previousP.TangentOnS1());
ptf2.SetTangent(previousP.TangentOnS2());
}
if (sens>0.) {
line->SetStartPoints(ptf1, ptf2);
}
else {
line->SetEndPoints(ptf1, ptf2);
}
}
InternalPerform(Func,FuncInv,Pmax);
#ifdef DEB
// cout <<"Perform : "<<nbcomputedsection<<" sections calculees"<<endl;
// cout <<line->NbPoints()<<" sections gardees"<<endl;
#endif
done = Standard_True;
}
Standard_Boolean Blend_Walking::PerformFirstSection
(Blend_Function& Func,
const Standard_Real Pdep,
math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real TolGuide,
TopAbs_State& Pos1,
TopAbs_State& Pos2)
{
iscomplete = Standard_False;
comptra = Standard_False;
line = new TheLine ();
tolesp = Abs(Tolesp);
tolgui = Abs(TolGuide);
Pos1 = Pos2 = TopAbs_UNKNOWN;
Blend_Status State;
param = Pdep;
Func.Set(param);
math_Vector tolerance(1,4),infbound(1,4),supbound(1,4);
Func.GetTolerance(tolerance,tolesp);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
rsnld.Perform(Func,ParDep,infbound,supbound);
if (!rsnld.IsDone()) {
return Standard_False;
}
rsnld.Root(sol);
ParDep = sol;
Pos1 = domain1->Classify(gp_Pnt2d(sol(1),sol(2)),
Min(tolerance(1),tolerance(2)),0);
Pos2 = domain2->Classify(gp_Pnt2d(sol(3),sol(4)),
Min(tolerance(3),tolerance(4)),0);
if (Pos1 != TopAbs_IN || Pos2 != TopAbs_IN) {
return Standard_False;
}
State = TestArret(Func, Blend_OK, Standard_False);
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf1,surf2,sol,param,Func);
}
#endif
return Standard_True;
}
Standard_Boolean Blend_Walking::PerformFirstSection
(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real Pdep,
const Standard_Real Pmax,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real TolGuide,
const Standard_Boolean RecOnS1,
const Standard_Boolean RecOnS2,
Standard_Real& Psol,
math_Vector& ParSol)
{
iscomplete = Standard_False;
comptra = Standard_False;
line = new TheLine ();
Standard_Real w1,w2, extrapol;
Standard_Boolean recad1,recad2;
tolesp = Abs(Tolesp);
tolgui = Abs(TolGuide);
if (Pmax-Pdep >= 0.) {
sens = 1.;
}
else {
sens = -1.;
}
extrapol = Abs(Pmax-Pdep)/50; // 2%
Blend_Status State;
param = Pdep;
Func.Set(param);
math_Vector tolerance(1,4),infbound(1,4),supbound(1,4);
math_Vector solrst1(1,4),solrst2(1,4);
TheExtremity Ext1,Ext2;
Standard_Integer Index1,Index2,nbarc;
Standard_Boolean Isvtx1,Isvtx2;
TheVertex Vtx1,Vtx2;
gp_Pnt2d p2d;
Func.GetTolerance(tolerance,tolesp);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
rsnld.Perform(Func,ParDep,infbound,supbound);
if (!rsnld.IsDone()) {
return Standard_False;
}
rsnld.Root(sol);
w1 = w2 = Pmax;
recad1 = RecOnS1 && Recadre(FuncInv,Standard_True,
sol,solrst1,Index1,Isvtx1,Vtx1, extrapol);
if (recad1) {
w1 = solrst1(2);
}
recad2 = RecOnS2 && Recadre(FuncInv,Standard_False,
sol,solrst2,Index2,Isvtx2,Vtx2, extrapol);
if (recad2) {
w2 = solrst2(2);
}
if (!recad1 && !recad2) {
return Standard_False;
}
if (recad1 && recad2) {
if (Abs(w1-w2) <= tolgui) {
//sol sur 1 et 2 a la fois
State = Blend_OnRst12;
param = w1;
ParSol(1) = solrst2(3);
ParSol(2) = solrst2(4);
ParSol(3) = solrst1(3);
ParSol(4) = solrst1(4);
}
else if (sens*(w2-w1) < 0.) { // on garde le plus grand
//sol sur 1
State = Blend_OnRst1;
param = w1;
recdomain1->Init();
nbarc = 1;
while (nbarc < Index1) {
nbarc++;
recdomain1->Next();
}
p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
ParSol(1) = p2d.X();
ParSol(2) = p2d.Y();
ParSol(3) = solrst1(3);
ParSol(4) = solrst1(4);
}
else {
//sol sur 2
State = Blend_OnRst2;
param = w2;
recdomain2->Init();
nbarc = 1;
while (nbarc < Index2) {
nbarc++;
recdomain2->Next();
}
p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
ParSol(1) = solrst2(3);
ParSol(2) = solrst2(4);
ParSol(3) = p2d.X();
ParSol(4) = p2d.Y();
}
}
else if (recad1) {
// sol sur 1
State = Blend_OnRst1;
param = w1;
recdomain1->Init();
nbarc = 1;
while (nbarc < Index1) {
nbarc++;
recdomain1->Next();
}
p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
ParSol(1) = p2d.X();
ParSol(2) = p2d.Y();
ParSol(3) = solrst1(3);
ParSol(4) = solrst1(4);
}
else { //if (recad2) {
//sol sur 2
State = Blend_OnRst2;
param = w2;
recdomain2->Init();
nbarc = 1;
while (nbarc < Index2) {
nbarc++;
recdomain2->Next();
}
p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
ParSol(1) = solrst2(3);
ParSol(2) = solrst2(4);
ParSol(3) = p2d.X();
ParSol(4) = p2d.Y();
}
Psol = param;
sol = ParSol;
Func.Set(param);
State = TestArret(Func, State, Standard_False);
switch (State) {
case Blend_OnRst1 :
{
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf1,surf2,sol,param,Func);
}
#endif
MakeExtremity(Ext1,Standard_True,Index1,
solrst1(1),Isvtx1,Vtx1);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),tolesp);
}
break;
case Blend_OnRst2 :
{
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf1,surf2,sol,param,Func);
}
#endif
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),tolesp);
MakeExtremity(Ext2,Standard_False,Index2,
solrst2(1),Isvtx2,Vtx2);
}
break;
case Blend_OnRst12 :
{
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf1,surf2,sol,param,Func);
}
#endif
MakeExtremity(Ext1,Standard_True,Index1,
solrst1(1),Isvtx1,Vtx1);
MakeExtremity(Ext2,Standard_False,Index2,
solrst2(1),Isvtx2,Vtx2);
}
break;
default:
{
Standard_Failure::Raise("Blend_Walking::PerformFirstSection : echec");
}
}
if (sens < 0.) {
line->SetEndPoints(Ext1,Ext2);
}
else {
line->SetStartPoints(Ext1,Ext2);
}
return Standard_True;
}
Standard_Boolean Blend_Walking::Continu(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real P)
{
if (!done) {StdFail_NotDone::Raise();}
const Blend_Point& firstBP = line->Point(1);
const Blend_Point& lastBP = line->Point(line->NbPoints());
if (P < firstBP.Parameter()){
sens = -1.;
previousP = firstBP;
}
else if(P > lastBP.Parameter()){
sens = 1.;
previousP = lastBP;
}
param = previousP.Parameter();
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
InternalPerform(Func,FuncInv,P);
return Standard_True;
}
Standard_Boolean Blend_Walking::Continu(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real P,
const Standard_Boolean OnS1)
{
if (!done) {StdFail_NotDone::Raise();}
TheExtremity Ext1,Ext2;
if (sens < 0.) {
Ext1 = line->StartPointOnFirst();
Ext2 = line->StartPointOnSecond();
if (OnS1 && Ext1.NbPointOnRst() == 0 ||
!OnS1 && Ext2.NbPointOnRst() == 0) {
return Standard_False;
}
previousP = line->Point(1);
}
else {
Ext1 = line->EndPointOnFirst();
Ext2 = line->EndPointOnSecond();
if (OnS1 && Ext1.NbPointOnRst() == 0 ||
!OnS1 && Ext2.NbPointOnRst() == 0) {
return Standard_False;
}
previousP = line->Point(line->NbPoints());
}
Standard_Integer length = line->NbPoints();
param = previousP.Parameter();
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
if(OnS1) clasonS1 = Standard_False;
else clasonS2 = Standard_False;
InternalPerform(Func,FuncInv,P);
clasonS1 = Standard_True;
clasonS2 = Standard_True;
Standard_Integer newlength = line->NbPoints();
if (sens <0.) {
if (OnS1 && line->StartPointOnSecond().NbPointOnRst() == 0 ||
!OnS1 && line->StartPointOnFirst().NbPointOnRst() == 0) {
line->Remove(1,newlength-length);
line->SetStartPoints(Ext1,Ext2);
return Standard_False;
}
}
else {
if (OnS1 && line->EndPointOnSecond().NbPointOnRst() == 0 ||
!OnS1 && line->EndPointOnFirst().NbPointOnRst() == 0) {
line->Remove(length,newlength);
line->SetEndPoints(Ext1,Ext2);
return Standard_False;
}
}
return Standard_True;
}
Standard_Boolean Blend_Walking::Complete(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real Pmin)
{
if (!done) {StdFail_NotDone::Raise();}
if (iscomplete) {return Standard_True;}
if (sens >0.) {
previousP = line->Point(1);
}
else {
previousP = line->Point(line->NbPoints());
}
sens = -sens;
param = previousP.Parameter();
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
InternalPerform(Func,FuncInv,Pmin);
#ifdef DEB
// cout <<"Complete : "<<nbcomputedsection<<" sections calculees"<<endl;
// cout <<line->NbPoints()<<" sections gardees"<<endl;
#endif
iscomplete = Standard_True;
return Standard_True;
}
void Blend_Walking::ClassificationOnS1(const Standard_Boolean C)
{
clasonS1 = C;
}
void Blend_Walking::ClassificationOnS2(const Standard_Boolean C)
{
clasonS2 = C;
}
void Blend_Walking::Check2d(const Standard_Boolean C)
{
check2d = C;
}
void Blend_Walking::Check(const Standard_Boolean C)
{
check = C;
}

308
src/Blend/Blend_Walking_2.gxx Executable file
View File

@@ -0,0 +1,308 @@
Blend_Status Blend_Walking::TestArret(Blend_Function& Function,
const Blend_Status State,
const Standard_Boolean TestDefl,
const Standard_Boolean TestSolu,
const Standard_Boolean TestLengthStep)
// On regarde si le point donne est solution.
// Si c est le cas,
// On verifie le critere de fleche sur surf1 et surf2
// Si OK, on classifie les points sur surf1 et sur surf2.
// Si les deux sont dedans : on retourne Blend_OK
// sinon si un seul est dedans
// on resout le pb inverse sur la restriction concernee
// sinon on resout le pb inverse sur la surface pour laquelle
// le point est le plus loin.
// sinon (fleche non OK)
// on renvoie Blend_StepTooLarge.
// sinon on renvoie Blend_StepTooLarge.
//
{
gp_Pnt pt1,pt2;
gp_Vec V1,V2;
gp_Vec Tgp1,Tgp2,Nor1,Nor2;
gp_Vec2d V12d,V22d;
Blend_Status State1,State2;
IntSurf_TypeTrans tras1,tras2;
Blend_Point curpoint;
Standard_Boolean loctwist1 = Standard_False, loctwist2 = Standard_False;
Standard_Real tolsolu = tolesp;
if ( !TestSolu) tolsolu *= 1000; //Ca doit toujours etre bon
if (Function.IsSolution(sol,tolsolu)) {
#ifdef DEB
sectioncalculee = 1;
#endif
Standard_Boolean curpointistangent = Function.IsTangencyPoint();
pt1 = Function.PointOnS1();
pt2 = Function.PointOnS2();
if(curpointistangent){
curpoint.SetValue(pt1,pt2,param,
sol(1),sol(2),sol(3),sol(4));
}
else{
V1 = Function.TangentOnS1();
V2 = Function.TangentOnS2();
V12d = Function.Tangent2dOnS1();
V22d = Function.Tangent2dOnS2();
curpoint.SetValue(pt1,pt2,param,
sol(1),sol(2),sol(3),sol(4),
V1,V2,V12d,V22d);
if(Function.TwistOnS1()) loctwist1 = Standard_True;
if(Function.TwistOnS2()) loctwist2 = Standard_True;
}
if (TestDefl && check) {
// Verification du critere de fleche sur chaque surface
//et sur la ligne guide
State1 = CheckDeflection(Standard_True,curpoint);
State2 = CheckDeflection(Standard_False,curpoint);
}
else {
State1 = Blend_OK;
State2 = Blend_OK;
if (TestLengthStep) {
// On verifie juste que le pas n'est pas trop grand
// (Cas des prolongements foireux)
Standard_Real curparamu,curparamv, prevparamu,prevparamv;
math_Vector inf(1,4), sup(1,4);
Function.GetBounds(inf, sup);
sup -= inf;
sup *= 0.05; // Pas max : 5% du domaine
curpoint.ParametersOnS1(curparamu,curparamv);
previousP.ParametersOnS1(prevparamu,prevparamv);
if (Abs(curparamu-prevparamu) > sup(1)) State1 = Blend_StepTooLarge;
if (Abs(curparamv-prevparamv) > sup(2)) State1 = Blend_StepTooLarge;
curpoint.ParametersOnS2(curparamu,curparamv);
previousP.ParametersOnS2(prevparamu,prevparamv);
if (Abs(curparamu-prevparamu) > sup(3)) State2 = Blend_StepTooLarge;
if (Abs(curparamv-prevparamv) > sup(4)) State2 = Blend_StepTooLarge;
}
}
if (State1 == Blend_Backward) {
State1 = Blend_StepTooLarge;
rebrou= Standard_True;
}
if (State2 == Blend_Backward) {
State2 = Blend_StepTooLarge;
rebrou = Standard_True;
}
if (State1 == Blend_StepTooLarge ||
State2 == Blend_StepTooLarge) {
return Blend_StepTooLarge;
}
// Ici seulement on peut statuer sur le twist
// Car les rejet ont ete effectue (BUC60322)
if (loctwist1) twistflag1 = Standard_True;
if (loctwist2) twistflag2 = Standard_True;
if (!comptra && !curpointistangent) {
Function.Tangent(sol(1),sol(2),sol(3),sol(4),Tgp1,Tgp2,Nor1,Nor2);
Nor1.Normalize();
Nor2.Normalize();
Standard_Real testra = Tgp1.Dot(Nor1.Crossed(V1));
if (Abs(testra) > Precision::Confusion()) {
tras1 = IntSurf_In;
if ((testra > 0. && !loctwist1) || (testra < 0. && loctwist1)) {
tras1 = IntSurf_Out;
}
testra = Tgp2.Dot(Nor2.Crossed(V2));
if (Abs(testra) > Precision::Confusion()) {
tras2 = IntSurf_Out;
if ((testra > 0. && !loctwist2) || (testra < 0. && loctwist2)) {
tras2 = IntSurf_In;
}
comptra = Standard_True;
line->Set(tras1,tras2);
}
}
}
if (State1 == Blend_OK ||
State2 == Blend_OK ) {
previousP = curpoint;
return State;
}
if (State1 == Blend_StepTooSmall &&
State2 == Blend_StepTooSmall) {
previousP = curpoint;
if (State == Blend_OK) {
return Blend_StepTooSmall;
}
else {
return State;
}
}
if (State == Blend_OK) {
return Blend_SamePoints;
}
else {
return State;
}
}
else {
return Blend_StepTooLarge;
}
}
Blend_Status Blend_Walking::CheckDeflection
(const Standard_Boolean OnFirst,
const Blend_Point& CurPoint)
{
// regle par tests dans U4 correspond a 11.478 d
const Standard_Real CosRef3D = 0.98;
const Standard_Real CosRef2D = 0.88; // correspond a 25 d
Standard_Real Norme, Cosi, Cosi2;
#ifndef DEB
Standard_Real prevNorme = 0.;
#else
Standard_Real prevNorme;
#endif
Standard_Real FlecheCourante;
Standard_Real Du,Dv,Duv;
Standard_Real tolu,tolv;
gp_Pnt Psurf;
gp_Vec Tgsurf;
gp_Vec2d Tgonsurf;
Standard_Real curparamu, curparamv;
Standard_Boolean curpointistangent = CurPoint.IsTangencyPoint();
gp_Pnt prevP;
gp_Vec prevTg;
gp_Vec2d previousd2d;
Standard_Real prevparamu, prevparamv;
Standard_Boolean prevpointistangent = previousP.IsTangencyPoint();
if (OnFirst) {
Psurf = CurPoint.PointOnS1();
if(!curpointistangent){
Tgsurf = CurPoint.TangentOnS1();
}
prevP = previousP.PointOnS1();
if(!prevpointistangent){
prevTg = previousP.TangentOnS1();
}
tolu = TheSurfaceTool::UResolution(surf1,tolesp);
tolv = TheSurfaceTool::VResolution(surf1,tolesp);
}
else {
Psurf = CurPoint.PointOnS2();
if(!curpointistangent){
Tgsurf = CurPoint.TangentOnS2();
}
prevP = previousP.PointOnS2();
if(!prevpointistangent){
prevTg = previousP.TangentOnS2();
}
tolu = TheSurfaceTool::UResolution(surf2,tolesp);
tolv = TheSurfaceTool::VResolution(surf2,tolesp);
}
gp_Vec Corde(prevP,Psurf);
Norme = Corde.SquareMagnitude();
// if(!curpointistangent) curNorme = Tgsurf.SquareMagnitude();
if(!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp*tolesp){
// il faudra peut etre forcer meme point
return Blend_SamePoints;
}
if(!prevpointistangent){
if(prevNorme <= tolesp*tolesp) {
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;
if (Cosi <0.) { // angle 3d>pi/2. --> retour arriere
return Blend_Backward;
}
Cosi2 = Cosi * Cosi / prevNorme / Norme;
if (Cosi2 < CosRef3D) {
return Blend_StepTooLarge;
}
}
if(!curpointistangent){
// Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
Cosi = sens*Corde*Tgsurf;
Cosi2 = Cosi * Cosi / Tgsurf.SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D || Cosi < 0.) {
return Blend_StepTooLarge;
}
}
if(check2d){
if (OnFirst) {
CurPoint.ParametersOnS1(curparamu,curparamv);
if(!curpointistangent) Tgonsurf = CurPoint.Tangent2dOnS1();
previousP.ParametersOnS1(prevparamu,prevparamv);
if(!prevpointistangent) previousd2d = previousP.Tangent2dOnS1();
}
else {
CurPoint.ParametersOnS2(curparamu,curparamv);
if(!curpointistangent) Tgonsurf = CurPoint.Tangent2dOnS2();
previousP.ParametersOnS2(prevparamu,prevparamv);
if(!prevpointistangent) previousd2d = previousP.Tangent2dOnS2();
}
Du = curparamu - prevparamu;
Dv = curparamv - prevparamv;
Duv = Du * Du + Dv * Dv;
// SqrtDuv = Sqrt(Duv);
if (Abs(Du) < tolu && Abs(Dv) < tolv){
// il faudra peut etre forcer meme point
return Blend_SamePoints; //point confondu 2d
}
if(!prevpointistangent){
if(Abs(previousd2d.X()) < tolu && Abs(previousd2d.Y()) < tolv){
// il faudra peut etre forcer meme point
return Blend_SamePoints; //point confondu 2d
}
Cosi = sens*(Du * previousd2d.X() + Dv * previousd2d.Y());
if (Cosi < 0) {
return Blend_Backward;
}
}
if(!curpointistangent){
// Voir s il faut faire le controle sur le signe de Cosi
Cosi = sens*(Du * Tgonsurf.X() + Dv * Tgonsurf.Y())/Tgonsurf.Magnitude();
Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D || Cosi <0.) {
return Blend_StepTooLarge;
}
}
}
if(!curpointistangent && !prevpointistangent){
// Estimation de la fleche courante
FlecheCourante = (prevTg.Normalized().XYZ()-Tgsurf.Normalized().XYZ()).SquareModulus()*Norme/64.;
if (FlecheCourante <= 0.25*fleche*fleche) {
return Blend_StepTooSmall;
}
if (FlecheCourante > fleche*fleche) {
// pas trop grand : commentaire interessant
return Blend_StepTooLarge;
}
}
return Blend_OK;
}

514
src/Blend/Blend_Walking_3.gxx Executable file
View File

@@ -0,0 +1,514 @@
//26-04-1997 modified by pmn : Initialisation plus fine de la resolution
Standard_Integer Blend_Walking::ArcToRecadre(const Standard_Boolean OnFirst,
const math_Vector& sol,
const Standard_Integer PrevIndex,
gp_Pnt2d& lastpt2d,
gp_Pnt2d& pt2d,
Standard_Real& ponarc)
{
Standard_Integer IndexSol = 0, nbarc = 0;
Standard_Boolean ok = Standard_False;
Standard_Boolean byinter = (line->NbPoints() != 0), okinter = 0;
Standard_Real distmin = RealLast();
Standard_Real uprev,vprev, prm, dist;
Handle(TheTopolTool) Iter;
if (OnFirst) {
if(byinter) previousP.ParametersOnS1(uprev,vprev);
pt2d.SetCoord(sol(1),sol(2));
Iter = recdomain1;
}
else {
if(byinter) previousP.ParametersOnS2(uprev,vprev);
pt2d.SetCoord(sol(3),sol(4));
Iter = recdomain2;
}
lastpt2d.SetCoord(uprev,vprev);
Iter->Init();
while (Iter->More()) {
nbarc++; ok = 0;
if (OnFirst) {
if(byinter) {
ok = okinter = TheBlendTool::Inters(pt2d,lastpt2d,
surf1,Iter->Value(),prm,dist);
}
if(!ok) ok = TheBlendTool::Project(pt2d,surf1,Iter->Value(),prm,dist);
}
else {
if(byinter) {
ok = okinter = TheBlendTool::Inters(pt2d,lastpt2d,
surf2,Iter->Value(),prm,dist);
}
if(!ok) ok = TheBlendTool::Project(pt2d,surf2,Iter->Value(),prm,dist);
}
if (ok && (nbarc != PrevIndex) ) {
if (dist<distmin || okinter) {
distmin = dist;
ponarc = prm;
IndexSol = nbarc;
if(okinter && (PrevIndex==0)) break;
}
}
Iter->Next();
}
return IndexSol;
}
Standard_Boolean Blend_Walking::Recadre(Blend_FuncInv& FuncInv,
const Standard_Boolean OnFirst,
const math_Vector& sol,
math_Vector& solrst,
Standard_Integer& Indexsol,
Standard_Boolean& IsVtx,
TheVertex& Vtx,
const Standard_Real Extrap)
{
Standard_Boolean jalons_Trouve = Standard_False;
Standard_Boolean recadre = Standard_True, ok;
Standard_Boolean byinter = (line->NbPoints() != 0);
#ifndef DEB
Standard_Integer LeJalon = 0;
#else
Standard_Integer LeJalon;
#endif
Standard_Integer nbarc;
Standard_Real dist,prm,pmin, vtol;
gp_Pnt2d pt2d, lastpt2d;
math_Vector toler(1,4),infb(1,4),supb(1,4),valsol(1,4);
Handle(Adaptor2d_HCurve2d) thecur;
Handle(TheTopolTool) Iter;
if (OnFirst) Iter = recdomain1;
else Iter = recdomain2;
Indexsol = ArcToRecadre(OnFirst, sol, 0,
lastpt2d, pt2d, pmin);
IsVtx = Standard_False;
if (Indexsol == 0) {
return Standard_False;
}
Iter->Init();
nbarc = 1;
while (nbarc < Indexsol) {
nbarc++;
Iter->Next();
}
TheArc thearc = Iter->Value();
if (OnFirst) {
thecur = TheBlendTool::CurveOnSurf(thearc,surf1);
}
else {
thecur = TheBlendTool::CurveOnSurf(thearc,surf2);
}
// Le probleme a resoudre
FuncInv.Set(OnFirst,thecur);
FuncInv.GetBounds(infb,supb);
infb(2) -= Extrap;
supb(2) += Extrap;
FuncInv.GetTolerance(toler,tolesp/10);//Il vaut mieux garder un peu de marge
math_FunctionSetRoot rsnld(FuncInv,toler,35);
toler *= 10; // Mais on fait les tests correctements
// Calcul d'un point d'init
Standard_Real ufirst,ulast;
TheBlendTool::Bounds(thecur, ufirst,ulast);
// Pour aider a trouver les coins singuliers on recadre eventuelement le paramtere
if (Abs(pmin-ufirst) < Abs(ulast-ufirst)/1000) {
pmin = ufirst;
}
if (Abs(pmin-ulast) < Abs(ulast-ufirst)/1000) {
pmin = ulast;
}
if (byinter) {
Standard_Real lastParam = previousP.Parameter();
// Verifie que le recadrage n'est pas un jalons
if (jalons.Length()!=0) {
Standard_Real t1, t2, t;
Standard_Boolean Cherche=Standard_True;
Standard_Integer ii;
if (lastParam < param) {
t1 = lastParam; t2 = param;
}
else {
t1 = param; t2 = lastParam;
}
for (ii=1; ii<=jalons.Length() && Cherche; ii++) {
t = jalons.Value(ii).Parameter();
if (((t1 < t) && (t2 > t)) || (t==param)) {
jalons_Trouve = Standard_True;
LeJalon = ii;
Cherche = Standard_False; //Ne marche que si l'on sort simultanement
}
else Cherche = t < t2; // On s'arrete si t>=t2;
}
}
if (!jalons_Trouve) {
//Initialisation par Interpolation
Standard_Real lambda, u, v;
gp_Pnt2d Pnt, Pnt1, Pnt2;//, POnC;
thecur->D0(pmin, Pnt);
if (OnFirst) {
previousP.ParametersOnS2(u,v);
Pnt1.SetCoord(u, v);
Pnt2.SetCoord(sol(3), sol(4));
}
else {
previousP.ParametersOnS1(u,v);
Pnt1.SetCoord(u, v);
Pnt2.SetCoord(sol(1), sol(2));
}
lambda = Pnt.Distance(lastpt2d);
if (lambda > 1.e-12) lambda /= Pnt.Distance(lastpt2d) + Pnt.Distance(pt2d);
else lambda = 0;
solrst(1) = pmin;
solrst(2) = (1-lambda)*lastParam + lambda*param;
solrst(3) = (1-lambda)*Pnt1.X() + lambda*Pnt2.X();
solrst(4) = (1-lambda)*Pnt1.Y() + lambda*Pnt2.Y();
}
}
else { // sinon on initialise par le dernier point calcule
solrst(1) = pmin;
solrst(2) = param;
if (OnFirst) {
solrst(3) = sol(3);
solrst(4) = sol(4);
}
else {
solrst(3) = sol(1);
solrst(4) = sol(2);
}
}
if (jalons_Trouve) { // On recupere le jalon
Blend_Point MonJalon;
Standard_Boolean periodic;
Standard_Real uperiod = 0, vperiod = 0;
gp_Pnt2d Pnt;
Standard_Real distaux;
MonJalon = jalons.Value(LeJalon);
solrst(2) = MonJalon.Parameter();
if (OnFirst) {
MonJalon.ParametersOnS2(solrst(3), solrst(4));
periodic = (surf2->IsUPeriodic() || surf2->IsVPeriodic());
}
else {
MonJalon.ParametersOnS1(solrst(3), solrst(4));
periodic = (surf1->IsUPeriodic() || surf1->IsVPeriodic());
}
// Recadrage eventuelle pour le cas periodique
if (periodic) {
Handle(Adaptor3d_HSurface) surf;
if (OnFirst) surf = surf2;
else surf = surf1;
lastpt2d = thecur->Value(pmin);
if (surf->IsUPeriodic()) {
uperiod = surf->UPeriod();
if (solrst(3)-lastpt2d.X() > uperiod*0.6) solrst(3) -= uperiod;
if (solrst(3)-lastpt2d.X() < -uperiod*0.6) solrst(3) += uperiod;
}
if (surf->IsVPeriodic()) {
vperiod = surf->VPeriod();
if (solrst(4)-lastpt2d.Y() > vperiod*0.6) solrst(4) -= vperiod;
if (solrst(4)-lastpt2d.Y() < -vperiod*0.6) solrst(4) += vperiod;
}
}
// Pour le parametre sur arc il faut projeter...
pt2d.SetCoord(solrst(3), solrst(4));
Pnt = thecur->Value(ufirst);
dist = pt2d.Distance(Pnt);
solrst(1) = ufirst;
Pnt = thecur->Value(ulast);
distaux = pt2d.Distance(Pnt);
if ( distaux < dist) {
solrst(1) = ulast;
dist = distaux;
}
if (dist>Precision::PConfusion()) {
prm = pmin;
if (OnFirst) {
ok = TheBlendTool::Project(pt2d,surf1,thearc,prm,distaux);
}
else {
ok = TheBlendTool::Project(pt2d,surf2,thearc,prm,distaux);
}
if (ok && (pt2d.Distance(thecur->Value(prm)) < dist)) solrst(1) = prm;
else solrst(1) = pmin;
}
// On verifie le jalon
jalons_Trouve = (FuncInv.IsSolution(solrst,tolesp));
}
if (!jalons_Trouve) {
// Resolution...
rsnld.Perform(FuncInv,solrst,infb,supb);
if (!rsnld.IsDone()) {
cout << "Walking::Recadre : RSNLD not done " << endl;
recadre = Standard_False;
}
else {
rsnld.Root(solrst);
recadre = FuncInv.IsSolution(solrst,tolesp);
}
}
// En cas d'echecs, on regarde si un autre arc
// peut faire l'affaire (cas des sorties a proximite d'un vertex)
dist = (ulast - ufirst)/100;
if ((!recadre) &&
((Abs(pmin-ulast) < dist) || (Abs(pmin-ufirst) < dist)) ) {
Indexsol = ArcToRecadre(OnFirst, sol, Indexsol,
lastpt2d, pt2d, pmin);
if (Indexsol == 0) {
return Standard_False;
}
Iter->Init();
nbarc = 1;
while (nbarc < Indexsol) {
nbarc++;
Iter->Next();
}
thearc = Iter->Value();
if (OnFirst) {
thecur = TheBlendTool::CurveOnSurf(thearc,surf1);
}
else {
thecur = TheBlendTool::CurveOnSurf(thearc,surf2);
}
solrst(1) = pmin;
// Le probleme a resoudre
FuncInv.Set(OnFirst,thecur);
FuncInv.GetBounds(infb,supb);
FuncInv.GetTolerance(toler,tolesp/10);//Il vaut mieux garder un peu de marge
math_FunctionSetRoot rsnld(FuncInv,toler,35);
toler *= 10; // Mais on fait les tests correctements
// Resolution...
rsnld.Perform(FuncInv,solrst,infb,supb);
if (!rsnld.IsDone()) {
cout << "Walking::Recadre : RSNLD not done " << endl;
recadre = Standard_False;
}
else {
rsnld.Root(solrst);
recadre = FuncInv.IsSolution(solrst,tolesp);
}
}
if (recadre) {
// Classification topologique
if (OnFirst) {
thecur = TheBlendTool::CurveOnSurf(thearc,surf1);
}
else {
thecur = TheBlendTool::CurveOnSurf(thearc,surf2);
}
TheBlendTool::Bounds(thecur, ufirst,ulast);
Iter->Initialize(thearc);
Iter->InitVertexIterator();
IsVtx = !Iter->MoreVertex();
while (!IsVtx) {
Vtx = Iter->Vertex();
vtol = 0.4*Abs(ulast-ufirst); // Un majorant de la tolerance
if (vtol > Max(TheBlendTool::Tolerance(Vtx,thearc), toler(1)))
vtol = Max(TheBlendTool::Tolerance(Vtx,thearc), toler(1));
if (Abs(TheBlendTool::Parameter(Vtx,thearc)-solrst(1)) <= vtol) {
IsVtx = Standard_True; // On est dans la boule du vertex ou
// le vertex est dans la "boule" du recadrage
}
else {
Iter->NextVertex();
IsVtx = !Iter->MoreVertex();
}
}
if (!Iter->MoreVertex()) {
IsVtx = Standard_False;
}
return Standard_True;
}
return Standard_False;
}
void Blend_Walking::Transition(const Standard_Boolean OnFirst,
const TheArc& A,
const Standard_Real Param,
IntSurf_Transition& TLine,
IntSurf_Transition& TArc)
{
Standard_Boolean computetranstionaveclacorde = 0;
gp_Vec tgline;
Blend_Point prevprev;
if(previousP.IsTangencyPoint()){
if(line->NbPoints() < 2) return;
computetranstionaveclacorde = 1;
if(sens < 0){
prevprev = line->Point(2);
}
else {
prevprev = line->Point(line->NbPoints() - 1);
}
}
gp_Pnt2d p2d;
gp_Vec2d dp2d;
gp_Pnt pbid;
gp_Vec d1u,d1v,normale,tgrst;
gp_Dir thenormal;
CSLib_NormalStatus stat;
TheArcTool::D1(A,Param,p2d,dp2d);
if (OnFirst) {
TheSurfaceTool::D1(surf1,p2d.X(),p2d.Y(),pbid,d1u,d1v);
if(!computetranstionaveclacorde) tgline = previousP.TangentOnS1();
else tgline = gp_Vec(prevprev.PointOnS1(),previousP.PointOnS1());
}
else {
TheSurfaceTool::D1(surf2,p2d.X(),p2d.Y(),pbid,d1u,d1v);
if(!computetranstionaveclacorde) tgline = previousP.TangentOnS2();
else tgline = gp_Vec(prevprev.PointOnS2(),previousP.PointOnS2());
}
tgrst.SetLinearForm(dp2d.X(),d1u,dp2d.Y(),d1v);
CSLib::Normal(d1u, d1v, 1.e-9, stat, thenormal);
if (stat == CSLib_Defined) normale.SetXYZ(thenormal.XYZ());
else {
Handle(Adaptor3d_HSurface) surf;
if (OnFirst) surf = surf1;
else surf = surf2;
Standard_Integer iu, iv;
TColgp_Array2OfVec Der(0, 2 , 0, 2);
TheSurfaceTool::D2(surf,p2d.X(),p2d.Y(),pbid, Der(1,0), Der(0,1),
Der(2,0), Der(0,2), Der(1,1));
Der(2,1) = TheSurfaceTool::DN(surf, p2d.X(), p2d.Y(), 2,1);
Der(1,2) = TheSurfaceTool::DN(surf,p2d.X(),p2d.Y(), 1,2);
Der(2,2) = TheSurfaceTool::DN(surf,p2d.X(),p2d.Y(), 2,2);
CSLib::Normal(2, Der, 1.e-9,
p2d.X(), p2d.Y(),
TheSurfaceTool::FirstUParameter(surf),
TheSurfaceTool::LastUParameter(surf),
TheSurfaceTool::FirstVParameter(surf),
TheSurfaceTool::LastVParameter(surf),
stat, thenormal, iu, iv);
normale.SetXYZ(thenormal.XYZ());
#if DEB
if (stat == CSLib_InfinityOfSolutions)
cout << "Blend_Walking::Transition : Infinite de Normal" << endl;
#endif
}
IntSurf::MakeTransition(tgline,tgrst,normale,TLine,TArc);
}
void Blend_Walking::MakeExtremity(TheExtremity& Extrem,
const Standard_Boolean OnFirst,
const Standard_Integer Index,
const Standard_Real Param,
const Standard_Boolean IsVtx,
const TheVertex& Vtx)
{
IntSurf_Transition Tline,Tarc;
Standard_Integer nbarc;
Handle(TheTopolTool) Iter;
if (OnFirst) {
Extrem.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(), tolesp);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS1());
Iter = recdomain1;
}
else {
Extrem.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(), tolesp);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS2());
Iter = recdomain2;
}
Iter->Init();
nbarc = 1;
while (nbarc < Index) {
nbarc++;
Iter->Next();
}
Transition(OnFirst,Iter->Value(),Param,Tline,Tarc);
Extrem.AddArc(Iter->Value(),Param,Tline,Tarc);
if (IsVtx) Extrem.SetVertex(Vtx);
}
void Blend_Walking::MakeSingularExtremity( TheExtremity& Extrem,
const Standard_Boolean OnFirst,
const TheVertex& Vtx)
{
IntSurf_Transition Tline,Tarc;
Handle(TheTopolTool) Iter;
Standard_Real prm;
if (OnFirst) {
Iter = recdomain1;
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS1());
}
else {
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS2());
Iter = recdomain2;
}
Iter->Init();
Extrem.SetVertex(Vtx);
while (Iter->More()) {
TheArc arc = Iter->Value();
Iter->Initialize(arc);
Iter->InitVertexIterator();
while (Iter->MoreVertex()) {
if (Iter->Identical(Vtx,Iter->Vertex())) {
prm = TheBlendTool::Parameter(Vtx,arc);
Transition(OnFirst,arc,prm,Tline,Tarc);
Extrem.AddArc(arc,prm,Tline,Tarc);
}
Iter->NextVertex();
}
Iter->Next();
}
}

552
src/Blend/Blend_Walking_4.gxx Executable file
View File

@@ -0,0 +1,552 @@
static void evalpinit(math_Vector& parinit,
const Blend_Point& previousP,
const Standard_Real parprec,
const Standard_Real param,
const math_Vector& infbound,
const math_Vector& supbound,
const Standard_Boolean classonS1,
const Standard_Boolean classonS2)
{
if(previousP.IsTangencyPoint()){
previousP.ParametersOnS1(parinit(1),parinit(2));
previousP.ParametersOnS2(parinit(3),parinit(4));
}
else {
Standard_Real u1,v1,u2,v2;
Standard_Real du1,dv1,du2,dv2;
Standard_Boolean Inside=Standard_True;
previousP.ParametersOnS1(u1,v1);
previousP.ParametersOnS2(u2,v2);
previousP.Tangent2dOnS1().Coord(du1,dv1);
previousP.Tangent2dOnS2().Coord(du2,dv2);
Standard_Real step = param - parprec;
u1+= step*du1;
v1+= step*dv1;
if ( classonS1 ) {
if ((u1<infbound(1)) || (u1>supbound(1))) Inside=Standard_False;
if ((v1<infbound(2)) || (v1>supbound(2))) Inside=Standard_False;
}
u2+= step*du2;
v2+= step*dv2;
if ( classonS2) {
if ((u2<infbound(3)) || (u2>supbound(3))) Inside=Standard_False;
if ((v2<infbound(4)) || (v2>supbound(4))) Inside=Standard_False;
}
if (Inside) {
parinit(1) = u1;
parinit(2) = v1;
parinit(3) = u2;
parinit(4) = v2;
}
else { // on ne joue pas au plus malin
previousP.ParametersOnS1(parinit(1),parinit(2));
previousP.ParametersOnS2(parinit(3),parinit(4));
}
}
}
void Blend_Walking::InternalPerform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real Bound)
{
Standard_Real stepw = pasmax;
Standard_Integer nbp = line->NbPoints();
if(nbp >= 2){ //On reprend le dernier step s'il n est pas trop petit.
if(sens < 0.){
stepw = (line->Point(2).Parameter() - line->Point(1).Parameter());
}
else{
stepw = (line->Point(nbp).Parameter() - line->Point(nbp - 1).Parameter());
}
stepw = Max(stepw,100.*tolgui);
}
Standard_Real parprec = param;
if (sens*(parprec - Bound) >= -tolgui) {
return;
}
Blend_Status State = Blend_OnRst12;
TopAbs_State situ1 =TopAbs_IN,situ2=TopAbs_IN;
Standard_Real w1,w2;
Standard_Integer Index1,Index2,nbarc;
Standard_Boolean Arrive,recad1,recad2, control;
Standard_Boolean Isvtx1,Isvtx2,echecrecad;
gp_Pnt2d p2d;
math_Vector tolerance(1,4),infbound(1,4),supbound(1,4),parinit(1,4);
math_Vector solrst1(1,4),solrst2(1,4);
TheVertex Vtx1,Vtx2;
TheExtremity Ext1,Ext2;
//IntSurf_Transition Tline,Tarc;
Func.GetTolerance(tolerance,tolesp);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
parinit = sol;
Arrive = Standard_False;
param = parprec + sens*stepw;
if(sens *(param - Bound) > 0.) {
stepw = sens*(Bound - parprec)*0.5;
param = parprec + sens*stepw;
}
evalpinit(parinit,previousP,parprec,param,
infbound,supbound, clasonS1, clasonS2);
while (!Arrive) {
#ifdef DEB
sectioncalculee = 0;
nbcomputedsection++;
#endif
Standard_Boolean bonpoint = 1;
Func.Set(param);
rsnld.Perform(Func,parinit,infbound,supbound);
if (!rsnld.IsDone()) {
State = Blend_StepTooLarge;
bonpoint = 0;
}
else {
rsnld.Root(sol);
if(clasonS1) situ1 = domain1->Classify(gp_Pnt2d(sol(1),sol(2)),
Min(tolerance(1),tolerance(2)),0);
else situ1 = TopAbs_IN;
if(clasonS2) situ2 = domain2->Classify(gp_Pnt2d(sol(3),sol(4)),
Min(tolerance(3),tolerance(4)),0);
else situ2 = TopAbs_IN;
}
if(bonpoint && line->NbPoints() == 1 && (situ1 != TopAbs_IN || situ2 != TopAbs_IN)){
State = Blend_StepTooLarge;
bonpoint = 0;
}
if(bonpoint){
w1 = w2 = Bound;
recad1 = Standard_False;
recad2 = Standard_False;
echecrecad = Standard_False;
control = Standard_False;
if (situ1 == TopAbs_OUT || situ1 == TopAbs_ON) {
// pb inverse sur surf1
//Si le recadrage s'effectue dans le sens de la progression a une tolerance pres,
//on a pris la mauvaise solution.
recad1 = Recadre(FuncInv,Standard_True,
sol,solrst1,Index1,Isvtx1,Vtx1);
if (recad1) {
Standard_Real wtemp;
wtemp = solrst1(2);
if ((param - wtemp)/sens>= -10*tolesp){
w1 = solrst1(2);
control = Standard_True;
}
else {
echecrecad = Standard_True;
recad1 = Standard_False;
State = Blend_StepTooLarge;
bonpoint = 0;
stepw = stepw/2.;
}
}
else {
echecrecad = Standard_True;
}
}
if (situ2 == TopAbs_OUT || situ2 == TopAbs_ON) {
// pb inverse sur surf2
//Si le recadrage s'effectue dans le sens de la progression a une tolerance pres,
//on a pris la mauvaise solution.
recad2 = Recadre(FuncInv,Standard_False,
sol,solrst2,Index2,Isvtx2,Vtx2);
if (recad2) {
Standard_Real wtemp;
wtemp = solrst2(2);
if ((param - wtemp)/sens>= -10*tolesp){
w2 = solrst2(2);
control = Standard_True;
}
else {
echecrecad = Standard_True;
recad2 = Standard_False;
State = Blend_StepTooLarge;
bonpoint = 0;
stepw = stepw/2.;
}
}
else {
echecrecad = Standard_True;
}
}
// Que faut il controler
if (recad1 && recad2) {
if (Abs(w1-w2) <= 10*tolgui) {
// pas besoin de controler les recadrage
// Le control pouvant se planter (cf model blend10)
// La tolerance est choisie grossse afin, de permetre au
// cheminement suivant, de poser quelques sections ...
control = Standard_False;
}
else if (sens*(w1-w2) < 0.) {
//sol sur 1 ?
recad2 = Standard_False;
}
else {
//sol sur 2 ?
recad1 = Standard_False;
}
}
// Controle effectif des recadrage
if (control) {
TopAbs_State situ;
if (recad1 && clasonS2) {
situ = recdomain2->Classify(gp_Pnt2d(solrst1(3),solrst1(4)),
Min(tolerance(3),tolerance(4)));
if (situ == TopAbs_OUT) {
recad1 = Standard_False;
echecrecad = Standard_True;
}
}
else if (recad2 && clasonS1) {
situ = recdomain1->Classify(gp_Pnt2d(solrst2(3),solrst2(4)),
Min(tolerance(1),tolerance(1)));
if (situ == TopAbs_OUT) {
recad2 = Standard_False;
echecrecad = Standard_True;
}
}
}
if(recad1 || recad2) echecrecad = Standard_False;
if (!echecrecad) {
if (recad1 && recad2) {
//sol sur 1 et 2 a la fois
// On passe par les arcs , pour ne pas avoir de probleme
// avec les surfaces periodiques.
State = Blend_OnRst12;
param = (w1+w2)/2;
p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
sol(1) = p2d.X();
sol(2) = p2d.Y();
p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
sol(3) = p2d.X();
sol(4) = p2d.Y();
}
else if (recad1) {
// sol sur 1
State = Blend_OnRst1;
param = w1;
recdomain1->Init();
nbarc = 1;
while (nbarc < Index1) {
nbarc++;
recdomain1->Next();
}
p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
sol(1) = p2d.X();
sol(2) = p2d.Y();
sol(3) = solrst1(3);
sol(4) = solrst1(4);
}
else if (recad2) {
//sol sur 2
State = Blend_OnRst2;
param = w2;
recdomain2->Init();
nbarc = 1;
while (nbarc < Index2) {
nbarc++;
recdomain2->Next();
}
p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
sol(1) = solrst2(3);
sol(2) = solrst2(4);
sol(3) = p2d.X();
sol(4) = p2d.Y();
}
else {
State = Blend_OK;
}
Standard_Boolean testdefl = 1;
#ifdef DEB
testdefl = !Blend_GetcontextNOTESTDEFL();
#endif
if (recad1 || recad2) {
Func.Set(param);
// Il vaut mieux un pas non orthodoxe que pas de recadrage!! PMN
State = TestArret(Func, State,
(testdefl && (Abs(stepw) > 3*tolgui)),
Standard_False, Standard_True);
}
else {
State = TestArret(Func, State, testdefl);
}
}
else {
// Ou bien le pas max est mal regle. On divise.
// if(line->NbPoints() == 1) State = Blend_StepTooLarge;
if (stepw > 2*tolgui) State = Blend_StepTooLarge;
// Sinon echec recadrage. On sort avec PointsConfondus
else {
#if DEB
cout << "Echec recadrage" << endl;
#endif
State = Blend_SamePoints;
}
}
}
#ifdef DEB
if (Blend_GettraceDRAWSECT()){
Drawsect(surf1,surf2,sol,param,Func, State);
}
#endif
switch (State) {
case Blend_OK :
{
// Mettre a jour la ligne.
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
parprec = param;
if (param == Bound) {
Arrive = Standard_True;
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(), tolesp);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(), tolesp);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
}
// Indiquer que fin sur Bound.
}
else {
param = param + sens*stepw;
if (sens*(param - Bound) > - tolgui) {
param = Bound;
}
}
evalpinit(parinit,previousP,parprec,param,
infbound,supbound, clasonS1, clasonS2);
}
break;
case Blend_StepTooLarge :
{
stepw = stepw/2.;
if (Abs(stepw) < tolgui) {
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
}
Arrive = Standard_True;
if (line->NbPoints()>=2) {
// Indiquer qu on s arrete en cours de cheminement
}
// else {
// line->Clear();
// }
}
else {
param = parprec + sens*stepw; // on ne risque pas de depasser Bound.
evalpinit(parinit,previousP,parprec,param,
infbound,supbound, clasonS1, clasonS2);
}
}
break;
case Blend_StepTooSmall :
{
// Mettre a jour la ligne.
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
parprec = param;
stepw = Min(1.5*stepw,pasmax);
if (param == Bound) {
Arrive = Standard_True;
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
}
// Indiquer que fin sur Bound.
}
else {
param = param + sens*stepw;
if (sens*(param - Bound) > - tolgui) {
param = Bound;
}
}
evalpinit(parinit,previousP,parprec,param,
infbound,supbound, clasonS1, clasonS2);
}
break;
case Blend_OnRst1 :
{
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
MakeExtremity(Ext1,Standard_True,Index1,
solrst1(1),Isvtx1,Vtx1);
// On blinde le cas singulier ou un des recadrage a planter
if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) {
Ext2.SetValue(previousP.PointOnS1(),
sol(3),sol(4),tolesp);
if (Isvtx1) MakeSingularExtremity(Ext2, Standard_False, Vtx1);
}
else {
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
}
Arrive = Standard_True;
}
break;
case Blend_OnRst2 :
{
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
// On blinde le cas singulier ou un des recadrage a plante
if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) {
Ext1.SetValue(previousP.PointOnS2(),
sol(1),sol(2),tolesp);
if (Isvtx2) MakeSingularExtremity(Ext1, Standard_True, Vtx2);
}
else {
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
}
MakeExtremity(Ext2,Standard_False,Index2,
solrst2(1),Isvtx2,Vtx2);
Arrive = Standard_True;
}
break;
case Blend_OnRst12 :
{
if (sens>0.) {
line->Append(previousP);
}
else {
line->Prepend(previousP);
}
if ( (Isvtx1 != Isvtx2) &&
(previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) ) {
// On blinde le cas singulier ou un seul recadrage
// est reconnu comme vertex.
if (Isvtx1) {
Isvtx2 = Standard_True;
Vtx2 = Vtx1;
}
else {
Isvtx1 = Standard_True;
Vtx1 = Vtx2;
}
}
MakeExtremity(Ext1,Standard_True,Index1,
solrst1(1),Isvtx1,Vtx1);
MakeExtremity(Ext2,Standard_False,Index2,
solrst2(1),Isvtx2,Vtx2);
Arrive = Standard_True;
}
break;
case Blend_SamePoints :
{
// On arrete
#if DEB
cout << " Points confondus dans le cheminement" << endl;
#endif
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);;
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
}
Arrive = Standard_True;
}
break;
#ifndef DEB
default:
break;
#endif
}
if (Arrive) {
if (sens > 0.) {
line->SetEndPoints(Ext1,Ext2);
}
else {
line->SetStartPoints(Ext1,Ext2);
}
}
}
}

9
src/Blend/FILES Executable file
View File

@@ -0,0 +1,9 @@
Blend_Walking_1.gxx
Blend_Walking_2.gxx
Blend_Walking_3.gxx
Blend_Walking_4.gxx
Blend_CSWalking_1.gxx
Blend_CSWalking_2.gxx
Blend_CSWalking_3.gxx
Blend_CSWalking_4.gxx
Blend_Debug.cxx