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:
54
src/BRepClass/BRepClass.cdl
Executable file
54
src/BRepClass/BRepClass.cdl
Executable file
@@ -0,0 +1,54 @@
|
||||
-- File: BRepClass.cdl
|
||||
-- Created: Wed Nov 18 16:27:04 1992
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
package BRepClass
|
||||
|
||||
---Purpose: The BRepClass packages provides classification
|
||||
-- algorithms for the BRep topology. It instantiates
|
||||
-- the algorithms from the package TopClass.
|
||||
|
||||
uses
|
||||
gp,
|
||||
TopAbs,
|
||||
TopoDS,
|
||||
TopExp,
|
||||
BRepTools,
|
||||
Geom2dInt,
|
||||
TopClass,
|
||||
--- IntCurveSurface,
|
||||
Bnd
|
||||
|
||||
|
||||
|
||||
|
||||
is
|
||||
class Edge;
|
||||
---Purpose: Stores the Edge and the Face.
|
||||
|
||||
class Intersector;
|
||||
---Purpose: Intersect an Edge with a segment. This class is
|
||||
-- inherited from IntConicCurveOfGInter from
|
||||
-- Geom2dInt.
|
||||
|
||||
class FacePassiveClassifier instantiates Classifier2d from TopClass
|
||||
(Edge from BRepClass,
|
||||
Intersector from BRepClass);
|
||||
|
||||
class FaceExplorer;
|
||||
---Purpose: Exploration of a Face to return UV edges.
|
||||
|
||||
class FClassifier instantiates FaceClassifier from TopClass
|
||||
(FaceExplorer from BRepClass,
|
||||
Edge from BRepClass,
|
||||
Intersector from BRepClass);
|
||||
|
||||
class FaceClassifier;
|
||||
---Purpose: Inherited from FClassifier to provide a
|
||||
-- Constructor with a Face.
|
||||
|
||||
|
||||
end BRepClass;
|
41
src/BRepClass/BRepClass_Edge.cdl
Executable file
41
src/BRepClass/BRepClass_Edge.cdl
Executable file
@@ -0,0 +1,41 @@
|
||||
-- File: Edge.cdl
|
||||
-- Created: Thu Nov 19 12:37:51 1992
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
|
||||
class Edge from BRepClass
|
||||
|
||||
---Purpose: This class is used to send the description of an
|
||||
-- Edge to the classifier. It contains an Edge and a
|
||||
-- Face. So the PCurve of the Edge can be found.
|
||||
|
||||
uses
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS
|
||||
|
||||
is
|
||||
Create returns Edge from BRepClass;
|
||||
|
||||
Create (E : Edge from TopoDS; F : Face from TopoDS)
|
||||
returns Edge from BRepClass;
|
||||
|
||||
Edge(me : in out) returns Edge from TopoDS
|
||||
---C++: inline
|
||||
---C++: return &
|
||||
---C++: alias "const TopoDS_Edge& Edge() const;"
|
||||
is static;
|
||||
|
||||
Face(me : in out) returns Face from TopoDS
|
||||
---C++: inline
|
||||
---C++: return &
|
||||
---C++: alias "const TopoDS_Face& Face() const;"
|
||||
is static;
|
||||
|
||||
fields
|
||||
myEdge : Edge from TopoDS;
|
||||
myFace : Face from TopoDS;
|
||||
|
||||
end Edge;
|
30
src/BRepClass/BRepClass_Edge.cxx
Executable file
30
src/BRepClass/BRepClass_Edge.cxx
Executable file
@@ -0,0 +1,30 @@
|
||||
// File: BRepClass_Edge.cxx
|
||||
// Created: Thu Nov 19 14:41:41 1992
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
|
||||
#include <BRepClass_Edge.ixx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepClass_Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepClass_Edge::BRepClass_Edge()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepClass_Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepClass_Edge::BRepClass_Edge(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F) :
|
||||
myEdge(E),
|
||||
myFace(F)
|
||||
{
|
||||
}
|
||||
|
46
src/BRepClass/BRepClass_Edge.lxx
Executable file
46
src/BRepClass/BRepClass_Edge.lxx
Executable file
@@ -0,0 +1,46 @@
|
||||
// File: BRepClass_Edge.lxx
|
||||
// Created: Thu Nov 19 14:44:29 1992
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline TopoDS_Edge& BRepClass_Edge::Edge()
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Edge& BRepClass_Edge::Edge() const
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline TopoDS_Face& BRepClass_Edge::Face()
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Face& BRepClass_Edge::Face() const
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
|
67
src/BRepClass/BRepClass_FaceClassifier.cdl
Executable file
67
src/BRepClass/BRepClass_FaceClassifier.cdl
Executable file
@@ -0,0 +1,67 @@
|
||||
-- File: BRepClass_FaceClassifier.cdl
|
||||
-- Created: Fri May 28 15:13:53 1993
|
||||
-- Author: Modelistation
|
||||
-- <model@sdsun1>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class FaceClassifier from BRepClass inherits FClassifier from BRepClass
|
||||
|
||||
---Purpose: Provides Constructors.
|
||||
|
||||
uses
|
||||
FaceExplorer from BRepClass,
|
||||
Face from TopoDS,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp
|
||||
|
||||
is
|
||||
Create returns FaceClassifier from BRepClass;
|
||||
---Purpose: Empty constructor, undefined algorithm.
|
||||
|
||||
|
||||
|
||||
|
||||
Create(F : in out FaceExplorer from BRepClass;
|
||||
P : Pnt2d from gp; Tol : Real)
|
||||
returns FaceClassifier from BRepClass;
|
||||
---Purpose: Creates an algorithm to classify the Point P with
|
||||
-- Tolerance <T> on the face described by <F>.
|
||||
|
||||
Create(F : Face from TopoDS;
|
||||
P : Pnt2d from gp; Tol : Real)
|
||||
returns FaceClassifier from BRepClass;
|
||||
---Purpose: Creates an algorithm to classify the Point P with
|
||||
-- Tolerance <T> on the face <F>.
|
||||
|
||||
Perform(me : in out;
|
||||
F : Face from TopoDS;
|
||||
P : Pnt2d from gp; Tol : Real)
|
||||
---Purpose: Classify the Point P with Tolerance <T> on the
|
||||
-- face described by <F>.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
|
||||
Create(F : in out FaceExplorer from BRepClass;
|
||||
P : Pnt from gp; Tol : Real)
|
||||
returns FaceClassifier from BRepClass;
|
||||
---Purpose: Creates an algorithm to classify the Point P with
|
||||
-- Tolerance <T> on the face described by <F>.
|
||||
|
||||
Create(F : Face from TopoDS;
|
||||
P : Pnt from gp; Tol : Real)
|
||||
returns FaceClassifier from BRepClass;
|
||||
---Purpose: Creates an algorithm to classify the Point P with
|
||||
-- Tolerance <T> on the face <F>.
|
||||
|
||||
Perform(me : in out;
|
||||
F : Face from TopoDS;
|
||||
P : Pnt from gp; Tol : Real)
|
||||
---Purpose: Classify the Point P with Tolerance <T> on the
|
||||
-- face described by <F>.
|
||||
is static;
|
||||
|
||||
|
||||
end FaceClassifier;
|
120
src/BRepClass/BRepClass_FaceClassifier.cxx
Executable file
120
src/BRepClass/BRepClass_FaceClassifier.cxx
Executable file
@@ -0,0 +1,120 @@
|
||||
|
||||
#include <BRepClass_FaceClassifier.ixx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepClass_FaceClassifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepClass_FaceClassifier::BRepClass_FaceClassifier()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepClass_FaceClassifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepClass_FaceClassifier::BRepClass_FaceClassifier(BRepClass_FaceExplorer& F,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
:
|
||||
BRepClass_FClassifier(F,P,Tol)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BRepClass_FaceClassifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
|
||||
const gp_Pnt& P,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Perform(F,P,Tol);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BRepClass_FaceClassifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Perform(F,P,Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepClass_FaceClassifier::Perform(const TopoDS_Face& F,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
BRepClass_FaceExplorer Fex(F);
|
||||
BRepClass_FClassifier::Perform(Fex,P,Tol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Integer aNbExt, aIndice, i;
|
||||
Standard_Real aU1, aU2, aV1, aV2, aMaxDist, aD;
|
||||
gp_Pnt2d aPuv;
|
||||
Extrema_ExtPS aExtrema;
|
||||
//
|
||||
aMaxDist=RealLast();
|
||||
aIndice=0;
|
||||
//
|
||||
BRepAdaptor_Surface aSurf(aF);
|
||||
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
|
||||
aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, aTol, aTol);
|
||||
//
|
||||
//modified by NIZNHY-PKV Wed Aug 13 11:28:47 2008f
|
||||
rejected=Standard_True;
|
||||
//modified by NIZNHY-PKV Wed Aug 13 11:28:49 2008t
|
||||
aExtrema.Perform(aP);
|
||||
if(!aExtrema.IsDone()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aNbExt=aExtrema.NbExt();
|
||||
if(!aNbExt) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
for (i=1; i<=aNbExt; ++i) {
|
||||
aD=aExtrema.SquareDistance(i);
|
||||
if(aD < aMaxDist) {
|
||||
aMaxDist=aD;
|
||||
aIndice=i;
|
||||
}
|
||||
}
|
||||
//
|
||||
if(aIndice) {
|
||||
aExtrema.Point(aIndice).Parameter(aU1, aU2);
|
||||
aPuv.SetCoord(aU1, aU2);
|
||||
Perform(aF, aPuv, aTol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
108
src/BRepClass/BRepClass_FaceExplorer.cdl
Executable file
108
src/BRepClass/BRepClass_FaceExplorer.cdl
Executable file
@@ -0,0 +1,108 @@
|
||||
-- File: FaceExplorer.cdl
|
||||
-- Created: Thu Nov 19 14:30:44 1992
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627
|
||||
|
||||
class FaceExplorer from BRepClass
|
||||
|
||||
---Purpose: Provide an exploration of a BRep Face for the
|
||||
-- classification.
|
||||
|
||||
uses
|
||||
Orientation from TopAbs,
|
||||
Pnt2d from gp,
|
||||
Lin2d from gp,
|
||||
Face from TopoDS,
|
||||
Explorer from TopExp,
|
||||
Edge from BRepClass
|
||||
|
||||
is
|
||||
Create (F : Face from TopoDS) returns FaceExplorer from BRepClass;
|
||||
|
||||
Reject(me; P : Pnt2d from gp) returns Boolean
|
||||
---Purpose: Should return True if the point is outside a
|
||||
-- bounding volume of the face.
|
||||
is static;
|
||||
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627 Begin
|
||||
-- Segment(me; P : Pnt2d from gp;
|
||||
Segment(me: in out; P : Pnt2d from gp;
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627 End
|
||||
L : out Lin2d from gp; Par : out Real)
|
||||
---Purpose: Returns in <L>, <Par> a segment having at least
|
||||
-- one intersection with the face boundary to
|
||||
-- compute intersections.
|
||||
returns Boolean from Standard -- skv OCC12627
|
||||
is static;
|
||||
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627 Begin
|
||||
OtherSegment(me: in out; P : Pnt2d from gp;
|
||||
L : out Lin2d from gp; Par : out Real)
|
||||
---Purpose: Returns in <L>, <Par> a segment having at least
|
||||
-- one intersection with the face boundary to
|
||||
-- compute intersections. Each call gives another segment.
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627 End
|
||||
InitWires(me : in out)
|
||||
---Purpose: Starts an exploration of the wires.
|
||||
is static;
|
||||
|
||||
MoreWires(me) returns Boolean
|
||||
---Purpose: Returns True if there is a current wire.
|
||||
--
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
NextWire(me : in out)
|
||||
---Purpose: Sets the explorer to the next wire.
|
||||
--
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
RejectWire(me; L : Lin2d from gp; Par : Real) returns Boolean
|
||||
---Purpose: Returns True if the wire bounding volume does not
|
||||
-- intersect the segment.
|
||||
is static;
|
||||
|
||||
InitEdges(me : in out)
|
||||
---Purpose: Starts an exploration of the edges of the current
|
||||
-- wire.
|
||||
is static;
|
||||
|
||||
MoreEdges(me) returns Boolean
|
||||
---Purpose: Returns True if there is a current edge.
|
||||
--
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
NextEdge(me : in out)
|
||||
---Purpose: Sets the explorer to the next edge.
|
||||
--
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
RejectEdge(me; L : Lin2d from gp; Par : Real) returns Boolean
|
||||
---Purpose: Returns True if the edge bounding volume does not
|
||||
-- intersect the segment.
|
||||
is static;
|
||||
|
||||
CurrentEdge(me; E : out Edge from BRepClass;
|
||||
Or : out Orientation from TopAbs)
|
||||
---Purpose: Current edge in current wire and its orientation.
|
||||
is static;
|
||||
|
||||
fields
|
||||
myFace : Face from TopoDS;
|
||||
myWExplorer : Explorer from TopExp;
|
||||
myEExplorer : Explorer from TopExp;
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627 Begin
|
||||
myCurEdgeInd: Integer from Standard;
|
||||
myCurEdgePar: Real from Standard;
|
||||
-- Modified by skv - Wed Jul 12 10:05:54 2006 OCC12627 End
|
||||
|
||||
end FaceExplorer;
|
199
src/BRepClass/BRepClass_FaceExplorer.cxx
Executable file
199
src/BRepClass/BRepClass_FaceExplorer.cxx
Executable file
@@ -0,0 +1,199 @@
|
||||
// File: BRepClass_FaceExplorer.cxx
|
||||
// Created: Thu Nov 19 15:54:56 1992
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
|
||||
// Modified by skv - Thu Jul 13 17:42:58 2006 OCC12627
|
||||
// Total rewriting of the method Segment; add the method OtherSegment.
|
||||
|
||||
#include <BRepClass_FaceExplorer.ixx>
|
||||
#include <Precision.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepClass_FaceExplorer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) :
|
||||
myFace(F),
|
||||
myCurEdgeInd(1),
|
||||
myCurEdgePar(0.123)
|
||||
{
|
||||
myFace.Orientation(TopAbs_FORWARD);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Reject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::Reject(const gp_Pnt2d&)const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Segment
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::Segment(const gp_Pnt2d& P,
|
||||
gp_Lin2d& L,
|
||||
Standard_Real& Par)
|
||||
{
|
||||
myCurEdgeInd = 1;
|
||||
myCurEdgePar = 0.123;
|
||||
|
||||
return OtherSegment(P, L, Par);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OtherSegment
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
|
||||
gp_Lin2d& L,
|
||||
Standard_Real& Par)
|
||||
{
|
||||
TopExp_Explorer anExpF(myFace,TopAbs_EDGE);
|
||||
Standard_Integer i;
|
||||
Standard_Real aFPar;
|
||||
Standard_Real aLPar;
|
||||
Handle(Geom2d_Curve) aC2d;
|
||||
Standard_Real aTolParConf = Precision::PConfusion();
|
||||
gp_Pnt2d aPOnC;
|
||||
Standard_Real aParamIn;
|
||||
|
||||
for (i = 1; anExpF.More(); anExpF.Next(), i++) {
|
||||
if (i != myCurEdgeInd)
|
||||
continue;
|
||||
|
||||
const TopoDS_Shape &aLocalShape = anExpF.Current();
|
||||
const TopAbs_Orientation anOrientation = aLocalShape.Orientation();
|
||||
|
||||
if (anOrientation == TopAbs_FORWARD || anOrientation == TopAbs_REVERSED) {
|
||||
const TopoDS_Edge &anEdge = TopoDS::Edge(aLocalShape);
|
||||
|
||||
aC2d = BRep_Tool::CurveOnSurface(anEdge, myFace, aFPar, aLPar);
|
||||
|
||||
if (!aC2d.IsNull()) {
|
||||
// Treatment of infinite cases.
|
||||
if (Precision::IsNegativeInfinite(aFPar)) {
|
||||
if (Precision::IsPositiveInfinite(aLPar)) {
|
||||
aFPar = -1.;
|
||||
aLPar = 1.;
|
||||
} else {
|
||||
aFPar = aLPar - 1.;
|
||||
}
|
||||
} else if (Precision::IsPositiveInfinite(aLPar))
|
||||
aLPar = aFPar + 1.;
|
||||
|
||||
for (; myCurEdgePar < 0.7 ;myCurEdgePar += 0.2111) {
|
||||
aParamIn = myCurEdgePar*aFPar + (1. - myCurEdgePar)*aLPar;
|
||||
|
||||
aC2d->D0(aParamIn, aPOnC);
|
||||
Par = aPOnC.Distance(P);
|
||||
|
||||
if (Par > aTolParConf) {
|
||||
gp_Vec2d aLinVec(P, aPOnC);
|
||||
gp_Dir2d aLinDir(aLinVec);
|
||||
|
||||
L = gp_Lin2d(P, aLinDir);
|
||||
|
||||
// Check if ends of a curve lie on a line.
|
||||
aC2d->D0(aFPar, aPOnC);
|
||||
|
||||
if (L.Distance(aPOnC) > aTolParConf) {
|
||||
aC2d->D0(aLPar, aPOnC);
|
||||
|
||||
if (L.Distance(aPOnC) > aTolParConf) {
|
||||
myCurEdgePar += 0.2111;
|
||||
|
||||
if (myCurEdgePar >= 0.7) {
|
||||
myCurEdgeInd++;
|
||||
myCurEdgePar = 0.123;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // if (!aC2d.IsNull()) {
|
||||
} // if (anOrientation == TopAbs_FORWARD ...
|
||||
|
||||
// This curve is not valid for line construction. Go to another edge.
|
||||
myCurEdgeInd++;
|
||||
myCurEdgePar = 0.123;
|
||||
}
|
||||
|
||||
// nothing found, return an horizontal line
|
||||
Par = RealLast();
|
||||
L = gp_Lin2d(P,gp_Dir2d(1,0));
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepClass_FaceExplorer::InitWires()
|
||||
{
|
||||
myWExplorer.Init(myFace,TopAbs_WIRE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RejectWire NYI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::RejectWire
|
||||
(const gp_Lin2d& ,
|
||||
const Standard_Real)const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepClass_FaceExplorer::InitEdges()
|
||||
{
|
||||
myEExplorer.Init(myWExplorer.Current(),TopAbs_EDGE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RejectEdge NYI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepClass_FaceExplorer::RejectEdge
|
||||
(const gp_Lin2d& ,
|
||||
const Standard_Real )const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CurrentEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepClass_FaceExplorer::CurrentEdge(BRepClass_Edge& E,
|
||||
TopAbs_Orientation& Or) const
|
||||
{
|
||||
E.Edge() = TopoDS::Edge(myEExplorer.Current());
|
||||
E.Face() = myFace;
|
||||
Or = E.Edge().Orientation();
|
||||
}
|
||||
|
46
src/BRepClass/BRepClass_FaceExplorer.lxx
Executable file
46
src/BRepClass/BRepClass_FaceExplorer.lxx
Executable file
@@ -0,0 +1,46 @@
|
||||
// File: BRepClass_FaceExplorer.lxx
|
||||
// Created: Mon Jan 25 19:12:49 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
//=======================================================================
|
||||
//function : MoreWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepClass_FaceExplorer::MoreWires()const
|
||||
{
|
||||
return myWExplorer.More();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepClass_FaceExplorer::NextWire()
|
||||
{
|
||||
myWExplorer.Next();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MoreEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepClass_FaceExplorer::MoreEdges()const
|
||||
{
|
||||
return myEExplorer.More();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepClass_FaceExplorer::NextEdge()
|
||||
{
|
||||
myEExplorer.Next();
|
||||
}
|
||||
|
||||
|
37
src/BRepClass/BRepClass_Intersector.cdl
Executable file
37
src/BRepClass/BRepClass_Intersector.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: Intersector.cdl
|
||||
-- Created: Thu Nov 19 14:27:14 1992
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phylox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class Intersector from BRepClass
|
||||
inherits IntConicCurveOfGInter from Geom2dInt
|
||||
|
||||
---Purpose: Implement the Intersector2d required by the classifier.
|
||||
|
||||
uses
|
||||
Lin2d from gp,
|
||||
Dir2d from gp,
|
||||
Edge from BRepClass
|
||||
|
||||
is
|
||||
Create returns Intersector from BRepClass;
|
||||
|
||||
Perform(me : in out;
|
||||
L : Lin2d from gp; P : Real; Tol : Real;
|
||||
E : Edge from BRepClass)
|
||||
---Purpose: Intersect the line segment and the edge.
|
||||
is static;
|
||||
|
||||
LocalGeometry(me; E : Edge from BRepClass;
|
||||
U : Real;
|
||||
T : out Dir2d from gp;
|
||||
N : out Dir2d from gp;
|
||||
C : out Real)
|
||||
---Purpose: Returns in <T>, <N> and <C> the tangent, normal
|
||||
-- and curvature of the edge <E> at parameter value
|
||||
-- <U>.
|
||||
is static;
|
||||
|
||||
end Intersector;
|
126
src/BRepClass/BRepClass_Intersector.cxx
Executable file
126
src/BRepClass/BRepClass_Intersector.cxx
Executable file
@@ -0,0 +1,126 @@
|
||||
// File: BRepClass_Intersector.cxx
|
||||
// Created: Thu Nov 19 15:04:21 1992
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phylox>
|
||||
|
||||
|
||||
#include <BRepClass_Intersector.ixx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <IntRes2d_Domain.hxx>
|
||||
#include <Geom2dLProp_CLProps2d.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepClass_Intersector
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepClass_Intersector::BRepClass_Intersector()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||
const Standard_Real P,
|
||||
const Standard_Real Tol,
|
||||
const BRepClass_Edge& E)
|
||||
{
|
||||
|
||||
Standard_Real pfbid,plbid;
|
||||
if (BRep_Tool::CurveOnSurface(E.Edge(),E.Face(),pfbid,plbid).IsNull()) {
|
||||
done = Standard_False; // !IsDone()
|
||||
}
|
||||
else {
|
||||
IntRes2d_Domain DL;
|
||||
if(P!=RealLast())
|
||||
DL.SetValues(L.Location(),0.,Tol,ElCLib::Value(P,L),P,Tol);
|
||||
else
|
||||
DL.SetValues(L.Location(),0.,Tol,Standard_True);
|
||||
|
||||
const TopoDS_Edge& EE = E.Edge();
|
||||
const TopoDS_Face& F = E.Face();
|
||||
TopoDS_Vertex Vdeb, Vfin;
|
||||
TopExp::Vertices(EE, Vdeb, Vfin);
|
||||
BRepAdaptor_Curve2d C(EE,F);
|
||||
Standard_Real deb = C.FirstParameter(), fin = C.LastParameter();
|
||||
gp_Pnt2d pdeb,pfin;
|
||||
C.D0(deb,pdeb);
|
||||
C.D0(fin,pfin);
|
||||
Standard_Real toldeb = 1.e-5, tolfin = 1.e-5;
|
||||
#if 0
|
||||
// essai de calcul juste des tolerances du domaine
|
||||
// qui ne couche pas avec les modeles pourris de
|
||||
// styler !!
|
||||
BRepAdaptor_Surface S(F);
|
||||
gp_Vec2d vdeb,vfin;
|
||||
C.D1(deb,pdeb,vdeb);
|
||||
C.D1(fin,pfin,vfin);
|
||||
gp_Pnt P; gp_Vec DU, DV;
|
||||
S.D1(pdeb.X(),pdeb.Y(),P,DU,DV);
|
||||
Standard_Real scaldeb = (vdeb.X()*DU + vdeb.Y()*DV).Magnitude();
|
||||
scaldeb = Max(scaldeb, 1.e-5);
|
||||
toldeb = BRep_Tool::Tolerance(Vdeb)/scaldeb;
|
||||
S.D1(pfin.X(),pfin.Y(),P,DU,DV);
|
||||
Standard_Real scalfin = (vfin.X()*DU + vfin.Y()*DV).Magnitude();
|
||||
scalfin = Max(scalfin, 1.e-5);
|
||||
tolfin = BRep_Tool::Tolerance(Vfin)/scalfin;
|
||||
#endif
|
||||
|
||||
IntRes2d_Domain DE(pdeb,deb,toldeb,pfin,fin,tolfin);
|
||||
// temporary periodic domain
|
||||
if (C.Curve()->IsPeriodic()) {
|
||||
DE.SetEquivalentParameters(C.FirstParameter(),
|
||||
C.FirstParameter() +
|
||||
C.Curve()->LastParameter() -
|
||||
C.Curve()->FirstParameter());
|
||||
}
|
||||
|
||||
Handle(Geom2d_Line) GL= new Geom2d_Line(L);
|
||||
Geom2dAdaptor_Curve CGA(GL);
|
||||
Geom2dInt_GInter Inter(CGA,DL,C,DE,
|
||||
Precision::PConfusion(),
|
||||
Precision::PIntersection());
|
||||
this->SetValues(Inter);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E,
|
||||
const Standard_Real U,
|
||||
gp_Dir2d& Tang,
|
||||
gp_Dir2d& Norm,
|
||||
Standard_Real& C) const
|
||||
{
|
||||
Standard_Real f,l;
|
||||
Geom2dLProp_CLProps2d Prop(BRep_Tool::CurveOnSurface(E.Edge(),E.Face(),f,l),
|
||||
U,2,Precision::PConfusion());
|
||||
Prop.Tangent(Tang);
|
||||
C = Prop.Curvature();
|
||||
if (C > Precision::PConfusion())
|
||||
Prop.Normal(Norm);
|
||||
else
|
||||
Norm.SetCoord(Tang.Y(),-Tang.X());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user