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

Integration of OCCT 6.5.0 from SVN

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

3
src/IntStart/FILES Executable file
View File

@@ -0,0 +1,3 @@
IntStart_SearchOnBoundaries_1.gxx
IntStart_SearchOnBoundaries_2.gxx

54
src/IntStart/IntStart.cdl Executable file
View File

@@ -0,0 +1,54 @@
-- File: IntStart.cdl
-- Created: Fri Sep 4 11:44:13 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun2>
---Copyright: Matra Datavision 1992
package IntStart
---Purpose: This package provides generic algorithms to
-- find specific points (points on boundaries
-- and points inside a surface) used as starting
-- points for marching algorithms.
---Level: Internal
--
-- All the methods of the classes of this package are Internal.
--
uses Standard, MMgt, TCollection, StdFail, TopAbs, GeomAbs, gp, IntSurf, math
is
deferred generic class ArcTool;
deferred generic class SOBTool;
deferred generic class TopolTool;
deferred generic class SOBFunction;
generic class Segment;
generic class PathPoint;
generic class SearchOnBoundaries, ThePathPoint, SequenceOfPathPoint,
TheSegment, SequenceOfSegment;
deferred generic class PSurfaceTool;
deferred generic class SITool;
deferred class SITopolTool;
deferred generic class SIFunction;
generic class SearchInside;
end IntStart;

View File

@@ -0,0 +1,32 @@
-- File: IntStart_ArcTool.cdl
-- Created: Tue May 4 18:01:10 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred generic class ArcTool from IntStart
(TheArc as any )
---Purpose: Template class for a tool on the restriction of
-- a surface.
-- It is possible to implement this class with an instantiation
-- of the class CurveTool from Adaptor3d..
is
Resolution(myclass; A: TheArc; Tol3d: Real from Standard)
---Purpose : Returns the parametric resolution corresponding
-- to the space resolution Tol3d.
returns Real from Standard;
end ArcTool;

View File

View File

