mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
10
src/IntWalk/FILES
Executable file
10
src/IntWalk/FILES
Executable file
@@ -0,0 +1,10 @@
|
||||
IntWalk_IWalking_1.gxx
|
||||
IntWalk_IWalking_2.gxx
|
||||
IntWalk_IWalking_3.gxx
|
||||
IntWalk_IWalking_4.gxx
|
||||
IntWalk_IWalking_5.gxx
|
||||
IntWalk_IWalking_6.gxx
|
||||
IntWalk_PWalking_1.gxx
|
||||
IntWalk_PWalking_2.gxx
|
||||
IntWalk_PWalking_3.gxx
|
||||
IntWalk_PWalking_4.gxx
|
64
src/IntWalk/IntWalk.cdl
Executable file
64
src/IntWalk/IntWalk.cdl
Executable file
@@ -0,0 +1,64 @@
|
||||
-- File: IntWalk.cdl
|
||||
-- Created: Thu Mar 28 11:05:24 1991
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@topsn3>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
|
||||
package IntWalk
|
||||
|
||||
---Purpose: This package defines the "walking" (marching?)algorithmes
|
||||
-- for the intersection between two surfaces.
|
||||
-- One of the surfaces is a parametric one.
|
||||
-- If the other is an implicit one, the "IWalking" class will
|
||||
-- be used.
|
||||
-- If both surfaces are parametric, the "PWalking" class will
|
||||
-- be used.
|
||||
|
||||
---Level: Internal
|
||||
--
|
||||
-- All the methods of the classes of this package are Internal.
|
||||
--
|
||||
uses
|
||||
Standard, MMgt, TCollection, TColStd, gp, math, StdFail, IntSurf, IntImp
|
||||
|
||||
is
|
||||
|
||||
enumeration StatusDeflection is
|
||||
PasTropGrand, PointConfondu, ArretSurPointPrecedent,
|
||||
ArretSurPoint, OK;
|
||||
|
||||
-- classe definition ressource sur surface biparametree
|
||||
|
||||
deferred generic class PSurfaceTool;
|
||||
|
||||
|
||||
-- classes de definition pour algorithme cheminement sur une
|
||||
-- surface biparametree
|
||||
|
||||
deferred generic class PathPointTool;
|
||||
|
||||
deferred generic class LoopPointTool;
|
||||
|
||||
deferred generic class IWFunction;
|
||||
|
||||
generic class Iterator;
|
||||
|
||||
|
||||
--classes des objets resultat pour cheminement sur surface bi-parametree
|
||||
|
||||
generic class IWLine;
|
||||
|
||||
|
||||
--algorithme cheminement/resolution
|
||||
|
||||
generic class IWalking, TheIWLine, SequenceOfIWLine;
|
||||
|
||||
|
||||
--algorithme/resolution pour un cheminement sur intersection entre
|
||||
-- 2 surfaces biparametrees
|
||||
|
||||
generic class PWalking, TheInt2S;
|
||||
|
||||
|
||||
end IntWalk;
|
115
src/IntWalk/IntWalk_IWFunction.cdl
Executable file
115
src/IntWalk/IntWalk_IWFunction.cdl
Executable file
@@ -0,0 +1,115 @@
|
||||
-- File: IntWalk_IWFunction.cdl
|
||||
-- Created: Thu Jun 3 12:05:37 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@topsn2>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred generic class IWFunction from IntWalk
|
||||
(ThePSurface as any)
|
||||
|
||||
inherits FunctionSetWithDerivatives from math
|
||||
|
||||
|
||||
---Purpose: Template class for a function on a parametric surface.
|
||||
-- the form of the function is F(u,v) = 0 where u and v are
|
||||
-- the parameteric coordinates of a point on the surface.
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Pnt from gp,
|
||||
Vec from gp,
|
||||
Dir2d from gp
|
||||
|
||||
|
||||
raises UndefinedDerivative from StdFail
|
||||
|
||||
is
|
||||
|
||||
Set(me: in out; PS: ThePSurface)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbVariables(me)
|
||||
|
||||
---Purpose: This method has to return 2.
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
|
||||
---Purpose: This method has to return 1.
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
Value(me : in out; X : Vector from math;
|
||||
F : out Vector from math)
|
||||
|
||||
---Purpose: The dimension of F is 1.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Derivatives(me : in out; X : Vector from math;
|
||||
D : out Matrix from math)
|
||||
|
||||
---Purpose: The dimension of D is (1,2).
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Values(me : in out; X : Vector from math;
|
||||
F : out Vector from math;
|
||||
D : out Matrix from math)
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Root(me)
|
||||
|
||||
---Purpose: Root is the value of the function at the solution.
|
||||
-- It is a vector of dimension 1, i-e a real.
|
||||
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
|
||||
Tolerance(me)
|
||||
|
||||
---Purpose: Returns the value Tol so that if Abs(Func.Root())<Tol
|
||||
-- the function is considered null.
|
||||
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
|
||||
Point(me)
|
||||
|
||||
---Purpose: Returns the value of the solution point on the surface.
|
||||
|
||||
returns Pnt from gp
|
||||
is static;
|
||||
|
||||
|
||||
IsTangent(me : in out)
|
||||
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
Direction3d(me: in out)
|
||||
|
||||
returns Vec from gp
|
||||
raises UndefinedDerivative from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
Direction2d(me: in out)
|
||||
|
||||
returns Dir2d from gp
|
||||
raises UndefinedDerivative from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
end IWFunction;
|
0
src/IntWalk/IntWalk_IWFunction.gxx
Executable file
0
src/IntWalk/IntWalk_IWFunction.gxx
Executable file
317
src/IntWalk/IntWalk_IWLine.cdl
Executable file
317
src/IntWalk/IntWalk_IWLine.cdl
Executable file
@@ -0,0 +1,317 @@
|
||||
-- File: IWLine.cdl
|
||||
-- Created: Wed Mar 25 15:16:53 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@sdsun4>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
generic class IWLine from IntWalk
|
||||
(TheStartPoint as any)
|
||||
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: Definition of a polyline resulting of the IWalking algoritm.
|
||||
-- Each point verifies :
|
||||
-- F(x(u,v),y(u,v),z(u,v))=0, F=implicit function.
|
||||
-- (x(u,v),y(u,v),z(u,v)) point on a parametric surface.
|
||||
-- This polyline is computed marching from a starting a point
|
||||
-- located on the surface 's boundary or inside the surface
|
||||
-- domain.
|
||||
-- a marching status is returned:
|
||||
-- ok --> the polyline starts and ends on a marching
|
||||
-- point
|
||||
-- tangent --> the polyline ends on a tangent point
|
||||
-- outside the boundaries --> the polyline is outside the
|
||||
-- surface 's boundaries .it ends on the natural boundaries
|
||||
-- because no marching points where found to stop
|
||||
-- beware : the directions are not oriented.
|
||||
|
||||
uses Couple from IntSurf,
|
||||
SequenceOfCouple from IntSurf,
|
||||
PntOn2S from IntSurf,
|
||||
LineOn2S from IntSurf,
|
||||
Vec from gp
|
||||
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
DomainError from Standard
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns mutable IWLine;
|
||||
|
||||
|
||||
Reverse(me : mutable)
|
||||
---Purpose: reverse the points in the line. Hasfirst, HasLast are kept.
|
||||
is static;
|
||||
|
||||
Cut(me : mutable; Index : Integer from Standard)
|
||||
---Purpose: Cut the line at the point of rank Index.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
AddPoint(me : mutable; P : PntOn2S from IntSurf)
|
||||
---Purpose: Add a point in the line.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
AddStatusFirst(me : mutable; Closed, HasFirst : Boolean from Standard)
|
||||
---Purpose:
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
AddStatusFirst(me : mutable; Closed, HasLast : Boolean from Standard;
|
||||
Index : Integer from Standard;
|
||||
P : TheStartPoint)
|
||||
---Purpose:
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
AddStatusFirstLast(me : mutable;
|
||||
Closed, HasFirst, HasLast: Boolean from Standard)
|
||||
---Purpose:
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
AddStatusLast(me : mutable; HasLast : Boolean from Standard)
|
||||
---Purpose:
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
AddStatusLast(me : mutable; HasLast : Boolean from Standard;
|
||||
Index : Integer from Standard;
|
||||
P : TheStartPoint)
|
||||
---Purpose:
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
AddIndexPassing(me : mutable; Index : Integer from Standard)
|
||||
|
||||
---Purpose: associer a l 'indice du point sur la ligne l'indice du point
|
||||
-- passant dans l'iterateur de depart
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
SetTangentVector(me: mutable; V: Vec from gp;
|
||||
Index: Integer from Standard)
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
SetTangencyAtBegining(me: mutable; IsTangent: Boolean from Standard)
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
SetTangencyAtEnd(me: mutable; IsTangent: Boolean from Standard)
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
NbPoints(me)
|
||||
|
||||
---Purpose: Returns the number of points of the line (including first
|
||||
-- point and end point : see HasLastPoint and HasFirstPoint).
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range Index.
|
||||
-- If index <= 0 or Index > NbPoints, an exception is raised.
|
||||
|
||||
returns PntOn2S from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Line(me)
|
||||
|
||||
---Purpose: Returns the LineOn2S contained in the walking line.
|
||||
|
||||
returns mutable LineOn2S from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsClosed(me)
|
||||
|
||||
---Purpose: Returns True if the line is closed.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasFirstPoint(me)
|
||||
|
||||
---Purpose: Returns True if the first point of the line is a
|
||||
-- marching point . when is HasFirstPoint==False ,the line
|
||||
-- begins on the natural bound of the surface.the line can be
|
||||
-- too long
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasLastPoint(me)
|
||||
|
||||
---Purpose: Returns True if the end point of the line is a
|
||||
-- marching point (Point from IntWS).
|
||||
-- when is HasFirstPoint==False ,the line ends
|
||||
-- on the natural bound of the surface.the line can be
|
||||
-- too long.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPoint(me)
|
||||
|
||||
---Purpose: Returns the first point of the line when it is a
|
||||
-- marching point.
|
||||
-- An exception is raised if HasFirstPoint returns False.
|
||||
|
||||
returns any TheStartPoint
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPointIndex(me)
|
||||
|
||||
---Purpose: Returns the Index of first point of the line when it is a
|
||||
-- marching point.This index is the index in the
|
||||
-- PointStartIterator.
|
||||
-- An exception is raised if HasFirstPoint returns False.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPoint(me)
|
||||
|
||||
---Purpose: Returns the last point of the line when it is a
|
||||
-- marching point.
|
||||
-- An exception is raised if HasLastPoint returns False.
|
||||
|
||||
returns any TheStartPoint
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPointIndex(me)
|
||||
|
||||
---Purpose: Returns the index of last point of the line when it is a
|
||||
-- marching point.This index is the index in the
|
||||
-- PointStartIterator.
|
||||
-- An exception is raised if HasLastPoint returns False.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPassingPoint(me)
|
||||
|
||||
---Purpose: returns the number of points belonging to Pnts1 which are
|
||||
-- passing point.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
PassingPoint(me; Index: Integer from Standard;
|
||||
IndexLine, IndexPnts : out Integer from Standard)
|
||||
|
||||
---Purpose: returns the index of the point belonging to the line which
|
||||
-- is associated to the passing point belonging to Pnts1
|
||||
-- an exception is raised if Index > NbPassingPoint()
|
||||
|
||||
raises OutOfRange from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
TangentVector(me; Index: out Integer from Standard)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsTangentAtBegining(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsTangentAtEnd(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
line : LineOn2S from IntSurf;
|
||||
couple : SequenceOfCouple from IntSurf;
|
||||
closed : Boolean from Standard;
|
||||
hasFirst : Boolean from Standard;
|
||||
hasLast : Boolean from Standard;
|
||||
firstIndex : Integer from Standard;
|
||||
lastIndex : Integer from Standard;
|
||||
theFirstPoint : TheStartPoint;
|
||||
theLastPoint : TheStartPoint;
|
||||
indextg : Integer from Standard;
|
||||
vcttg : Vec from gp;
|
||||
istgtbeg : Boolean from Standard;
|
||||
istgtend : Boolean from Standard;
|
||||
|
||||
end IWLine;
|
20
src/IntWalk/IntWalk_IWLine.gxx
Executable file
20
src/IntWalk/IntWalk_IWLine.gxx
Executable file
@@ -0,0 +1,20 @@
|
||||
#include <IntSurf_Couple.hxx>
|
||||
|
||||
IntWalk_IWLine::IntWalk_IWLine()
|
||||
{
|
||||
line = new IntSurf_LineOn2S ();
|
||||
closed=hasFirst=hasLast=istgtbeg=istgtend=Standard_False;
|
||||
indextg=-1;
|
||||
}
|
||||
|
||||
void IntWalk_IWLine::Reverse()
|
||||
{
|
||||
line->Reverse();
|
||||
Standard_Integer N = line->NbPoints();
|
||||
Standard_Integer NbCouple = couple.Length();
|
||||
for (Standard_Integer i = 1; i <= NbCouple; i++) {
|
||||
couple(i) = IntSurf_Couple(N - couple(i).First() + 1,
|
||||
couple(i).Second());
|
||||
}
|
||||
}
|
||||
|
178
src/IntWalk/IntWalk_IWLine.lxx
Executable file
178
src/IntWalk/IntWalk_IWLine.lxx
Executable file
@@ -0,0 +1,178 @@
|
||||
#ifndef Standard_DomainError_HeaderFile
|
||||
#include <Standard_DomainError.hxx>
|
||||
#endif
|
||||
#ifndef IntSurf_LineOn2S_HeaderFile
|
||||
#include <IntSurf_LineOn2S.hxx>
|
||||
#endif
|
||||
#ifndef IntSurf_Couple_HeaderFile
|
||||
#include <IntSurf_Couple.hxx>
|
||||
#endif
|
||||
#ifndef IntSurf_SequenceOfCouple_HeaderFile
|
||||
#include <IntSurf_SequenceOfCouple.hxx>
|
||||
#endif
|
||||
|
||||
inline void IntWalk_IWLine::Cut(const Standard_Integer Index)
|
||||
{
|
||||
//-- cout<<" split : "<<Index<<endl;
|
||||
Handle(IntSurf_LineOn2S) lost = line->Split(Index);
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddPoint(const IntSurf_PntOn2S& P)
|
||||
{
|
||||
line->Add(P);
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddStatusFirst(const Standard_Boolean Closed,
|
||||
const Standard_Boolean HasFirst)
|
||||
{
|
||||
closed = Closed;
|
||||
hasFirst = HasFirst;
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddStatusLast (const Standard_Boolean HasLast)
|
||||
{
|
||||
hasLast = HasLast;
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddStatusFirst(const Standard_Boolean Closed,
|
||||
const Standard_Boolean HasFirst,
|
||||
const Standard_Integer Index,
|
||||
const TheStartPoint& P ) {
|
||||
closed = Closed;
|
||||
hasFirst = HasFirst;
|
||||
firstIndex = Index;
|
||||
theFirstPoint = P;
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddStatusLast(const Standard_Boolean HasLast,
|
||||
const Standard_Integer Index,
|
||||
const TheStartPoint& P ) {
|
||||
hasLast = HasLast;
|
||||
lastIndex = Index;
|
||||
theLastPoint = P;
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddStatusFirstLast(const Standard_Boolean Closed,
|
||||
const Standard_Boolean HasFirst,
|
||||
const Standard_Boolean HasLast )
|
||||
{
|
||||
closed = Closed;
|
||||
hasFirst = HasFirst;
|
||||
hasLast = HasLast;
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::AddIndexPassing(const Standard_Integer Index)
|
||||
|
||||
{
|
||||
couple.Append(IntSurf_Couple(line->NbPoints()+1, Index));
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_IWLine::NbPoints() const
|
||||
{
|
||||
return line->NbPoints();
|
||||
}
|
||||
|
||||
inline const IntSurf_PntOn2S& IntWalk_IWLine::Value
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
return line->Value(Index);
|
||||
}
|
||||
|
||||
inline const Handle(IntSurf_LineOn2S)& IntWalk_IWLine::Line () const
|
||||
{
|
||||
return line;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_IWLine::IsClosed() const
|
||||
{
|
||||
return closed;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_IWLine::HasFirstPoint() const
|
||||
{
|
||||
return hasFirst;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_IWLine::FirstPointIndex() const
|
||||
{
|
||||
if (!hasFirst) Standard_DomainError::Raise();
|
||||
return firstIndex;
|
||||
}
|
||||
|
||||
inline const TheStartPoint& IntWalk_IWLine::FirstPoint() const
|
||||
{
|
||||
if (!hasFirst) Standard_DomainError::Raise();
|
||||
return theFirstPoint;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_IWLine::HasLastPoint() const
|
||||
{
|
||||
return hasLast;
|
||||
}
|
||||
|
||||
inline const TheStartPoint& IntWalk_IWLine::LastPoint() const
|
||||
{
|
||||
if (!hasLast) Standard_DomainError::Raise();
|
||||
return theLastPoint;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_IWLine::LastPointIndex() const
|
||||
{
|
||||
if (!hasLast) Standard_DomainError::Raise();
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_IWLine::NbPassingPoint() const
|
||||
{
|
||||
return couple.Length();
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::PassingPoint(const Standard_Integer Index,
|
||||
Standard_Integer& IndexLine,
|
||||
Standard_Integer& IndexPnts) const
|
||||
{
|
||||
IndexLine = couple(Index).First();
|
||||
IndexPnts = couple(Index).Second();
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::SetTangentVector (const gp_Vec& V,
|
||||
const Standard_Integer Index) {
|
||||
indextg = Index;
|
||||
vcttg = V;
|
||||
|
||||
//-- cout<<"\n IntWalk_IWLine::SetTangentVector : "<<V.X()<<" "<<V.Y()<<" "<<V.Z()<<" Ind:"<<Index<<" NbPts:"<<NbPoints()<<endl;
|
||||
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::SetTangencyAtBegining
|
||||
(const Standard_Boolean IsTangent) {
|
||||
|
||||
istgtend = IsTangent;
|
||||
}
|
||||
|
||||
inline void IntWalk_IWLine::SetTangencyAtEnd
|
||||
(const Standard_Boolean IsTangent) {
|
||||
|
||||
istgtend = IsTangent;
|
||||
}
|
||||
|
||||
inline const gp_Vec& IntWalk_IWLine::TangentVector
|
||||
(Standard_Integer& Index) const {
|
||||
//-- if(istgtend == Standard_False && istgtbeg == Standard_False) {
|
||||
//-- cout<<" IntWalk_IWLine.lxx : Pb "<<endl;
|
||||
//-- }
|
||||
Index = indextg;
|
||||
return vcttg;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_IWLine::IsTangentAtBegining () const {
|
||||
|
||||
return istgtbeg;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_IWLine::IsTangentAtEnd () const {
|
||||
|
||||
return istgtend;
|
||||
}
|
||||
|
||||
|
293
src/IntWalk/IntWalk_IWalking.cdl
Executable file
293
src/IntWalk/IntWalk_IWalking.cdl
Executable file
@@ -0,0 +1,293 @@
|
||||
-- File: IWalking.cdl
|
||||
-- Created: Wed Mar 25 15:16:53 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@sdsun4>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
generic class IWalking from IntWalk (
|
||||
ThePointOfPath as any;
|
||||
ThePointOfPathTool as any; -- as PathPointTool(ThePointOfPath)
|
||||
ThePOPIterator as any; -- as Iterator from IntWalk(ThePointOfPath)
|
||||
ThePointOfLoop as any;
|
||||
ThePointOfLoopTool as any; -- as LoopPointTool(ThePointOfLoop)
|
||||
ThePOLIterator as any; -- as Iterator from IntWalk(ThePointOfLoop)
|
||||
ThePSurface as any;
|
||||
ThePSurfaceTool as any; -- as PSurfaceTool(ThePSurface)
|
||||
TheIWFunction as any) -- as IWFunction from IntWalk(ThePSurface)
|
||||
|
||||
|
||||
---Purpose: This class implements an algorithm to find all the points
|
||||
-- on a parametric surface verifying f(u,v)=0
|
||||
-- where f is defined in the IWFunction class.
|
||||
-- These points are found by a marching algorithm, using a set of
|
||||
-- points as starting points.
|
||||
|
||||
|
||||
|
||||
|
||||
uses Vector from math,
|
||||
SequenceOfInteger from TColStd,
|
||||
SequenceOfReal from TColStd,
|
||||
StatusDeflection from IntWalk,
|
||||
Vec from gp,
|
||||
Dir2d from gp,
|
||||
PntOn2S from IntSurf
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
|
||||
class TheIWLine instantiates IWLine from IntWalk
|
||||
(ThePointOfPath);
|
||||
|
||||
class SequenceOfIWLine instantiates Sequence from TCollection
|
||||
(TheIWLine);
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns IWalking from IntWalk;
|
||||
|
||||
|
||||
Create(Epsilon, Deflection, Step : Real from Standard)
|
||||
|
||||
---Purpose: Deflection is the maximum deflection admitted between two
|
||||
-- consecutive points on a resulting polyline.
|
||||
-- Step is the maximum increment admitted between two
|
||||
-- consecutive points (in 2d space).
|
||||
-- Epsilon est la tolerance au dela de laquelle 2 points
|
||||
-- sont confondus
|
||||
|
||||
returns IWalking from IntWalk;
|
||||
|
||||
|
||||
SetTolerance(me: in out;Epsilon, Deflection, Step : Real from Standard)
|
||||
|
||||
---Purpose: Deflection is the maximum deflection admitted between two
|
||||
-- consecutive points on a resulting polyline.
|
||||
-- Step is the maximum increment admitted between two
|
||||
-- consecutive points (in 2d space).
|
||||
-- Epsilon est la tolerance au dela de laquelle 2 points
|
||||
-- sont confondus
|
||||
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
Pnts1 : ThePOPIterator;
|
||||
Pnts2 : ThePOLIterator;
|
||||
Func : in out TheIWFunction;
|
||||
S : ThePSurface;
|
||||
Reversed : Boolean from Standard = Standard_False)
|
||||
|
||||
---Purpose: Searches a set of polylines starting on a point of Pnts1
|
||||
-- or Pnts2.
|
||||
-- Each point on a resulting polyline verifies F(u,v)=0
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
Pnts1 : ThePOPIterator;
|
||||
Func : in out TheIWFunction;
|
||||
S : ThePSurface;
|
||||
Reversed : Boolean from Standard = Standard_False)
|
||||
|
||||
---Purpose: Searches a set of polylines starting on a point of Pnts1.
|
||||
-- Each point on a resulting polyline verifies F(u,v)=0
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns true if the calculus was successful.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbLines(me)
|
||||
|
||||
---Purpose: Returns the number of resulting polylines.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the polyline of range Index.
|
||||
-- An exception is raised if IsDone is False.
|
||||
-- An exception is raised if Index<=0 or Index>NbLines.
|
||||
|
||||
returns TheIWLine
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbSinglePnts(me)
|
||||
|
||||
---Purpose: Returns the number of points belonging to Pnts on which no
|
||||
-- line starts or ends.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SinglePnt(me ; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range Index .
|
||||
-- An exception is raised if IsDone returns False.
|
||||
-- An exception is raised if Index<=0 or
|
||||
-- Index > NbSinglePnts.
|
||||
|
||||
returns ThePointOfPath
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
-- -- private
|
||||
|
||||
Cadrage(me; BornInf, BornSup, UVap : in out Vector from math;
|
||||
Step : in out Real from Standard;
|
||||
-- StepV : in out Real from Standard;
|
||||
StepSign : Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
is static protected;
|
||||
|
||||
TestArretPassage (me: in out; Umult : SequenceOfReal from TColStd;
|
||||
Vmult : SequenceOfReal from TColStd;
|
||||
Section: in out TheIWFunction;
|
||||
UV : in out Vector from math;
|
||||
Irang : out Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
is static protected;
|
||||
|
||||
TestArretPassage (me: in out; Umult : SequenceOfReal from TColStd;
|
||||
Vmult : SequenceOfReal from TColStd;
|
||||
UV : Vector from math;
|
||||
Index : Integer from Standard;
|
||||
Irang : out Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
is static protected;
|
||||
|
||||
TestArretAjout(me: in out; Section: in out TheIWFunction;
|
||||
UV : in out Vector from math;
|
||||
Irang : out Integer from Standard;
|
||||
PSol : out PntOn2S from IntSurf )
|
||||
returns Boolean from Standard
|
||||
is static protected;
|
||||
|
||||
TestArretCadre(me : in out; Umult : SequenceOfReal from TColStd;
|
||||
Vmult : SequenceOfReal from TColStd;
|
||||
Line : mutable TheIWLine;
|
||||
Section: in out TheIWFunction;
|
||||
UV : in out Vector from math;
|
||||
Irang : out Integer from Standard)
|
||||
is static protected;
|
||||
|
||||
|
||||
TestDeflection(me: in out; Section : in out TheIWFunction;
|
||||
Finished : Boolean from Standard;
|
||||
UV : Vector from math;
|
||||
StatusPrecedent : StatusDeflection from IntWalk;
|
||||
NbDivision : in out Integer from Standard;
|
||||
Step : in out Real from Standard;
|
||||
-- StepV : in out Real from Standard;
|
||||
StepSign : Integer from Standard)
|
||||
returns StatusDeflection from IntWalk
|
||||
is static protected;
|
||||
|
||||
ComputeOpenLine(me : in out; Umult : SequenceOfReal from TColStd;
|
||||
Vmult : SequenceOfReal from TColStd;
|
||||
Pnts1 : ThePOPIterator;
|
||||
Section: in out TheIWFunction;
|
||||
Rajout : in out Boolean from Standard)
|
||||
is static protected;
|
||||
|
||||
OpenLine(me : in out; N : Integer from Standard;
|
||||
Psol : PntOn2S from IntSurf;
|
||||
Pnts1 : ThePOPIterator;
|
||||
Section: in out TheIWFunction;
|
||||
Line : mutable TheIWLine)
|
||||
is static protected;
|
||||
|
||||
ComputeCloseLine(me : in out; Umult : SequenceOfReal from TColStd;
|
||||
Vmult : SequenceOfReal from TColStd;
|
||||
Pnts1 : ThePOPIterator;
|
||||
Pnts2 : ThePOLIterator;
|
||||
Section: in out TheIWFunction;
|
||||
Rajout : in out Boolean from Standard)
|
||||
is static protected;
|
||||
|
||||
AddPointInCurrentLine(me ; N : Integer from Standard;
|
||||
PathPnt : ThePointOfPath;
|
||||
CurrentLine : mutable TheIWLine)
|
||||
is static protected;
|
||||
|
||||
MakeWalkingPoint(me : in out ; Case : Integer from Standard;
|
||||
U,V : Real from Standard;
|
||||
Section : in out TheIWFunction;
|
||||
Psol : in out PntOn2S from IntSurf)
|
||||
|
||||
is static protected;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
seqSingle : ThePOPIterator;
|
||||
fleche : Real from Standard;
|
||||
pas : Real from Standard;
|
||||
tolerance : Vector from math;
|
||||
epsilon : Real from Standard;
|
||||
reversed : Boolean from Standard;
|
||||
|
||||
ustart1 : SequenceOfReal from TColStd;
|
||||
vstart1 : SequenceOfReal from TColStd;
|
||||
nbMultiplicities : SequenceOfInteger from TColStd;
|
||||
etat1 : SequenceOfInteger from TColStd;
|
||||
ustart2 : SequenceOfReal from TColStd;
|
||||
vstart2 : SequenceOfReal from TColStd;
|
||||
etat2 : SequenceOfInteger from TColStd;
|
||||
Um : Real from Standard; -- Min U de la surf
|
||||
UM : Real from Standard; -- Max U de la surf
|
||||
Vm : Real from Standard; -- Min V de la surf
|
||||
VM : Real from Standard; -- Max V de la surf
|
||||
previousPoint : PntOn2S from IntSurf;
|
||||
prevtg : Boolean from Standard;
|
||||
previousd3d : Vec from gp;
|
||||
previousd2d : Dir2d from gp;
|
||||
seqAjout : SequenceOfInteger from TColStd;
|
||||
lines : SequenceOfIWLine;
|
||||
|
||||
end IWalking;
|
||||
|
12
src/IntWalk/IntWalk_IWalking.gxx
Executable file
12
src/IntWalk/IntWalk_IWalking.gxx
Executable file
@@ -0,0 +1,12 @@
|
||||
#include <IntWalk_StatusDeflection.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
#include <IntWalk_IWalking_1.gxx>
|
||||
#include <IntWalk_IWalking_2.gxx>
|
||||
#include <IntWalk_IWalking_3.gxx>
|
||||
#include <IntWalk_IWalking_4.gxx>
|
||||
#include <IntWalk_IWalking_5.gxx>
|
||||
#include <IntWalk_IWalking_6.gxx>
|
48
src/IntWalk/IntWalk_IWalking.lxx
Executable file
48
src/IntWalk/IntWalk_IWalking.lxx
Executable file
@@ -0,0 +1,48 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
#include IntWalk_TheIWLine_hxx
|
||||
|
||||
inline void IntWalk_IWalking::SetTolerance(const Standard_Real Epsilon,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real Increment )
|
||||
{
|
||||
fleche = Deflection;
|
||||
pas = Increment;
|
||||
epsilon = Epsilon*Epsilon;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntWalk_IWalking::IsDone() const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_IWalking::NbLines() const
|
||||
{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return lines.Length();
|
||||
}
|
||||
|
||||
inline const Handle(IntWalk_TheIWLine)& IntWalk_IWalking::Value
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return lines.Value(Index);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_IWalking::NbSinglePnts() const
|
||||
{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return seqSingle.Length();
|
||||
}
|
||||
|
||||
inline const ThePointOfPath& IntWalk_IWalking::SinglePnt
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return seqSingle.Value(Index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
239
src/IntWalk/IntWalk_IWalking_1.gxx
Executable file
239
src/IntWalk/IntWalk_IWalking_1.gxx
Executable file
@@ -0,0 +1,239 @@
|
||||
#ifdef CHRONO
|
||||
#include <OSD_Chronometer.hxx>
|
||||
OSD_Chronometer Chronrsnld;
|
||||
|
||||
#endif
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real Increment ) :
|
||||
done(Standard_False),
|
||||
fleche(Deflection),
|
||||
pas(Increment),
|
||||
tolerance(1,2),
|
||||
epsilon(Epsilon*Epsilon)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// etat1=12 pas tangent,pas passant
|
||||
// etat1=11 tangent,pas passant
|
||||
// etat1=2 pas tangent,passant
|
||||
// etat1=1 tangent,passant
|
||||
// lorsque un point a ete traite son etat devient negatif.
|
||||
// ***************************************************************************
|
||||
// etat2=13 point de demarage interieur sur ligne ferme
|
||||
// etat2=12 point de demarage interieur sur ligne ouverte
|
||||
// (ligne initialement fermee -> la ligne s est ouverte)
|
||||
// lorsque un point a ete traite (ou si on passe dessus lors du
|
||||
// cheminement) son etat devient negatif.
|
||||
// ****************************************************************************
|
||||
|
||||
//
|
||||
// Perform avec points interieurs
|
||||
//
|
||||
void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
|
||||
const ThePOLIterator& Pnts2,
|
||||
TheIWFunction& Func,
|
||||
const ThePSurface& Caro,
|
||||
const Standard_Boolean Reversed)
|
||||
|
||||
{
|
||||
|
||||
Standard_Integer I;
|
||||
ThePointOfPath PathPnt;
|
||||
Standard_Boolean Rajout = Standard_False;
|
||||
Standard_Integer nbPnts1 = Pnts1.Length();
|
||||
Standard_Integer nbPnts2 = Pnts2.Length();
|
||||
Standard_Real U,V;
|
||||
|
||||
done = Standard_False;
|
||||
|
||||
ustart1.Clear();
|
||||
vstart1.Clear();
|
||||
etat1.Clear();
|
||||
nbMultiplicities.Clear();
|
||||
ustart2.Clear();
|
||||
vstart2.Clear();
|
||||
etat2.Clear();
|
||||
seqAjout.Clear();
|
||||
lines.Clear();
|
||||
reversed = Reversed;
|
||||
|
||||
|
||||
// Chargement de etat1 et etat2 et des ustart et vstart.
|
||||
|
||||
TColStd_SequenceOfReal Umult;
|
||||
TColStd_SequenceOfReal Vmult;
|
||||
|
||||
Standard_Integer decal=0;
|
||||
for (I=1;I <= nbPnts1+decal; I++) {
|
||||
PathPnt = Pnts1.Value(I-decal);
|
||||
etat1.Append(1);
|
||||
if (!ThePointOfPathTool::IsPassingPnt(PathPnt))
|
||||
etat1(I) = 11;
|
||||
if (!ThePointOfPathTool::IsTangent(PathPnt))
|
||||
etat1(I) = etat1(I) + 1;
|
||||
|
||||
Standard_Integer etat1I=etat1(I);
|
||||
#ifdef DEB
|
||||
Standard_Integer multi=0;
|
||||
#endif
|
||||
//-- cout<<" \n Etat1("<<I<<") = "<<etat1I<<endl;
|
||||
if(etat1I==2) { //-- lbr le 15 fev 99
|
||||
etat1(I)=11;
|
||||
|
||||
ThePointOfPathTool::Value2d(PathPnt, U,V);
|
||||
ustart1.Append(U);
|
||||
vstart1.Append(V);
|
||||
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
|
||||
|
||||
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
|
||||
ThePointOfPathTool::Parameters(PathPnt, J, U , V);
|
||||
Umult.Append(U);
|
||||
Vmult.Append(V);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
ThePointOfPathTool::Value2d(PathPnt, U,V);
|
||||
ustart1.Append(U);
|
||||
vstart1.Append(V);
|
||||
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
|
||||
|
||||
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
|
||||
ThePointOfPathTool::Parameters(PathPnt, J, U , V);
|
||||
Umult.Append(U);
|
||||
Vmult.Append(V);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (I = 1; I <= nbPnts2; I++) {
|
||||
etat2.Append(13);
|
||||
ThePointOfLoopTool::Value2d(Pnts2.Value(I), U,V);
|
||||
ustart2.Append(U);
|
||||
vstart2.Append(V);
|
||||
}
|
||||
|
||||
tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
|
||||
tolerance(2) = ThePSurfaceTool::VResolution(Caro,Precision::Confusion());
|
||||
|
||||
Um = ThePSurfaceTool::FirstUParameter(Caro);
|
||||
Vm = ThePSurfaceTool::FirstVParameter(Caro);
|
||||
UM = ThePSurfaceTool::LastUParameter(Caro);
|
||||
VM = ThePSurfaceTool::LastVParameter(Caro);
|
||||
|
||||
if (UM < Um) {
|
||||
Standard_Real utemp = UM;
|
||||
UM = Um;
|
||||
Um = utemp;
|
||||
}
|
||||
if (VM < Vm) {
|
||||
Standard_Real vtemp = VM;
|
||||
VM = Vm;
|
||||
Vm = vtemp;
|
||||
}
|
||||
|
||||
Func.Set(Caro);
|
||||
|
||||
// calcul de toutes les lignes ouvertes
|
||||
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
|
||||
// calcul de toutes les lignes fermees
|
||||
if (nbPnts2 != 0) ComputeCloseLine(Umult,Vmult,Pnts1,Pnts2,Func,Rajout);
|
||||
for (I = 1; I <= nbPnts1; I++) {
|
||||
if (etat1(I) >0) seqSingle.Append(Pnts1(I));
|
||||
}
|
||||
done = Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Perform sans point interieur
|
||||
//
|
||||
|
||||
void IntWalk_IWalking::Perform(const ThePOPIterator& Pnts1,
|
||||
TheIWFunction& Func,
|
||||
const ThePSurface& Caro,
|
||||
const Standard_Boolean Reversed)
|
||||
|
||||
{
|
||||
Standard_Integer I;
|
||||
ThePointOfPath PathPnt;
|
||||
Standard_Boolean Rajout = Standard_False;
|
||||
Standard_Integer nbPnts1 = Pnts1.Length();
|
||||
Standard_Real U,V;
|
||||
|
||||
done = Standard_False;
|
||||
|
||||
ustart1.Clear();
|
||||
vstart1.Clear();
|
||||
etat1.Clear();
|
||||
nbMultiplicities.Clear();
|
||||
ustart2.Clear();
|
||||
vstart2.Clear();
|
||||
etat2.Clear();
|
||||
seqAjout.Clear();
|
||||
lines.Clear();
|
||||
reversed = Reversed;
|
||||
|
||||
|
||||
// Chargement de etat1 et de ustart1 et vstart1.
|
||||
|
||||
TColStd_SequenceOfReal Umult;
|
||||
TColStd_SequenceOfReal Vmult;
|
||||
|
||||
for (I=1;I <= nbPnts1; I++) {
|
||||
PathPnt = Pnts1.Value(I);
|
||||
etat1.Append(1);
|
||||
if (!ThePointOfPathTool::IsPassingPnt(PathPnt)) etat1(I) = 11;
|
||||
if (!ThePointOfPathTool::IsTangent(PathPnt)) etat1(I) = etat1(I) + 1;
|
||||
ThePointOfPathTool::Value2d(PathPnt, U,V);
|
||||
ustart1.Append(U);
|
||||
vstart1.Append(V);
|
||||
nbMultiplicities.Append(ThePointOfPathTool::Multiplicity(PathPnt));
|
||||
|
||||
for (Standard_Integer J = 1; J <= nbMultiplicities(I); J++) {
|
||||
ThePointOfPathTool::Parameters(PathPnt, J, U , V);
|
||||
Umult.Append(U);
|
||||
Vmult.Append(V);
|
||||
}
|
||||
}
|
||||
|
||||
tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
|
||||
tolerance(2) = ThePSurfaceTool::VResolution(Caro,Precision::Confusion());
|
||||
|
||||
Um = ThePSurfaceTool::FirstUParameter(Caro);
|
||||
Vm = ThePSurfaceTool::FirstVParameter(Caro);
|
||||
UM = ThePSurfaceTool::LastUParameter(Caro);
|
||||
VM = ThePSurfaceTool::LastVParameter(Caro);
|
||||
|
||||
if (UM < Um) {
|
||||
Standard_Real utemp = UM;
|
||||
UM = Um;
|
||||
Um = utemp;
|
||||
}
|
||||
if (VM < Vm) {
|
||||
Standard_Real vtemp = VM;
|
||||
VM = Vm;
|
||||
Vm = vtemp;
|
||||
}
|
||||
|
||||
Func.Set(Caro);
|
||||
|
||||
// calcul de toutes les lignes ouvertes
|
||||
if (nbPnts1 != 0) ComputeOpenLine(Umult,Vmult,Pnts1,Func,Rajout);
|
||||
|
||||
for (I = 1; I <= nbPnts1; I++) {
|
||||
if (etat1(I) >0) seqSingle.Append(Pnts1(I));
|
||||
}
|
||||
done = Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
751
src/IntWalk/IntWalk_IWalking_2.gxx
Executable file
751
src/IntWalk/IntWalk_IWalking_2.gxx
Executable file
@@ -0,0 +1,751 @@
|
||||
//-- IntWalk_IWalking_2.gxx
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
// _______________________________________________
|
||||
//
|
||||
// Cadrage d un point (u, v) dans le domaine naturel d une surface ET mise
|
||||
// a jour du couple (u, v) pour le calcul du point suivant.
|
||||
//
|
||||
Standard_Boolean IntWalk_IWalking::Cadrage
|
||||
(math_Vector& BornInf,
|
||||
math_Vector& BornSup,
|
||||
math_Vector& UVap,
|
||||
Standard_Real& Step,
|
||||
// Standard_Real& StepV,
|
||||
const Standard_Integer StepSign) const
|
||||
|
||||
// on a toujours :
|
||||
// BorInf(1) <= UVap(1) <= BornSup(1) et BorInf(2) <= UVap(2) <= BornSup(2)
|
||||
// 1) on verifier si le point approche ne depasse pas le domaine naturel de
|
||||
// la surface
|
||||
// 2) si c est le cas on cadre le point approche sur frontiere en prenant la
|
||||
// meilleure direction. On MODIFIE alors le pas d avancement et une des
|
||||
// bornes bloquer un des parametres lors du prochain appel a FunctionSetRoot;
|
||||
// 3) on recalcule couple (u, v) approche pour le le calcul du point suivant.
|
||||
// 4) return Standard_True si cadrage, Standard_False si pas de cadrage.
|
||||
{
|
||||
Standard_Real Duvx = previousd2d.X();
|
||||
Standard_Real Duvy = previousd2d.Y();
|
||||
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(UVap(1),UVap(2));
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(UVap(1),UVap(2));
|
||||
}
|
||||
|
||||
Standard_Real U1 = UVap(1) + Step * Duvx * StepSign;
|
||||
Standard_Real V1 = UVap(2) + Step * Duvy * StepSign;
|
||||
|
||||
|
||||
Standard_Boolean infu = (U1 <= BornInf(1)+Precision::PConfusion());
|
||||
Standard_Boolean supu = (U1 >= BornSup(1)-Precision::PConfusion());
|
||||
Standard_Boolean infv = (V1 <= BornInf(2)+Precision::PConfusion());
|
||||
Standard_Boolean supv = (V1 >= BornSup(2)-Precision::PConfusion());
|
||||
|
||||
Standard_Real theStepU,theStepV;
|
||||
|
||||
if (!infu && !supu && !infv && !supv) {
|
||||
UVap(1) = U1;
|
||||
UVap(2) = V1;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if ((infu || supu) && (infv || supv)) {
|
||||
if (infu) { // jag 940616
|
||||
if(Duvx) {
|
||||
theStepU = Abs((BornInf(1) - UVap(1)) / Duvx); // iso U =BornInf(1)
|
||||
}
|
||||
else {
|
||||
theStepU = Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Duvx) {
|
||||
theStepU = Abs((BornSup(1) - UVap(1)) / Duvx); // iso U =BornSup(1)
|
||||
}
|
||||
else {
|
||||
theStepU = Step;
|
||||
}
|
||||
}
|
||||
if (infv) { // jag 940616
|
||||
if(Duvy) {
|
||||
theStepV = Abs((BornInf(2) - UVap(2)) / Duvy); // iso V =BornInf(2)
|
||||
}
|
||||
else {
|
||||
theStepV = Step;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Duvy) {
|
||||
theStepV = Abs((BornSup(2) - UVap(2)) / Duvy); // iso V =BornSup(2)
|
||||
}
|
||||
else {
|
||||
theStepV = Step;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (theStepU <= theStepV) {
|
||||
Step = theStepU;
|
||||
if (infu) {
|
||||
UVap(1) = BornInf(1);
|
||||
BornSup(1) = BornInf(1);
|
||||
}
|
||||
else {
|
||||
UVap(1) = BornSup(1);
|
||||
BornInf(1) = BornSup(1);
|
||||
}
|
||||
UVap(2) += Step*Duvy*StepSign;
|
||||
}
|
||||
else {
|
||||
Step = theStepV;
|
||||
if (infv) {
|
||||
UVap(2) = BornInf(2);
|
||||
BornSup(2) = BornInf(2);
|
||||
}
|
||||
else {
|
||||
UVap(2) = BornSup(2);
|
||||
BornInf(2) = BornSup(2);
|
||||
}
|
||||
UVap(1) += Step*Duvx*StepSign;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
else if (infu) { // jag 940616
|
||||
if(Duvx) {
|
||||
Standard_Real aStep = Abs((BornInf(1) - UVap(1)) / Duvx); // iso U =BornInf(1)
|
||||
if(aStep<Step) Step=aStep;
|
||||
}
|
||||
BornSup(1) = BornInf(1); // on bloque le parametre
|
||||
UVap(1) = BornInf(1);
|
||||
UVap(2) += Step*Duvy*StepSign;;
|
||||
return Standard_True;
|
||||
}
|
||||
else if (supu) { // jag 940616
|
||||
if(Duvx) {
|
||||
Standard_Real aStep = Abs((BornSup(1) - UVap(1)) / Duvx); // iso U =BornSup(1)
|
||||
if(aStep<Step) Step=aStep;
|
||||
}
|
||||
BornInf(1) = BornSup(1); // on bloque le parametre
|
||||
UVap(1) = BornSup(1);
|
||||
UVap(2) += Step*Duvy*StepSign;
|
||||
return Standard_True;
|
||||
}
|
||||
else if (infv) { // jag 940616
|
||||
if(Duvy) {
|
||||
Standard_Real aStep = Abs((BornInf(2) - UVap(2)) / Duvy); // iso V =BornInf(2)
|
||||
if(aStep<Step) Step=aStep;
|
||||
}
|
||||
BornSup(2) = BornInf(2);
|
||||
UVap(1) += Step*Duvx*StepSign;
|
||||
UVap(2) = BornInf(2);
|
||||
return Standard_True;
|
||||
}
|
||||
else if (supv) { // jag 940616
|
||||
if(Duvy) {
|
||||
Standard_Real aStep = Abs((BornSup(2) - UVap(2)) / Duvy); // iso V =BornSup(2)
|
||||
if(aStep<Step) Step=aStep;
|
||||
}
|
||||
BornInf(2) = BornSup(2);
|
||||
UVap(1) += Step*Duvx*StepSign;
|
||||
UVap(2) = BornSup(2);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IntWalk_IWalking::TestArretPassage
|
||||
(const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
TheIWFunction& sp,
|
||||
math_Vector& UV,
|
||||
Standard_Integer& Irang)
|
||||
|
||||
// Umult et Vmult : tableau des points d arret (ou passant) sur frontiere, ici
|
||||
// on ne s interesse qu aux points passant.
|
||||
// UV : le point courant.
|
||||
// Irang : en sortie : donne l index du point d arret dans uvstart1 ou 0.
|
||||
// on considere qu on ne risque de passer que sur un seul point
|
||||
// passant.
|
||||
|
||||
|
||||
// test d arret pour une ligne d intersection OUVERTE
|
||||
// 1) test de passage sur l ensemble des points interieur
|
||||
// 2) test d arret sur l ensemble des points depart
|
||||
// si on detecte un arret on renvoie l index du point d arret (Irang) dans
|
||||
// l iterateur des points de depart et les parametres associes dans
|
||||
// l espace UV.
|
||||
{
|
||||
Standard_Real Up, Vp, Du, Dv, Dup, Dvp, Utest,Vtest;
|
||||
Standard_Integer i, j, k, N, ind;
|
||||
Standard_Real tolu = tolerance(1);
|
||||
Standard_Real tolv = tolerance(2);
|
||||
Standard_Real tolu2 = 10.*tolerance(1);
|
||||
Standard_Real tolv2 = 10.*tolerance(2);
|
||||
|
||||
Standard_Boolean Arrive = Standard_False;
|
||||
|
||||
// test de passage sur point pouvant demarrer une boucle;les marquer traites
|
||||
// si passe sur la ligne ouverte
|
||||
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(Up,Vp);
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(Up,Vp);
|
||||
}
|
||||
|
||||
for (i = 1; i <= etat2.Length(); i++) {
|
||||
if (etat2(i) > 0) {
|
||||
// debug jag 05.04.94
|
||||
|
||||
// if ((Up-ustart2(i))*(UV(1)-ustart2(i)) +
|
||||
// (Vp-vstart2(i))*(UV(2)-vstart2(i)) <= 0)
|
||||
Utest = ustart2(i);
|
||||
Vtest = vstart2(i);
|
||||
|
||||
Du = UV(1)-Utest;
|
||||
Dv = UV(2)-Vtest;
|
||||
Dup = Up - Utest;
|
||||
Dvp = Vp - Vtest;
|
||||
|
||||
//-- lbr le 30 oct 97
|
||||
|
||||
//IFV for OCC20285
|
||||
|
||||
|
||||
Standard_Real tolustolv=tolu/tolv;
|
||||
|
||||
if ((Abs(Du) < tolu2 && Abs(Dv) < tolv2) ||
|
||||
(Abs(Dup) < tolu2 && Abs(Dvp) < tolv2)) {
|
||||
|
||||
etat2(i) = -etat2(i);
|
||||
}
|
||||
else {
|
||||
Standard_Real DDu = (UV(1)-Up);
|
||||
Standard_Real DDv = (UV(2)-Vp);
|
||||
Standard_Real DDD = DDu*DDu+DDv*DDv;
|
||||
Standard_Real DD1 = Du*Du+Dv*Dv;
|
||||
if(DD1<=DDD) {
|
||||
Standard_Real DD2 = Dup*Dup+Dvp*Dvp;
|
||||
if(DD2<=DDD && ((Du*Dup) + (Dv*Dvp*tolu/tolv) <= 0.)) {
|
||||
etat2(i) = -etat2(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test d arret sur point donne en entree et non encore traite
|
||||
|
||||
// Modified by Sergey KHROMOV - Tue Nov 20 10:55:01 2001 Begin
|
||||
// Check of all path points in the following order:
|
||||
// * First check all not treated points;
|
||||
// * After that check of already treated ones.
|
||||
Standard_Integer l;
|
||||
|
||||
//// Modified by jgv, 28.07.2010 for OCC21914 ////
|
||||
// There are several path points between (Up,Vp) and UV
|
||||
// So several path points satisfy the condition
|
||||
// Dup*UV1mUtest + Dvp*UV2mVtest) < 0
|
||||
// We choose from them the path point with
|
||||
// minimum distance to (Up,Vp)
|
||||
TColStd_SequenceOfInteger i_candidates;
|
||||
TColStd_SequenceOfReal SqDist_candidates;
|
||||
|
||||
for (l = 1; l <= 2 && !Arrive; l++) {
|
||||
Standard_Boolean isToCheck;
|
||||
|
||||
for (i = 1; i <= etat1.Length(); i++) {
|
||||
if (l == 1)
|
||||
isToCheck = (etat1(i) > 0);
|
||||
else
|
||||
isToCheck = (etat1(i) < 0);
|
||||
|
||||
if (isToCheck) {
|
||||
// Modified by Sergey KHROMOV - Tue Nov 20 11:03:16 2001 End
|
||||
|
||||
// debug jag voir avec isg
|
||||
|
||||
Utest = ustart1(i);
|
||||
Vtest = vstart1(i);
|
||||
Dup = Up - Utest;
|
||||
Dvp = Vp - Vtest;
|
||||
if (Abs(Dup) >= tolu || Abs(Dvp) >= tolv) {
|
||||
Standard_Real UV1mUtest = UV(1)-Utest;
|
||||
Standard_Real UV2mVtest = UV(2)-Vtest;
|
||||
if(( (Dup*UV1mUtest + Dvp*UV2mVtest) < 0) ||
|
||||
( Abs(UV1mUtest) < tolu
|
||||
&& Abs(UV2mVtest) < tolv)) {
|
||||
i_candidates.Append(i);
|
||||
SqDist_candidates.Append(Dup*Dup + Dvp*Dvp);
|
||||
/*
|
||||
Irang=i;
|
||||
Arrive = Standard_True;
|
||||
UV(1) = Utest;
|
||||
UV(2) = Vtest;
|
||||
*/
|
||||
}
|
||||
else if (nbMultiplicities(i) > 0 && i_candidates.IsEmpty()) {
|
||||
N=0;
|
||||
for (k = 1; k < i; k++) {
|
||||
N+=nbMultiplicities(k);
|
||||
}
|
||||
for (j = N + 1; j <= N + nbMultiplicities(i); j++) {
|
||||
if (((Up-Umult(j))*(UV(1)-Umult(j)) +
|
||||
(Vp-Vmult(j))*(UV(2)-Vmult(j)) < 0) ||
|
||||
(Abs(UV(1)-Umult(j)) < tolu &&
|
||||
Abs(UV(2)-Vmult(j)) < tolv)) {
|
||||
Irang=i;
|
||||
Arrive = Standard_True;
|
||||
UV(1) = Utest;
|
||||
UV(2) = Vtest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Arrive) {
|
||||
static math_Vector bidF(1,1);
|
||||
static math_Matrix bidD(1,1,1,2);
|
||||
#ifdef DEB
|
||||
Standard_Boolean bidB =
|
||||
#endif
|
||||
sp.Values(UV,bidF,bidD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end of for (i = 1; i <= etat1.Length(); i++)
|
||||
if (!i_candidates.IsEmpty())
|
||||
{
|
||||
Standard_Real MinSqDist = RealLast();
|
||||
for (ind = 1; ind <= i_candidates.Length(); ind++)
|
||||
if (SqDist_candidates(ind) < MinSqDist)
|
||||
{
|
||||
MinSqDist = SqDist_candidates(ind);
|
||||
Irang = i_candidates(ind);
|
||||
}
|
||||
Arrive = Standard_True;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
}
|
||||
} //end of for (l = 1; l <= 2 && !Arrive; l++)
|
||||
return Arrive;
|
||||
}
|
||||
|
||||
Standard_Boolean IntWalk_IWalking::TestArretPassage
|
||||
(const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
const math_Vector& UV,
|
||||
const Standard_Integer Index,
|
||||
Standard_Integer& Irang)
|
||||
{
|
||||
// Umult, Vmult : tableau des points d arret (ou passant) sur frontiere, ici
|
||||
// on ne s interesse qu aux points passant.
|
||||
// UV : le point courant.
|
||||
// Index : l index du point de demarrage dans uvstart2 de la ligne en cours
|
||||
// (c est un point interieur).
|
||||
// Irang : en sortie : donne l index du point passant dans uvstart1 ou 0.
|
||||
// on considere qu on ne risque de passer que sur un seul point
|
||||
// passant.
|
||||
|
||||
// test d arret pour une ligne d intersection FERMEE.
|
||||
// 1) test de passage sur l ensemble des points interieur
|
||||
// 2) test de passage sur les points passant.
|
||||
|
||||
Standard_Real Up, Vp, Scal;
|
||||
Standard_Boolean Arrive = Standard_False;
|
||||
Standard_Integer N, k, i;
|
||||
Standard_Real Utest,Vtest;
|
||||
Standard_Real tolu = tolerance(1);
|
||||
Standard_Real tolv = tolerance(2);
|
||||
|
||||
|
||||
// tests d arret et de passage sur points interieurs.
|
||||
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(Up,Vp);
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(Up,Vp);
|
||||
}
|
||||
|
||||
Standard_Real UV1=UV(1);
|
||||
Standard_Real UV2=UV(2);
|
||||
|
||||
|
||||
//-- On met tout le monde ds une boite 0 1 x 0 1
|
||||
//-- en tourte rigueur il faudrait faire les test en 3d
|
||||
|
||||
Standard_Real deltau=UM-Um;
|
||||
Standard_Real deltav=VM-Vm;
|
||||
|
||||
Up/=deltau; UV1/=deltau;
|
||||
Vp/=deltav; UV2/=deltav;
|
||||
|
||||
tolu/=deltau;
|
||||
tolv/=deltav;
|
||||
|
||||
Standard_Real tolu2=tolu+tolu;
|
||||
Standard_Real tolv2=tolv+tolv;
|
||||
|
||||
|
||||
Standard_Real dPreviousCurrent = (Up-UV1)*(Up-UV1)+(Vp-UV2)*(Vp-UV2);
|
||||
for (k = 1; k <= etat2.Length(); k++) {
|
||||
if (etat2(k) > 0) {
|
||||
Utest = ustart2(k);
|
||||
Vtest = vstart2(k);
|
||||
|
||||
Utest/=deltau;
|
||||
Vtest/=deltav;
|
||||
|
||||
Standard_Real UV1mUtest=UV1-Utest;
|
||||
Standard_Real UV2mVtest=UV2-Vtest;
|
||||
if( (UV1mUtest<tolu2 && UV1mUtest>-tolu2)
|
||||
&& (UV2mVtest<tolv2 && UV2mVtest>-tolv2)) {
|
||||
if(Index!=k) {
|
||||
//-- cout<<"* etat2 : ("<<k<<")"<<endl;
|
||||
etat2(k)=-etat2(k); //-- marque le point comme point de passage
|
||||
}
|
||||
else { //-- Index == k
|
||||
//-- cout<<"* Arrive"<<endl;
|
||||
Arrive=Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Real UpmUtest = (Up-Utest);
|
||||
Standard_Real VpmVtest = (Vp-Vtest);
|
||||
Standard_Real dPreviousStart = (UpmUtest)*(UpmUtest)+(VpmVtest)*(VpmVtest);
|
||||
Standard_Real dCurrentStart = UV1mUtest * UV1mUtest + UV2mVtest * UV2mVtest;
|
||||
|
||||
Scal=(UpmUtest)*(UV1mUtest)+(VpmVtest)*(UV2mVtest);
|
||||
if( (Abs(UpmUtest)<tolu && Abs(VpmVtest)<tolv)) {
|
||||
if(Index != k ) {
|
||||
//-- cout<<"** etat2 : ("<<k<<")"<<endl;
|
||||
etat2(k) = -etat2(k);
|
||||
}
|
||||
}
|
||||
else if(Scal<0 && (dPreviousStart+dCurrentStart < dPreviousCurrent)) {
|
||||
if (Index == k ) { // on a boucle.
|
||||
Arrive = Standard_True;
|
||||
//-- cout<<"** Arrive : k="<<k<<endl;
|
||||
}
|
||||
else {
|
||||
//-- cout<<"*** etat2 : ("<<k<<")"<<endl;
|
||||
etat2(k) = -etat2(k); // marque le point point de passage
|
||||
}
|
||||
}
|
||||
else if(k!=Index) {
|
||||
if(dPreviousStart < dPreviousCurrent*0.25) {
|
||||
etat2(k) = -etat2(k); // marque le point point de passage
|
||||
//-- cout<<"**** etat2 : ("<<k<<")"<<endl;
|
||||
}
|
||||
else {
|
||||
if(dCurrentStart < dPreviousCurrent*0.25) {
|
||||
//-- cout<<"***** etat2 : ("<<k<<")"<<endl;
|
||||
etat2(k) = -etat2(k); // marque le point point de passage
|
||||
}
|
||||
else {
|
||||
Standard_Real UMidUtest = 0.5*(UV1+Up)-Utest;
|
||||
Standard_Real VMidVtest = 0.5*(UV2+Vp)-Vtest;
|
||||
Standard_Real dMiddleStart = UMidUtest* UMidUtest+VMidVtest*VMidVtest;
|
||||
|
||||
if(dMiddleStart < dPreviousCurrent*0.5) {
|
||||
//-- cout<<"*********** etat2 : ("<<k<<")"<<endl;
|
||||
etat2(k) = -etat2(k); // marque le point point de passage
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test de passage sur points passant.
|
||||
|
||||
Irang =0;
|
||||
for (i = 1; i <= etat1.Length(); i++) {
|
||||
if (etat1(i) > 0 && etat1(i) < 11) { //test des points passant
|
||||
Utest = ustart1(i);
|
||||
Vtest = vstart1(i);
|
||||
Utest/=deltau;
|
||||
Vtest/=deltav;
|
||||
|
||||
if (((Up-Utest) * (UV1-Utest) + (Vp-Vtest) * (UV2-Vtest) < 0) ||
|
||||
(Abs(UV1-Utest) < tolu && Abs(UV2-Vtest) < tolv))
|
||||
Irang = i;
|
||||
else if (nbMultiplicities(i) > 0) {
|
||||
N=0;
|
||||
for (k = 1; k < i; k++) N = N + nbMultiplicities(k);
|
||||
for (Standard_Integer j = N + 1; j <= N + nbMultiplicities(i); j++) {
|
||||
Standard_Real Umultj = Umult(j)/deltau;
|
||||
Standard_Real Vmultj = Vmult(j)/deltav;
|
||||
if (((Up-Umultj)*(UV1-Umultj) +
|
||||
(Vp-Vmultj)*(UV2-Vmultj) < 0) ||
|
||||
(Abs(UV1-Umultj) < tolu &&
|
||||
Abs(UV2-Vmultj) < tolv)) {
|
||||
Irang=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Arrive;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IntWalk_IWalking::TestArretAjout
|
||||
(TheIWFunction& sp,
|
||||
math_Vector& UV,
|
||||
Standard_Integer& Irang,
|
||||
IntSurf_PntOn2S& Psol)
|
||||
|
||||
// test d arret sur les points rajoutes
|
||||
// ces points sont des points sur frontiere naturelle qui n ont pas ete
|
||||
// donnes en entree
|
||||
// on renvoit : Psol, le point rajoute.
|
||||
// Irang, l index dans l iterateur des points rajoutes.
|
||||
// UV, parametre du point rajoute.
|
||||
//
|
||||
{
|
||||
Standard_Boolean Arrive = Standard_False;
|
||||
Standard_Real U1,V1;
|
||||
Standard_Real Up,Vp;
|
||||
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(Up,Vp);
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(Up,Vp);
|
||||
}
|
||||
|
||||
Standard_Integer nbAjout = seqAjout.Length();
|
||||
for (Standard_Integer i = 1; i <= nbAjout; i++) {
|
||||
Irang = seqAjout.Value(i);
|
||||
|
||||
// on rajoute le test Abs(Irang) <= lines.Length() pour le cas ou
|
||||
// on ouvre une ligne fermee suite a l ajout 1 point sur cette meme
|
||||
// ligne. De toute facon on a un gros pb , car on va avoir 2 points
|
||||
// rajoutes sur cette ligne...
|
||||
|
||||
if (Abs(Irang) <= lines.Length()) {
|
||||
|
||||
const Handle(IntWalk_TheIWLine)& Line = lines.Value(Abs(Irang));
|
||||
if (Irang>0)
|
||||
Psol = Line->Value(Line->NbPoints());
|
||||
else
|
||||
Psol = Line->Value(1);
|
||||
if (!reversed) {
|
||||
Psol.ParametersOnS2(U1, V1);
|
||||
}
|
||||
else {
|
||||
Psol.ParametersOnS1(U1, V1);
|
||||
}
|
||||
if (((Up-U1) * (UV(1)-U1) +
|
||||
(Vp-V1) * (UV(2)-V1)) < 0 ||
|
||||
(Abs(UV(1)-U1) < tolerance(1) &&
|
||||
Abs(UV(2)-V1) < tolerance(2))) {
|
||||
//jag 940615 Irang= -Abs(Irang);
|
||||
Arrive = Standard_True;
|
||||
UV(1) = U1;
|
||||
UV(2) = V1;
|
||||
static math_Vector bidF(1,1);
|
||||
static math_Matrix bidD(1,1,1,2);
|
||||
#ifdef DEB
|
||||
Standard_Boolean bidB =
|
||||
#endif
|
||||
sp.Values(UV,bidF,bidD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Arrive;
|
||||
}
|
||||
|
||||
void IntWalk_IWalking::TestArretCadre
|
||||
(const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
const Handle(IntWalk_TheIWLine)& Line,
|
||||
TheIWFunction& sp,
|
||||
math_Vector& UV,
|
||||
Standard_Integer& Irang)
|
||||
|
||||
// test d arret alors qu on est sur frontiere.
|
||||
// on a essaye tous les tests d arret et on est arrive.
|
||||
// test d arret sur les points donne au depart deja marques et sur
|
||||
// l ensemble de la ligne courante. Cette ligne peut etre racourcie si
|
||||
// on trouve in point d arret.
|
||||
// Abs(Irang) = index dans l iterateur des points de depart ou 0
|
||||
// si Irang <0 , il faut ajouter ce point a la ligne ( pas de Line->Cut)
|
||||
// UV = parametre du point de depart
|
||||
{
|
||||
Standard_Real Scal, Up, Vp, Uc, Vc;
|
||||
Standard_Integer N;
|
||||
Standard_Boolean Found = Standard_False;
|
||||
|
||||
|
||||
Irang =0;
|
||||
for (Standard_Integer i = 1; i <= etat1.Length(); i++) {
|
||||
if (etat1(i) < 0) {
|
||||
N=0; // rang dans UVMult.
|
||||
if (nbMultiplicities(i) > 0) {
|
||||
for (Standard_Integer k = 1; k < i; k++)
|
||||
N+=nbMultiplicities(k);
|
||||
}
|
||||
if (!reversed) {
|
||||
Line->Value(1).ParametersOnS2(Up,Vp);
|
||||
}
|
||||
else {
|
||||
Line->Value(1).ParametersOnS1(Up,Vp);
|
||||
}
|
||||
Standard_Integer nbp= Line->NbPoints();
|
||||
for (Standard_Integer j = 2; j <= nbp; j++) {
|
||||
if (!reversed) {
|
||||
Line->Value(j).ParametersOnS2(Uc,Vc);
|
||||
}
|
||||
else {
|
||||
Line->Value(j).ParametersOnS1(Uc,Vc);
|
||||
}
|
||||
|
||||
Scal = (Up-ustart1(i)) * (Uc-ustart1(i)) +
|
||||
(Vp-vstart1(i)) * (Vc-vstart1(i));
|
||||
// si on a trouve un point d arret : on arrete la ligne sur ce point.
|
||||
if (Scal < 0) {
|
||||
Line->Cut(j); nbp= Line->NbPoints();
|
||||
Irang = i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
}
|
||||
else if (Abs(Uc-ustart1(i)) < tolerance(1) &&
|
||||
Abs(Vc-vstart1(i)) < tolerance(2) ) {
|
||||
Line->Cut(j); nbp= Line->NbPoints();
|
||||
Irang=i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
}
|
||||
else if (nbMultiplicities(i) > 0) {
|
||||
for (Standard_Integer k = N+1; k <= N + nbMultiplicities(i); k++) {
|
||||
Scal = (Up-Umult(k)) * (Uc-Umult(k)) +
|
||||
(Vp-Vmult(k)) * (Vc-Vmult(k));
|
||||
if (Scal < 0) {
|
||||
Line->Cut(j); nbp= Line->NbPoints();
|
||||
Irang=i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
break;
|
||||
}
|
||||
else if (Abs(Uc-Umult(k)) < tolerance(1) &&
|
||||
Abs(Vc-Vmult(k)) < tolerance(2)) {
|
||||
Line->Cut(j); nbp= Line->NbPoints();
|
||||
Irang=i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Found) {
|
||||
static math_Vector bidF(1,1);
|
||||
static math_Matrix bidD(1,1,1,2);
|
||||
#ifdef DEB
|
||||
Standard_Boolean bidB =
|
||||
#endif
|
||||
sp.Values(UV,bidF,bidD);
|
||||
Standard_Integer NBP = Line->NbPoints();
|
||||
Standard_Integer Indextg;
|
||||
Line->TangentVector(Indextg);
|
||||
if(Indextg > NBP) {
|
||||
if(j>3 && j<=NBP+1) {
|
||||
gp_Vec Dir3d = sp.Direction3d();
|
||||
gp_Vec Dir3d1 = gp_Vec(Line->Value(j-2).Value(),Line->Value(j-1).Value());
|
||||
Standard_Real dot = Dir3d.Dot(Dir3d1);
|
||||
if(dot<0.0) { // Normalement on ne doit pas passer souvent ds cette Fonction !!!
|
||||
Dir3d.Reverse();
|
||||
//-- cout<<" IntWalk_IWalking_2.gxx REVERSE "<<endl;
|
||||
}
|
||||
Line->SetTangentVector(previousd3d,j-1);
|
||||
}
|
||||
#ifdef DEB
|
||||
else {
|
||||
cout<<" IntWalk_IWalking_2.gxx : bizarrerie 30 10 97 "<<endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
Up = Uc;
|
||||
Vp = Vc;
|
||||
}
|
||||
|
||||
// et maintenant on compare le dernier point de la ligne et le dernier
|
||||
// point calcule.
|
||||
// il n y aura pas besoin de "Cuter"
|
||||
|
||||
Scal = (Up-ustart1(i)) * (UV(1)-ustart1(i)) +
|
||||
// (Vp-ustart1(i)) * (UV(2)-vstart1(i));
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:29:41 2000
|
||||
(Vp-vstart1(i)) * (UV(2)-vstart1(i));
|
||||
|
||||
if (Scal < 0) {
|
||||
Irang = i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
}
|
||||
else if (Abs(UV(1)-ustart1(i)) < tolerance(1) &&
|
||||
Abs(UV(2)-vstart1(i)) < tolerance(2)) {
|
||||
Irang=i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
}
|
||||
else if (nbMultiplicities(i) > 0) {
|
||||
for (Standard_Integer j = N+1; j <= N+nbMultiplicities(i); j++) {
|
||||
Scal = (Up-Umult(j)) * (UV(1)-Umult(j)) +
|
||||
(Vp-Vmult(j)) * (UV(2)-Vmult(j));
|
||||
if (Scal < 0) {
|
||||
Irang=i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
break;
|
||||
}
|
||||
else if (Abs(UV(1)-Umult(j)) < tolerance(1) &&
|
||||
Abs(UV(2)-Vmult(j)) < tolerance(2)) {
|
||||
Irang=i;
|
||||
UV(1) = ustart1(Irang);
|
||||
UV(2) = vstart1(Irang);
|
||||
Found = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Found) {
|
||||
Irang = -Irang; // jag 941017
|
||||
static math_Vector bidF(1,1);
|
||||
static math_Matrix bidD(1,1,1,2);
|
||||
#ifdef DEB
|
||||
Standard_Boolean bidB =
|
||||
#endif
|
||||
sp.Values(UV,bidF,bidD);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
498
src/IntWalk/IntWalk_IWalking_3.gxx
Executable file
498
src/IntWalk/IntWalk_IWalking_3.gxx
Executable file
@@ -0,0 +1,498 @@
|
||||
//-- File IntWalk_IWalking_3.gxx
|
||||
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:07:26 2000.BEGIN
|
||||
static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_SequenceOfInteger& etat,
|
||||
const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
const TColStd_SequenceOfReal& ustart,
|
||||
const TColStd_SequenceOfReal& vstart,
|
||||
const Standard_Real& prevUp,
|
||||
const Standard_Real& prevVp,
|
||||
const TColStd_SequenceOfInteger& nbMultiplicities,
|
||||
const math_Vector& tolerance,
|
||||
TheIWFunction& sp,
|
||||
math_Vector& UV,
|
||||
Standard_Integer& Irang);
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:07:39 2000.END
|
||||
|
||||
|
||||
void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
const ThePOPIterator& Pnts1,
|
||||
TheIWFunction& Func,
|
||||
Standard_Boolean& Rajout)
|
||||
|
||||
// traitement ligne ouvert.
|
||||
//
|
||||
// 1) pour tout point de depart non passant et non tangent et non encore traite
|
||||
// calcul du pas d'avancement = pas en fonction de la fleche et du pas max.
|
||||
//
|
||||
// 2) calcul d'un point approche (ce point est sur la tangente a la section
|
||||
// de distance = pas du point interieur)
|
||||
//
|
||||
// 3) tant que {
|
||||
// (l'ensemble des points calcules ne depassent pas un point dans la
|
||||
// liste des points de depart)
|
||||
// ou
|
||||
// (l'ensemble des points ne forme pas une ligne ouverte allant
|
||||
// d 'une frontiere du domaine a un autre ou d un point de tangence
|
||||
// a une frontiere ou de 2 points de tangence : cas singuliers)
|
||||
//
|
||||
// 1) cadrage du point approche sur les frontieres si necessaire (il
|
||||
// y a calcul du pas)
|
||||
// 2) calcul du point
|
||||
// 3) si point non trouve on divise le pas
|
||||
// 4) tests d'arrets
|
||||
// 5) calcul du pas en fonction de la fleche et du pas maxi,
|
||||
// (TestDeflection)
|
||||
// arret possible.
|
||||
// fin tant que.
|
||||
|
||||
{
|
||||
Standard_Integer I, N;
|
||||
static math_Vector BornInf(1,2), BornSup(1,2), UVap(1,2);
|
||||
Standard_Real PasC, PasCu, PasCv;
|
||||
Standard_Boolean Arrive; // indique si ligne terminee
|
||||
Standard_Boolean Cadre; //indique si on est sur frontiere du domaine
|
||||
Standard_Boolean ArretAjout; //indique si on est sur point ajoute
|
||||
IntSurf_PntOn2S Psol;
|
||||
Handle(IntWalk_TheIWLine) CurrentLine; // ligne en construction
|
||||
Standard_Boolean Tgtend;
|
||||
|
||||
IntWalk_StatusDeflection Status, StatusPrecedent;
|
||||
|
||||
Standard_Integer NbDivision;
|
||||
// nombre de fois que l on a divise le pas pour une section
|
||||
|
||||
Standard_Integer StepSign;
|
||||
|
||||
ThePointOfPath PathPnt;
|
||||
|
||||
BornInf(1) = Um;
|
||||
BornSup(1) = UM;
|
||||
BornInf(2) = Vm;
|
||||
BornSup(2) = VM;
|
||||
|
||||
math_FunctionSetRoot Rsnld(Func, tolerance);
|
||||
Standard_Integer nbPath = Pnts1.Length();
|
||||
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:32:34 2000.BEGIN
|
||||
TColStd_SequenceOfInteger movementdirectioninfo;
|
||||
for (I = 1; I <= nbPath; I++) {
|
||||
movementdirectioninfo.Append(0);
|
||||
}
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:32:38 2000.END
|
||||
|
||||
for (I = 1; I <= nbPath; I++) {
|
||||
//point de depart de cheminement
|
||||
// if (etat1(I) > 11) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:33:37 2000.BEGIN
|
||||
if ((etat1(I) > 11) || ((etat1(I) < -11) && (movementdirectioninfo(I)!=0))) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:33:43 2000.END
|
||||
PathPnt = Pnts1.Value(I);
|
||||
CurrentLine = new IntWalk_TheIWLine ();
|
||||
CurrentLine->SetTangencyAtBegining(Standard_False);
|
||||
Tgtend = Standard_False;
|
||||
CurrentLine->AddStatusFirst(Standard_False, Standard_True, I, PathPnt);
|
||||
UVap(1) = ustart1(I);
|
||||
UVap(2) = vstart1(I);
|
||||
MakeWalkingPoint(11, UVap(1), UVap(2), Func, previousPoint);
|
||||
previousd3d = Func.Direction3d();
|
||||
previousd2d = Func.Direction2d();
|
||||
CurrentLine->AddPoint(previousPoint);
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:34:32 2000.BEGIN
|
||||
if(movementdirectioninfo(I) !=0) {
|
||||
if(movementdirectioninfo(I) < 0) {
|
||||
StepSign = -1;
|
||||
CurrentLine->SetTangentVector(previousd3d.Reversed(),1);
|
||||
} else {
|
||||
StepSign = 1;
|
||||
CurrentLine->SetTangentVector(previousd3d,1);
|
||||
}
|
||||
} else {
|
||||
Standard_Real tyutuyt=ThePointOfPathTool::Direction3d(PathPnt) * previousd3d;
|
||||
if( tyutuyt < 0) {
|
||||
StepSign = -1;
|
||||
CurrentLine->SetTangentVector(previousd3d.Reversed(),1);
|
||||
}
|
||||
else {
|
||||
StepSign = 1;
|
||||
CurrentLine->SetTangentVector(previousd3d,1);
|
||||
}
|
||||
}
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:34:37 2000.END
|
||||
|
||||
// Modified by Sergey KHROMOV - Tue Nov 20 10:41:45 2001 Begin
|
||||
etat1(I) = - abs(etat1(I));
|
||||
movementdirectioninfo(I) = (movementdirectioninfo(I)==0) ? StepSign : 0;
|
||||
// Modified by Sergey KHROMOV - Tue Nov 20 10:41:56 2001 End
|
||||
// premier pas d avancement
|
||||
Standard_Real d2dx = Abs(previousd2d.X());
|
||||
Standard_Real d2dy = Abs(previousd2d.Y());
|
||||
if (d2dx < tolerance(1)) {
|
||||
PasC = pas * (VM-Vm)/d2dy;
|
||||
}
|
||||
else if (d2dy < tolerance(2)) {
|
||||
PasC = pas * (UM-Um)/d2dx;
|
||||
}
|
||||
else {
|
||||
PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy);
|
||||
}
|
||||
|
||||
Arrive = Standard_False;
|
||||
ArretAjout = Standard_False;
|
||||
NbDivision = 0;
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:39:37 2000
|
||||
Standard_Integer IndexOfPathPointDoNotCheck=0;
|
||||
|
||||
while (!Arrive) { // tant que un des tests d arret est non verifie
|
||||
|
||||
Cadre = Cadrage(BornInf,BornSup,UVap,PasC,StepSign);
|
||||
// Frontiere?
|
||||
|
||||
#ifdef CHRONO
|
||||
Chronrsnld.Start();
|
||||
#endif
|
||||
|
||||
Rsnld.Perform(Func,UVap,BornInf,BornSup);
|
||||
|
||||
#ifdef CHRONO
|
||||
Chronrsnld.Stop();
|
||||
#endif
|
||||
|
||||
if (Cadre) {
|
||||
BornInf(1) = Um; BornSup(1) = UM; BornInf(2) = Vm; BornSup(2) = VM;
|
||||
}
|
||||
if (Rsnld.IsDone()) {
|
||||
if (Abs(Func.Root()) > Func.Tolerance()) {
|
||||
PasC = PasC / 2.0;
|
||||
PasCu = Abs(PasC*previousd2d.X());
|
||||
PasCv = Abs(PasC*previousd2d.Y());
|
||||
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
|
||||
if (CurrentLine->NbPoints() == 1) break;
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // a voir
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
}
|
||||
else { // test arret
|
||||
Rsnld.Root(UVap);
|
||||
Arrive = TestArretPassage(Umult, Vmult, Func, UVap, N);
|
||||
if (Arrive) {
|
||||
Cadre = Standard_False;
|
||||
//au cas ou on aurait cadre et arrive en meme temps
|
||||
}
|
||||
else {
|
||||
if (Rajout) {
|
||||
ArretAjout =TestArretAjout(Func, UVap, N, Psol);
|
||||
if (ArretAjout) {
|
||||
// jag 940615
|
||||
Tgtend = lines.Value(N)->IsTangentAtEnd();
|
||||
N = -N;
|
||||
}
|
||||
}
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:09:08 2000.BEGIN
|
||||
if(!(Rajout && ArretAjout)) {
|
||||
Standard_Real prevUp, prevVp;
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(prevUp, prevVp);
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(prevUp, prevVp);
|
||||
}
|
||||
Arrive = TestPassedSolutionWithNegativeState(etat1, Umult, Vmult, ustart1, vstart1, prevUp, prevVp,
|
||||
nbMultiplicities, tolerance, Func, UVap, N);
|
||||
if(Arrive) {
|
||||
Cadre = Standard_False;
|
||||
}
|
||||
}
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:09:13 2000.END
|
||||
if (!ArretAjout && Cadre) {
|
||||
if (CurrentLine->NbPoints() == 1) break; // annuler la ligne
|
||||
TestArretCadre(Umult, Vmult, CurrentLine, Func, UVap, N);
|
||||
// if (N == 0) {
|
||||
if (N <= 0) { // jag 941017
|
||||
MakeWalkingPoint(2, UVap(1), UVap(2), Func, Psol);
|
||||
Tgtend = Func.IsTangent();
|
||||
N = -N;
|
||||
}
|
||||
}
|
||||
}
|
||||
Status = TestDeflection(Func, Arrive, UVap, StatusPrecedent,
|
||||
NbDivision,PasC,StepSign);
|
||||
StatusPrecedent = Status;
|
||||
if (Status == IntWalk_PasTropGrand) {
|
||||
Arrive = Standard_False;
|
||||
ArretAjout = Standard_False;
|
||||
Tgtend = Standard_False; // jag 940615
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(UVap(1), UVap(2));
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(UVap(1), UVap(2));
|
||||
}
|
||||
}
|
||||
else if (ArretAjout || Cadre) {
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
if (Status != IntWalk_ArretSurPointPrecedent) {
|
||||
CurrentLine->AddPoint(Psol);
|
||||
}
|
||||
if (Cadre && N==0) {
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
}
|
||||
else if (Status == IntWalk_ArretSurPointPrecedent) {
|
||||
if (CurrentLine->NbPoints() == 1) { //annuler la ligne
|
||||
Arrive = Standard_False;
|
||||
break;
|
||||
}
|
||||
Arrive = Standard_True;
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // a voir
|
||||
}
|
||||
else if (Arrive) {
|
||||
if (CurrentLine->NbPoints() == 1 && // annuler la ligne
|
||||
(N == I || Status == IntWalk_PointConfondu) ) {
|
||||
// si N == I on s est probablement trompe de uv
|
||||
// principal ou bien le point
|
||||
// est un point d accumulation
|
||||
// si point confondu les donnees de depart sont mauvaises
|
||||
Arrive = Standard_False;
|
||||
break;
|
||||
}
|
||||
// on a necessairement N > 0 jag 940617
|
||||
// point d arret donne en entree
|
||||
PathPnt = Pnts1.Value(N);
|
||||
|
||||
Standard_Integer etat1N=etat1(N);
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:09:51 2000.BEGIN
|
||||
// if (etat1N < 11) { // point passant qui est un arret
|
||||
if (Abs(etat1N) < 11) { // point passant qui est un arret
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:12:11 2000.END
|
||||
if (Status == IntWalk_ArretSurPoint) {
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // a voir
|
||||
}
|
||||
else {
|
||||
Arrive = Standard_False;
|
||||
}
|
||||
CurrentLine->AddIndexPassing(N);
|
||||
}
|
||||
else { // point d arret donne en entree
|
||||
if (etat1N == 11) {
|
||||
Tgtend = Standard_True;
|
||||
}
|
||||
CurrentLine->AddStatusLast(Standard_True, N, PathPnt);
|
||||
}
|
||||
AddPointInCurrentLine(N,PathPnt,CurrentLine);
|
||||
if ((etat1N != 1 && etat1N != 11)) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:43:05 2000.BEGIN
|
||||
// etat1(N)= - etat1N;
|
||||
etat1(N)= - Abs(etat1N);
|
||||
movementdirectioninfo(N) = (movementdirectioninfo(N)==0) ? StepSign : 0;
|
||||
if(Arrive && movementdirectioninfo(N)!=0) {
|
||||
IndexOfPathPointDoNotCheck = N;
|
||||
}
|
||||
|
||||
if(Arrive) {
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:45:33 2000.END
|
||||
}
|
||||
}
|
||||
else if (Status == IntWalk_ArretSurPoint) {
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True;
|
||||
MakeWalkingPoint(1, UVap(1), UVap(2), Func, Psol);
|
||||
CurrentLine->AddPoint(Psol);
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
else if (Status == IntWalk_OK) {
|
||||
MakeWalkingPoint(2, UVap(1), UVap(2), Func, previousPoint);
|
||||
previousd3d = Func.Direction3d();
|
||||
previousd2d = Func.Direction2d();
|
||||
CurrentLine->AddPoint(previousPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // pas de solution numerique
|
||||
PasC = PasC / 2.;
|
||||
PasCu = Abs(PasC*previousd2d.X());
|
||||
PasCv = Abs(PasC*previousd2d.Y());
|
||||
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
|
||||
if (CurrentLine->NbPoints()==1) break;
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Tgtend = Standard_True; // a voir
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length() + 1);
|
||||
}
|
||||
}
|
||||
} // fin de la ligne commencee
|
||||
|
||||
if (Arrive) {
|
||||
CurrentLine->SetTangencyAtEnd(Tgtend);
|
||||
lines.Append(CurrentLine);
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:59:29 2000.BEGIN
|
||||
movementdirectioninfo(I)=0;
|
||||
if(etat1(I) > 0)
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:59:42 2000.END
|
||||
etat1(I)=-etat1(I);
|
||||
|
||||
//-- lbr le 5 juin 97 (Pb ds Contap)
|
||||
for(Standard_Integer av=1; av<=nbPath; av++) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 13:00:22 2000.BEGIN
|
||||
// if (etat1(av) > 11) {
|
||||
if ((etat1(av) > 11) ||
|
||||
((av!=I) &&
|
||||
(av!=IndexOfPathPointDoNotCheck) &&
|
||||
(etat1(av) < -11) &&
|
||||
(movementdirectioninfo(av)!=0))) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END
|
||||
Standard_Real Uav=ustart1(av);
|
||||
Standard_Real Vav=vstart1(av);
|
||||
Standard_Real Uavp,Vavp;
|
||||
const IntSurf_PntOn2S &avP=CurrentLine->Value(CurrentLine->NbPoints());
|
||||
if (!reversed) {
|
||||
avP.ParametersOnS2(Uavp,Vavp);
|
||||
}
|
||||
else {
|
||||
avP.ParametersOnS1(Uavp,Vavp);
|
||||
}
|
||||
Uav-=Uavp;
|
||||
Vav-=Vavp;
|
||||
Uav*=0.001; Vav*=0.001;
|
||||
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 13:01:38 2000.BEGIN
|
||||
// etat1(av)=-etat1(av);
|
||||
if(etat1(av) < 0) {
|
||||
movementdirectioninfo(av) = 0;
|
||||
} else {
|
||||
etat1(av)=-etat1(av);
|
||||
movementdirectioninfo(av) = StepSign;
|
||||
}
|
||||
// modified by NIZHNY-MKK Fri Oct 27 13:01:42 2000.END
|
||||
CurrentLine->AddStatusLast(Standard_True, av, Pnts1.Value(av));
|
||||
//-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl;
|
||||
}
|
||||
|
||||
const IntSurf_PntOn2S &avPP=CurrentLine->Value(1);
|
||||
if (!reversed) {
|
||||
avPP.ParametersOnS2(Uavp,Vavp);
|
||||
}
|
||||
else {
|
||||
avPP.ParametersOnS1(Uavp,Vavp);
|
||||
}
|
||||
Uav=ustart1(av);
|
||||
Vav=vstart1(av);
|
||||
Uav-=Uavp;
|
||||
Vav-=Vavp;
|
||||
Uav*=0.001; Vav*=0.001;
|
||||
if(Abs(Uav)<tolerance(1) && Abs(Vav)<tolerance(2)) {
|
||||
// modified by NIZHNY-MKK Fri Oct 27 13:02:49 2000.BEGIN
|
||||
// etat1(av)=-etat1(av);
|
||||
if(etat1(av) < 0) {
|
||||
movementdirectioninfo(av) = 0;
|
||||
} else {
|
||||
etat1(av)=-etat1(av);
|
||||
movementdirectioninfo(av) = -StepSign;
|
||||
}
|
||||
// modified by NIZHNY-MKK Fri Oct 27 13:02:52 2000.END
|
||||
//-- cout<<"\n Debug ? lbr ds IntWalk_IWalking_3.gxx"<<endl;
|
||||
CurrentLine->AddStatusFirst(Standard_False, Standard_True, av, Pnts1.Value(av));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} //fin de traitement d un point
|
||||
} //fin de tous les points
|
||||
}
|
||||
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:07:53 2000.BEGIN
|
||||
static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_SequenceOfInteger& etat,
|
||||
const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
const TColStd_SequenceOfReal& ustart,
|
||||
const TColStd_SequenceOfReal& vstart,
|
||||
const Standard_Real& prevUp,
|
||||
const Standard_Real& prevVp,
|
||||
const TColStd_SequenceOfInteger& nbMultiplicities,
|
||||
const math_Vector& tolerance,
|
||||
TheIWFunction& sp,
|
||||
math_Vector& UV,
|
||||
Standard_Integer& Irang) {
|
||||
Standard_Boolean Arrive = Standard_False;
|
||||
Standard_Real Dup, Dvp, Utest,Vtest;
|
||||
Standard_Real tolu = tolerance(1);
|
||||
Standard_Real tolv = tolerance(2);
|
||||
Standard_Integer i, j, k, N;
|
||||
for (i = 1; i <= etat.Length(); i++) {
|
||||
if (etat(i) < -11) {
|
||||
|
||||
// debug jag voir avec isg
|
||||
|
||||
Utest = ustart(i);
|
||||
Vtest = vstart(i);
|
||||
Dup = prevUp - Utest;
|
||||
Dvp = prevVp - Vtest;
|
||||
if (Abs(Dup) >= tolu || Abs(Dvp) >= tolv) {
|
||||
Standard_Real UV1mUtest = UV(1)-Utest;
|
||||
Standard_Real UV2mVtest = UV(2)-Vtest;
|
||||
if(( (Dup*UV1mUtest + Dvp*UV2mVtest) < 0) ||
|
||||
( Abs(UV1mUtest) < tolu
|
||||
&& Abs(UV2mVtest) < tolv)) {
|
||||
Irang=i;
|
||||
Arrive = Standard_True;
|
||||
UV(1) = Utest;
|
||||
UV(2) = Vtest;
|
||||
}
|
||||
else if (nbMultiplicities(i) > 0) {
|
||||
N=0;
|
||||
for (k = 1; k < i; k++) {
|
||||
N+=nbMultiplicities(k);
|
||||
}
|
||||
for (j = N + 1; j <= N + nbMultiplicities(i); j++) {
|
||||
if (((prevUp-Umult(j))*(UV(1)-Umult(j)) +
|
||||
(prevVp-Vmult(j))*(UV(2)-Vmult(j)) < 0) ||
|
||||
(Abs(UV(1)-Umult(j)) < tolu &&
|
||||
Abs(UV(2)-Vmult(j)) < tolv)) {
|
||||
Irang=i;
|
||||
Arrive = Standard_True;
|
||||
UV(1) = Utest;
|
||||
UV(2) = Vtest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Arrive) {
|
||||
static math_Vector bidF(1,1);
|
||||
static math_Matrix bidD(1,1,1,2);
|
||||
#ifdef DEB
|
||||
Standard_Boolean bidB =
|
||||
#endif
|
||||
sp.Values(UV,bidF,bidD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Arrive;
|
||||
}
|
||||
// modified by NIZHNY-MKK Thu Nov 2 15:07:58 2000.END
|
341
src/IntWalk/IntWalk_IWalking_4.gxx
Executable file
341
src/IntWalk/IntWalk_IWalking_4.gxx
Executable file
@@ -0,0 +1,341 @@
|
||||
//-- File IntWalk_IWalking_4.gxx
|
||||
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
const TColStd_SequenceOfReal& Vmult,
|
||||
const ThePOPIterator& Pnts1,
|
||||
const ThePOLIterator& Pnts2,
|
||||
TheIWFunction& Func,
|
||||
Standard_Boolean& Rajout )
|
||||
// *********** traitement ligne fermee **********************
|
||||
//
|
||||
// pour tout point interieur non encore traite
|
||||
// calculer le pas d avancement=pas en fonction de la fleche
|
||||
// et du pas max
|
||||
// calculer un point approche (ce point est sur la tangente a la section
|
||||
// de distance = pas du point interieur)
|
||||
// tant que
|
||||
// (l ensemble des points calcules ne forme pas une boucle fermee)
|
||||
// ou
|
||||
// (l ensemble des points ne forme pas une ligne ouverte allant
|
||||
// d une frontiere du domaine a un autre ou d un point de tangence
|
||||
// a une frontiere ou de 2 points de tangence :cas singuliers)
|
||||
//
|
||||
// cadrer le point approche sur les frontieres si necessaire
|
||||
// calcul du point
|
||||
// si point non trouve diviser le pas
|
||||
// test d arret
|
||||
// calcul du pas en fonction de la fleche et du pas maxi(arret possible)
|
||||
//
|
||||
// ********************************************************************
|
||||
{
|
||||
|
||||
Standard_Integer I,N;
|
||||
static math_Vector BornInf(1,2),BornSup(1,2);
|
||||
static math_Vector Uvap(1,2);// parametres approches courant
|
||||
Standard_Real PasC; // taux d`avancement sur la tangente
|
||||
Standard_Real PasCu; // pas d avancement courant en U
|
||||
Standard_Real PasCv; // pas d avancement courant en V
|
||||
Standard_Real PasSav; //sauvegarde du premier pas d avancement
|
||||
Standard_Boolean Arrive;// indique si ligne terminee
|
||||
Standard_Boolean Cadre; //indique si on est sur frontiere du domaine
|
||||
Standard_Boolean ArretAjout; //indique si on est sur un point ajoute
|
||||
IntSurf_PntOn2S Psol;
|
||||
Handle(IntWalk_TheIWLine) CurrentLine; //ligne en construction
|
||||
ThePointOfPath PathPnt;
|
||||
ThePointOfLoop LoopPnt;
|
||||
|
||||
Standard_Boolean Tgtbeg,Tgtend;
|
||||
|
||||
Standard_Integer StepSign;
|
||||
|
||||
IntWalk_StatusDeflection Status,StatusPrecedent;
|
||||
Standard_Integer NbDivision ; // nombre de fois que l on a divise le pas
|
||||
// lors du calcul d 1 section
|
||||
|
||||
Standard_Integer Ipass ;
|
||||
//indice dans l iterateur des points sur arete du point de
|
||||
//passage
|
||||
|
||||
|
||||
BornInf(1) = Um;
|
||||
BornSup(1) = UM;
|
||||
BornInf(2) = Vm;
|
||||
BornSup(2) = VM;
|
||||
|
||||
math_FunctionSetRoot Rsnld(Func,tolerance);
|
||||
Standard_Integer nbLoop = Pnts2.Length();
|
||||
|
||||
for (I = 1;I<=nbLoop;I++) {
|
||||
if (etat2(I) > 12) { // point de demarrage de ligne fermee
|
||||
|
||||
LoopPnt = Pnts2.Value(I);
|
||||
previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed,
|
||||
ustart2(I),vstart2(I));
|
||||
previousd3d = ThePointOfLoopTool::Direction3d(LoopPnt);
|
||||
previousd2d = ThePointOfLoopTool::Direction2d(LoopPnt);
|
||||
|
||||
CurrentLine = new IntWalk_TheIWLine ();
|
||||
CurrentLine->AddPoint(previousPoint);
|
||||
CurrentLine->SetTangentVector(previousd3d,1);
|
||||
Tgtbeg = Standard_False;
|
||||
Tgtend = Standard_False;
|
||||
Uvap(1) = ustart2(I);
|
||||
Uvap(2) = vstart2(I);
|
||||
|
||||
StepSign = 1;
|
||||
|
||||
// premier pas d avancement
|
||||
|
||||
Standard_Real d2dx = Abs(previousd2d.X());
|
||||
Standard_Real d2dy = Abs(previousd2d.Y());
|
||||
if (d2dx < tolerance(1)) {
|
||||
PasC = pas * (VM-Vm)/d2dy;
|
||||
}
|
||||
else if (d2dy < tolerance(2)) {
|
||||
PasC = pas * (UM-Um)/d2dx;
|
||||
}
|
||||
else {
|
||||
PasC = pas * Min((UM-Um)/d2dx,(VM-Vm)/d2dy);
|
||||
}
|
||||
|
||||
PasSav = PasC;
|
||||
|
||||
Arrive = Standard_False;
|
||||
ArretAjout = Standard_False;
|
||||
NbDivision = 0;
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
while (!Arrive) { // tant que aucun test d arret verifie
|
||||
Cadre=Cadrage(BornInf,BornSup,Uvap,PasC, StepSign); // frontiere?
|
||||
#ifdef CHRONO
|
||||
Chronrsnld.Start();
|
||||
#endif
|
||||
|
||||
Rsnld.Perform(Func,Uvap,BornInf,BornSup);
|
||||
|
||||
#ifdef CHRONO
|
||||
Chronrsnld.Stop();
|
||||
#endif
|
||||
|
||||
if (Cadre) { // remise a jour des bornes.
|
||||
BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM;
|
||||
}
|
||||
if (Rsnld.IsDone()) {
|
||||
if (Abs(Func.Root()) > Func.Tolerance()) { // pas de solution a la tolerance
|
||||
PasC = PasC/2.;
|
||||
PasCu = Abs(PasC*previousd2d.X());
|
||||
PasCv = Abs(PasC*previousd2d.Y());
|
||||
|
||||
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
|
||||
if (CurrentLine->NbPoints()==1) break;
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusFirstLast(Standard_False,
|
||||
Standard_False,Standard_False);
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
Tgtend = Standard_True;
|
||||
}
|
||||
}
|
||||
else { // il y a une solution
|
||||
Rsnld.Root(Uvap);
|
||||
Arrive = TestArretPassage(Umult,Vmult,Uvap,I,Ipass);
|
||||
if (Arrive) {//remettre les bons parametres pour le test de fleche.
|
||||
Psol = CurrentLine->Value(1);
|
||||
if (!reversed) {
|
||||
Psol.ParametersOnS2(Uvap(1),Uvap(2));
|
||||
}
|
||||
else {
|
||||
Psol.ParametersOnS1(Uvap(1),Uvap(2));
|
||||
}
|
||||
Cadre=Standard_False;
|
||||
//au cas ou on aurait cadre et arrive en meme temps
|
||||
}
|
||||
else { // modif jag 940615
|
||||
|
||||
if (Rajout) { // test sur les points rajoutes
|
||||
ArretAjout =TestArretAjout(Func,Uvap,N,Psol);
|
||||
if (ArretAjout) {
|
||||
if (N >0) {
|
||||
Tgtend = lines.Value(N)->IsTangentAtEnd();
|
||||
N = -N;
|
||||
}
|
||||
else {
|
||||
Tgtend = lines.Value(-N)->IsTangentAtBegining();
|
||||
}
|
||||
Arrive = (etat2(I) == 12);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ArretAjout&& Cadre) { // test sur les points deja marques
|
||||
if (CurrentLine->NbPoints() == 1) break; // annuler la ligne
|
||||
TestArretCadre(Umult,Vmult,CurrentLine,Func,Uvap,N);
|
||||
// if (N==0) {
|
||||
if (N <= 0) { // jag 941017
|
||||
MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol);
|
||||
Tgtend = Func.IsTangent(); // jag 940616
|
||||
N = -N;
|
||||
}
|
||||
Arrive = (etat2(I) == 12); // la ligne s est ouverte
|
||||
}
|
||||
}
|
||||
Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
|
||||
NbDivision,PasC,StepSign);
|
||||
StatusPrecedent = Status;
|
||||
if (Status == IntWalk_PasTropGrand) {// division du pas
|
||||
Arrive = Standard_False;
|
||||
ArretAjout = Standard_False;
|
||||
Tgtend = Standard_False; // jag 940616
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(Uvap(1),Uvap(2));
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(Uvap(1),Uvap(2));
|
||||
}
|
||||
}
|
||||
else if (ArretAjout || Cadre) {
|
||||
|
||||
if (Arrive) { // la ligne s est ouverte
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
if (Status != IntWalk_ArretSurPointPrecedent) {
|
||||
CurrentLine->AddPoint(Psol);
|
||||
}
|
||||
if (Cadre && N==0) {
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
|
||||
}
|
||||
else { // a ouvrir
|
||||
etat2(I) = 12; //la declarer ouverte
|
||||
Tgtbeg = Tgtend;
|
||||
Tgtend = Standard_False;
|
||||
ArretAjout = Standard_False;
|
||||
StepSign = -1;
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
PasC = PasSav;
|
||||
if (Status == IntWalk_ArretSurPointPrecedent) {
|
||||
OpenLine(0,Psol,Pnts1,Func,CurrentLine);
|
||||
}
|
||||
else {
|
||||
OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine);
|
||||
}
|
||||
if (Cadre && N==0) {
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(-lines.Length()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( Status == IntWalk_ArretSurPointPrecedent) {
|
||||
if (CurrentLine->NbPoints() == 1) { //annuler la ligne
|
||||
Arrive = Standard_False;
|
||||
break;
|
||||
}
|
||||
if (etat2(I) >12) { //la ligne doit s ouvrir
|
||||
etat2(I) = 12; //la declarer ouverte
|
||||
ArretAjout = Standard_False;
|
||||
OpenLine(0,Psol,Pnts1,Func,CurrentLine);
|
||||
StepSign = -1;
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
Arrive = Standard_False;
|
||||
PasC = PasSav;
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(-lines.Length()-1);
|
||||
}
|
||||
else { // la ligne s est ouverte
|
||||
Arrive =Standard_True;
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
}
|
||||
else if (Arrive) {
|
||||
if (etat2(I) > 12) { //ligne fermee bon cas
|
||||
CurrentLine->AddStatusFirstLast(Standard_True,
|
||||
Standard_False,Standard_False);
|
||||
CurrentLine->AddPoint(CurrentLine->Value(1));
|
||||
}
|
||||
else if (N >0) { //point d arret donne en entree
|
||||
PathPnt = Pnts1.Value(N);
|
||||
CurrentLine->AddStatusLast(Standard_True,N,PathPnt);
|
||||
AddPointInCurrentLine(N,PathPnt,CurrentLine);
|
||||
}
|
||||
}
|
||||
else if (Status == IntWalk_ArretSurPoint) {
|
||||
if (etat2(I) >12) { //la ligne doit s ouvrir
|
||||
etat2(I) = 12; //la declarer ouverte
|
||||
Tgtbeg = Standard_True;
|
||||
Tgtend = Standard_False;
|
||||
N= -lines.Length()-1;
|
||||
Psol.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
|
||||
OpenLine(N,Psol,Pnts1,Func,CurrentLine);
|
||||
StepSign = -1;
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(N);
|
||||
StatusPrecedent = IntWalk_OK;
|
||||
Arrive = Standard_False;
|
||||
PasC = PasSav;
|
||||
}
|
||||
else {
|
||||
Arrive = Standard_True;
|
||||
if (Ipass!=0) { //point de passage ,point d arret
|
||||
PathPnt = Pnts1.Value(Ipass);
|
||||
CurrentLine->AddStatusLast(Standard_True,Ipass,PathPnt);
|
||||
AddPointInCurrentLine(Ipass,PathPnt,CurrentLine);
|
||||
}
|
||||
else {
|
||||
CurrentLine->AddStatusLast(Standard_False);
|
||||
IntSurf_PntOn2S newP;
|
||||
newP.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
|
||||
CurrentLine->AddPoint(newP);
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Status == IntWalk_OK) {
|
||||
if (Ipass!=0) CurrentLine->AddIndexPassing(Ipass);
|
||||
previousPoint.SetValue(Func.Point(),reversed,Uvap(1),Uvap(2));
|
||||
previousd3d = Func.Direction3d();
|
||||
previousd2d = Func.Direction2d();
|
||||
CurrentLine->AddPoint(previousPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //pas de solution numerique NotDone
|
||||
PasC = PasC/2.;
|
||||
PasCu = Abs(PasC*previousd2d.X());
|
||||
PasCv = Abs(PasC*previousd2d.Y());
|
||||
|
||||
if (PasCu <= tolerance(1) && PasCv <= tolerance(2)) {
|
||||
if (CurrentLine->NbPoints() == 1) break; // annuler la ligne
|
||||
Arrive = Standard_True;
|
||||
CurrentLine->AddStatusFirstLast(Standard_False,Standard_False,
|
||||
Standard_False);
|
||||
Tgtend = Standard_True;
|
||||
Rajout = Standard_True;
|
||||
seqAjout.Append(lines.Length()+1);
|
||||
}
|
||||
}
|
||||
}// fin de la ligne commencee
|
||||
if (Arrive) {
|
||||
CurrentLine->SetTangencyAtBegining(Tgtbeg);
|
||||
CurrentLine->SetTangencyAtEnd(Tgtend);
|
||||
|
||||
lines.Append(CurrentLine);
|
||||
etat2(I)=-etat2(I); //marque le point comme traite
|
||||
}
|
||||
} //fin de traitement d un point de depart
|
||||
} //fin de tous les points de depart
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
270
src/IntWalk/IntWalk_IWalking_5.gxx
Executable file
270
src/IntWalk/IntWalk_IWalking_5.gxx
Executable file
@@ -0,0 +1,270 @@
|
||||
IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
|
||||
(TheIWFunction& sp,
|
||||
const Standard_Boolean Finished,
|
||||
const math_Vector& UV,
|
||||
const IntWalk_StatusDeflection StatusPrecedent,
|
||||
Standard_Integer& NbDivision,
|
||||
Standard_Real& Step,
|
||||
const Standard_Integer StepSign)
|
||||
{
|
||||
// Verification du pas d avancement, ET recalcul de ce pas :
|
||||
//
|
||||
// 1)test point confondu
|
||||
// si oui les autres tests ne sont pas faits
|
||||
// 2)test angle 3d trop grand
|
||||
// si oui on divise le pas, on sort
|
||||
// angle3d = angle ((point precedent, point calcule),
|
||||
// tangente precedente)
|
||||
// 3)verification du pas d avancement en 2d
|
||||
// 4)test point confondu
|
||||
// 5)test angle 2d trop grand
|
||||
// 6)test point de tangence
|
||||
// si oui on sort
|
||||
// 7)calcul de la tangente en u,v de la section
|
||||
// 8)test angle 3d trop grand
|
||||
// angle3d = angle ((point precedent, point calcule),
|
||||
// nouvelle tangente)
|
||||
// 9)test angle 2d trop grand
|
||||
//10)test de changement de rive(depasser le point de tangence sans le savoir)
|
||||
//11)calcul du pas d avancement en fonction de la fleche
|
||||
//12)ajustement du pas en fonction des pas precedents
|
||||
|
||||
IntWalk_StatusDeflection Status = IntWalk_OK;
|
||||
|
||||
static const Standard_Real CosRef3D = 0.98;// regle par tests dans U4
|
||||
// correspond a 11.478 d
|
||||
static const Standard_Real CosRef2D = 0.88; // correspond a 25 d
|
||||
static const Standard_Integer MaxDivision = 60; // nombre maxi de division
|
||||
// du pas a cause de
|
||||
// l angle trop grand en 2d (U4)
|
||||
//---------------------------------------------------------------------------------
|
||||
//-- lbr le 4 Avril 95 : On peut se trouver ds le cas ou Status renvoie point
|
||||
//-- confondus si epsilon est assez grand (1e-11) . Dans ce cas on boucle
|
||||
//-- sans jamais changer les valeurs envoyees a Rsnld.
|
||||
static Standard_Integer NbPointsConfondusConsecutifs = 0 ;
|
||||
static Standard_Integer EpsilonSembleTropGrand = 0 ;
|
||||
//---------------------------------------------------------------------------------
|
||||
Standard_Real Paramu, Paramv, StepU,StepV;
|
||||
Standard_Real Cosi, Cosi2, Norme;
|
||||
|
||||
gp_Vec Corde(previousPoint.Value(), sp.Point());
|
||||
|
||||
Norme = Corde.SquareMagnitude();
|
||||
// if (Norme <= epsilon*epsilon) {
|
||||
if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // le carre est deja pris dans le constructeur
|
||||
Status = IntWalk_PointConfondu;
|
||||
if (StatusPrecedent == IntWalk_PasTropGrand) {
|
||||
return IntWalk_ArretSurPointPrecedent;
|
||||
}
|
||||
|
||||
if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Provisoire
|
||||
if(epsilon>0.00000000001) epsilon*=0.5; //-- Provisoire
|
||||
EpsilonSembleTropGrand = 0; //-- Provisoire
|
||||
}
|
||||
}
|
||||
else {
|
||||
NbPointsConfondusConsecutifs = 0; //-- Provisoire
|
||||
EpsilonSembleTropGrand = 0; //-- Provisoire
|
||||
if(Norme<1e-16) Norme = 1e-16; //-- Provisoire
|
||||
|
||||
Cosi = Corde * previousd3d;
|
||||
if (Cosi*StepSign < 0.) { // angle 3d > pi/2 !!!!
|
||||
Cosi2 = 0.;
|
||||
}
|
||||
else {
|
||||
Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme;
|
||||
}
|
||||
if (Cosi2 < CosRef3D) { //angle 3d trop grand
|
||||
Step = Step /2.0;
|
||||
StepU = Abs(Step*previousd2d.X());
|
||||
StepV = Abs(Step*previousd2d.Y());
|
||||
if (StepU < tolerance(1) && StepV < tolerance(2))
|
||||
Status = IntWalk_ArretSurPointPrecedent;
|
||||
else
|
||||
Status = IntWalk_PasTropGrand;
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(Paramu, Paramv);
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(Paramu, Paramv);
|
||||
}
|
||||
Standard_Real Du = UV(1) - Paramu;
|
||||
Standard_Real Dv = UV(2) - Paramv;
|
||||
Standard_Real Duv = Du * Du + Dv * Dv;
|
||||
if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2))
|
||||
return IntWalk_ArretSurPointPrecedent; //point confondu 2d
|
||||
Cosi = StepSign * (Du * previousd2d.X() +
|
||||
Dv * previousd2d.Y());
|
||||
if (Cosi < 0 && Status == IntWalk_PointConfondu)
|
||||
return IntWalk_ArretSurPointPrecedent; // on sort car retour arriere
|
||||
// avec point confondu
|
||||
|
||||
|
||||
if (sp.IsTangent())
|
||||
return IntWalk_ArretSurPoint;
|
||||
|
||||
//si au cours du cheminement on a subdivise plus de MaxDivision pour chaque
|
||||
//pas precedent,anomalie sur le carreau;on ne fait plus rien (experience U4)
|
||||
|
||||
if (NbDivision < MaxDivision &&
|
||||
Status != IntWalk_PointConfondu &&
|
||||
StatusPrecedent!= IntWalk_PointConfondu ) {
|
||||
Cosi2 = Cosi * Cosi / Duv;
|
||||
if (Cosi2 < CosRef2D || Cosi < 0 ) {
|
||||
Step = Step / 2.0;
|
||||
StepU = Abs(Step*previousd2d.X());
|
||||
StepV = Abs(Step*previousd2d.Y());
|
||||
|
||||
if (StepU < tolerance(1) && StepV < tolerance(2))
|
||||
Status = IntWalk_ArretSurPointPrecedent;
|
||||
else
|
||||
Status = IntWalk_PasTropGrand;
|
||||
NbDivision = NbDivision + 1;
|
||||
return Status;
|
||||
}
|
||||
|
||||
Cosi = Corde * sp.Direction3d();
|
||||
Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme;
|
||||
if (Cosi2 < CosRef3D ){ //angle 3d trop grand
|
||||
Step = Step / 2.;
|
||||
StepU = Abs(Step*previousd2d.X());
|
||||
StepV = Abs(Step*previousd2d.Y());
|
||||
if (StepU < tolerance(1) && StepV < tolerance(2))
|
||||
Status = IntWalk_ArretSurPoint;
|
||||
else
|
||||
Status = IntWalk_PasTropGrand;
|
||||
return Status;
|
||||
}
|
||||
Cosi = Du * sp.Direction2d().X() +
|
||||
Dv * sp.Direction2d().Y();
|
||||
Cosi2 = Cosi * Cosi / Duv;
|
||||
if (Cosi2 < CosRef2D ||
|
||||
sp.Direction2d() * previousd2d < 0) {
|
||||
//angle 2d trop grand ou changement de rive
|
||||
Step = Step / 2.;
|
||||
StepU = Abs(Step*previousd2d.X());
|
||||
StepV = Abs(Step*previousd2d.Y());
|
||||
if (StepU < tolerance(1) && StepV < tolerance(2))
|
||||
Status = IntWalk_ArretSurPointPrecedent;
|
||||
else
|
||||
Status = IntWalk_PasTropGrand;
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Finished) {
|
||||
|
||||
if (Status == IntWalk_PointConfondu) {
|
||||
StepU = Min(Abs(1.5 * Du),pas*(UM-Um));
|
||||
StepV = Min(Abs(1.5 * Dv),pas*(VM-Vm));
|
||||
|
||||
Standard_Real d2dx = Abs(previousd2d.X());
|
||||
Standard_Real d2dy = Abs(previousd2d.Y());
|
||||
|
||||
if (d2dx < tolerance(1)) {
|
||||
Step = StepV/d2dy;
|
||||
}
|
||||
else if (d2dy < tolerance(2)) {
|
||||
Step = StepU/d2dx;
|
||||
}
|
||||
else {
|
||||
Step = Min(StepU/d2dx,StepV/d2dy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
// on estime la fleche courante.
|
||||
// si fleche/2<=flechecourante<= fleche on considere que le critere est
|
||||
// respecte.
|
||||
// sinon ajuster le pas en fonction du pas precedent
|
||||
|
||||
/*
|
||||
Standard_Real Dist = Sqrt(Norme)/3.;
|
||||
TColgp_Array1OfPnt Poles(1,4);
|
||||
gp_Pnt POnCurv,Milieu;
|
||||
Poles(1) = previousPoint.Value();
|
||||
Poles(4) = sp.Point();
|
||||
Poles(2) = Poles(1).XYZ() +
|
||||
StepSign * Dist* previousd3d.Normalized().XYZ();
|
||||
Poles(3) = Poles(4).XYZ() -
|
||||
StepSign * Dist*sp.Direction3d().Normalized().XYZ();
|
||||
BzCLib::PntPole(0.5,Poles,POnCurv);
|
||||
Milieu = (Poles(1).XYZ() + Poles(4).XYZ())*0.5;
|
||||
// FlecheCourante = Milieu.Distance(POnCurv);
|
||||
Standard_Real FlecheCourante = Milieu.SquareDistance(POnCurv);
|
||||
*/
|
||||
|
||||
// Calcul direct :
|
||||
// POnCurv=(((p1+p2)/2.+(p2+p3)/2.)/2. + ((p2+p3)/2.+(p3+P4)/2.)/2.)/2.
|
||||
// soit POnCurv = p1/8. + 3.p2/8. + 3.p3/8. + p4/8.
|
||||
// Or p2 = p1 + lambda*d1 et p3 = p4 - lambda*d4
|
||||
// Donc POnCurv = (p1 + p4)/2. + 3.*(lambda d1 - lambda d4)/8.
|
||||
// On calcule l'ecart avec (p1+p4)/2. . Il faut donc juste calculer
|
||||
// la norme (au carre) de 3.*lambda (d1 - d4)/8.
|
||||
// soit la norme de :
|
||||
// 3.*(Sqrt(Norme)/3.)*StepSign*(d1-d4)/8.
|
||||
// ce qui fait, en prenant le carre :
|
||||
// Norme * (d1-d4).SquareMagnitude()/64.
|
||||
|
||||
Standard_Real FlecheCourante =
|
||||
(previousd3d.Normalized().XYZ()-sp.Direction3d().Normalized().XYZ()).SquareModulus()*Norme/64.;
|
||||
|
||||
|
||||
// if (FlecheCourante <= 0.5*fleche) {
|
||||
if (FlecheCourante <= 0.25*fleche*fleche) {
|
||||
|
||||
Standard_Real d2dx = Abs(sp.Direction2d().X());
|
||||
Standard_Real d2dy = Abs(sp.Direction2d().Y());
|
||||
|
||||
StepU = Min(Abs(1.5*Du),pas*(UM-Um));
|
||||
StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
|
||||
|
||||
if (d2dx < tolerance(1)) {
|
||||
Step = StepV/d2dy;
|
||||
}
|
||||
else if (d2dy < tolerance(2)) {
|
||||
Step = StepU/d2dx;
|
||||
}
|
||||
else {
|
||||
Step = Min(StepU/d2dx,StepV/d2dy);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// if (FlecheCourante > fleche) { // pas trop grand
|
||||
if (FlecheCourante > fleche*fleche) { // pas trop grand
|
||||
Step = Step /2.;
|
||||
Status = IntWalk_PasTropGrand;
|
||||
}
|
||||
else {
|
||||
Standard_Real d2dx = Abs(sp.Direction2d().X());
|
||||
Standard_Real d2dy = Abs(sp.Direction2d().Y());
|
||||
|
||||
StepU = Min(Abs(1.5*Du),pas*(UM-Um));
|
||||
StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
|
||||
|
||||
if (d2dx < tolerance(1)) {
|
||||
Step = Min(Step,StepV/d2dy);
|
||||
}
|
||||
else if (d2dy < tolerance(2)) {
|
||||
Step = Min(Step,StepU/d2dx);
|
||||
}
|
||||
else {
|
||||
Step = Min(Step,Min(StepU/d2dx,StepV/d2dy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
113
src/IntWalk/IntWalk_IWalking_6.gxx
Executable file
113
src/IntWalk/IntWalk_IWalking_6.gxx
Executable file
@@ -0,0 +1,113 @@
|
||||
//-- File IntWalk_IWalking_6.gxx
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
void IntWalk_IWalking::AddPointInCurrentLine
|
||||
(const Standard_Integer N,
|
||||
const ThePointOfPath& PathPnt,
|
||||
const Handle(IntWalk_TheIWLine)& CurrentLine) const {
|
||||
|
||||
|
||||
IntSurf_PntOn2S Psol;
|
||||
Psol.SetValue(ThePointOfPathTool::Value3d(PathPnt),
|
||||
reversed,ustart1(N),vstart1(N));
|
||||
CurrentLine->AddPoint(Psol);
|
||||
}
|
||||
|
||||
|
||||
void IntWalk_IWalking::MakeWalkingPoint
|
||||
(const Standard_Integer Case,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
TheIWFunction& sp,
|
||||
IntSurf_PntOn2S& Psol )
|
||||
|
||||
{
|
||||
|
||||
// Case == 1 : make a WalkinkPoint.
|
||||
// Case == 2 : make a WalkinkPoint.
|
||||
// The computation of the tangency on is done
|
||||
// Case == 10 + i : make a WalkinkPoint according to i.
|
||||
// but F is updated according to U and V
|
||||
// Case == other : the exception Standard_Failure is raised.
|
||||
|
||||
if (Case == 1)
|
||||
Psol.SetValue(sp.Point(),reversed, U, V);
|
||||
else if (Case == 2) {
|
||||
#ifdef DEB
|
||||
Standard_Boolean foo = sp.IsTangent();
|
||||
#endif
|
||||
Psol.SetValue(sp.Point(),reversed, U, V);
|
||||
}
|
||||
else if (Case == 11 || Case == 12 ) {
|
||||
static math_Vector UV(1, 2);
|
||||
static math_Vector FF(1, 1);
|
||||
static math_Matrix DD(1, 1, 1, 2);
|
||||
UV(1) = U;
|
||||
UV(2) = V;
|
||||
sp.Values(UV, FF, DD);
|
||||
MakeWalkingPoint(Case - 10, U, V, sp, Psol);
|
||||
}
|
||||
else {
|
||||
Standard_ConstructionError::Raise();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IntWalk_IWalking::OpenLine(const Standard_Integer N,
|
||||
const IntSurf_PntOn2S& Psol,
|
||||
const ThePOPIterator& Pnts1,
|
||||
TheIWFunction& sp,
|
||||
const Handle(IntWalk_TheIWLine)& Line )
|
||||
// **************** ouverture de la ligne et repartir dans l autre sens********
|
||||
|
||||
{
|
||||
ThePointOfPath PathPnt;
|
||||
|
||||
static math_Vector UV(1, 2);
|
||||
static math_Vector FF(1, 1);
|
||||
static math_Matrix DD(1, 1, 1, 2);
|
||||
|
||||
previousPoint = Line->Value(1);
|
||||
if (!reversed) {
|
||||
previousPoint.ParametersOnS2(UV(1),UV(2));
|
||||
}
|
||||
else {
|
||||
previousPoint.ParametersOnS1(UV(1),UV(2));
|
||||
}
|
||||
sp.Values(UV, FF, DD);
|
||||
previousd3d = sp.Direction3d();
|
||||
previousd2d = sp.Direction2d();
|
||||
|
||||
if (N>0) { //point de depart donne en entree
|
||||
PathPnt = Pnts1.Value(N);
|
||||
//marque la ligne comme ouverte avec point d arret donne
|
||||
Line->AddStatusFirst(Standard_False,Standard_True,N,PathPnt);
|
||||
|
||||
|
||||
AddPointInCurrentLine(N,PathPnt,Line);
|
||||
|
||||
}
|
||||
else {
|
||||
if (N <0) Line->AddPoint(Psol);
|
||||
Line->AddStatusFirst(Standard_False,Standard_False);
|
||||
//marque la ligne comme ouverte sans point d arret donne
|
||||
}
|
||||
Line->Reverse(); //inverser la ligne
|
||||
Line->SetTangentVector(previousd3d.Reversed(),Line->NbPoints());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
52
src/IntWalk/IntWalk_Iterator.cdl
Executable file
52
src/IntWalk/IntWalk_Iterator.cdl
Executable file
@@ -0,0 +1,52 @@
|
||||
-- File: Iterator.cdl
|
||||
-- Created: Fri Mar 6 16:13:20 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
generic class Iterator from IntWalk (Point as any)
|
||||
|
||||
|
||||
---Purpose: Template class to describe the exploration argument of the
|
||||
-- generic class IWalking
|
||||
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns Iterator from IntWalk;
|
||||
|
||||
|
||||
Length(me)
|
||||
|
||||
---Purpose: returns the dimension of the exploration
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me; Index : Integer)
|
||||
|
||||
---Purpose: returns the current point
|
||||
-- an exception is raised if i>NbPoints
|
||||
|
||||
returns Point
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Append(me: in out; P: Point)
|
||||
|
||||
---Purpose: Adds a point in the iterator.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
end Iterator;
|
0
src/IntWalk/IntWalk_Iterator.gxx
Executable file
0
src/IntWalk/IntWalk_Iterator.gxx
Executable file
54
src/IntWalk/IntWalk_LoopPointTool.cdl
Executable file
54
src/IntWalk/IntWalk_LoopPointTool.cdl
Executable file
@@ -0,0 +1,54 @@
|
||||
-- File: LoopPointTool.cdl
|
||||
-- Created: Mon Mar 9 16:55:09 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
deferred generic class LoopPointTool from IntWalk
|
||||
(LoopPoint as any)
|
||||
|
||||
---Purpose: template class to describe the necessary ressources
|
||||
-- for a point usedas a starting point for a marching
|
||||
-- algorithm.
|
||||
-- The 'marching algorithm' determines the intersection
|
||||
-- between an implicit surface and a parametrized surface.
|
||||
-- these point are inside the surface not on the boundaries.
|
||||
|
||||
uses Pnt from gp,
|
||||
Vec from gp,
|
||||
Dir2d from gp
|
||||
|
||||
is
|
||||
|
||||
Value3d(myclass; PStart: LoopPoint)
|
||||
|
||||
---Purpose: Returns the 3d coordinates of the starting point.
|
||||
|
||||
returns Pnt from gp;
|
||||
|
||||
|
||||
Value2d(myclass; PStart: LoopPoint; U, V: out Real from Standard);
|
||||
|
||||
---Purpose: Returns the <U,V> parameters which are associated
|
||||
-- with <P>
|
||||
-- it's the parameters which start the marching algorithm
|
||||
|
||||
|
||||
Direction3d(myclass; PStart: LoopPoint)
|
||||
|
||||
---Purpose: returns the tangent at the intersectin in 3d space
|
||||
-- associated to <P>
|
||||
|
||||
returns Vec from gp;
|
||||
|
||||
|
||||
Direction2d(myclass; PStart: LoopPoint)
|
||||
|
||||
---Purpose: returns the tangent at the intersectin in the
|
||||
-- parametric space of the parametrized surface.This tangent
|
||||
-- is associated to the value2d
|
||||
|
||||
returns Dir2d from gp;
|
||||
|
||||
|
||||
end LoopPointTool;
|
0
src/IntWalk/IntWalk_LoopPointTool.gxx
Executable file
0
src/IntWalk/IntWalk_LoopPointTool.gxx
Executable file
64
src/IntWalk/IntWalk_PSurfaceTool.cdl
Executable file
64
src/IntWalk/IntWalk_PSurfaceTool.cdl
Executable file
@@ -0,0 +1,64 @@
|
||||
-- File: PSurfaceTool.cdl
|
||||
-- Created: Fri Mar 6 16:32:01 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred generic class PSurfaceTool from IntWalk (ThePSurface as any)
|
||||
|
||||
|
||||
---Purpose: Template class for a tool on a bi-parametrised
|
||||
-- surface.
|
||||
-- It is possible to implement this class with an
|
||||
-- instantiation of the SurfaceTool from Adaptor3d.
|
||||
|
||||
is
|
||||
|
||||
UIntervalFirst(myclass ; S: ThePSurface)
|
||||
|
||||
---Purpose: Returns the first U parameter of the surface.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
VIntervalFirst(myclass ; S: ThePSurface)
|
||||
|
||||
---Purpose: Returns the first V parameter of the surface.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
UIntervalLast(myclass ; S: ThePSurface)
|
||||
|
||||
---Purpose: Returns the last U parameter of the surface.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
VIntervalLast(myclass ; S: ThePSurface)
|
||||
|
||||
---Purpose: Returns the last V parameter of the surface.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
UResolution(myclass; S : ThePSurface; Tol3d: Real from Standard)
|
||||
|
||||
---Purpose: Returns the numerical resolution in the U direction,
|
||||
-- for a given resolution in 3d space.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
VResolution(myclass; S : ThePSurface; Tol3d: Real from Standard)
|
||||
|
||||
---Purpose: Returns the numerical resolution in the V direction,
|
||||
-- for a given resolution in 3d space.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
|
||||
end PSurfaceTool;
|
||||
|
0
src/IntWalk/IntWalk_PSurfaceTool.gxx
Executable file
0
src/IntWalk/IntWalk_PSurfaceTool.gxx
Executable file
299
src/IntWalk/IntWalk_PWalking.cdl
Executable file
299
src/IntWalk/IntWalk_PWalking.cdl
Executable file
@@ -0,0 +1,299 @@
|
||||
-- File: PWalking.cdl
|
||||
-- Created: Fri Apr 3 10:27:42 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
generic class PWalking from IntWalk (
|
||||
ThePSurface as any;
|
||||
ThePSurfaceTool as any) -- as PSurfaceTool from IntWalk(ThePSurface)
|
||||
|
||||
|
||||
---Purpose: This class implements an algorithm to determine the
|
||||
-- intersection between 2 parametrized surface, marching from
|
||||
-- a starting point. The intersection line
|
||||
-- starts and ends on the natural surface 's boundaries .
|
||||
|
||||
|
||||
uses XY from gp,
|
||||
StatusDeflection from IntWalk,
|
||||
ConstIsoparametric from IntImp,
|
||||
Array1OfReal from TColStd,
|
||||
PntOn2S from IntSurf,
|
||||
LineOn2S from IntSurf,
|
||||
Dir from gp,
|
||||
Dir2d from gp
|
||||
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
|
||||
|
||||
class TheInt2S instantiates Int2S from IntImp
|
||||
(ThePSurface, ThePSurfaceTool);
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create ( Caro1 ,
|
||||
Caro2 : ThePSurface ;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
---Purpose: Constructor used to set the data to compute intersection
|
||||
-- lines between Caro1 and Caro2.
|
||||
-- Deflection is the maximum deflection admitted between two
|
||||
-- consecutive points on the resulting polyline.
|
||||
-- TolTangency is the tolerance to find a tangent point.
|
||||
-- Func is the criterion which has to be evaluated at each
|
||||
-- solution point (each point of the line).
|
||||
-- It is necessary to call the Perform method to compute
|
||||
-- the intersection lines.
|
||||
-- la ligne trouvee part d'un point sur ou dans les 2 domaines
|
||||
-- naturelles des surfaces .Elle peut etre fermee ;dans les
|
||||
-- cas standard si elle est ouverte elle s arrete et commence
|
||||
-- a une frontiere d 'un des domaines.Si une ligne ouverte
|
||||
-- s arrete en plein milieu d'un domaine ,on s'arrete sur
|
||||
-- point de tangence.
|
||||
-- Epsilon tolerance au carre de confusion de points
|
||||
|
||||
returns PWalking;
|
||||
|
||||
|
||||
Create ( Caro1 ,
|
||||
Caro2 : ThePSurface ;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard;
|
||||
U1,V1,U2,V2 :Real from Standard)
|
||||
|
||||
---Purpose: Returns the intersection line containing the exact
|
||||
-- point Poin. This line is a polygonal line.
|
||||
-- Deflection is the maximum deflection admitted between two
|
||||
-- consecutive points on the resulting polyline.
|
||||
-- TolTangency is the tolerance to find a tangent point.
|
||||
-- Func is the criterion which has to be evaluated at each
|
||||
-- solution point (each point of the line).
|
||||
-- la ligne trouvee part d'un point sur ou dans les 2 domaines
|
||||
-- naturelles des surfaces .Elle peut etre fermee ;dans les
|
||||
-- cas standard si elle est ouverte elle s arrete et commence
|
||||
-- a une frontiere d 'un des domaines.Si une ligne ouverte
|
||||
-- s arrete en plein milieu d'un domaine ,on s'arrete sur
|
||||
-- point de tangence.
|
||||
-- Epsilon tolerance au carre de confusion de points
|
||||
|
||||
returns PWalking;
|
||||
|
||||
|
||||
Perform(me :in out;ParDep : Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: calcule la ligne d 'intersection
|
||||
|
||||
is static;
|
||||
|
||||
Perform(me :in out;ParDep : Array1OfReal from TColStd;
|
||||
u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard)
|
||||
|
||||
---Purpose: calcule la ligne d 'intersection le reglage des
|
||||
-- pas est fait a partir des valeurs min max sur u et
|
||||
-- v. (si ces donnees ne sont pas presentes comme
|
||||
-- dans la methode precedente, les pas initiaux sont
|
||||
-- calcules a partir des min max uv des faces).
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
PerformFirstPoint(me :in out;
|
||||
ParDep : Array1OfReal from TColStd;
|
||||
FirstPoint: in out PntOn2S from IntSurf)
|
||||
|
||||
---Purpose: calcule le premier point d'une ligne d'intersection
|
||||
--
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns true if the calculus was successful.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPoints(me)
|
||||
|
||||
---Purpose: Returns the number of points of the resulting polyline.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me ; Index : Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range Index on the polyline.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
-- An exception is raised if Index<=0 or Index>NbPoints.
|
||||
|
||||
returns PntOn2S from IntSurf
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Line(me)
|
||||
|
||||
returns mutable LineOn2S from IntSurf
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
TangentAtFirst(me)
|
||||
|
||||
---Purpose: Returns True if the surface are tangent at the first point
|
||||
-- of the line.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TangentAtLast(me)
|
||||
|
||||
---Purpose: Returns true if the surface are tangent at the last point
|
||||
-- of the line.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
IsClosed(me)
|
||||
|
||||
---Purpose: Returns True if the line is closed.
|
||||
-- An exception is raised if IsDone returns False.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
TangentAtLine(me; Index: out Integer from Standard)
|
||||
|
||||
returns Dir from gp
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
--private
|
||||
|
||||
TestDeflection(me : in out)
|
||||
|
||||
returns StatusDeflection from IntWalk
|
||||
is static;
|
||||
|
||||
|
||||
TestArret(me : in out; DejaReparti : Boolean from Standard;
|
||||
Param : in out Array1OfReal from TColStd;
|
||||
ChoixIso : out ConstIsoparametric from IntImp)
|
||||
|
||||
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
RepartirOuDiviser(me : in out; DejaReparti : in out Boolean from Standard;
|
||||
ChoixIso : out ConstIsoparametric from IntImp;
|
||||
Arrive : in out Boolean from Standard )
|
||||
|
||||
is static;
|
||||
|
||||
AddAPoint ( me : in out ;
|
||||
line : in out LineOn2S from IntSurf ;
|
||||
POn2S : PntOn2S from IntSurf ) ;
|
||||
---C++: inline
|
||||
|
||||
ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric from IntImp;
|
||||
theDirectionFlag: Boolean from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
line : LineOn2S from IntSurf;
|
||||
close : Boolean from Standard;
|
||||
tgfirst : Boolean from Standard;
|
||||
tglast : Boolean from Standard;
|
||||
indextg : Integer from Standard;
|
||||
tgdir : Dir from gp;
|
||||
|
||||
fleche : Real from Standard; -- fleche maxi autorisee
|
||||
pasMax : Real from Standard; -- ratio uv maximum autorise
|
||||
tolconf : Real from Standard; -- tol de confusion de 2 points
|
||||
pasuv : Real from Standard[4];-- pas uv sur les caros
|
||||
pasSav : Real from Standard[4];-- premier pas sauvegarde
|
||||
pasInit : Real from Standard[4];-- sauvegarde des pas
|
||||
|
||||
Um1 : Real from Standard;
|
||||
UM1 : Real from Standard;
|
||||
Vm1 : Real from Standard;
|
||||
VM1 : Real from Standard;
|
||||
|
||||
Um2 : Real from Standard;
|
||||
UM2 : Real from Standard;
|
||||
Vm2 : Real from Standard;
|
||||
VM2 : Real from Standard;
|
||||
|
||||
ResoU1 : Real from Standard;
|
||||
ResoU2 : Real from Standard;
|
||||
ResoV1 : Real from Standard;
|
||||
ResoV2 : Real from Standard;
|
||||
|
||||
sensCheminement : Integer from Standard;
|
||||
choixIsoSav : ConstIsoparametric from IntImp;
|
||||
-- sauvegarde du choix 1 iere iso
|
||||
previousPoint : PntOn2S from IntSurf;
|
||||
-- point d 'intersection precedent
|
||||
previoustg : Boolean from Standard;
|
||||
previousd : Dir from gp;
|
||||
previousd1 : Dir2d from gp;
|
||||
previousd2 : Dir2d from gp;
|
||||
firstd1 : Dir2d from gp;
|
||||
firstd2 : Dir2d from gp;
|
||||
|
||||
myIntersectionOn2S : TheInt2S ;
|
||||
|
||||
end PWalking;
|
10
src/IntWalk/IntWalk_PWalking.gxx
Executable file
10
src/IntWalk/IntWalk_PWalking.gxx
Executable file
@@ -0,0 +1,10 @@
|
||||
#include <IntWalk_StatusDeflection.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <IntImp_ComputeTangence.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#include <IntWalk_PWalking_1.gxx>
|
||||
#include <IntWalk_PWalking_2.gxx>
|
||||
#include <IntWalk_PWalking_3.gxx>
|
||||
#include <IntWalk_PWalking_4.gxx>
|
71
src/IntWalk/IntWalk_PWalking.lxx
Executable file
71
src/IntWalk/IntWalk_PWalking.lxx
Executable file
@@ -0,0 +1,71 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <IntSurf_LineOn2S.hxx>
|
||||
|
||||
inline Standard_Boolean IntWalk_PWalking::IsDone() const {
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntWalk_PWalking::NbPoints() const {
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return line->NbPoints();
|
||||
}
|
||||
|
||||
inline const IntSurf_PntOn2S& IntWalk_PWalking::Value
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) StdFail_NotDone::Raise();
|
||||
return line->Value(Index);
|
||||
}
|
||||
|
||||
|
||||
inline const Handle(IntSurf_LineOn2S)& IntWalk_PWalking::Line () const {
|
||||
|
||||
if (!done) StdFail_NotDone::Raise();
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntWalk_PWalking::TangentAtFirst() const{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return tgfirst;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_PWalking::TangentAtLast() const{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return tglast;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntWalk_PWalking::IsClosed() const{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
return close;
|
||||
}
|
||||
|
||||
inline const gp_Dir& IntWalk_PWalking::TangentAtLine
|
||||
(Standard_Integer& Index) const
|
||||
{
|
||||
if(!done) StdFail_NotDone::Raise();
|
||||
Index = indextg;
|
||||
return tgdir;
|
||||
}
|
||||
|
||||
#define REGLAGE 0
|
||||
|
||||
inline void IntWalk_PWalking::AddAPoint(Handle(IntSurf_LineOn2S)& theLine,
|
||||
const IntSurf_PntOn2S& POn2S) {
|
||||
#if REGLAGE
|
||||
Standard_Integer n=theLine->NbPoints();
|
||||
if(n) {
|
||||
gp_Vec V(POn2S.Value(),theLine->Value(n).Value());
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
POn2S.Parameters(u1,v1,u2,v2);
|
||||
theLine->Value(n).Parameters(U1,V1,U2,V2);
|
||||
printf("\n%3d: (%10.5g)(%+12.5g %+12.5g %+12.5g) (%+12.5g %+12.5g) (%+12.5g %+12.5g)",n,
|
||||
V.Magnitude(),V.X(),V.Y(),V.Z(),U1-u1,V1-v1,U2-u2,V2-v2);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
theLine->Add(POn2S);
|
||||
}
|
||||
|
||||
|
1430
src/IntWalk/IntWalk_PWalking_1.gxx
Executable file
1430
src/IntWalk/IntWalk_PWalking_1.gxx
Executable file
File diff suppressed because it is too large
Load Diff
124
src/IntWalk/IntWalk_PWalking_2.gxx
Executable file
124
src/IntWalk/IntWalk_PWalking_2.gxx
Executable file
@@ -0,0 +1,124 @@
|
||||
//-------------------------------------------------------------------
|
||||
//-- I n t W a l k _ P W a l k i n g _ 2 . g x x
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void IntWalk_PWalking::
|
||||
RepartirOuDiviser(Standard_Boolean& DejaReparti,
|
||||
IntImp_ConstIsoparametric& ChoixIso,
|
||||
Standard_Boolean& Arrive)
|
||||
|
||||
// au voisinage d '1 point ,il y a echec du cheminement
|
||||
// il faut diviser le pas pour essayer de continuer
|
||||
//si le pas est trop petit ou si on est arrive sur une frontiere
|
||||
// repartir dans l autre sens si cela n a pas ete deja fait sinon arret
|
||||
|
||||
{
|
||||
// Standard_Integer i;
|
||||
if (Arrive) { //repartir dans l autre sens
|
||||
if (!DejaReparti ) {
|
||||
Arrive = Standard_False;
|
||||
DejaReparti = Standard_True;
|
||||
previousPoint = line->Value(1);
|
||||
previoustg = Standard_False;
|
||||
previousd1 = firstd1;
|
||||
previousd2 = firstd2;
|
||||
previousd = tgdir;
|
||||
indextg = line->NbPoints();
|
||||
tgdir.Reverse();
|
||||
line->Reverse();
|
||||
|
||||
//-- printf("\nIntWalk_PWalking_2.gxx Reverse %3d\n",indextg);
|
||||
sensCheminement = -1;
|
||||
tgfirst = tglast;
|
||||
tglast = Standard_False;
|
||||
ChoixIso = choixIsoSav;
|
||||
#if 0
|
||||
pasuv[0]=pasSav[0];
|
||||
pasuv[1]=pasSav[1];
|
||||
pasuv[2]=pasSav[2];
|
||||
pasuv[3]=pasSav[3];
|
||||
#else
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
Standard_Integer nn=line->NbPoints();
|
||||
if(nn>2) {
|
||||
line->Value(nn).Parameters(u1,v1,u2,v2);
|
||||
line->Value(nn-1).Parameters(U1,V1,U2,V2);
|
||||
pasuv[0]=Abs(u1-U1);
|
||||
pasuv[1]=Abs(v1-V1);
|
||||
pasuv[2]=Abs(u2-U2);
|
||||
pasuv[3]=Abs(v2-V2);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( pasuv[0]*0.5 < ResoU1
|
||||
&& pasuv[1]*0.5 < ResoV1
|
||||
&& pasuv[2]*0.5 < ResoU2
|
||||
&& pasuv[3]*0.5 < ResoV2
|
||||
) {
|
||||
if (!previoustg) {
|
||||
tglast = Standard_True; // EST-CE SUFFISANT ????
|
||||
}
|
||||
|
||||
if (!DejaReparti) { //repartir dans l autre sens
|
||||
DejaReparti = Standard_True;
|
||||
previousPoint = line->Value(1);
|
||||
previoustg = Standard_False;
|
||||
previousd1 = firstd1;
|
||||
previousd2 = firstd2;
|
||||
previousd = tgdir;
|
||||
indextg = line->NbPoints();
|
||||
tgdir.Reverse();
|
||||
line->Reverse();
|
||||
|
||||
//-- printf("\nIntWalk_PWalking_2.gxx Reverse %3d\n",indextg);
|
||||
|
||||
sensCheminement = -1;
|
||||
tgfirst = tglast;
|
||||
tglast = Standard_False;
|
||||
ChoixIso = choixIsoSav;
|
||||
|
||||
#if 0
|
||||
pasuv[0]=pasSav[0];
|
||||
pasuv[1]=pasSav[1];
|
||||
pasuv[2]=pasSav[2];
|
||||
pasuv[3]=pasSav[3];
|
||||
#else
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
Standard_Integer nn=line->NbPoints();
|
||||
if(nn>2) {
|
||||
line->Value(nn).Parameters(u1,v1,u2,v2);
|
||||
line->Value(nn-1).Parameters(U1,V1,U2,V2);
|
||||
pasuv[0]=Abs(u1-U1);
|
||||
pasuv[1]=Abs(v1-V1);
|
||||
pasuv[2]=Abs(u2-U2);
|
||||
pasuv[3]=Abs(v2-V2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else Arrive = Standard_True;
|
||||
}
|
||||
else {
|
||||
pasuv[0]*=0.5;
|
||||
pasuv[1]*=0.5;
|
||||
pasuv[2]*=0.5;
|
||||
pasuv[3]*=0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
282
src/IntWalk/IntWalk_PWalking_3.gxx
Executable file
282
src/IntWalk/IntWalk_PWalking_3.gxx
Executable file
@@ -0,0 +1,282 @@
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//#define DEBUG 0
|
||||
|
||||
IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection()
|
||||
|
||||
// tester si fleche respectee en calculant un majorant de fleche
|
||||
// soit le point precedent et sa tangente ,le point nouveau calcule et sa
|
||||
// tangente ;on peut trouver une cubique passant par ces 2 points et ayant
|
||||
// pour derivee les tangentes de l intersection
|
||||
// calculer le point au parametre 0.5 sur la cubique=p1
|
||||
// calculer le point milieu des 2 points d intersection=p2
|
||||
// si fleche/2<=||p1p2||<= fleche on considere que l on respecte la fleche
|
||||
// sinon ajuster le pas en fonction du rapport ||p1p2||/fleche et du pas
|
||||
// precedent
|
||||
// tester si dans les 2 plans tangents des surfaces on a pas un angle2d trop
|
||||
// grand : si oui diviser le pas
|
||||
// tester s il n y a pas changement de rive
|
||||
//
|
||||
{
|
||||
static Standard_Integer STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0;
|
||||
static Standard_Integer STATIC_PRECEDENT_INFLEXION = 0;
|
||||
|
||||
if(line->NbPoints() ==1 ) {
|
||||
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=STATIC_PRECEDENT_INFLEXION=0;
|
||||
}
|
||||
|
||||
IntWalk_StatusDeflection Status = IntWalk_OK;
|
||||
Standard_Real FlecheCourante ,Ratio;
|
||||
|
||||
|
||||
const IntSurf_PntOn2S& CurrentPoint = myIntersectionOn2S.Point();
|
||||
//==================================================================================
|
||||
//========= A r r e t s u r p o i n t ============
|
||||
//==================================================================================
|
||||
if (myIntersectionOn2S.IsTangent()) {
|
||||
return IntWalk_ArretSurPoint;
|
||||
}
|
||||
|
||||
const gp_Dir& TgCourante = myIntersectionOn2S.Direction();
|
||||
|
||||
//==================================================================================
|
||||
//========= R i s q u e d e p o i n t d i n f l e x i o n ============
|
||||
//==================================================================================
|
||||
if (TgCourante.Dot(previousd)<0) {
|
||||
//------------------------------------------------------------
|
||||
//-- Risque de point d inflexion : On divise le pas par 2
|
||||
//-- On initialise STATIC_PRECEDENT_INFLEXION pour qu a
|
||||
//-- l appel suivant, on retourne Pas_OK si il n y a
|
||||
//-- plus de risque de point d inflexion
|
||||
//------------------------------------------------------------
|
||||
|
||||
pasuv[0]*=0.5;
|
||||
pasuv[1]*=0.5;
|
||||
pasuv[2]*=0.5;
|
||||
pasuv[3]*=0.5;
|
||||
STATIC_PRECEDENT_INFLEXION+=3;
|
||||
if (pasuv[0] < ResoU1 && pasuv[1] <ResoV1 && pasuv[2] <ResoU2 && pasuv[3] < ResoV2)
|
||||
return IntWalk_ArretSurPointPrecedent;
|
||||
else
|
||||
return IntWalk_PasTropGrand;
|
||||
}
|
||||
|
||||
else {
|
||||
if(STATIC_PRECEDENT_INFLEXION > 0) {
|
||||
STATIC_PRECEDENT_INFLEXION -- ;
|
||||
return IntWalk_OK;
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================
|
||||
//========= D e t e c t i o n d e P o in t s c o n f o n d u s ===========
|
||||
//==================================================================================
|
||||
|
||||
Standard_Real Dist = previousPoint.Value().
|
||||
SquareDistance(CurrentPoint.Value());
|
||||
|
||||
|
||||
if (Dist < tolconf*tolconf ) {
|
||||
pasuv[0] = Max(5.*ResoU1,Min(1.5*pasuv[0],pasInit[0]));
|
||||
pasuv[1] = Max(5.*ResoV1,Min(1.5*pasuv[1],pasInit[1]));
|
||||
pasuv[2] = Max(5.*ResoU2,Min(1.5*pasuv[2],pasInit[2]));
|
||||
pasuv[3] = Max(5.*ResoV2,Min(1.5*pasuv[3],pasInit[3]));
|
||||
Status = IntWalk_PointConfondu;
|
||||
}
|
||||
|
||||
//==================================================================================
|
||||
Standard_Real Up1,Vp1,Uc1,Vc1,Du1,Dv1,AbsDu1,AbsDu2,AbsDv1,AbsDv2;
|
||||
Standard_Real Up2,Vp2,Uc2,Vc2,Du2,Dv2;
|
||||
|
||||
previousPoint.Parameters(Up1,Vp1,Up2,Vp2);
|
||||
CurrentPoint.Parameters(Uc1,Vc1,Uc2,Vc2);
|
||||
|
||||
Du1 = Uc1 - Up1; Dv1 = Vc1 - Vp1;
|
||||
Du2 = Uc2 - Up2; Dv2 = Vc2 - Vp2;
|
||||
|
||||
AbsDu1 = Abs(Du1);
|
||||
AbsDu2 = Abs(Du2);
|
||||
AbsDv1 = Abs(Dv1);
|
||||
AbsDv2 = Abs(Dv2);
|
||||
//=================================================================================
|
||||
//==== P a s d e p r o g r e s s i o n (entre previous et Current) =======
|
||||
//=================================================================================
|
||||
if ( AbsDu1 < ResoU1 && AbsDv1 < ResoV1
|
||||
&& AbsDu2 < ResoU2 && AbsDv2 < ResoV2) {
|
||||
pasuv[0] = ResoU1; pasuv[1] = ResoV1; pasuv[2] = ResoU2; pasuv[3] = ResoV2;
|
||||
return(IntWalk_ArretSurPointPrecedent);
|
||||
}
|
||||
//==================================================================================
|
||||
//OCC431(apo): modified ->
|
||||
static Standard_Real CosRef2D = Cos(PI/9.0), AngRef2D = PI/2.0;
|
||||
|
||||
static Standard_Real /*tolArea = 100.0,*/ d = 7.0;
|
||||
Standard_Real tolArea = 100.0;
|
||||
if (ResoU1 < Precision::PConfusion() ||
|
||||
ResoV1 < Precision::PConfusion() ||
|
||||
ResoU2 < Precision::PConfusion() ||
|
||||
ResoV2 < Precision::PConfusion() )
|
||||
tolArea = tolArea*2.0;
|
||||
|
||||
Standard_Real Cosi1, CosRef1, Ang1, AngRef1, ResoUV1, Duv1, d1, tolCoeff1;
|
||||
Standard_Real Cosi2, CosRef2, Ang2, AngRef2, ResoUV2, Duv2, d2, tolCoeff2;
|
||||
Cosi1 = Du1*previousd1.X() + Dv1*previousd1.Y();
|
||||
Cosi2 = Du2*previousd2.X() + Dv2*previousd2.Y();
|
||||
Duv1 = Du1*Du1 + Dv1*Dv1;
|
||||
Duv2 = Du2*Du2 + Dv2*Dv2;
|
||||
ResoUV1 = ResoU1*ResoU1 + ResoV1*ResoV1;
|
||||
ResoUV2 = ResoU2*ResoU2 + ResoV2*ResoV2;
|
||||
//
|
||||
//modified by NIZNHY-PKV Wed Nov 13 12:25:44 2002 f
|
||||
//
|
||||
Standard_Real aMinDiv2=Precision::Confusion();
|
||||
aMinDiv2=aMinDiv2*aMinDiv2;
|
||||
//
|
||||
d1=d;
|
||||
if (Duv1>aMinDiv2) {
|
||||
d1 = Abs(ResoUV1/Duv1);
|
||||
d1 = Min(Sqrt(d1)*tolArea, d);
|
||||
}
|
||||
//d1 = Abs(ResoUV1/Duv1);
|
||||
//d1 = Min(Sqrt(d1)*tolArea,d);
|
||||
//modified by NIZNHY-PKV Wed Nov 13 12:34:30 2002 t
|
||||
tolCoeff1 = Exp(d1);
|
||||
//
|
||||
//modified by NIZNHY-PKV Wed Nov 13 12:34:43 2002 f
|
||||
d2=d;
|
||||
if (Duv2>aMinDiv2) {
|
||||
d2 = Abs(ResoUV2/Duv2);
|
||||
d2 = Min(Sqrt(d2)*tolArea,d);
|
||||
}
|
||||
//d2 = Abs(ResoUV2/Duv2);
|
||||
//d2 = Min(Sqrt(d2)*tolArea,d);
|
||||
//modified by NIZNHY-PKV Wed Nov 13 12:34:53 2002 t
|
||||
tolCoeff2 = Exp(d2);
|
||||
CosRef1 = CosRef2D/tolCoeff1;
|
||||
CosRef2 = CosRef2D/tolCoeff2;
|
||||
//
|
||||
//==================================================================================
|
||||
//== Les points ne sont pas confondus : ==
|
||||
//== D e t e c t i o n d e A r r e t s u r P o i n t p r e c e d e n t ==
|
||||
//== P a s T r o p G r a n d (angle dans Esp UV) ==
|
||||
//== C h a n g e m e n t d e r i v e ==
|
||||
//==================================================================================
|
||||
if (Status != IntWalk_PointConfondu) {
|
||||
if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2) {
|
||||
pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
|
||||
if (pasuv[0]<ResoU1 && pasuv[1]<ResoV1 && pasuv[2]<ResoU2 && pasuv[3]<ResoV2) {
|
||||
return(IntWalk_ArretSurPointPrecedent);
|
||||
}
|
||||
else {
|
||||
pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
|
||||
return(IntWalk_PasTropGrand);
|
||||
}
|
||||
}
|
||||
const gp_Dir2d& Tg2dcourante1 = myIntersectionOn2S.DirectionOnS1();
|
||||
const gp_Dir2d& Tg2dcourante2 = myIntersectionOn2S.DirectionOnS2();
|
||||
Cosi1 = Du1*Tg2dcourante1.X() + Dv1*Tg2dcourante1.Y();
|
||||
Cosi2 = Du2*Tg2dcourante2.X() + Dv2*Tg2dcourante2.Y();
|
||||
Ang1 = Abs(previousd1.Angle(Tg2dcourante1));
|
||||
Ang2 = Abs(previousd2.Angle(Tg2dcourante2));
|
||||
AngRef1 = AngRef2D*tolCoeff1;
|
||||
AngRef2 = AngRef2D*tolCoeff2;
|
||||
//-------------------------------------------------------
|
||||
//-- Test : Angle trop grand dans l espace UV -----
|
||||
//-- Changement de rive -----
|
||||
//-------------------------------------------------------
|
||||
if(Cosi1*Cosi1 < CosRef1*Duv1 || Cosi2*Cosi2 < CosRef2*Duv2 || Ang1 > AngRef1 || Ang2 > AngRef2) {
|
||||
pasuv[0]*=0.5; pasuv[1]*=0.5; pasuv[2]*=0.5; pasuv[3]*=0.5;
|
||||
if (pasuv[0]<ResoU1 && pasuv[1]<ResoV1 && pasuv[2]<ResoU2 && pasuv[3]<ResoV2)
|
||||
return(IntWalk_ArretSurPoint);
|
||||
else
|
||||
return(IntWalk_PasTropGrand);
|
||||
}
|
||||
}
|
||||
//<-OCC431(apo)
|
||||
//==================================================================================
|
||||
//== D e t e c t i o n d e : Pas Trop Petit
|
||||
//== Pas Trop Grand
|
||||
//==================================================================================
|
||||
|
||||
//---------------------------------------
|
||||
//-- Estimation de la fleche --
|
||||
//---------------------------------------
|
||||
FlecheCourante =
|
||||
Sqrt(Abs((previousd.XYZ()-TgCourante.XYZ()).SquareModulus()*Dist))/8.;
|
||||
|
||||
if ( FlecheCourante<= fleche*0.5) { //-- Pas Courant trop petit
|
||||
if(FlecheCourante>1e-16) {
|
||||
Ratio = 0.5*(fleche/FlecheCourante);
|
||||
}
|
||||
else {
|
||||
Ratio = 10.0;
|
||||
}
|
||||
Standard_Real pasSu1 = pasuv[0];
|
||||
Standard_Real pasSv1 = pasuv[1];
|
||||
Standard_Real pasSu2 = pasuv[2];
|
||||
Standard_Real pasSv2 = pasuv[3];
|
||||
|
||||
//-- Dans les cas ou lorsqu on demande
|
||||
//-- un point a U+DeltaU , ....
|
||||
//-- on recupere un point a U + Epsilon
|
||||
//-- Epsilon << DeltaU.
|
||||
|
||||
if(pasuv[0]< AbsDu1) pasuv[0] = AbsDu1;
|
||||
if(pasuv[1]< AbsDv1) pasuv[1] = AbsDv1;
|
||||
if(pasuv[2]< AbsDu2) pasuv[2] = AbsDu2;
|
||||
if(pasuv[3]< AbsDv2) pasuv[3] = AbsDv2;
|
||||
|
||||
if(pasuv[0]<ResoU1) pasuv[0]=ResoU1;
|
||||
if(pasuv[1]<ResoV1) pasuv[1]=ResoV1;
|
||||
if(pasuv[2]<ResoU2) pasuv[2]=ResoU2;
|
||||
if(pasuv[3]<ResoV2) pasuv[3]=ResoV2;
|
||||
//-- if(Ratio>10.0 ) { Ratio=10.0; }
|
||||
Standard_Real R1,R = pasInit[0]/pasuv[0];
|
||||
R1= pasInit[1]/pasuv[1]; if(R1<R) R=R1;
|
||||
R1= pasInit[2]/pasuv[2]; if(R1<R) R=R1;
|
||||
R1= pasInit[3]/pasuv[3]; if(R1<R) R=R1;
|
||||
if(Ratio > R) Ratio=R;
|
||||
pasuv[0] = Min(Ratio*pasuv[0],pasInit[0]);
|
||||
pasuv[1] = Min(Ratio*pasuv[1],pasInit[1]);
|
||||
pasuv[2] = Min(Ratio*pasuv[2],pasInit[2]);
|
||||
pasuv[3] = Min(Ratio*pasuv[3],pasInit[3]);
|
||||
if (pasuv[0] != pasSu1 || pasuv[2] != pasSu2||
|
||||
pasuv[1] != pasSv1 || pasuv[3] != pasSv2) {
|
||||
if(++STATIC_BLOCAGE_SUR_PAS_TROP_GRAND > 5) {
|
||||
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0;
|
||||
return IntWalk_PasTropGrand;
|
||||
}
|
||||
}
|
||||
if(Status == IntWalk_OK) {
|
||||
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
|
||||
//-- On tente d augmenter le pas
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
else { //-- FlecheCourante > fleche*0.5
|
||||
if (FlecheCourante > fleche) { //-- Pas Courant Trop Grand
|
||||
Ratio = fleche/FlecheCourante;
|
||||
pasuv[0] = Ratio*pasuv[0];
|
||||
pasuv[1] = Ratio*pasuv[1];
|
||||
pasuv[2] = Ratio*pasuv[2];
|
||||
pasuv[3] = Ratio*pasuv[3];
|
||||
//if(++STATIC_BLOCAGE_SUR_PAS_TROP_GRAND > 5) {
|
||||
// STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0;
|
||||
return IntWalk_PasTropGrand;
|
||||
//}
|
||||
}
|
||||
else { //-- fleche/2 < FlecheCourante <= fleche
|
||||
Ratio = 0.75 * (fleche / FlecheCourante);
|
||||
}
|
||||
}
|
||||
pasuv[0] = Max(5.*ResoU1,Min(Min(Ratio*AbsDu1,pasuv[0]),pasInit[0]));
|
||||
pasuv[1] = Max(5.*ResoV1,Min(Min(Ratio*AbsDv1,pasuv[1]),pasInit[1]));
|
||||
pasuv[2] = Max(5.*ResoU2,Min(Min(Ratio*AbsDu2,pasuv[2]),pasInit[2]));
|
||||
pasuv[3] = Max(5.*ResoV2,Min(Min(Ratio*AbsDv2,pasuv[3]),pasInit[3]));
|
||||
if(Status == IntWalk_OK) STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=0;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
169
src/IntWalk/IntWalk_PWalking_4.gxx
Executable file
169
src/IntWalk/IntWalk_PWalking_4.gxx
Executable file
@@ -0,0 +1,169 @@
|
||||
//-- File : IntWalk_PWalking_4.gxx
|
||||
//--
|
||||
//-- Modif du 5 Octobre 94 (LBR)
|
||||
//-- if(Trouve) ...
|
||||
//-- On deborde sur une frontiere, Duv[.] = -1 -1 -1 -1
|
||||
//-- donc on garde la meme iso bloquee (voir if(k!=1) )
|
||||
//--
|
||||
|
||||
//-- Modif du 8 juillet 96 (LBR)
|
||||
//-- simplifaication du traitement des auto-intersections.
|
||||
//-- Idee :
|
||||
//-- Tester la boucle fermee en 3d et en 2d.
|
||||
//--
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
|
||||
Standard_Boolean IntWalk_PWalking::
|
||||
TestArret(const Standard_Boolean DejaReparti,
|
||||
TColStd_Array1OfReal& Param,
|
||||
IntImp_ConstIsoparametric& ChoixIso)
|
||||
|
||||
//
|
||||
// tester si le point d intersection donne par ces parametres reste dans le
|
||||
// domaine naturelle de chaque carreau.
|
||||
// si le point deborde cadrer de facon a trouver la meilleure iso (frontiere)
|
||||
// qui intersecte le plus franchement l autre carreau
|
||||
// sinon tester si presence de ligne fermee
|
||||
//
|
||||
{
|
||||
Standard_Real Uvd[4],Uvf[4],Epsuv[4],Duv[4],Uvp[4],dv,dv2,ParC[4];
|
||||
Standard_Real DPc,DPb;
|
||||
#ifndef DEB
|
||||
Standard_Integer i = 0, k = 0;
|
||||
#else
|
||||
Standard_Integer i,k;
|
||||
#endif
|
||||
Epsuv[0] = ResoU1;
|
||||
Epsuv[1] = ResoV1;
|
||||
Epsuv[2] = ResoU2;
|
||||
Epsuv[3] = ResoV2;
|
||||
previousPoint.Parameters(Uvp[0],Uvp[1],Uvp[2],Uvp[3]);
|
||||
Standard_Boolean Trouve = Standard_False;
|
||||
|
||||
Uvd[0]=Um1; Uvf[0]=UM1; Uvd[1]=Vm1; Uvf[1]=VM1;
|
||||
Uvd[2]=Um2; Uvf[2]=UM2; Uvd[3]=Vm2; Uvf[3]=VM2;
|
||||
|
||||
Standard_Integer im1;
|
||||
for ( i = 1,im1 = 0;i<=4;i++,im1++) {
|
||||
switch(i) {
|
||||
case 1: k=2; break;
|
||||
case 2: k=1; break;
|
||||
case 3: k=4; break;
|
||||
case 4: k=3; break;
|
||||
}
|
||||
if (Param(i) < (Uvd[im1]-Epsuv[im1])) { //-- Current ----- Bound Inf ----- Previous
|
||||
Trouve = Standard_True; //--
|
||||
DPc = Uvp[im1]-Param(i); //-- Previous - Current
|
||||
DPb = Uvp[im1]-Uvd[im1]; //-- Previous - Bound Inf
|
||||
ParC[im1] = Uvd[im1]; //-- ParamCorrige
|
||||
dv = Param(k)-Uvp[k-1]; //-- Current - Previous (Sur Autre Direction)
|
||||
dv2 = dv*dv;
|
||||
if(dv2>RealEpsilon()) { //-- Progression sur l autre Direction ?
|
||||
Duv[im1] = DPc*DPb + dv2;
|
||||
Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2);
|
||||
}
|
||||
else {
|
||||
Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas
|
||||
} //-- le choix de l iso
|
||||
}
|
||||
else if (Param(i) > (Uvf[im1] + Epsuv[im1])) { //-- Previous ----- Bound Sup ----- Current
|
||||
Trouve = Standard_True; //--
|
||||
DPc = Param(i)-Uvp[im1]; //-- Current - Previous
|
||||
DPb = Uvf[im1]-Uvp[im1]; //-- Bound Sup - Previous
|
||||
ParC[im1] = Uvf[im1]; //-- Param Corrige
|
||||
dv = Param(k)-Uvp[k-1]; //-- Current - Previous (Sur autre Direction)
|
||||
dv2 = dv*dv;
|
||||
if(dv2>RealEpsilon()) { //-- Progression sur l autre Direction ?
|
||||
Duv[im1] = DPc*DPb + dv2;
|
||||
Duv[im1] = Duv[im1]*Duv[im1]/(DPc*DPc+dv2)/(DPb*DPb+dv2);
|
||||
}
|
||||
else {
|
||||
Duv[im1]=-1.0; //-- Si Pas de prgogression, on ne change pas
|
||||
} //-- le choix de l iso
|
||||
}
|
||||
else {
|
||||
Duv[im1]= -1.;
|
||||
ParC[im1]=Param(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (Trouve) {
|
||||
//--------------------------------------------------
|
||||
//-- Un des Parametres u1,v1,u2,v2 est en dehors --
|
||||
//-- des bornes naturelles. --
|
||||
//-- On cherche la meilleure direction de --
|
||||
//-- progression et on recadre les params. --
|
||||
//--------------------------------------------------
|
||||
Standard_Real ddv = -1.0;
|
||||
k=-1;
|
||||
for (i=0;i<=3;i++) {
|
||||
Param(i+1) = ParC[i];
|
||||
if(Duv[i]>ddv) {
|
||||
ddv = Duv[i];
|
||||
k=i;
|
||||
}
|
||||
}
|
||||
if(k!=-1) {
|
||||
ChoixIso = ChoixRef[k];
|
||||
}
|
||||
else {
|
||||
if((ParC[0]<=Uvd[0]+Epsuv[0]) || (ParC[0]>=Uvf[0]-Epsuv[0])) {
|
||||
ChoixIso = IntImp_UIsoparametricOnCaro1;
|
||||
}
|
||||
else if((ParC[1]<=Uvd[1]+Epsuv[1]) || (ParC[1]>=Uvf[1]-Epsuv[1])) {
|
||||
ChoixIso = IntImp_VIsoparametricOnCaro1;
|
||||
}
|
||||
else if((ParC[2]<=Uvd[2]+Epsuv[2]) || (ParC[2]>=Uvf[2]-Epsuv[2])) {
|
||||
ChoixIso = IntImp_UIsoparametricOnCaro2;
|
||||
}
|
||||
else if((ParC[3]<=Uvd[3]+Epsuv[3]) || (ParC[3]>=Uvf[3]-Epsuv[3])) {
|
||||
ChoixIso = IntImp_VIsoparametricOnCaro2;
|
||||
}
|
||||
}
|
||||
close = Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DejaReparti) { // recherche si ligne fermee
|
||||
|
||||
Standard_Real u,v,up,vp;
|
||||
const IntSurf_PntOn2S& POn2S1=line->Value(1);
|
||||
POn2S1.ParametersOnS1(u,v);
|
||||
gp_Pnt2d P1uv(u,v);
|
||||
previousPoint.ParametersOnS1(u,v);
|
||||
up=u; vp=v;
|
||||
gp_Pnt2d Prevuv(u,v);
|
||||
myIntersectionOn2S.Point().ParametersOnS1(u,v);
|
||||
gp_Pnt2d myIntersuv(u,v);
|
||||
Standard_Boolean close2d = (P1uv.XY()-Prevuv.XY())*
|
||||
(P1uv.XY()-myIntersuv.XY()) <0.0;
|
||||
|
||||
const gp_Pnt &P1 = line->Value(1).Value();
|
||||
close = (P1.XYZ() - previousPoint.Value().XYZ())*
|
||||
(P1.XYZ() - myIntersectionOn2S.Point().Value().XYZ()) < 0;
|
||||
if(close != close2d) {
|
||||
#ifdef DEB
|
||||
cout<<"\n PWalking_4 TestArret - close2d"<<close2d<<endl;
|
||||
#endif
|
||||
}
|
||||
Standard_Boolean autoclose = Standard_False;
|
||||
previousPoint.ParametersOnS2(u,v);
|
||||
if( myIntersectionOn2S.Function().AuxillarSurface1()
|
||||
== myIntersectionOn2S.Function().AuxillarSurface2()) {
|
||||
if(Abs(u-up)<=1e-7 && Abs(v-vp)<=1e-7) {
|
||||
autoclose=Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (autoclose || (close&&close2d));
|
||||
}
|
||||
else return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
|
106
src/IntWalk/IntWalk_PathPointTool.cdl
Executable file
106
src/IntWalk/IntWalk_PathPointTool.cdl
Executable file
@@ -0,0 +1,106 @@
|
||||
-- File: PathPointTool.cdl
|
||||
-- Created: Mon Mar 9 16:55:09 1992
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred generic class PathPointTool from IntWalk
|
||||
(PathPoint as any)
|
||||
|
||||
---Purpose: Template class to describe the necessary ressources
|
||||
-- for a point used as a starting point for a marching
|
||||
-- algorithm.
|
||||
-- The 'marching algorithm' determines the intersection
|
||||
-- between an implicit surface and a parametrized surface.
|
||||
-- these points are necessary on an arc of the surface
|
||||
|
||||
uses Pnt from gp,
|
||||
Vec from gp,
|
||||
Dir2d from gp
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
UndefinedDerivative from StdFail
|
||||
|
||||
is
|
||||
|
||||
Value3d(myclass; PStart: PathPoint)
|
||||
|
||||
---Purpose: Returns the 3d coordinates of the starting point.
|
||||
|
||||
returns Pnt from gp;
|
||||
|
||||
|
||||
Value2d(myclass; PStart: PathPoint; U, V: out Real from Standard);
|
||||
|
||||
---Purpose: Returns the <U, V> parameters which are associated
|
||||
-- with <P>
|
||||
-- it's the parameters which start the marching algorithm
|
||||
|
||||
|
||||
IsPassingPnt(myclass; PStart: PathPoint)
|
||||
|
||||
---Purpose: Returns True if the point is a point on a non-oriented
|
||||
-- arc, which means that the intersection line does not
|
||||
-- stop at such a point but just go through such a point.
|
||||
-- IsPassingPnt is True when IsOnArc is True
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
IsTangent(myclass; PStart: PathPoint )
|
||||
|
||||
---Purpose: Returns True if the surfaces are tangent at this point.
|
||||
-- IsTangent can be True when IsOnArc is True
|
||||
-- if IsPassingPnt is True and IsTangent is True,this point
|
||||
-- is a stopped point.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Direction3d(myclass; PStart: PathPoint)
|
||||
|
||||
---Purpose: returns the tangent at the intersection in 3d space
|
||||
-- associated to <P>
|
||||
-- an exception is raised if IsTangent is true.
|
||||
|
||||
returns Vec from gp
|
||||
|
||||
raises UndefinedDerivative from StdFail;
|
||||
|
||||
|
||||
Direction2d(myclass; PStart: PathPoint)
|
||||
|
||||
---Purpose: returns the tangent at the intersection in the
|
||||
-- parametric space of the parametrized surface.This tangent
|
||||
-- is associated to the value2d
|
||||
-- la tangente a un sens signifiant (indique le sens de chemin
|
||||
-- ement)
|
||||
-- an exception is raised if IsTangent is true.
|
||||
|
||||
returns Dir2d from gp
|
||||
|
||||
raises UndefinedDerivative from StdFail;
|
||||
|
||||
|
||||
Multiplicity(myclass; PStart: PathPoint)
|
||||
|
||||
---Purpose: Returns the multiplicity of the point i-e
|
||||
-- the number of auxillar parameters associated to the
|
||||
-- point which the principal parameters are given by Value2d
|
||||
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
Parameters(myclass; PStart: PathPoint;
|
||||
Mult: Integer from Standard;
|
||||
U, V: out Real from Standard)
|
||||
|
||||
---Purpose: Parametric coordinates associated to the multiplicity.
|
||||
-- An exception is raised if Mult<=0 or Mult>multiplicity.
|
||||
|
||||
raises OutOfRange from Standard;
|
||||
|
||||
|
||||
end PathPointTool;
|
||||
|
0
src/IntWalk/IntWalk_PathPointTool.gxx
Executable file
0
src/IntWalk/IntWalk_PathPointTool.gxx
Executable file
Reference in New Issue
Block a user