mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
1
src/GeomInt/FILES
Executable file
1
src/GeomInt/FILES
Executable file
@@ -0,0 +1 @@
|
||||
GeomInt_IntSS_1.cxx
|
50
src/GeomInt/GeomInt.cdl
Executable file
50
src/GeomInt/GeomInt.cdl
Executable file
@@ -0,0 +1,50 @@
|
||||
-- File: GeomInt.cdl
|
||||
-- Created: Fri Jan 27 10:21:27 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
package GeomInt
|
||||
|
||||
---Purpose: Provides intersections on between two surfaces of Geom.
|
||||
-- The result are curves from Geom.
|
||||
|
||||
|
||||
uses StdFail,
|
||||
TCollection,
|
||||
TColStd,
|
||||
TopAbs,
|
||||
|
||||
gp,
|
||||
Geom,
|
||||
Geom2d,
|
||||
TColGeom,
|
||||
TColGeom2d,
|
||||
Adaptor3d,
|
||||
GeomAdaptor,
|
||||
|
||||
IntSurf,
|
||||
IntPatch,
|
||||
ApproxInt
|
||||
|
||||
is
|
||||
|
||||
class IntSS;
|
||||
|
||||
class LineConstructor;
|
||||
|
||||
class LineTool;
|
||||
|
||||
class WLApprox instantiates Approx from ApproxInt
|
||||
(HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d,
|
||||
Quadric from IntSurf,
|
||||
QuadricTool from IntSurf,
|
||||
WLine from IntPatch);
|
||||
|
||||
private class ParameterAndOrientation;
|
||||
|
||||
private class SequenceOfParameterAndOrientation instantiates
|
||||
Sequence from TCollection(ParameterAndOrientation);
|
||||
|
||||
end GeomInt;
|
217
src/GeomInt/GeomInt_IntSS.cdl
Executable file
217
src/GeomInt/GeomInt_IntSS.cdl
Executable file
@@ -0,0 +1,217 @@
|
||||
-- File: GeomInt_IntSS.cdl
|
||||
-- Created: Fri Jan 27 10:26:45 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class IntSS from GeomInt
|
||||
|
||||
---Purpose:
|
||||
|
||||
|
||||
uses Intersection from IntPatch,
|
||||
LineConstructor from GeomInt,
|
||||
SequenceOfCurve from TColGeom,
|
||||
SequenceOfCurve from TColGeom2d,
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
Curve from Geom,
|
||||
Curve from Geom2d,
|
||||
Surface from Geom,
|
||||
HSurface from GeomAdaptor,
|
||||
TopolTool from Adaptor3d,
|
||||
Line from IntPatch
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns IntSS from GeomInt;
|
||||
---C++: inline
|
||||
|
||||
Create(S1,S2: Surface from Geom; Tol: Real from Standard;
|
||||
Approx : Boolean from Standard = Standard_True;
|
||||
ApproxS1 : Boolean from Standard = Standard_False;
|
||||
ApproxS2 : Boolean from Standard = Standard_False)
|
||||
---Purpose: performs general intersection of two surfaces just now
|
||||
returns IntSS from GeomInt;
|
||||
---C++: inline
|
||||
|
||||
Perform(me: in out;S1,S2 : Surface from Geom; Tol: Real from Standard;
|
||||
Approx : Boolean from Standard = Standard_True;
|
||||
ApproxS1 : Boolean from Standard = Standard_False;
|
||||
ApproxS2 : Boolean from Standard = Standard_False)
|
||||
---Purpose: general intersection of two surfaces
|
||||
is static;
|
||||
|
||||
Perform(me: in out;HS1,HS2: HSurface from GeomAdaptor; Tol: Real from Standard;
|
||||
Approx : Boolean from Standard = Standard_True;
|
||||
ApproxS1 : Boolean from Standard = Standard_False;
|
||||
ApproxS2 : Boolean from Standard = Standard_False)
|
||||
---Purpose: intersection of adapted surfaces
|
||||
is static;
|
||||
---C++: inline
|
||||
|
||||
Perform(me: in out;S1,S2: Surface from Geom; Tol: Real from Standard;
|
||||
U1,V1,U2,V2: Real from Standard;
|
||||
Approx : Boolean from Standard = Standard_True;
|
||||
ApproxS1 : Boolean from Standard = Standard_False;
|
||||
ApproxS2 : Boolean from Standard = Standard_False)
|
||||
---Purpose: general intersection using a starting point
|
||||
is static;
|
||||
|
||||
Perform(me: in out;HS1,HS2: HSurface from GeomAdaptor; Tol: Real from Standard;
|
||||
U1,V1,U2,V2: Real from Standard;
|
||||
Approx : Boolean from Standard = Standard_True;
|
||||
ApproxS1 : Boolean from Standard = Standard_False;
|
||||
ApproxS2 : Boolean from Standard = Standard_False)
|
||||
---Purpose: intersection of adapted surfaces using a starting point
|
||||
is static;
|
||||
---C++: inline
|
||||
|
||||
IsDone(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
|
||||
TolReached3d(me) returns Real from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
|
||||
TolReached2d(me) returns Real from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
|
||||
NbLines(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
Line(me; Index: Integer from Standard)
|
||||
|
||||
returns any Curve from Geom
|
||||
---C++: return const&
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasLineOnS1(me; Index: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
|
||||
LineOnS1(me; Index: Integer from Standard)
|
||||
|
||||
returns any Curve from Geom2d
|
||||
---C++: return const&
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
HasLineOnS2(me; Index: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
|
||||
LineOnS2(me; Index: Integer from Standard)
|
||||
|
||||
returns any Curve from Geom2d
|
||||
---C++: return const&
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbBoundaries(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
Boundary(me; Index: Integer from Standard)
|
||||
|
||||
returns any Curve from Geom
|
||||
---C++: return const&
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
NbPoints(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Index: Integer from Standard)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: inline
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Pnt2d(me; Index: Integer from Standard;
|
||||
OnFirst: Boolean from Standard)
|
||||
|
||||
returns Pnt2d from gp
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
SetTolFixTangents(me:out;
|
||||
aTolCheck:Real from Standard;
|
||||
aTolAngCheck:Real from Standard);
|
||||
|
||||
TolFixTangents(me:out;
|
||||
aTolCheck:out Real from Standard;
|
||||
aTolAngCheck:out Real from Standard);
|
||||
|
||||
--- Private methods
|
||||
--
|
||||
--
|
||||
InternalPerform(me: in out; Tol: Real from Standard;
|
||||
Approx,ApproxS1,ApproxS2 : Boolean from Standard;
|
||||
useStart : Boolean from Standard;
|
||||
U1,V1,U2,V2: Real from Standard)
|
||||
is static protected;
|
||||
|
||||
MakeCurve(me: in out; Ind : Integer from Standard;
|
||||
D1,D2 : TopolTool from Adaptor3d;
|
||||
Tol : Real from Standard;
|
||||
Approx : Boolean from Standard;
|
||||
Approx1 : Boolean from Standard;
|
||||
Approx2 : Boolean from Standard)
|
||||
is protected;
|
||||
|
||||
fields
|
||||
|
||||
myIntersector : Intersection from IntPatch;
|
||||
myLConstruct : LineConstructor from GeomInt;
|
||||
myHS1 : HSurface from GeomAdaptor;
|
||||
myHS2 : HSurface from GeomAdaptor;
|
||||
myNbrestr : Integer from Standard;
|
||||
sline : SequenceOfCurve from TColGeom;
|
||||
slineS1 : SequenceOfCurve from TColGeom2d;
|
||||
slineS2 : SequenceOfCurve from TColGeom2d;
|
||||
myTolReached2d : Real from Standard;
|
||||
myTolReached3d : Real from Standard;
|
||||
--
|
||||
myTolCheck : Real from Standard;
|
||||
myTolAngCheck : Real from Standard;
|
||||
--
|
||||
end IntSS;
|
178
src/GeomInt/GeomInt_IntSS.cxx
Executable file
178
src/GeomInt/GeomInt_IntSS.cxx
Executable file
@@ -0,0 +1,178 @@
|
||||
// File: GeomInt_IntSS.cxx
|
||||
// Created: Fri Jan 27 10:46:42 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Open CASCADE 1995
|
||||
|
||||
#include <GeomInt_IntSS.ixx>
|
||||
|
||||
#include <Adaptor3d_TopolTool.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : General intersection
|
||||
//=======================================================================
|
||||
void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
|
||||
const Handle(Geom_Surface)& S2,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean Approx,
|
||||
const Standard_Boolean ApproxS1,
|
||||
const Standard_Boolean ApproxS2)
|
||||
{
|
||||
myHS1 = new GeomAdaptor_HSurface(S1);
|
||||
if (S1==S2)
|
||||
myHS2 = myHS1;
|
||||
else
|
||||
myHS2 = new GeomAdaptor_HSurface(S2);
|
||||
InternalPerform(Tol,Approx,ApproxS1,ApproxS2,Standard_False,0.,0.,0.,0.);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : General intersection with a Starting Point
|
||||
//=======================================================================
|
||||
void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
|
||||
const Handle(Geom_Surface)& S2,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Real U1, const Standard_Real V1,
|
||||
const Standard_Real U2, const Standard_Real V2,
|
||||
const Standard_Boolean Approx,
|
||||
const Standard_Boolean ApproxS1,
|
||||
const Standard_Boolean ApproxS2)
|
||||
{
|
||||
myHS1 = new GeomAdaptor_HSurface(S1);
|
||||
if (S1==S2)
|
||||
myHS2 = myHS1;
|
||||
else
|
||||
myHS2 = new GeomAdaptor_HSurface(S2);
|
||||
InternalPerform(Tol,Approx,ApproxS1,ApproxS2,Standard_True,U1,V1,U2,V2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Internal Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomInt_IntSS::InternalPerform(const Standard_Real Tol,
|
||||
const Standard_Boolean Approx,
|
||||
const Standard_Boolean ApproxS1,
|
||||
const Standard_Boolean ApproxS2,
|
||||
const Standard_Boolean useStart,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2)
|
||||
{
|
||||
myTolReached2d = myTolReached3d = 0.0;
|
||||
myNbrestr = 0;
|
||||
sline.Clear();
|
||||
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool(myHS1);
|
||||
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool(myHS2);
|
||||
myLConstruct.Load(dom1,dom2,myHS1,myHS2);
|
||||
|
||||
Standard_Real TolArc = Tol;
|
||||
Standard_Real TolTang = Tol;
|
||||
Standard_Real UVMaxStep = 0.001;
|
||||
Standard_Real Deflection = 0.1;
|
||||
|
||||
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
|
||||
|
||||
if(myHS1 == myHS2) {
|
||||
myIntersector.Perform(myHS1,dom1,TolArc,TolTang);
|
||||
}
|
||||
else if (!useStart) {
|
||||
myIntersector.Perform(myHS1,dom1,myHS2,dom2,TolArc,TolTang);
|
||||
}
|
||||
else {
|
||||
myIntersector.Perform(myHS1,dom1,myHS2,dom2,U1,V1,U2,V2,TolArc,TolTang);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
if (myIntersector.IsDone()) {
|
||||
const Standard_Integer nblin = myIntersector.NbLines();
|
||||
for (Standard_Integer i=1; i<= nblin; i++) {
|
||||
MakeCurve(i,dom1,dom2,Tol,Approx,ApproxS1,ApproxS2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Line
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Geom_Curve) & GeomInt_IntSS::Line (const Standard_Integer Index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::Line");
|
||||
return sline(Index+myNbrestr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Boundary
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Geom_Curve) & GeomInt_IntSS::Boundary (const Standard_Integer Index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::Line");
|
||||
Standard_OutOfRange_Raise_if(Index <= 0 || Index > myNbrestr,
|
||||
"GeomInt_IntSS::Boundary");
|
||||
return sline(Index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Pnt2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt2d GeomInt_IntSS::Pnt2d(const Standard_Integer Index,
|
||||
const Standard_Boolean OnFirst) const
|
||||
{
|
||||
const IntPatch_Point& thept = myIntersector.Point(Index);
|
||||
Standard_Real U,V;
|
||||
if (OnFirst)
|
||||
thept.ParametersOnS1(U,V);
|
||||
else
|
||||
thept.ParametersOnS2(U,V);
|
||||
return gp_Pnt2d(U,V);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasLineOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomInt_IntSS::HasLineOnS1(const Standard_Integer index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::HasLineOnS1");
|
||||
return (!slineS1(index).IsNull());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasLineOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomInt_IntSS::HasLineOnS2(const Standard_Integer index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::HasLineOnS2");
|
||||
return (!slineS2(index).IsNull());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LineOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Geom2d_Curve) & GeomInt_IntSS::LineOnS1(const Standard_Integer Index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::LineOnS1");
|
||||
return slineS1(Index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LineOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Geom2d_Curve) & GeomInt_IntSS::LineOnS2(const Standard_Integer Index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::LineOnS2");
|
||||
return slineS2(Index);
|
||||
}
|
136
src/GeomInt/GeomInt_IntSS.lxx
Executable file
136
src/GeomInt/GeomInt_IntSS.lxx
Executable file
@@ -0,0 +1,136 @@
|
||||
// File: GeomInt_IntSS.lxx
|
||||
// Created: Fri Jan 27 10:40:51 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
#include <IntPatch_Point.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomInt_IntSS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline GeomInt_IntSS::GeomInt_IntSS ()
|
||||
: myNbrestr(0),
|
||||
myTolReached2d(0.0),
|
||||
myTolReached3d(0.0),
|
||||
myTolCheck(0.0000001),
|
||||
myTolAngCheck(0.3)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomInt_IntSS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline GeomInt_IntSS::GeomInt_IntSS (const Handle(Geom_Surface)& S1,
|
||||
const Handle(Geom_Surface)& S2,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean Approx,
|
||||
const Standard_Boolean ApproxS1,
|
||||
const Standard_Boolean ApproxS2)
|
||||
: myNbrestr(0),
|
||||
myTolReached2d(0.0),
|
||||
myTolReached3d(0.0),
|
||||
myTolCheck(0.0000001),
|
||||
myTolAngCheck(0.3)
|
||||
{
|
||||
Perform(S1,S2,Tol,Approx,ApproxS1,ApproxS2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Intersection of Adapted surfaces
|
||||
//=======================================================================
|
||||
inline void GeomInt_IntSS::Perform(const Handle(GeomAdaptor_HSurface)& HS1,
|
||||
const Handle(GeomAdaptor_HSurface)& HS2,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean Approx,
|
||||
const Standard_Boolean ApproxS1,
|
||||
const Standard_Boolean ApproxS2)
|
||||
{
|
||||
myHS1 = HS1;
|
||||
myHS2 = HS2;
|
||||
InternalPerform(Tol,Approx,ApproxS1,ApproxS2,Standard_False,0.,0.,0.,0.);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Intersection of Adapted surfaces with a Starting Point
|
||||
//=======================================================================
|
||||
inline void GeomInt_IntSS::Perform(const Handle(GeomAdaptor_HSurface)& HS1,
|
||||
const Handle(GeomAdaptor_HSurface)& HS2,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Real U1, const Standard_Real V1,
|
||||
const Standard_Real U2, const Standard_Real V2,
|
||||
const Standard_Boolean Approx,
|
||||
const Standard_Boolean ApproxS1,
|
||||
const Standard_Boolean ApproxS2)
|
||||
{
|
||||
myHS1 = HS1;
|
||||
myHS2 = HS2;
|
||||
InternalPerform(Tol,Approx,ApproxS1,ApproxS2,Standard_True,U1,V1,U2,V2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean GeomInt_IntSS::IsDone () const
|
||||
{
|
||||
return myIntersector.IsDone();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TolReached2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real GeomInt_IntSS::TolReached2d () const
|
||||
{
|
||||
return myTolReached2d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TolReached3d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real GeomInt_IntSS::TolReached3d () const
|
||||
{
|
||||
return myTolReached3d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbLines
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer GeomInt_IntSS::NbLines () const
|
||||
{
|
||||
return sline.Length()-myNbrestr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbBoundaries
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer GeomInt_IntSS::NbBoundaries () const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"");
|
||||
return myNbrestr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer GeomInt_IntSS::NbPoints () const
|
||||
{
|
||||
return myIntersector.NbPnts();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline gp_Pnt GeomInt_IntSS::Point (const Standard_Integer Index) const
|
||||
{
|
||||
return myIntersector.Point(Index).Value();
|
||||
}
|
1967
src/GeomInt/GeomInt_IntSS_1.cxx
Executable file
1967
src/GeomInt/GeomInt_IntSS_1.cxx
Executable file
File diff suppressed because it is too large
Load Diff
81
src/GeomInt/GeomInt_LineConstructor.cdl
Executable file
81
src/GeomInt/GeomInt_LineConstructor.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: GeomInt_LineConstructor.cdl
|
||||
-- Created: Tue Feb 7 10:07:01 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class LineConstructor from GeomInt
|
||||
|
||||
---Purpose: Splits given Line.
|
||||
|
||||
uses Line from IntPatch,
|
||||
TopolTool from Adaptor3d,
|
||||
HSurface from GeomAdaptor,
|
||||
SequenceOfReal from TColStd
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns LineConstructor from GeomInt;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Load(me: in out; D1,D2: TopolTool from Adaptor3d;
|
||||
S1,S2: HSurface from GeomAdaptor)
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Initializes me by two surfaces and corresponding
|
||||
--- tools which represent boundaries of surfaces
|
||||
---
|
||||
|
||||
Perform(me: in out; L: Line from IntPatch)
|
||||
is static;
|
||||
---Purpose:
|
||||
--- Splits line
|
||||
---
|
||||
|
||||
IsDone(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Returns True if splitting was successful
|
||||
---
|
||||
|
||||
NbParts(me)
|
||||
returns Integer from Standard
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Returns number of splits
|
||||
---
|
||||
|
||||
Part(me; I: Integer from Standard; WFirst,WLast: out Real from Standard)
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Return first and last parameters
|
||||
--- for given index of split
|
||||
---
|
||||
|
||||
PeriodicLine(me; L: Line from IntPatch)
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
seqp : SequenceOfReal from TColStd;
|
||||
myDom1: TopolTool from Adaptor3d;
|
||||
myDom2: TopolTool from Adaptor3d;
|
||||
myHS1 : HSurface from GeomAdaptor;
|
||||
myHS2 : HSurface from GeomAdaptor;
|
||||
|
||||
end LineConstructor;
|
612
src/GeomInt/GeomInt_LineConstructor.cxx
Executable file
612
src/GeomInt/GeomInt_LineConstructor.cxx
Executable file
@@ -0,0 +1,612 @@
|
||||
// File: GeomInt_LineConstructor.cxx
|
||||
// Created: Tue Feb 7 10:12:45 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
#include <GeomInt_LineConstructor.ixx>
|
||||
|
||||
#include <GeomInt_LineTool.hxx>
|
||||
#include <GeomInt_SequenceOfParameterAndOrientation.hxx>
|
||||
#include <GeomInt_ParameterAndOrientation.hxx>
|
||||
|
||||
#include <IntPatch_Point.hxx>
|
||||
#include <IntPatch_GLine.hxx>
|
||||
#include <IntPatch_WLine.hxx>
|
||||
#include <IntPatch_ALine.hxx>
|
||||
#include <IntSurf_Transition.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Recadre
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
Standard_Real& u1,
|
||||
Standard_Real& v1,
|
||||
Standard_Real& u2,
|
||||
Standard_Real& v2)
|
||||
{
|
||||
Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs1 = myHS1->GetType();
|
||||
switch (typs1)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS1IsUPeriodic = Standard_True;
|
||||
myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Le cas de biparametrees periodiques est gere en amont
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs2 = myHS2->GetType();
|
||||
switch (typs2)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS2IsUPeriodic = Standard_True;
|
||||
myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Le cas de biparametrees periodiques est gere en amont
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(myHS1IsUPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS1->UPeriod();
|
||||
const Standard_Real f = myHS1->FirstUParameter();
|
||||
const Standard_Real l = myHS1->LastUParameter();
|
||||
while(u1 < f) { u1+=lmf; }
|
||||
while(u1 > l) { u1-=lmf; }
|
||||
}
|
||||
if(myHS1IsVPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS1->VPeriod();
|
||||
const Standard_Real f = myHS1->FirstVParameter();
|
||||
const Standard_Real l = myHS1->LastVParameter();
|
||||
while(v1 < f) { v1+=lmf; }
|
||||
while(v1 > l) { v1-=lmf; }
|
||||
}
|
||||
if(myHS2IsUPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS2->UPeriod();
|
||||
const Standard_Real f = myHS2->FirstUParameter();
|
||||
const Standard_Real l = myHS2->LastUParameter();
|
||||
while(u2 < f) { u2+=lmf; }
|
||||
while(u2 > l) { u2-=lmf; }
|
||||
}
|
||||
if(myHS2IsVPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS2->VPeriod();
|
||||
const Standard_Real f = myHS2->FirstVParameter();
|
||||
const Standard_Real l = myHS2->LastVParameter();
|
||||
while(v2 < f) { v2+=lmf; }
|
||||
while(v2 > l) { v2-=lmf; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
const gp_Pnt& Ptref,
|
||||
Standard_Real& U1,
|
||||
Standard_Real& V1,
|
||||
Standard_Real& U2,
|
||||
Standard_Real& V2)
|
||||
{
|
||||
IntSurf_Quadric quad1,quad2;
|
||||
switch (myHS1->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad1.SetValue(myHS1->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad1.SetValue(myHS1->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad1.SetValue(myHS1->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("GeomInt_LineConstructor::Parameters");
|
||||
}
|
||||
switch (myHS2->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad2.SetValue(myHS2->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad2.SetValue(myHS2->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad2.SetValue(myHS2->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("GeomInt_LineConstructor::Parameters");
|
||||
}
|
||||
quad1.Parameters(Ptref,U1,V1);
|
||||
quad2.Parameters(Ptref,U2,V2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
{
|
||||
Standard_Integer i,nbvtx;
|
||||
Standard_Real firstp,lastp;
|
||||
const Standard_Real Tol = Precision::PConfusion() * 35.0;
|
||||
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
if(typl == IntPatch_Analytic)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_ALine)& ALine = *((Handle(IntPatch_ALine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(firstp!=lastp)
|
||||
{
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
const gp_Pnt Pmid = ALine->Value(pmid);
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) {
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
else if(typl == IntPatch_Walking)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_WLine)& WLine = *((Handle(IntPatch_WLine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(firstp!=lastp)
|
||||
{
|
||||
const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
|
||||
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
|
||||
Pmid.Parameters(u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) { //-- !=ON
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
else if (typl != IntPatch_Restriction)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
Standard_Boolean intrvtested = Standard_False;
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(Abs(firstp-lastp)>Precision::PConfusion())
|
||||
{
|
||||
intrvtested = Standard_True;
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
gp_Pnt Pmid;
|
||||
switch (typl)
|
||||
{
|
||||
case IntPatch_Lin: Pmid = ElCLib::Value(pmid,GLine->Line()); break;
|
||||
case IntPatch_Circle: Pmid = ElCLib::Value(pmid,GLine->Circle()); break;
|
||||
case IntPatch_Ellipse: Pmid = ElCLib::Value(pmid,GLine->Ellipse()); break;
|
||||
case IntPatch_Hyperbola: Pmid = ElCLib::Value(pmid,GLine->Hyperbola()); break;
|
||||
case IntPatch_Parabola: Pmid = ElCLib::Value(pmid,GLine->Parabola()); break;
|
||||
}
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) {
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
|
||||
lastp = PI + PI + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
|
||||
const Standard_Real cadrinf = GeomInt_LineTool::FirstParameter(L);
|
||||
const Standard_Real cadrsup = GeomInt_LineTool::LastParameter(L);
|
||||
Standard_Real acadr = (firstp+lastp)*0.5;
|
||||
while(acadr < cadrinf) { acadr+=PI+PI; }
|
||||
while(acadr > cadrsup) { acadr-=PI+PI; }
|
||||
if(acadr>=cadrinf && acadr<=cadrsup)
|
||||
{
|
||||
if(Abs(firstp-lastp)>Precision::PConfusion())
|
||||
{
|
||||
intrvtested = Standard_True;
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
gp_Pnt Pmid;
|
||||
if (typl == IntPatch_Circle)
|
||||
Pmid = ElCLib::Value(pmid,GLine->Circle());
|
||||
else
|
||||
Pmid = ElCLib::Value(pmid,GLine->Ellipse());
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) {
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!intrvtested) {
|
||||
// on garde a priori. Il faudrait un point 2d sur chaque
|
||||
// surface pour prendre la decision. Sera fait dans
|
||||
// l`appelant
|
||||
seqp.Append(GeomInt_LineTool::FirstParameter(L));
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
}
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
done = Standard_False;
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
if (nbvtx == 0) { // on garde a priori. Il faudrait un point 2d sur chaque
|
||||
// surface pour prendre la decision. Sera fait dans
|
||||
// l`appelant
|
||||
seqp.Append(GeomInt_LineTool::FirstParameter(L));
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
GeomInt_SequenceOfParameterAndOrientation seqpss;
|
||||
TopAbs_Orientation or1=TopAbs_FORWARD,or2=TopAbs_FORWARD;
|
||||
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
const IntPatch_Point& thevtx = GeomInt_LineTool::Vertex(L,i);
|
||||
const Standard_Real prm = thevtx.ParameterOnLine();
|
||||
if (thevtx.IsOnDomS1())
|
||||
{
|
||||
switch (thevtx.TransitionLineArc1().TransitionType())
|
||||
{
|
||||
case IntSurf_In: or1 = TopAbs_FORWARD; break;
|
||||
case IntSurf_Out: or1 = TopAbs_REVERSED; break;
|
||||
case IntSurf_Touch: or1 = TopAbs_INTERNAL; break;
|
||||
case IntSurf_Undecided: or1 = TopAbs_INTERNAL; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
or1 = TopAbs_INTERNAL;
|
||||
|
||||
if (thevtx.IsOnDomS2())
|
||||
{
|
||||
switch (thevtx.TransitionLineArc2().TransitionType())
|
||||
{
|
||||
case IntSurf_In: or2 = TopAbs_FORWARD; break;
|
||||
case IntSurf_Out: or2 = TopAbs_REVERSED; break;
|
||||
case IntSurf_Touch: or2 = TopAbs_INTERNAL; break;
|
||||
case IntSurf_Undecided: or2 = TopAbs_INTERNAL; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
or2 = TopAbs_INTERNAL;
|
||||
|
||||
const Standard_Integer nbinserted = seqpss.Length();
|
||||
Standard_Boolean inserted = Standard_False;
|
||||
for (Standard_Integer j=1; j<=nbinserted;j++)
|
||||
{
|
||||
if (Abs(prm-seqpss(j).Parameter()) <= Tol)
|
||||
{
|
||||
// on cumule
|
||||
GeomInt_ParameterAndOrientation& valj = seqpss.ChangeValue(j);
|
||||
if (or1 != TopAbs_INTERNAL) {
|
||||
if (valj.Orientation1() != TopAbs_INTERNAL) {
|
||||
if (or1 != valj.Orientation1()) {
|
||||
valj.SetOrientation1(TopAbs_INTERNAL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
valj.SetOrientation1(or1);
|
||||
}
|
||||
}
|
||||
|
||||
if (or2 != TopAbs_INTERNAL) {
|
||||
if (valj.Orientation2() != TopAbs_INTERNAL) {
|
||||
if (or2 != valj.Orientation2()) {
|
||||
valj.SetOrientation2(TopAbs_INTERNAL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
valj.SetOrientation2(or2);
|
||||
}
|
||||
}
|
||||
|
||||
inserted = Standard_True;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prm < seqpss(j).Parameter()-Tol ) {
|
||||
// on insere avant la position j
|
||||
seqpss.InsertBefore(j,GeomInt_ParameterAndOrientation(prm,or1,or2));
|
||||
inserted = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!inserted) {
|
||||
seqpss.Append(GeomInt_ParameterAndOrientation(prm,or1,or2));
|
||||
}
|
||||
}
|
||||
|
||||
// on determine l`etat en debut de ligne
|
||||
Standard_Boolean trim = Standard_False;
|
||||
Standard_Boolean dansS1 = Standard_False;
|
||||
Standard_Boolean dansS2 = Standard_False;
|
||||
|
||||
nbvtx = seqpss.Length();
|
||||
for (i=1; i<= nbvtx; i++)
|
||||
{
|
||||
or1 = seqpss(i).Orientation1();
|
||||
if (or1 != TopAbs_INTERNAL)
|
||||
{
|
||||
trim = Standard_True;
|
||||
dansS1 = (or1 != TopAbs_FORWARD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > nbvtx)
|
||||
{
|
||||
Standard_Real U,V;
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
|
||||
{
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS1() )
|
||||
{
|
||||
GeomInt_LineTool::Vertex(L,i).ParametersOnS1(U,V);
|
||||
gp_Pnt2d PPCC(U,V);
|
||||
if (myDom1->Classify(PPCC,Tol) == TopAbs_OUT) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
dansS1 = Standard_True; // on garde dans le doute
|
||||
}
|
||||
|
||||
for (i=1; i<= nbvtx; i++)
|
||||
{
|
||||
or2 = seqpss(i).Orientation2();
|
||||
if (or2 != TopAbs_INTERNAL)
|
||||
{
|
||||
trim = Standard_True;
|
||||
dansS2 = (or2 != TopAbs_FORWARD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > nbvtx)
|
||||
{
|
||||
Standard_Real U,V;
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
|
||||
{
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS2() )
|
||||
{
|
||||
GeomInt_LineTool::Vertex(L,i).ParametersOnS2(U,V);
|
||||
if (myDom2->Classify(gp_Pnt2d(U,V),Tol) == TopAbs_OUT) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
dansS2 = Standard_True; // on garde dans le doute
|
||||
}
|
||||
|
||||
if (!trim) { // on a necessairement dansS1 == dansS2 == Standard_True
|
||||
seqp.Append(GeomInt_LineTool::FirstParameter(L));
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
// On epluche la sequence seqpss pour constituer les bouts valides
|
||||
// et les stocker dans seqp(2*i+1) et seqp(2*i+2)
|
||||
Standard_Real thefirst = GeomInt_LineTool::FirstParameter(L);
|
||||
Standard_Real thelast = GeomInt_LineTool::LastParameter(L);
|
||||
firstp = thefirst;
|
||||
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
or1 = seqpss(i).Orientation1();
|
||||
or2 = seqpss(i).Orientation2();
|
||||
if (dansS1 && dansS2)
|
||||
{
|
||||
if (or1 == TopAbs_REVERSED)
|
||||
dansS1 = Standard_False;
|
||||
/*else if (or1 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
if (or2 == TopAbs_REVERSED)
|
||||
dansS2 = Standard_False;
|
||||
/*else if (or2 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
if (!dansS1 || !dansS2)
|
||||
{
|
||||
lastp = seqpss(i).Parameter();
|
||||
Standard_Real stofirst = Max(firstp, thefirst);
|
||||
Standard_Real stolast = Min(lastp, thelast) ;
|
||||
if (stolast > stofirst) {
|
||||
seqp.Append(stofirst);
|
||||
seqp.Append(stolast);
|
||||
}
|
||||
if (lastp > thelast)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dansS1)
|
||||
{
|
||||
if (or1 == TopAbs_REVERSED)
|
||||
dansS1 = Standard_False;
|
||||
/*else if (or1 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (or1 == TopAbs_FORWARD)
|
||||
dansS1 = Standard_True;
|
||||
/*else if (or1 == TopAbs_REVERSED) {
|
||||
}*/
|
||||
}
|
||||
if (dansS2)
|
||||
{
|
||||
if (or2 == TopAbs_REVERSED)
|
||||
dansS2 = Standard_False;
|
||||
/*else if (or2 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (or2 == TopAbs_FORWARD)
|
||||
dansS2 = Standard_True;
|
||||
/*else if (or2 == TopAbs_REVERSED) {
|
||||
}*/
|
||||
}
|
||||
if (dansS1 && dansS2)
|
||||
firstp = seqpss(i).Parameter();
|
||||
}
|
||||
}
|
||||
|
||||
// le petit dernier a rajouter
|
||||
if (dansS1 && dansS2)
|
||||
{
|
||||
lastp = thelast;
|
||||
firstp = Max(firstp,thefirst);
|
||||
if (lastp > firstp) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
done = Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PeriodicLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomInt_LineConstructor::PeriodicLine (const Handle(IntPatch_Line)& L) const
|
||||
{
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
if (typl != IntPatch_Circle && typl != IntPatch_Ellipse)
|
||||
return;
|
||||
|
||||
const Standard_Real Tol = Precision::PConfusion();
|
||||
Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
|
||||
Standard_Integer i,j,nbvtx = glin->NbVertex();
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
IntPatch_Point thevtx = glin->Vertex(i);
|
||||
const Standard_Real prm = thevtx.ParameterOnLine();
|
||||
Standard_Boolean changevtx = Standard_False;
|
||||
if (thevtx.IsOnDomS1() || thevtx.IsOnDomS2())
|
||||
{
|
||||
for (j=1; j<=nbvtx; j++)
|
||||
{
|
||||
if (j!=i)
|
||||
{
|
||||
const IntPatch_Point& thevtxbis = glin->Vertex(j);
|
||||
const Standard_Real prmbis = thevtxbis.ParameterOnLine();
|
||||
if (Abs(prm-prmbis) <= Tol)
|
||||
{
|
||||
Standard_Real u,v;
|
||||
gp_Pnt2d p2d;
|
||||
if (thevtx.IsOnDomS1() && thevtxbis.IsOnDomS1() &&
|
||||
thevtxbis.TransitionLineArc1().TransitionType()==IntSurf_In)
|
||||
{
|
||||
p2d = thevtx.ArcOnS1()->Value(thevtx.ParameterOnArc1());
|
||||
u = p2d.X(); v = p2d.Y();
|
||||
p2d = thevtxbis.ArcOnS1()->Value(thevtxbis.ParameterOnArc1());
|
||||
if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
|
||||
{
|
||||
changevtx = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (thevtx.IsOnDomS2() && thevtxbis.IsOnDomS2() &&
|
||||
thevtxbis.TransitionLineArc2().TransitionType()==IntSurf_In)
|
||||
{
|
||||
p2d = thevtx.ArcOnS2()->Value(thevtx.ParameterOnArc2());
|
||||
u = p2d.X(); v = p2d.Y();
|
||||
p2d = thevtxbis.ArcOnS2()->Value(thevtxbis.ParameterOnArc2());
|
||||
if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
|
||||
{
|
||||
changevtx = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changevtx) {
|
||||
thevtx.SetParameter(prm + 2.*PI);
|
||||
glin->Replace(i,thevtx);
|
||||
}
|
||||
}
|
||||
}
|
69
src/GeomInt/GeomInt_LineConstructor.lxx
Executable file
69
src/GeomInt/GeomInt_LineConstructor.lxx
Executable file
@@ -0,0 +1,69 @@
|
||||
// File: GeomInt_LineConstructor.lxx
|
||||
// Created: Tue Feb 7 10:12:45 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomInt_LineConstructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline GeomInt_LineConstructor::GeomInt_LineConstructor ()
|
||||
: done(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void GeomInt_LineConstructor::Load (const Handle(Adaptor3d_TopolTool)& D1,
|
||||
const Handle(Adaptor3d_TopolTool)& D2,
|
||||
const Handle(GeomAdaptor_HSurface)& S1,
|
||||
const Handle(GeomAdaptor_HSurface)& S2)
|
||||
{
|
||||
myDom1 = D1;
|
||||
myDom2 = D2;
|
||||
myHS1 = S1;
|
||||
myHS2 = S2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean GeomInt_LineConstructor::IsDone () const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbParts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer GeomInt_LineConstructor::NbParts () const
|
||||
{
|
||||
if (!done) { StdFail_NotDone::Raise(); }
|
||||
return (seqp.Length() / 2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Part
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void GeomInt_LineConstructor::Part (const Standard_Integer I,
|
||||
Standard_Real& WFirst,
|
||||
Standard_Real& WLast) const
|
||||
{
|
||||
if (!done) { StdFail_NotDone::Raise(); }
|
||||
WFirst = seqp(2*I-1);
|
||||
WLast = seqp(2*I);
|
||||
}
|
40
src/GeomInt/GeomInt_LineTool.cdl
Executable file
40
src/GeomInt/GeomInt_LineTool.cdl
Executable file
@@ -0,0 +1,40 @@
|
||||
-- File: GeomInt_LineTool.cdl
|
||||
-- Created: Wed Feb 8 09:42:03 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@topsn2>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
class LineTool from GeomInt
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Line from IntPatch,
|
||||
Point from IntPatch,
|
||||
Pnt2d from gp
|
||||
|
||||
is
|
||||
|
||||
|
||||
NbVertex(myclass; L: Line from IntPatch)
|
||||
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
Vertex(myclass; L:Line from IntPatch; I: Integer from Standard)
|
||||
|
||||
returns Point from IntPatch;
|
||||
---C++: return const&
|
||||
|
||||
FirstParameter(myclass; L: Line from IntPatch)
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
LastParameter(myclass; L: Line from IntPatch)
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
end LineTool;
|
154
src/GeomInt/GeomInt_LineTool.cxx
Executable file
154
src/GeomInt/GeomInt_LineTool.cxx
Executable file
@@ -0,0 +1,154 @@
|
||||
// File: GeomInt_LineTool.cxx
|
||||
// Created: Wed Feb 8 10:00:15 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
#include <GeomInt_LineTool.ixx>
|
||||
|
||||
#include <IntPatch_WLine.hxx>
|
||||
#include <IntPatch_RLine.hxx>
|
||||
#include <IntPatch_ALine.hxx>
|
||||
#include <IntPatch_GLine.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GeomInt_LineTool::NbVertex(const Handle(IntPatch_Line)& L)
|
||||
{
|
||||
switch (L->ArcType())
|
||||
{
|
||||
case IntPatch_Analytic: return Handle(IntPatch_ALine)::DownCast(L)->NbVertex();
|
||||
case IntPatch_Restriction: return Handle(IntPatch_RLine)::DownCast(L)->NbVertex();
|
||||
case IntPatch_Walking: return Handle(IntPatch_WLine)::DownCast(L)->NbVertex();
|
||||
default: break;
|
||||
}
|
||||
return Handle(IntPatch_GLine)::DownCast(L)->NbVertex();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Vertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntPatch_Point & GeomInt_LineTool::Vertex(const Handle(IntPatch_Line)& L,
|
||||
const Standard_Integer I)
|
||||
{
|
||||
switch (L->ArcType())
|
||||
{
|
||||
case IntPatch_Analytic: return Handle(IntPatch_ALine)::DownCast(L)->Vertex(I);
|
||||
case IntPatch_Restriction: return Handle(IntPatch_RLine)::DownCast(L)->Vertex(I);
|
||||
case IntPatch_Walking: return Handle(IntPatch_WLine)::DownCast(L)->Vertex(I);
|
||||
default: break;
|
||||
}
|
||||
return Handle(IntPatch_GLine)::DownCast(L)->Vertex(I);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GeomInt_LineTool::FirstParameter (const Handle(IntPatch_Line)& L)
|
||||
{
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
switch (typl)
|
||||
{
|
||||
case IntPatch_Analytic:
|
||||
{
|
||||
Handle(IntPatch_ALine) alin = Handle(IntPatch_ALine)::DownCast(L);
|
||||
if (alin->HasFirstPoint())
|
||||
return alin->FirstPoint().ParameterOnLine();
|
||||
Standard_Boolean included;
|
||||
Standard_Real firstp = alin->FirstParameter(included);
|
||||
if (!included)
|
||||
firstp += Epsilon(firstp);
|
||||
return firstp;
|
||||
}
|
||||
|
||||
case IntPatch_Restriction:
|
||||
{
|
||||
Handle(IntPatch_RLine) rlin = Handle(IntPatch_RLine)::DownCast(L);
|
||||
return (rlin->HasFirstPoint()? rlin->FirstPoint().ParameterOnLine() : -Precision::Infinite()); // a voir selon le type de la ligne 2d
|
||||
}
|
||||
|
||||
case IntPatch_Walking:
|
||||
{
|
||||
Handle(IntPatch_WLine) wlin = Handle(IntPatch_WLine)::DownCast(L);
|
||||
return (wlin->HasFirstPoint()? wlin->FirstPoint().ParameterOnLine() : 1.);
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
|
||||
if (glin->HasFirstPoint())
|
||||
return glin->FirstPoint().ParameterOnLine();
|
||||
switch (typl)
|
||||
{
|
||||
case IntPatch_Lin:
|
||||
case IntPatch_Parabola:
|
||||
case IntPatch_Hyperbola:
|
||||
return -Precision::Infinite();
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LastParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GeomInt_LineTool::LastParameter (const Handle(IntPatch_Line)& L)
|
||||
{
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
switch (typl)
|
||||
{
|
||||
case IntPatch_Analytic:
|
||||
{
|
||||
Handle(IntPatch_ALine) alin = Handle(IntPatch_ALine)::DownCast(L);
|
||||
if (alin->HasLastPoint())
|
||||
return alin->LastPoint().ParameterOnLine();
|
||||
Standard_Boolean included;
|
||||
Standard_Real lastp = alin->LastParameter(included);
|
||||
if (!included)
|
||||
lastp -=Epsilon(lastp);
|
||||
return lastp;
|
||||
}
|
||||
|
||||
case IntPatch_Restriction:
|
||||
{
|
||||
Handle(IntPatch_RLine) rlin = Handle(IntPatch_RLine)::DownCast(L);
|
||||
return (rlin->HasLastPoint()? rlin->LastPoint().ParameterOnLine() : Precision::Infinite()); // a voir selon le type de la ligne 2d
|
||||
}
|
||||
|
||||
case IntPatch_Walking:
|
||||
{
|
||||
Handle(IntPatch_WLine) wlin = Handle(IntPatch_WLine)::DownCast(L);
|
||||
return (wlin->HasLastPoint()? wlin->LastPoint().ParameterOnLine() : wlin->NbPnts());
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
|
||||
if (glin->HasLastPoint())
|
||||
return glin->LastPoint().ParameterOnLine();
|
||||
switch (typl)
|
||||
{
|
||||
case IntPatch_Lin:
|
||||
case IntPatch_Parabola:
|
||||
case IntPatch_Hyperbola:
|
||||
return Precision::Infinite();
|
||||
case IntPatch_Circle:
|
||||
case IntPatch_Ellipse:
|
||||
return 2.*PI;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0;
|
||||
}
|
60
src/GeomInt/GeomInt_ParameterAndOrientation.cdl
Executable file
60
src/GeomInt/GeomInt_ParameterAndOrientation.cdl
Executable file
@@ -0,0 +1,60 @@
|
||||
-- File: GeomInt_ParameterAndOrientation.cdl
|
||||
-- Created: Wed Feb 8 09:32:29 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@topsn2>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
private class ParameterAndOrientation from GeomInt
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Orientation from TopAbs
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns ParameterAndOrientation from GeomInt;
|
||||
|
||||
|
||||
Create(P: Real from Standard; Or1,Or2: Orientation from TopAbs)
|
||||
|
||||
returns ParameterAndOrientation from GeomInt;
|
||||
|
||||
|
||||
SetOrientation1(me: in out; Or: Orientation from TopAbs)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetOrientation2(me: in out; Or: Orientation from TopAbs)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Parameter(me)
|
||||
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
|
||||
Orientation1(me)
|
||||
|
||||
returns Orientation from TopAbs
|
||||
is static;
|
||||
|
||||
|
||||
Orientation2(me)
|
||||
|
||||
returns Orientation from TopAbs
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
prm : Real from Standard;
|
||||
or1 : Orientation from TopAbs;
|
||||
or2 : Orientation from TopAbs;
|
||||
|
||||
end ParameterAndOrientation;
|
83
src/GeomInt/GeomInt_ParameterAndOrientation.cxx
Executable file
83
src/GeomInt/GeomInt_ParameterAndOrientation.cxx
Executable file
@@ -0,0 +1,83 @@
|
||||
// File: GeomInt_ParameterAndOrientation.cxx
|
||||
// Created: Wed Feb 8 09:37:12 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// <jag@topsn2>
|
||||
|
||||
|
||||
#include <GeomInt_ParameterAndOrientation.ixx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomInt_ParameterAndOrientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomInt_ParameterAndOrientation::GeomInt_ParameterAndOrientation() :
|
||||
prm(0.0),or1(TopAbs_FORWARD),or2(TopAbs_FORWARD)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomInt_ParameterAndOrientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomInt_ParameterAndOrientation::GeomInt_ParameterAndOrientation
|
||||
(const Standard_Real P,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2) : prm(P), or1(Or1), or2(Or2)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetOrientation1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomInt_ParameterAndOrientation::SetOrientation1
|
||||
(const TopAbs_Orientation Or1)
|
||||
{
|
||||
or1 = Or1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetOrientation2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomInt_ParameterAndOrientation::SetOrientation2
|
||||
(const TopAbs_Orientation Or2)
|
||||
{
|
||||
or2 = Or2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GeomInt_ParameterAndOrientation::Parameter () const
|
||||
{
|
||||
return prm;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Orientation1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_Orientation GeomInt_ParameterAndOrientation::Orientation1 () const
|
||||
{
|
||||
return or1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Orientation2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_Orientation GeomInt_ParameterAndOrientation::Orientation2 () const
|
||||
{
|
||||
return or2;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user