@@ -0,0 +1,69 @@
-- File: PSurfaceTool.cdl
-- Created: Mon May 18 09:24:52 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun1>
---Copyright: Matra Datavision 1992
deferred generic class PSurfaceTool from IntStart
(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;

View File

View File

@@ -0,0 +1,118 @@
-- File: PathPoint.cdl
-- Created: Thu Oct 22 12:21:02 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun2>
---Copyright: Matra Datavision 1992
generic class PathPoint from IntStart
(TheVertex as any;
TheArc as any)
---Purpose: This class describes a point on an arc which
-- solution intersection between 2 surfaces.
uses Pnt from gp,
Vec from gp,
Dir2d from gp
raises DomainError from Standard
is
Create
returns PathPoint from IntStart;
Create(P: Pnt from gp; Tol: Real from Standard;
V: TheVertex; A: TheArc; Parameter: Real from Standard)
returns PathPoint from IntStart;
Create(P: Pnt from gp; Tol: Real from Standard;
A: TheArc; Parameter: Real from Standard)
returns PathPoint from IntStart;
SetValue(me: in out; P: Pnt from gp; Tol: Real from Standard;
V: TheVertex; A: TheArc;
Parameter: Real from Standard)
---C++: inline
is static;
SetValue(me: in out; P: Pnt from gp; Tol: Real from Standard;
A: TheArc; Parameter: Real from Standard)
---C++: inline
is static;
Value(me)
returns Pnt from gp
---C++: return const&
---C++: inline
is static;
Tolerance(me)
returns Real from Standard
---C++: inline
is static;
IsNew(me)
returns Boolean from Standard
---C++: inline
is static;
Vertex(me)
returns any TheVertex
---C++: return const&
---C++: inline
raises DomainError from Standard
is static;
Arc(me)
returns any TheArc
---C++: return const&
---C++: inline
is static;
Parameter(me)
returns Real from Standard
---C++: inline
raises DomainError from Standard
is static;
fields
point : Pnt from gp;
tol : Real from Standard;
isnew : Boolean from Standard;
vtx : TheVertex;
arc : TheArc;
param : Real from Standard;
end PathPoint;

View File

@@ -0,0 +1,20 @@
IntStart_PathPoint::IntStart_PathPoint () {
}
IntStart_PathPoint::IntStart_PathPoint (const gp_Pnt& P,
const Standard_Real Tol,
const TheVertex& V,
const TheArc& A,
const Standard_Real Parameter):
point(P),tol(Tol),isnew(Standard_False),vtx(V),arc(A),param(Parameter)
{}
IntStart_PathPoint::IntStart_PathPoint (const gp_Pnt& P,
const Standard_Real Tol,
const TheArc& A,
const Standard_Real Parameter):
point(P),tol(Tol),isnew(Standard_True),arc(A),param(Parameter)
{}

View File

@@ -0,0 +1,60 @@
#include <Standard_DomainError.hxx>
inline void IntStart_PathPoint::SetValue (const gp_Pnt& P,
const Standard_Real Tol,
const TheVertex& V,
const TheArc& A,
const Standard_Real Parameter) {
isnew = Standard_False;
point = P;
tol = Tol;
vtx = V;
arc = A;
param = Parameter;
}
inline void IntStart_PathPoint::SetValue (const gp_Pnt& P,
const Standard_Real Tol,
const TheArc& A,
const Standard_Real Parameter) {
isnew = Standard_True;
point = P;
tol = Tol;
arc = A;
param = Parameter;
}
inline const gp_Pnt& IntStart_PathPoint::Value () const {
return point;
}
inline Standard_Real IntStart_PathPoint::Tolerance () const {
return tol;
}
inline Standard_Boolean IntStart_PathPoint::IsNew () const {
return isnew;
}
inline const TheVertex& IntStart_PathPoint::Vertex () const {
if (isnew) {Standard_DomainError::Raise ();}
return vtx;
}
inline const TheArc& IntStart_PathPoint::Arc () const {
return arc;
}
inline Standard_Real IntStart_PathPoint::Parameter () const {
return param;
}

View File

@@ -0,0 +1,115 @@
-- File: IntStart_SIFunction.cdl
-- Created: Wed Jun 2 18:46:12 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred generic class SIFunction from IntStart
(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 SIFunction;

View File

View File

@@ -0,0 +1,35 @@
-- File: IntStart_SITool.cdl
-- Created: Tue May 4 16:20:18 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred generic class SITool from IntStart
(ThePSurface as any)
---Purpose: Template class for an additional tool on a bi-parametrised
-- surface.
uses State from TopAbs
is
NbSamplePoints(myclass; S: ThePSurface)
returns Integer from Standard;
SamplePoint(myclass; S: ThePSurface; Index: Integer from Standard;
U,V: out Real from Standard);
-- Classify(myclass; S: ThePSurface; U,V: Real from Standard)
--
-- returns State from TopAbs;
end SITool;

View File

View File

@@ -0,0 +1,30 @@
-- File: IntStart_SITopolTool.cdl
-- Created: Wed Mar 30 15:11:14 1994
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1994
deferred class SITopolTool from IntStart
---Purpose: template class for a topological tool.
-- This tool is linked with the surface on which
-- the classification has to be made.
inherits TShared from MMgt
uses State from TopAbs,
Pnt2d from gp
is
Classify(me: mutable; P: Pnt2d from gp; Tol: Real from Standard)
returns State from TopAbs
is deferred;
end SITopolTool;

View File

@@ -0,0 +1 @@
#include <IntStart_SITopolTool.ixx>

View File

@@ -0,0 +1,55 @@
-- File: IntStart_SOBFunction.cdl
-- Created: Wed Jun 2 13:10:29 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred generic class SOBFunction from IntStart
(TheArc as any)
inherits FunctionWithDerivative from math
---Purpose: Template class for the function on an arc of restriction
-- used in the SearchOnBoundaries class.
uses Pnt from gp
is
Set(me: in out; A: TheArc)
is static;
Value(me: in out; X: Real from Standard; F: out Real from Standard)
returns Boolean from Standard;
Derivative(me: in out; X: Real from Standard; D: out Real from Standard)
returns Boolean from Standard;
Values(me: in out; X: Real from Standard; F,D: out Real from Standard)
returns Boolean from Standard;
GetStateNumber(me: in out)
returns Integer from Standard
is redefined;
Valpoint(me; Index: Integer from Standard)
returns Pnt from gp
is static;
end SOBFunction;

View File

142
src/IntStart/IntStart_SOBTool.cdl Executable file
View File

@@ -0,0 +1,142 @@
-- File: IntStart_SOBTool.cdl
-- Created: Tue May 4 18:13:35 1993
-- Author: Jacques GOUSSARD
-- <jag@topsn2>
---Copyright: Matra Datavision 1993
deferred generic class SOBTool from IntStart
(TheVertex as any;
TheArc as any)
---Purpose:
uses Pnt from gp
is
-- Methods for an arc of restrictition
HasBeenSeen(myclass; A: TheArc)
---Purpose: Returns True if all the intersection point and edges
-- are known on the Arc.
returns Boolean from Standard;
-- The following methods are used when HasBeenSeen returns Standard_True
NbPoints(myclass; A: TheArc)
---Purpose: Returns the number of intersection points on the arc A.
returns Integer from Standard;
Value(myclass; A: TheArc; Index: Integer from Standard;
Pt: out Pnt from gp; Tol: out Real from Standard;
U: out Real from Standard);
---Purpose: Returns the value (Pt), the tolerance (Tol), and
-- the parameter (U) on the arc A , of the intersection
-- point of range Index.
IsVertex(myclass; A: TheArc; Index: Integer from Standard)
---Purpose: Returns True if the intersection point of range Index
-- corresponds with a vertex on the arc A.
returns Boolean from Standard;
Vertex(myclass; A: TheArc; Index: Integer from Standard;
Vtx: out TheVertex);
---Purpose: When IsVertex returns True, this method returns the
-- vertex on the arc A.
NbSegments(myclass; A: TheArc)
---Purpose: returns the number of part of A solution of the
-- of intersection problem.
returns Integer from Standard;
HasFirstPoint(myclass; A: TheArc; Index: Integer from Standard;
IndFirst: out Integer from Standard)
---Purpose: Returns True when the segment of range Index is not
-- open at the left side. In that case, IndFirst is the
-- range in the list intersection points (see NbPoints)
-- of the one which defines the left bound of the segment.
-- Otherwise, the method has to return False, and IndFirst
-- has no meaning.
returns Boolean from Standard;
HasLastPoint(myclass; A: TheArc; Index: Integer from Standard;
IndLast: out Integer from Standard)
---Purpose: Returns True when the segment of range Index is not
-- open at the right side. In that case, IndLast is the
-- range in the list intersection points (see NbPoints)
-- of the one which defines the right bound of the segment.
-- Otherwise, the method has to return False, and IndLast
-- has no meaning.
returns Boolean from Standard;
IsAllSolution(myclass; A: TheArc)
---Purpose: Returns True when the whole restriction is solution
-- of the intersection problem.
returns Boolean from Standard;
-- The following methods are used when HasBeenSeen returns Standard_False
NbSamplesOnArc(myclass; A: TheArc)
---Purpose: returns the number of points which is used to make
-- a sample on the arc. this number is a function of
-- the Surface and the CurveOnSurface complexity.
returns Integer from Standard;
Bounds(myclass; A: TheArc; Ufirst,Ulast: out Real from Standard);
---Purpose: Returns the parametric limits on the arc A.
-- These limits must be finite : they are either
-- the real limits of the arc, for a finite arc,
-- or a bounding box for an infinite arc.
Parameter(myclass; V: TheVertex; A: TheArc)
---Purpose: Returns the parameter of the vertex V on the arc A.
returns Real from Standard;
Tolerance(myclass; V: TheVertex; A: TheArc)
---Purpose: Returns the parametric tolerance on the arc used
-- to consider that the vertex and another point meet,
-- i-e if the difference between the parameter of the
-- Vertex and the parameter of the other point is less
-- than Tolerance, the point are "merged".
returns Real from Standard;
end SOBTool;

View File

View File

@@ -0,0 +1,96 @@
-- File: SearchInside.cdl
-- Created: Fri May 15 11:02:58 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun1>
---Copyright: Matra Datavision 1992
generic class SearchInside from IntStart (
ThePSurface as any;
ThePSurfaceTool as any; -- as PSurfaceTool from IntStart (ThePSurface)
TheTopolTool as Transient; -- as SITopolTool from IntStart
TheSITool as any; -- as SITool from IntStart (ThePSurface)
TheFunction as any) -- as SIFunction from IntStart(ThePSurface)
---Purpose:
uses InteriorPoint from IntSurf,
SequenceOfInteriorPoint from IntSurf
raises NotDone from StdFail,
OutOfRange from Standard
is
Create
returns SearchInside from IntStart;
Create (F: in out TheFunction; Surf: ThePSurface; T: TheTopolTool;
Epsilon : Real from Standard)
returns SearchInside from IntStart;
Perform(me: in out; F: in out TheFunction; Surf: ThePSurface;
T: TheTopolTool;
Epsilon: Real from Standard)
is static;
Perform(me: in out; F: in out TheFunction; Surf: ThePSurface;
UStart,VStart: Real from Standard)
is static;
IsDone(me)
returns Boolean
---C++: inline
is static;
NbPoints(me)
---Purpose: Returns the number of points.
-- The exception NotDone if raised if IsDone
-- returns False.
returns Integer
---C++: inline
raises NotDone from StdFail
is static;
Value(me; Index: Integer)
---Purpose: Returns the point of range Index.
-- The exception NotDone if raised if IsDone
-- returns False.
-- The exception OutOfRange if raised if
-- Index <= 0 or Index > NbPoints.
returns InteriorPoint from IntSurf
---C++: return const&
---C++: inline
raises NotDone from StdFail,
OutOfRange from Standard
is static;
fields
done : Boolean from Standard;
list : SequenceOfInteriorPoint from IntSurf;
end SearchInside;

View File

@@ -0,0 +1,253 @@
//-- File IntStart_SearchInside.gxx
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <math_FunctionSetRoot.hxx>
#include <Precision.hxx>
#include <gp_Pnt2d.hxx>
#include <TopAbs_State.hxx>
IntStart_SearchInside::IntStart_SearchInside (): done(Standard_False)
{}
IntStart_SearchInside::IntStart_SearchInside (TheFunction& Func,
const ThePSurface& PS,
const Handle(TheTopolTool)& T,
const Standard_Real Epsilon) {
Perform(Func,PS,T,Epsilon);
}
//=======================================================================
//function : Perform
//purpose : Search all inside points
//=======================================================================
void IntStart_SearchInside::Perform (TheFunction& Func,
const ThePSurface& PS,
const Handle(TheTopolTool)& T,
const Standard_Real Epsilon) {
done = Standard_False;
list.Clear();
static math_Vector Binf(1,2), Bsup(1,2), UVap(1,2),toler(1,2);
gp_Pnt psol;
Standard_Boolean testpnt;
Standard_Integer i,j,nbpt;
TopAbs_State situ;
Standard_Real umin,umax,vmin,vmax;
Binf(1) = umin = ThePSurfaceTool::FirstUParameter(PS);
Binf(2) = vmin = ThePSurfaceTool::FirstVParameter(PS);
Bsup(1) = umax = ThePSurfaceTool::LastUParameter(PS);
Bsup(2) = vmax = ThePSurfaceTool::LastVParameter(PS);
Standard_Integer NbsampleU= T->NbSamplesU();
Standard_Integer NbsampleV= T->NbSamplesV();
Standard_Integer Nbsample = T->NbSamples();
Standard_Real du = Bsup(1)-Binf(1);
Standard_Real dv = Bsup(2)-Binf(2);
du/=(Standard_Real)NbsampleU*0.5;
dv/=(Standard_Real)NbsampleV*0.5;
Standard_Real toler1 = toler(1) = ThePSurfaceTool::UResolution(PS,Precision::Confusion());
Standard_Real toler2 = toler(2) = ThePSurfaceTool::VResolution(PS,Precision::Confusion());
Standard_Real Maxtoler1toler2 = toler1;
if(toler2>Maxtoler1toler2) Maxtoler1toler2 = toler2;
//-- lbr le 15 mai 97
//-- on interdit aux points d'etre trop prets des restrictions
Maxtoler1toler2*=1000;
if(Maxtoler1toler2>du*0.001) Maxtoler1toler2=du*0.001;
if(Maxtoler1toler2>dv*0.001) Maxtoler1toler2=dv*0.001;
Func.Set(PS);
Standard_Real Tol = Func.Tolerance();
math_FunctionSetRoot Rsnld(Func,toler);
Standard_Integer REJET_OK=0;
Standard_Integer REJET_KO=0;
//-- lbr le 15 mai 97
umin+=du*0.01;
vmin+=dv*0.01;
umax-=du*0.01;
vmax-=dv*0.01;
//-- lbr le 30 octobre 97 :
//-- Si une surface vient tangenter 2 edges proche d un coin
//-- il faut faire attention qu un point de depart soit trouve au
//-- voisinage du coin. Car ds le cas contraire, le cheminement ne
//-- pourra pas passer au travers des frontieres :
//--
//-- typiquement I est un cylindre (conge)
//--
//-- PPPPPPPPPPPPPPPPPPPP*PPPPPPPPPPPPPPPP
//-- P I I
//-- P I I
//-- P I
//-- P # il faut trouver un point ici
//-- P I
//-- P I
//-- PI
//-- * I
//-- PI I
//-- P I I I I I I I I
//--
for (i=1; i <= Nbsample+12; i++) {
gp_Pnt2d s2d;
gp_Pnt s3d;
Standard_Boolean nepastester=Standard_False;
if(i<=Nbsample) {
T->SamplePoint(i,s2d,s3d);
UVap(1)=s2d.X(); UVap(2)=s2d.Y();
Standard_Real u1,v1,u2,v2;
u1 = Binf(1) = Max(umin,UVap(1)-du);
v1 = Binf(2) = Max(vmin,UVap(2)-dv);
u2 = Bsup(1) = Min(umax,UVap(1)+du);
v2 = Bsup(2) = Min(vmax,UVap(2)+dv);
//-- gp_Pnt Pmilieu = ThePSurfaceTool::Value(PS,0.5*(u1+u2),0.5*(v1+v2));
gp_Pnt Pextrm1 = ThePSurfaceTool::Value(PS,u1,v1);
gp_Pnt Pextrm2 = ThePSurfaceTool::Value(PS,u2,v2);
static math_Vector Valf(1,1);
Func.Value(UVap,Valf);
Standard_Real rvalf = Valf(1);
Standard_Real DistPP = Pextrm1.SquareDistance(Pextrm2);
if(rvalf*rvalf > 3.0*DistPP) {
REJET_OK++;
nepastester=Standard_True;
}
}
else {
if(i==Nbsample+1) { s2d.SetCoord(umin+du*0.02,vmin+dv*0.02); }
else if(i==Nbsample+2) { s2d.SetCoord(umax-du*0.02,vmin+dv*0.02); }
else if(i==Nbsample+3) { s2d.SetCoord(umin+du*0.02,vmax-dv*0.02); }
else if(i==Nbsample+4) { s2d.SetCoord(umax-du*0.02,vmax-dv*0.02); }
else if(i==Nbsample+5) { s2d.SetCoord(umin+du*0.02,vmin+dv*0.02); }
else if(i==Nbsample+6) { s2d.SetCoord(umax-du*0.02,vmin+dv*0.02); }
else if(i==Nbsample+7) { s2d.SetCoord(umin+du*0.02,vmax-dv*0.02); }
else if(i==Nbsample+8) { s2d.SetCoord(umax-du*0.02,vmax-dv*0.02); }
else if(i==Nbsample+9) { s2d.SetCoord(umin+du*0.005,vmin+dv*0.005); }
else if(i==Nbsample+10){ s2d.SetCoord(umax-du*0.005,vmin+dv*0.005); }
else if(i==Nbsample+11){ s2d.SetCoord(umin+du*0.005,vmax-dv*0.005); }
else { s2d.SetCoord(umax-du*0.005,vmax-dv*0.005); }
UVap(1)=s2d.X(); UVap(2)=s2d.Y();
Binf(1) = Max(umin,UVap(1)-du);
Binf(2) = Max(vmin,UVap(2)-dv);
Bsup(1) = Min(umax,UVap(1)+du);
Bsup(2) = Min(vmax,UVap(2)+dv);
}
if(nepastester==Standard_False) {
REJET_KO++;
Rsnld.Perform(Func,UVap,Binf,Bsup);
if (Rsnld.IsDone()) {
if (Abs(Func.Root()) <= Tol) {
if (!Func.IsTangent()) {
psol = Func.Point();
Rsnld.Root(UVap);
// On regarde si le point trouve est bien un nouveau point.
j = 1;
nbpt = list.Length();
testpnt = (j <= nbpt);
while (testpnt) {
const IntSurf_InteriorPoint& IPj = list(j);
const gp_Pnt& Pj = IPj.Value();
if ( (Abs(Pj.X()-psol.X()) <= Epsilon)
&& (Abs(Pj.Y()-psol.Y()) <= Epsilon)
&& (Abs(Pj.Z()-psol.Z()) <= Epsilon)
&& (Abs(UVap(1)-IPj.UParameter()) <= toler1)
&& (Abs(UVap(2)-IPj.VParameter()) <= toler2) ) {
testpnt = Standard_False;
}
else {
j = j+1;
testpnt = (j <= nbpt);
}
}
if (j > nbpt) {
// situ = TheSITool::Classify(PS,UVap(1),UVap(2));
situ = T->Classify(gp_Pnt2d(UVap(1),UVap(2)),
Maxtoler1toler2,Standard_False); //-- ,Standard_False pour ne pas recadrer on Periodic
if (situ == TopAbs_IN) {
list.Append(IntSurf_InteriorPoint(psol,UVap(1),UVap(2),
Func.Direction3d(),
Func.Direction2d()));
}
}
}
}
}
}
}
//-- printf("\n Total : %d Rejet : %d RatioPointCalc : %g nbpt =%d\n",REJET_OK+REJET_KO,REJET_OK,(double)(REJET_KO)/(double)(REJET_OK+REJET_KO),list.Length());
done = Standard_True;
}
//=======================================================================
//function : Perform
//purpose : Test the given inside point
//=======================================================================
void IntStart_SearchInside::Perform (TheFunction& Func,
const ThePSurface& PS,
const Standard_Real UStart,
const Standard_Real VStart)
{
done = Standard_False;
list.Clear();
math_Vector Binf(1,2), Bsup(1,2), toler(1,2);
Binf(1) = ThePSurfaceTool::FirstUParameter(PS);
Binf(2) = ThePSurfaceTool::FirstVParameter(PS);
Bsup(1) = ThePSurfaceTool::LastUParameter(PS);
Bsup(2) = ThePSurfaceTool::LastVParameter(PS);
toler(1) = ThePSurfaceTool::UResolution(PS,Precision::Confusion());
toler(2) = ThePSurfaceTool::VResolution(PS,Precision::Confusion());
if (UStart-Binf(1) > -toler(1) && UStart-Bsup(1) < toler(1) &&
VStart-Binf(2) > -toler(2) && VStart-Bsup(2) < toler(2)) {
Func.Set(PS);
math_Vector UVap(1,2);
UVap(1)=UStart; UVap(2)=VStart;
math_FunctionSetRoot Rsnld(Func,toler);
Rsnld.Perform(Func,UVap,Binf,Bsup);
if (Rsnld.IsDone()) {
Standard_Real tol = Func.Tolerance();
Standard_Real valf = Func.Root();
if (Abs(valf) <= tol && !Func.IsTangent()) {
const gp_Pnt& psol = Func.Point();
Rsnld.Root(UVap);
IntSurf_InteriorPoint intp (psol,UVap(1),UVap(2),
Func.Direction3d(),Func.Direction2d());
list.Append(intp);
}
}
}
done = Standard_True;
}

View File

@@ -0,0 +1,24 @@
#include <StdFail_NotDone.hxx>
inline Standard_Boolean IntStart_SearchInside::IsDone () const {
return done;
}
inline Standard_Integer IntStart_SearchInside::NbPoints () const {
if (!done) {StdFail_NotDone::Raise();}
return list.Length();
}
inline const IntSurf_InteriorPoint& IntStart_SearchInside::Value
(const Standard_Integer Index) const
{
if (!done) {StdFail_NotDone::Raise();}
return list.Value(Index);
}

View File

@@ -0,0 +1,168 @@
-- File: SearchOnBoundaries.cdl
-- Created: Fri Sep 4 11:43:50 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun2>
---Copyright: Matra Datavision 1992
generic class SearchOnBoundaries from IntStart (
TheVertex as any;
TheArc as any;
TheArcTool as any; -- as ArcTool from IntStart(TheArc)
TheSOBTool as any; -- as SOBTool from IntStart(TheVertex,TheArc)
TheTopolTool as Transient; -- as TopolTool from IntStart
-- (TheVertex,TheArc)
TheFunction as any) -- as SOBFunction from IntStart(TheArc)
---Purpose: This class implements algorithmes to find the intersection
-- points and curves between the arcs of restriction
-- of a surface (parametric or implicit), used through
-- the classes TheArcTool, TheSOBTool and TheTopolTool,
-- and an implicit surface (natural quadric : Pln, Cylinder,
-- Cone, Sphere from gp)..
raises NotDone from StdFail,
OutOfRange from Standard,
ConstructionError from Standard
class ThePathPoint instantiates PathPoint from IntStart
(TheVertex,TheArc);
class SequenceOfPathPoint instantiates Sequence from TCollection
(ThePathPoint);
class TheSegment instantiates Segment from IntStart
(TheVertex,
TheArc,
ThePathPoint);
class SequenceOfSegment instantiates Sequence from TCollection
(TheSegment);
is
Create
---Purpose: Empty constructor.
returns SearchOnBoundaries from IntStart;
Perform(me : in out;
F : in out TheFunction;
Domain: TheTopolTool;
TolBoundary,TolTangency : Real from Standard)
---Purpose: Algorithm to find the points and parts of curves of Domain
-- (domain of of restriction of a surface) which verify
-- F = 0.
-- TolBoundary defines if a curve is on Q.
-- TolTangency defines if a point is on Q.
raises ConstructionError from Standard
-- The exception ConstructionError is raised if one of the bounds
-- of an arc of the domain is infinite. See the method Bounds
-- of the class SOBTool.
is static;
IsDone(me)
---Purpose: Returns True if the calculus was successful.
returns Boolean from Standard
---C++: inline
is static;
AllArcSolution(me)
---Purpose: Returns true if all arc of the Arcs are solution (inside
-- the surface).
-- An exception is raised if IsDone returns False.
returns Boolean from Standard
---C++: inline
raises NotDone from StdFail
is static;
NbPoints(me)
---Purpose: Returns the number of resulting points.
-- An exception is raised if IsDone returns False (NotDone).
returns Integer from Standard
---C++: inline
raises NotDone from StdFail
is static;
Point(me; Index: Integer from Standard)
---Purpose: Returns the resulting point of range Index.
-- The exception NotDone is raised if IsDone() returns
-- False.
-- The exception OutOfRange is raised if
-- Index <= 0 or Index > NbPoints.
returns ThePathPoint from IntStart
---C++: return const&
---C++: inline
raises NotDone from StdFail,
OutOfRange from Standard
is static;
NbSegments(me)
---Purpose: Returns the number of the resulting segments.
-- An exception is raised if IsDone returns False (NotDone).
returns Integer from Standard
---C++: inline
raises NotDone from StdFail
is static;
Segment(me; Index: Integer from Standard)
---Purpose: Returns the resulting segment of range Index.
-- The exception NotDone is raised if IsDone() returns
-- False.
-- The exception OutOfRange is raised if
-- Index <= 0 or Index > NbPoints.
returns TheSegment from IntStart
---C++: return const&
---C++: inline
raises NotDone from StdFail,
OutOfRange from Standard
is static;
fields
done : Boolean from Standard;
all : Boolean from Standard;
sseg : SequenceOfSegment from IntStart;
spnt : SequenceOfPathPoint from IntStart;
end SearchOnBoundaries;

View File

@@ -0,0 +1,8 @@
#include <math_FunctionSample.hxx>
#include <math_FunctionAllRoots.hxx>
#include <gp_Vec.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <IntStart_SearchOnBoundaries_1.gxx>
#include <IntStart_SearchOnBoundaries_2.gxx>

View File

@@ -0,0 +1,44 @@
#include <StdFail_NotDone.hxx>
inline Standard_Boolean IntStart_SearchOnBoundaries::IsDone () const {
return done;
}
inline Standard_Boolean IntStart_SearchOnBoundaries::AllArcSolution () const {
if (!done) {StdFail_NotDone::Raise();}
return all;
}
inline Standard_Integer IntStart_SearchOnBoundaries::NbPoints () const {
if (!done) {StdFail_NotDone::Raise();}
return spnt.Length();
}
inline const IntStart_ThePathPoint& IntStart_SearchOnBoundaries::Point
(const Standard_Integer Index) const {
if (!done) {StdFail_NotDone::Raise();}
return spnt.Value(Index);
}
inline Standard_Integer IntStart_SearchOnBoundaries::NbSegments () const {
if (!done) {StdFail_NotDone::Raise();}
return sseg.Length();
}
inline const IntStart_TheSegment& IntStart_SearchOnBoundaries::Segment
(const Standard_Integer Index) const {
if (!done) {StdFail_NotDone::Raise();}
return sseg.Value(Index);
}

View File

@@ -0,0 +1,822 @@
// Modified by skv - Tue Aug 31 12:13:51 2004 OCC569
#include <Precision.hxx>
#include <IntSurf_Quadric.hxx>
static
void FindVertex (const TheArc&,
const Handle(TheTopolTool)&,
TheFunction&,
IntStart_SequenceOfPathPoint&,
const Standard_Real);
static
void BoundedArc (const TheArc&,
const Handle(TheTopolTool)&,
const Standard_Real,
const Standard_Real,
TheFunction&,
IntStart_SequenceOfPathPoint&,
IntStart_SequenceOfSegment&,
const Standard_Real,
const Standard_Real,
Standard_Boolean&);
static
void InfiniteArc (const TheArc&,
const Handle(TheTopolTool)&,
const Standard_Real,
const Standard_Real,
TheFunction&,
IntStart_SequenceOfPathPoint&,
IntStart_SequenceOfSegment&,
const Standard_Real,
const Standard_Real,
Standard_Boolean&);
static
void PointProcess (const gp_Pnt&,
const Standard_Real,
const TheArc&,
const Handle(TheTopolTool)&,
IntStart_SequenceOfPathPoint&,
const Standard_Real,
Standard_Integer&);
static
Standard_Integer TreatLC (const TheArc& A,
const Handle(TheTopolTool)& aDomain,
const IntSurf_Quadric& aQuadric,
const Standard_Real TolBoundary,
IntStart_SequenceOfPathPoint& pnt);
//=======================================================================
//function : FindVertex
//purpose :
//=======================================================================
void FindVertex (const TheArc& A,
const Handle(TheTopolTool)& Domain,
TheFunction& Func,
IntStart_SequenceOfPathPoint& pnt,
const Standard_Real Toler)
{
// Recherche des vertex de l arc de restriction A solutions. On stocke les
// vertex solutions dans la liste pnt.
TheVertex vtx;
//gp_Pnt point;
Standard_Real param,valf;
Standard_Integer itemp;
// Domain.InitVertexIterator(A);
Domain->Initialize(A);
Domain->InitVertexIterator();
while (Domain->MoreVertex()) {
vtx = Domain->Vertex();
param = TheSOBTool::Parameter(vtx,A);
// Evaluer la fonction et regarder par rapport a la tolerance
// du vertex. Si la distance <= tolerance alors ajouter le vertex a
// la liste des points solutions
// L arc est suppose deja charge dans la fonction.
Func.Value(param,valf);
if (Abs(valf) <= Toler) {
itemp = Func.GetStateNumber();
pnt.Append(IntStart_ThePathPoint(Func.Valpoint(itemp),Toler,
vtx,A,param));
// on rajoute la solution
}
Domain->NextVertex();
}
}
//=======================================================================
//function : BoundedArc
//purpose :
//=======================================================================
void BoundedArc (const TheArc& A,
const Handle(TheTopolTool)& Domain,
const Standard_Real Pdeb,
const Standard_Real Pfin,
TheFunction& Func,
IntStart_SequenceOfPathPoint& pnt,
IntStart_SequenceOfSegment& seg,
const Standard_Real TolBoundary,
const Standard_Real TolTangency,
Standard_Boolean& Arcsol)
{
// Recherche des points solutions et des bouts d arc solution sur un arc donne.
// On utilise la fonction math_FunctionAllRoots. Ne convient donc que pour
// des arcs ayant un point debut et un point de fin (intervalle ferme de
// parametrage).
Standard_Integer i,Nbi,Nbp;
gp_Pnt ptdeb,ptfin;
Standard_Real pardeb,parfin;
Standard_Integer ideb,ifin,range,ranged,rangef;
// Creer l echantillonage (math_FunctionSample ou classe heritant)
// Appel a math_FunctionAllRoots
Standard_Real EpsX = TheArcTool::Resolution(A,Precision::Confusion());
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@ La Tolerance est asociee a l arc ( Incoherence avec le cheminement )
//@@@ ( EpsX ~ 1e-5 et ResolutionU et V ~ 1e-9 )
//@@@ le vertex trouve ici n'est pas retrouve comme point d arret d une
//@@@ ligne de cheminement
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
EpsX = 0.0000000001;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// Standard_Integer NbEchant = TheSOBTool::NbSamplesOnArc(A);
Standard_Integer NbEchant = Func.NbSamples();
//-- Modif 24 Aout 93 -----------------------------
Standard_Real nTolTangency = TolTangency;
if((Pfin - Pdeb) < (TolTangency*10.0)) {
nTolTangency=(Pfin-Pdeb)*0.1;
}
if(EpsX>(nTolTangency+nTolTangency)) {
EpsX = nTolTangency * 0.1;
}
//--------------------------------------------------
//-- Plante avec un edge avec 2 Samples
//-- dont les extremites son solutions (f=0)
//-- et ou la derivee est nulle
//-- Exemple : un segment diametre d une sphere
//-- if(NbEchant<3) NbEchant = 3; //-- lbr le 19 Avril 95
//--------------------------------------------------
Standard_Real para=0,dist,maxdist;
/* if(NbEchant<20) NbEchant = 20; //-- lbr le 22 Avril 96
//-- Toujours des pbs
*/
if(NbEchant<100) NbEchant = 100; //-- lbr le 22 Avril 96
//-- Toujours des pbs
//-------------------------------------------------------------- REJECTIONS le 15 oct 98
Standard_Boolean Rejection=Standard_True;
Standard_Real maxdr,maxr,minr,ur,dur;
minr=RealLast();
maxr=-minr;
maxdr=-minr;
dur=(Pfin-Pdeb)*0.2;
for(i=1,ur=Pdeb;i<=6;i++) {
Standard_Real F,D;
if(Func.Values(ur,F,D)) {
Standard_Real lminr,lmaxr;
if(D<0.0) D=-D;
D*=dur+dur;
if(D>maxdr) maxdr=D;
lminr=F-D;
lmaxr=F+D;
if(lminr<minr) minr=lminr;
if(lmaxr>maxr) maxr=lmaxr;
if(minr<0.0 && maxr>0.0) {
Rejection=Standard_False;
continue;
}
}
ur+=dur;
}
dur=0.001+maxdr+(maxr-minr)*0.1;
minr-=dur;
maxr+=dur;
if(minr<0.0 && maxr>0.0) {
Rejection=Standard_False;
}
Arcsol=Standard_False;
if(Rejection==Standard_False) {
math_FunctionSample Echant(Pdeb,Pfin,NbEchant);
Standard_Boolean aelargir=Standard_True;
//modified by NIZNHY-PKV Thu Apr 12 09:25:19 2001 f
//
//maxdist = 100.0*TolBoundary;
maxdist = TolBoundary+TolTangency;
//
//modified by NIZNHY-PKV Thu Apr 12 09:25:23 2001 t
for(i=1; i<=NbEchant && aelargir;i++) {
Standard_Real u = Echant.GetParameter(i);
if(Func.Value(u,dist)) {
if(dist>maxdist || -dist>maxdist) {
aelargir=Standard_False;
}
}
}
if(aelargir && maxdist<0.01) {
#ifdef DEB
//-- cout<<"\n Tolerance elargie a "<<maxdist<<" dans IntStart_SearchOnBoundaries_1.gxx"<<endl;
#endif
}
else {
maxdist = TolBoundary;
}
math_FunctionAllRoots Sol(Func,Echant,EpsX,maxdist,maxdist); //-- TolBoundary,nTolTangency);
if (!Sol.IsDone()) {Standard_Failure::Raise();}
Nbp=Sol.NbPoints();
//-- detection du cas ou la fonction est quasi tangente et que les
//-- zeros sont quasi confondus.
//-- Dans ce cas on prend le point "milieu"
//-- On suppose que les solutions sont triees.
Standard_Real *TabSol=NULL;
if(Nbp) {
TabSol = new Standard_Real [Nbp+2];
for(i=1;i<=Nbp;i++) {
TabSol[i]=Sol.GetPoint(i);
}
Standard_Boolean ok;
do {
ok=Standard_True;
for(i=1;i<Nbp;i++) {
if(TabSol[i]>TabSol[i+1]) {
ok=Standard_False;
para=TabSol[i]; TabSol[i]=TabSol[i+1]; TabSol[i+1]=para;
}
}
}
while(ok==Standard_False);
//modified by NIZNHY-PKV Wed Mar 21 18:34:18 2001 f
//////////////////////////////////////////////////////////
// The treatment of the situation when line(arc) that is
// tangent to cylinder(domain).
// We should have only one solution i.e Nbp=1. Ok?
// But we have 2,3,.. solutions. That is wrong ersult.
// The TreatLC(...) function is dedicated to solve the pb.
// PKV Fri Mar 23 12:17:29 2001
Standard_Integer ip;
const IntSurf_Quadric& aQuadric=Func.Quadric();
ip=TreatLC (A, Domain, aQuadric, TolBoundary, pnt);
if (ip) {
//////////////////////////////////////////////////////////
//modified by NIZNHY-PKV Wed Mar 21 18:34:23 2001 t
//
// Using of old usual way proposed by Laurent
//
for(i=1;i<Nbp;i++) {
Standard_Real parap1=TabSol[i+1];
para=TabSol[i];
Standard_Real param=(para+parap1)*0.5;
Standard_Real ym;
if(Func.Value(param,ym)) {
if(Abs(ym)<maxdist) {
// Modified by skv - Tue Aug 31 12:13:51 2004 OCC569 Begin
// Consider this interval as tangent one. Treat it to find
// parameter with the lowest function value.
// Compute the number of nodes.
Standard_Real aTol = TolBoundary*1000.0;
if(aTol > 0.001)
aTol = 0.001;
// fix floating point exception 569, chl-922-e9
parap1 = (Abs(parap1) < 1.e9) ? parap1 : ((parap1 >= 0.) ? 1.e9 : -1.e9);
para = (Abs(para) < 1.e9) ? para : ((para >= 0.) ? 1.e9 : -1.e9);
Standard_Integer aNbNodes = RealToInt(Ceiling((parap1 - para)/aTol));
Standard_Real aVal = RealLast();
//Standard_Integer aNbNodes = 23;
Standard_Real aDelta = (parap1 - para)/(aNbNodes + 1.);
Standard_Integer ii;
Standard_Real aMinPar = Pdeb - 1.;
Standard_Real aCurPar;
Standard_Real aCurVal;
for (ii = 0; ii <= aNbNodes + 1; ii++) {
aCurPar = (ii < aNbNodes + 1) ? para + ii*aDelta : parap1;
if (Func.Value(aCurPar, aCurVal)) {
//if (aCurVal < aVal) {
if (Abs(aCurVal) < aVal) {
//aVal = aCurVal;
aVal = Abs(aCurVal);
param = aCurPar;
}
}
}
// Modified by skv - Tue Aug 31 12:13:51 2004 OCC569 End
TabSol[i]=Pdeb-1;
TabSol[i+1]=param;
}
}
}
for (i=1; i<=Nbp; i++) {
para=TabSol[i];
if((para-Pdeb)<EpsX || (Pfin-para)<EpsX) {
}
else {
if(Func.Value(para,dist)) {
//modified by jgv 5.07.01 for the bug buc60927
Standard_Integer anIndx;
Standard_Real aParam;
if (Abs(dist) < maxdist)
{
aParam = Sol.GetPoint(i);
if (Abs(aParam-Pdeb)<=Precision::PConfusion() || Abs(aParam-Pfin)<=Precision::PConfusion())
anIndx = Sol.GetPointState(i);
else
{
anIndx = Func.GetStateNumber(); //take the middle point
aParam = para;
}
}
else
{
anIndx = Sol.GetPointState(i);
aParam = Sol.GetPoint(i);
}
const gp_Pnt& aPnt = Func.Valpoint(anIndx);
//////////////////////////////////////////////
PointProcess(aPnt, aParam, A, Domain, pnt, TolBoundary, range);
}
}
}
if(TabSol) {
delete [] TabSol;
}
}// end ofif (ip)
} // end of if(Nbp)
// Pour chaque intervalle trouve faire
// Traiter les extremites comme des points
// Ajouter intervalle dans la liste des segments
Nbi=Sol.NbIntervals();
if(Nbp) {
//--cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx :Nbp>0 0 <- Nbi "<<Nbi<<endl;
Nbi=0;
}
//-- cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx : Nbi : "<<Nbi<<endl;
for (i=1; i<=Nbi; i++) {
IntStart_TheSegment newseg;
newseg.SetValue(A);
// Recuperer point debut et fin, et leur parametre.
Sol.GetInterval(i,pardeb,parfin);
Sol.GetIntervalState(i,ideb,ifin);
//-- cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx : i= "<<i<<" ParDeb:"<<pardeb<<" ParFin:"<<parfin<<endl;
ptdeb=Func.Valpoint(ideb);
ptfin=Func.Valpoint(ifin);
PointProcess(ptdeb,pardeb,A,Domain,pnt,TolBoundary,ranged);
newseg.SetLimitPoint(pnt.Value(ranged),Standard_True);
PointProcess(ptfin,parfin,A,Domain,pnt,TolBoundary,rangef);
newseg.SetLimitPoint(pnt.Value(rangef),Standard_False);
seg.Append(newseg);
}
if (Nbi==1) {
if (pardeb == Pdeb && parfin == Pfin) {
Arcsol=Standard_True;
}
}
}
}
//=======================================================================
//function : ComputeBoundsfromInfinite
//purpose :
//=======================================================================
//-- PROVISOIRE - TEMPORAIRE - PAS BON - NYI - A FAIRE
//-- provisoire - temporaire - pas bon - nyi - a faire
void ComputeBoundsfromInfinite(TheFunction& Func,
Standard_Real& PDeb,
Standard_Real& PFin,
Standard_Integer& NbEchant)
{
//-- On cherche des parametres de debut et de fin de l arc (courbe 2d)
//-- infini, de facon a intersecter la quadrique avec une portion d arc
//-- finie.
//-- La quadrique est un plan, un cylindre, un cone ou une sphere.
//-- Idee : On prend un point quelconque sur l'arc et on fait croitre les
//-- bornes vers des valeurs ou la fonction distance signee a des chances
//-- de s annuler.
//-- ATTENTION : Les calculs ci-dessous fournissent une estimation tres
//-- grossiere des parametres .
//-- Cela evite les raises et permet a des cas de Boites
//-- inifinies de marcher. Il faudra reprendre ce code
//-- avec des intersections Courbe Surface.
NbEchant = 10;
Standard_Real U0 = 0.0;
//Standard_Real U1;
Standard_Real dU = 0.001;
Standard_Real Dist0,Dist1;//Grad0,Grad1;
//Standard_Real D1OnArc;
Func.Value(U0 , Dist0);
Func.Value(U0+dU, Dist1);
Standard_Real dDist = Dist1 - Dist0;
if(dDist) {
U0 -= dU*Dist0 / dDist;
PDeb = PFin = U0;
Standard_Real Umin = U0 - 1e5;
Func.Value(Umin , Dist0);
Func.Value(Umin+dU, Dist1);
dDist = Dist1-Dist0;
if(dDist) {
Umin -= dU*Dist0 / dDist;
}
else {
Umin-=10.0;
}
Standard_Real Umax = U0 + 1e8;
Func.Value(Umax , Dist0);
Func.Value(Umax+dU, Dist1);
dDist = Dist1-Dist0;
if(dDist) {
Umax -= dU*Dist0 / dDist;
}
else {
Umax+=10.0;
}
if(Umin>U0) { Umin=U0-10.0; }
if(Umax<U0) { Umax=U0+10.0; }
PFin = Umax;
PDeb = Umin;
}
else {
//-- Possibilite de Arc totalement inclu ds Quad
PDeb = 1e10;
PFin = -1e10;
}
}
//=======================================================================
//function : InfiniteArc
//purpose :
//=======================================================================
void InfiniteArc (const TheArc& A,
const Handle(TheTopolTool)& Domain,
const Standard_Real Pdeb,
const Standard_Real Pfin,
TheFunction& Func,
IntStart_SequenceOfPathPoint& pnt,
IntStart_SequenceOfSegment& seg,
const Standard_Real TolBoundary,
const Standard_Real TolTangency,
Standard_Boolean& Arcsol)
{
// Recherche des points solutions et des bouts d arc solution sur un arc donne.
// On utilise la fonction math_FunctionAllRoots. Ne convient donc que pour
// des arcs ayant un point debut et un point de fin (intervalle ferme de
// parametrage).
Standard_Integer i,Nbi,Nbp;
gp_Pnt ptdeb,ptfin;
Standard_Real pardeb,parfin;
Standard_Integer ideb,ifin,range,ranged,rangef;
// Creer l echantillonage (math_FunctionSample ou classe heritant)
// Appel a math_FunctionAllRoots
Standard_Real EpsX = TheArcTool::Resolution(A,Precision::Confusion());
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@ La Tolerance est asociee a l arc ( Incoherence avec le cheminement )
//@@@ ( EpsX ~ 1e-5 et ResolutionU et V ~ 1e-9 )
//@@@ le vertex trouve ici n'est pas retrouve comme point d arret d une
//@@@ ligne de cheminement
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
EpsX = 0.0000000001;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// Standard_Integer NbEchant = TheSOBTool::NbSamplesOnArc(A);
Standard_Integer NbEchant = Func.NbSamples();
//-- Modif 24 Aout 93 -----------------------------
Standard_Real nTolTangency = TolTangency;
if((Pfin - Pdeb) < (TolTangency*10.0)) {
nTolTangency=(Pfin-Pdeb)*0.1;
}
if(EpsX>(nTolTangency+nTolTangency)) {
EpsX = nTolTangency * 0.1;
}
//--------------------------------------------------
//-- Plante avec un edge avec 2 Samples
//-- dont les extremites sont solutions (f=0)
//-- et ou la derivee est nulle
//-- Exemple : un segment diametre d une sphere
if(NbEchant<3) NbEchant = 3; //-- lbr le 19 Avril 95
//--------------------------------------------------
Standard_Real PDeb = Pdeb;
Standard_Real PFin = Pfin;
ComputeBoundsfromInfinite(Func,PDeb,PFin,NbEchant);
math_FunctionSample Echant(PDeb,PFin,NbEchant);
math_FunctionAllRoots Sol(Func,Echant,EpsX,TolBoundary,nTolTangency);
if (!Sol.IsDone()) {Standard_Failure::Raise();}
Nbp=Sol.NbPoints();
for (i=1; i<=Nbp; i++) {
Standard_Real para = Sol.GetPoint(i);
Standard_Real dist;
if(Func.Value(para,dist)) {
//--if(Abs(dist)>nTolTangency) {
//--cout<<" Point sur restriction a dist="<<dist<<endl;
//--}
PointProcess(Func.Valpoint(Sol.GetPointState(i)),Sol.GetPoint(i),
A,Domain,pnt,TolBoundary,range);
}
//--else {
//-- cout<<" Point Rejete dans IntStart_SearchOnBoundaries_1.gxx "<<endl;
//--}
}
// Pour chaque intervalle trouve faire
// Traiter les extremites comme des points
// Ajouter intervalle dans la liste des segments
Nbi=Sol.NbIntervals();
for (i=1; i<=Nbi; i++) {
IntStart_TheSegment newseg;
newseg.SetValue(A);
// Recuperer point debut et fin, et leur parametre.
Sol.GetInterval(i,pardeb,parfin);
Sol.GetIntervalState(i,ideb,ifin);
ptdeb=Func.Valpoint(ideb);
ptfin=Func.Valpoint(ifin);
PointProcess(ptdeb,pardeb,A,Domain,pnt,TolBoundary,ranged);
newseg.SetLimitPoint(pnt.Value(ranged),Standard_True);
PointProcess(ptfin,parfin,A,Domain,pnt,TolBoundary,rangef);
newseg.SetLimitPoint(pnt.Value(rangef),Standard_False);
seg.Append(newseg);
}
Arcsol=Standard_False;
if (Nbi==1) {
if (pardeb == Pdeb && parfin == Pfin) {
Arcsol=Standard_True;
}
}
}
//=======================================================================
//function : PointProcess
//purpose :
//=======================================================================
void PointProcess (const gp_Pnt& Pt,
const Standard_Real Para,
const TheArc& A,
const Handle(TheTopolTool)& Domain,
IntStart_SequenceOfPathPoint& pnt,
const Standard_Real Tol,
Standard_Integer& Range)
{
// Regarder si un point solution est confondu avec un vertex.
// Si confondu, on doit retrouver ce vertex dans la liste des points de
// depart. On renvoie alors le rang de ce point dans la liste pnt.
// Sinon, on ajoute le point dans la liste.
Standard_Integer k;
Standard_Boolean found,goon;
Standard_Real dist,toler;
Standard_Integer Nbsol = pnt.Length();
TheVertex vtx;
IntStart_ThePathPoint ptsol;
// Domain.InitVertexIterator(A);
Domain->Initialize(A);
Domain->InitVertexIterator();
found = Standard_False;
goon = Domain->MoreVertex();
while (goon) {
vtx = Domain->Vertex();
dist= Abs(Para-TheSOBTool::Parameter(vtx,A));
toler = TheSOBTool::Tolerance(vtx,A);
#ifdef DEB
if(toler>0.1) {
cout<<"IntStart_SearchOnBoundaries_1.gxx : ** WARNING ** Tol Vertex="<<toler<<endl;
cout<<" Ou Edge degenere Ou Kro pointu"<<endl;
if(toler>10000) toler=1e-7;
}
#endif
if (dist <= toler) {
// Localiser le vertex dans la liste des solutions
k=1;
found = (k>Nbsol);
while (!found) {
ptsol = pnt.Value(k);
if (!ptsol.IsNew()) {
//jag 940608 if (ptsol.Vertex() == vtx &&
//jag 940608 ptsol.Arc() == A) {
if (Domain->Identical(ptsol.Vertex(),vtx) &&
ptsol.Arc() == A &&
Abs(ptsol.Parameter()-Para) <= toler) {
found=Standard_True;
}
else {
k=k+1;
found=(k>Nbsol);
}
}
else {
k=k+1;
found=(k>Nbsol);
}
}
if (k<=Nbsol) { // on a retrouve le vertex
Range = k;
}
else { // au cas ou...
ptsol.SetValue(Pt,Tol,vtx,A,Para);
pnt.Append(ptsol);
Range = pnt.Length();
}
found = Standard_True;
goon = Standard_False;
}
else {
Domain->NextVertex();
goon = Domain->MoreVertex();
}
}
if (!found) { // on n est pas tombe sur un vertex
Standard_Real TOL=Tol;
TOL*=1000.0;
if(TOL>0.001) TOL=0.001;
ptsol.SetValue(Pt,TOL,A,Para);
pnt.Append(ptsol);
Range = pnt.Length();
}
}
//modified by NIZNHY-PKV Fri Mar 23 10:53:15 2001
#include <TopoDS_Edge.hxx>
#include <Geom_Curve.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <Adaptor3d_HSurface.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Line.hxx>
#include <gp_Lin.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Ax1.hxx>
#include <gp_Lin.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Precision.hxx>
#include <Extrema_ExtCC.hxx>
#include <Extrema_POnCurv.hxx>
//=======================================================================
//function : TreatLC
//purpose :
//=======================================================================
Standard_Integer TreatLC (const TheArc& A,
const Handle(TheTopolTool)& aDomain,
const IntSurf_Quadric& aQuadric,
const Standard_Real TolBoundary,
IntStart_SequenceOfPathPoint& pnt)
{
Standard_Integer anExitCode=1, aNbExt;
Standard_Address anEAddress=aDomain->Edge();
if (anEAddress==NULL) {
return anExitCode;
}
TopoDS_Edge* anE=(TopoDS_Edge*)anEAddress;
if (BRep_Tool::Degenerated(*anE)) {
return anExitCode;
}
GeomAbs_CurveType aTypeE;
BRepAdaptor_Curve aBAC(*anE);
aTypeE=aBAC.GetType();
if (aTypeE!=GeomAbs_Line) {
return anExitCode;
}
GeomAbs_SurfaceType aTypeS;
aTypeS=aQuadric.TypeQuadric();
if (aTypeS!=GeomAbs_Cylinder) {
return anExitCode;
}
Standard_Real f, l, U1f, U1l, U2f, U2l, U1, UEgde, TOL, aDist, aR, aRRel, Tol;
Handle(Geom_Curve) aCEdge=BRep_Tool::Curve(*anE, f, l);
gp_Cylinder aCyl=aQuadric.Cylinder();
const gp_Ax1& anAx1=aCyl.Axis();
gp_Lin aLin(anAx1);
Handle(Geom_Line) aCAxis=new Geom_Line (aLin);
aR=aCyl.Radius();
U1f = aCAxis->FirstParameter();
U1l = aCAxis->LastParameter();
U2f = aCEdge->FirstParameter();
U2l = aCEdge->LastParameter();
GeomAdaptor_Curve C1, C2;
C1.Load(aCAxis);
C2.Load(aCEdge);
Tol = Precision::PConfusion();
Extrema_ExtCC anExtCC(C1, C2, U1f, U1l, U2f, U2l, Tol, Tol);
aNbExt=anExtCC.NbExt();
if (aNbExt!=1) {
return anExitCode;
}
gp_Pnt P1,PEdge;
Extrema_POnCurv PC1, PC2;
anExtCC.Points(1, PC1, PC2);
P1 =PC1.Value();
PEdge=PC2.Value();
U1=PC1.Parameter();
UEgde=PC2.Parameter();
aDist=PEdge.Distance(P1);
aRRel=fabs(aDist-aR)/aR;
if (aRRel > TolBoundary) {
return anExitCode;
}
if (UEgde < (f+TolBoundary) || UEgde > (l-TolBoundary)) {
return anExitCode;
}
//
// Do not wonder !
// It was done as into PointProcess(...) function
//printf("TreatLC()=> tangent line is found\n");
TOL=1000.*TolBoundary;
if(TOL>0.001) TOL=0.001;
IntStart_ThePathPoint ptsol;
ptsol.SetValue(PEdge, TOL, A, UEgde);
pnt.Append(ptsol);
anExitCode=0;
return anExitCode;
}

View File

@@ -0,0 +1,96 @@
#include <Precision.hxx>
//=======================================================================
//function : IntStart_SearchOnBoundaries::IntStart_SearchOnBoundaries
//purpose :
//=======================================================================
IntStart_SearchOnBoundaries::IntStart_SearchOnBoundaries ()
: done(Standard_False)
{
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void IntStart_SearchOnBoundaries::Perform (TheFunction& Func,
const Handle(TheTopolTool)& Domain,
const Standard_Real TolBoundary,
const Standard_Real TolTangency)
{
done = Standard_False;
spnt.Clear();
sseg.Clear();
Standard_Boolean Arcsol;
Standard_Real PDeb,PFin, prm, tol;
Standard_Integer i, nbknown, nbfound,index;
gp_Pnt pt;
Domain->Init();
if (Domain->More()) {
all = Standard_True;
}
else {
all = Standard_False;
}
while (Domain->More()) {
TheArc A = Domain->Value();
if (!TheSOBTool::HasBeenSeen(A)) {
Func.Set(A);
FindVertex(A,Domain,Func,spnt,TolBoundary);
TheSOBTool::Bounds(A,PDeb,PFin);
if(Precision::IsNegativeInfinite(PDeb) ||
Precision::IsPositiveInfinite(PFin)) {
InfiniteArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
TolBoundary,TolTangency,Arcsol);
}
else {
BoundedArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
TolBoundary,TolTangency,Arcsol);
}
all = (all && Arcsol);
}
else {
// as it seems we'll never be here, because
// TheSOBTool::HasBeenSeen(A) always returns FALSE
nbfound = spnt.Length();
// On recupere les points connus
nbknown = TheSOBTool::NbPoints(A);
for (i=1; i<=nbknown; i++) {
TheSOBTool::Value(A,i,pt,tol,prm);
if (TheSOBTool::IsVertex(A,i)) {
TheVertex vtx;
TheSOBTool::Vertex(A,i,vtx);
spnt.Append(IntStart_ThePathPoint(pt,tol,vtx,A,prm));
}
else {
spnt.Append(IntStart_ThePathPoint(pt,tol,A,prm));
}
}
// On recupere les arcs solutions
nbknown = TheSOBTool::NbSegments(A);
for (i=1; i<=nbknown; i++) {
IntStart_TheSegment newseg;
newseg.SetValue(A);
if (TheSOBTool::HasFirstPoint(A,i,index)) {
newseg.SetLimitPoint(spnt.Value(nbfound+index),Standard_True);
}
if (TheSOBTool::HasLastPoint(A,i,index)) {
newseg.SetLimitPoint(spnt.Value(nbfound+index),Standard_False);
}
sseg.Append(newseg);
}
all = (all& TheSOBTool::IsAllSolution(A));
}
Domain->Next();
}
done = Standard_True;
}

119
src/IntStart/IntStart_Segment.cdl Executable file
View File

@@ -0,0 +1,119 @@
-- File: Segment.cdl
-- Created: Tue Apr 14 09:48:28 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun1>
---Copyright: Matra Datavision 1992
generic class Segment from IntStart
(TheVertex as any;
TheArc as any;
ThePathPoint as any) -- as PathPoint from IntStart (TheVertex,TheArc)
---Purpose: This class defines the intersection between two implicit
-- surfaces A and B, when this intersection is a part of an
-- arc of restriction .
-- It can be bounded or semi infinite;
-- the extremities of these curves are vertices(ThepathPoint).
raises DomainError from Standard
is
Create
---Purpose: Empty constructor.
returns Segment;
SetValue(me: in out; A: TheArc)
---Purpose: Defines the concerned arc.
---C++: inline
is static;
SetLimitPoint(me: in out; V: ThePathPoint; First: Boolean)
---Purpose: Defines the first point or the last point,
-- depending on the value of the boolean First.
is static;
Curve(me)
---Purpose: Returns the geometric curve on the surface 's domain
-- which is solution.
returns any TheArc
---C++: return const&
---C++: inline
is static;
HasFirstPoint(me)
---Purpose: Returns True if there is a vertex (ThePathPoint) defining
-- the lowest valid parameter on the arc.
returns Boolean from Standard
---C++: inline
is static;
FirstPoint(me)
---Purpose: Returns the first point.
returns ThePathPoint
---C++: return const&
---C++: inline
raises DomainError from Standard
is static;
HasLastPoint(me)
---Purpose: Returns True if there is a vertex (ThePathPoint) defining
-- the greatest valid parameter on the arc.
returns Boolean from Standard
---C++: inline
is static;
LastPoint(me)
---Purpose: Returns the last point.
returns ThePathPoint
---C++: return const&
---C++: inline
raises DomainError from Standard
is static;
fields
arc : TheArc;
hasfp : Boolean from Standard;
thefp : ThePathPoint;
haslp : Boolean from Standard;
thelp : ThePathPoint;
end Segment;

View File

@@ -0,0 +1,19 @@
IntStart_Segment::IntStart_Segment () {}
void IntStart_Segment::SetLimitPoint (const ThePathPoint& V,
const Standard_Boolean First) {
if (First) {
hasfp = Standard_True;
thefp = V;
}
else {
haslp = Standard_True;
thelp = V;
}
}

View File

@@ -0,0 +1,42 @@
#include <Standard_DomainError.hxx>
inline void IntStart_Segment::SetValue (const TheArc& A) {
hasfp = Standard_False;
haslp = Standard_False;
arc = A;
}
inline const TheArc& IntStart_Segment::Curve () const {
return arc;
}
inline Standard_Boolean IntStart_Segment::HasFirstPoint () const {
return hasfp;
}
inline const ThePathPoint& IntStart_Segment::FirstPoint () const {
if (!hasfp) { Standard_DomainError::Raise(); }
return thefp;
}
inline Standard_Boolean IntStart_Segment::HasLastPoint () const {
return haslp;
}
inline const ThePathPoint& IntStart_Segment::LastPoint () const {
if (!haslp) { Standard_DomainError::Raise(); }
return thelp;
}

View File

@@ -0,0 +1,90 @@
-- File: TopolTool.cdl
-- Created: Tue Nov 3 10:59:04 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun2>
---Copyright: Matra Datavision 1992
deferred generic class TopolTool from IntStart
( TheVertex as any;
TheArc as any
)
---Purpose: Template class for an iterator the restriction of
-- a surface.
inherits TShared from MMgt
raises DomainError from Standard
is
-- Arc iterator
Init(me: mutable)
;
More(me: mutable)
returns Boolean from Standard
;
Value(me: mutable)
returns any TheArc
;
Next(me: mutable)
;
-- Iterator on the vertex of an arc of restriction
Initialize(me: mutable; A:TheArc)
;
InitVertexIterator(me: mutable)
;
MoreVertex(me: mutable)
returns Boolean from Standard
;
Vertex(me: mutable)
returns any TheVertex
;
NextVertex(me: mutable)
;
Identical(me: mutable; V1,V2: TheVertex)
---Purpose: Returns True if the vertices V1 and V2 are identical.
-- This method does not take the orientation of the
-- vertices in account.
returns Boolean;
end TopolTool;

View File