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

22
src/TopOpeBRep/FILES Executable file
View File

@@ -0,0 +1,22 @@
FILES
TopOpeBRep_FacesFiller_1.cxx
TopOpeBRep_FacesFiller_VPonR.cxx
TopOpeBRep_EdgesIntersector_1.cxx
TopOpeBRep_vpr.cxx
TopOpeBRep_vprclo.cxx
TopOpeBRep_vprdeg.cxx
TopOpeBRep_kpart.cxx
TopOpeBRep_FaceEdgeFiller_DEB.cxx
TopOpeBRep_ProcessGR.cxx
TopOpeBRep_tools.hxx
TopOpeBRep_ProcessSectionEdges.cxx
TopOpeBRep_trace.cxx
TopOpeBRep_traceBOOPNINT.cxx
TopOpeBRep_traceALWL.cxx
TopOpeBRep_traceSIFF.hxx
TopOpeBRep_traceSIFF.cxx
TopOpeBRep_define.hxx
TopOpeBRep_DRAW.hxx
TopOpeBRep_DRAW.cxx
TopOpeBRep_sort.cxx
TopOpeBRep_mergePDS.cxx

140
src/TopOpeBRep/TopOpeBRep.cdl Executable file
View File

@@ -0,0 +1,140 @@
-- File: TopOpeBRep.cdl
-- Created: Thu Jun 17 09:59:51 1993
-- Author: Jean Yves LEBEY
---Copyright: Matra Datavision 1993
package TopOpeBRep
---Purpose: This package provides the topological operations
-- on the BRep data structure.
uses
Standard,
MMgt,
TColStd,
TopAbs,
TopoDS,
TopTools,
TopExp,
gp,
Geom,
Geom2d,
GeomAbs,
Geom2dAdaptor,
Bnd,
BRep,
BRepClass,
BRepAdaptor,
BRepTopAdaptor,
ProjLib,
IntRes2d,
Geom2dInt,
IntSurf,
IntPatch,
GeomAdaptor,
IntCurveSurface,
BRepIntCurveSurface,
TopOpeBRepDS,
TopOpeBRepTool,
TCollection
is
enumeration TypeLineCurve is
ANALYTIC,RESTRICTION,WALKING,
LINE,CIRCLE,ELLIPSE,PARABOLA,HYPERBOLA,
OTHERTYPE
end TypeLineCurve;
class VPointInter;
class Array1OfVPointInter instantiates Array1 from TCollection
(VPointInter from TopOpeBRep);
class HArray1OfVPointInter instantiates HArray1 from TCollection
(VPointInter from TopOpeBRep, Array1OfVPointInter from TopOpeBRep);
pointer PThePointOfIntersection to Point from IntPatch;
class VPointInterIterator;
pointer PPntOn2S to PntOn2S from IntSurf;
class WPointInter;
class WPointInterIterator;
class LineInter;
pointer PLineInter to LineInter from TopOpeBRep;
class Array1OfLineInter instantiates Array1 from TCollection
(LineInter from TopOpeBRep);
class HArray1OfLineInter instantiates HArray1 from TCollection
(LineInter from TopOpeBRep, Array1OfLineInter from TopOpeBRep);
class DataMapOfTopolTool instantiates DataMap from TCollection
(Shape from TopoDS,
TopolTool from BRepTopAdaptor,
ShapeMapHasher from TopTools);
pointer PIntRes2d_IntersectionPoint to IntersectionPoint from IntRes2d;
class Hctxff2d;
class Hctxee2d;
enumeration P2Dstatus is
P2DUNK,P2DINT,P2DSGF,P2DSGL,P2DNEW
end P2Dstatus;
class Point2d;
class SequenceOfPoint2d instantiates Sequence from TCollection(Point2d from TopOpeBRep);
class PointClassifier;
class VPointInterClassifier;
class GeomTool;
class FacesIntersector;
---Purpose: Describes the intersection of two faces.
pointer PFacesIntersector to FacesIntersector from TopOpeBRep;
class EdgesIntersector;
---Purpose: Describes the intersection of two edges on the same surface
pointer PEdgesIntersector to EdgesIntersector from TopOpeBRep;
class FaceEdgeIntersector;
---Purpose: Describes the intersection of a face and an edge.
class ShapeScanner;
class ShapeIntersector;
class ShapeIntersector2d;
class PointGeomTool;
class FFTransitionTool;
class Bipoint;
class ListOfBipoint instantiates List from TCollection(Bipoint);
class FacesFiller;
pointer PFacesFiller to FacesFiller from TopOpeBRep;
class FFDumper;
class EdgesFiller;
class FaceEdgeFiller;
class DSFiller;
Print(TLC : TypeLineCurve from TopOpeBRep; OS : in out OStream)
---C++: return &
returns OStream;
---Purpose: Prints the name of <TLC> as a String on the
-- Stream <S> and returns <S>.
end TopOpeBRep;

34
src/TopOpeBRep/TopOpeBRep.cxx Executable file
View File

@@ -0,0 +1,34 @@
// File: TopOpeBRep.cxx
// Created: Tue Aug 2 16:02:44 1994
// Author: Jean Yves LEBEY
// <jyl@meteox>
// Modifed: Portage NT 7-5-97 DPF (strcasecmp)
#include <TopOpeBRep.ixx>
//#ifdef WNT
//#define strcasecmp strcmp Already defined
//#endif
//=======================================================================
//function : Print
//purpose :
//=======================================================================
Standard_OStream& TopOpeBRep::Print
(const TopOpeBRep_TypeLineCurve t, Standard_OStream& OS)
{
switch (t) {
case TopOpeBRep_ANALYTIC : OS << "ANALYTIC"; break;
case TopOpeBRep_RESTRICTION : OS << "RESTRICTION"; break;
case TopOpeBRep_WALKING : OS << "WALKING"; break;
case TopOpeBRep_LINE : OS << "LINE"; break;
case TopOpeBRep_CIRCLE : OS << "CIRCLE"; break;
case TopOpeBRep_ELLIPSE : OS << "ELLIPSE"; break;
case TopOpeBRep_PARABOLA : OS << "PARABOLA"; break;
case TopOpeBRep_HYPERBOLA : OS << "HYPERBOLA"; break;
case TopOpeBRep_OTHERTYPE : OS << "OTHERTYPE"; break;
default : OS << "UNKNOWN"; break;
}
return OS;
}

View File

@@ -0,0 +1,24 @@
-- File: TopOpeBRep_Bipoint.cdl
-- Created: Thu Jan 9 15:44:12 1997
-- Author: Jean Yves LEBEY
-- <jyl@bistrox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class Bipoint from TopOpeBRep
uses
Integer from Standard
is
Create returns Bipoint from TopOpeBRep;
Create(I1,I2 : Integer from Standard) returns Bipoint from TopOpeBRep;
I1(me) returns Integer from Standard;
I2(me) returns Integer from Standard;
fields
myI1,myI2 : Integer from Standard;
end Bipoint;

View File

@@ -0,0 +1,20 @@
// File: TopOpeBRep_Bipoint.cxx
// Created: Thu Jan 9 15:46:51 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#include <TopOpeBRep_Bipoint.ixx>
#include <Standard_ProgramError.hxx>
TopOpeBRep_Bipoint::TopOpeBRep_Bipoint():myI1(0),myI2(0){}
TopOpeBRep_Bipoint::TopOpeBRep_Bipoint
(const Standard_Integer I1,const Standard_Integer I2):myI1(I1),myI2(I2){}
Standard_Integer TopOpeBRep_Bipoint::I1() const {
if(myI1<=0)Standard_ProgramError::Raise("TopOpeBRep_Bipoint I1=0");
return myI1;
}
Standard_Integer TopOpeBRep_Bipoint::I2() const {
if(myI2<=0)Standard_ProgramError::Raise("TopOpeBRep_Bipoint I2=0");
return myI2;
}

View File

@@ -0,0 +1,5 @@
// File: TopOpeBRep_DRAW.cxx
// Created: Wed Nov 26 14:08:01 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>

View File

@@ -0,0 +1,13 @@
// File: TopOpeBRep_DRAW.hxx
// Created: Wed Nov 26 14:07:41 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifndef _TopOpeBRep_DRAW_HeaderFile
#define _TopOpeBRep_DRAW_HeaderFile
#ifdef DRAW
#include <TopOpeBRepDS_DRAW.hxx>
#endif
#endif

View File

@@ -0,0 +1,193 @@
-- File: TopOpeBRep_DSFiller.cdl
-- Created: Wed Jun 23 20:25:39 1993
-- Author: Jean Yves LEBEY
-- <jyl@zerox>
---Copyright: Matra Datavision 1993
class DSFiller from TopOpeBRep
---Purpose: Provides class methods to fill a datastructure
-- with results of intersections.
--
-- 1. Use an Intersector to find pairs of
-- intersecting GeomShapes
--
-- 2. For each pair fill the DataStructure using the
-- appropriate Filler.
--
-- 3. Complete the DataStructure to record shapes to
-- rebuild (shells, wires )
uses
ShapeEnum from TopAbs,
Shape from TopoDS,
ListOfShape from TopTools,
Face from TopoDS,
ShapeTool from TopOpeBRepTool,
ShapeExplorer from TopOpeBRepTool,
PShapeClassifier from TopOpeBRepTool,
HDataStructure from TopOpeBRepDS,
DataStructure from TopOpeBRepDS,
Kind from TopOpeBRepDS,
ShapeIntersector from TopOpeBRep,
ShapeIntersector2d from TopOpeBRep,
FacesIntersector from TopOpeBRep,
FacesFiller from TopOpeBRep,
EdgesIntersector from TopOpeBRep,
EdgesFiller from TopOpeBRep,
FaceEdgeIntersector from TopOpeBRep,
FaceEdgeFiller from TopOpeBRep
is
Create returns DSFiller from TopOpeBRep;
--modified by NIZNHY-PKV Mon Dec 16 10:24:42 2002 f
Destroy(me: out);
---C++: alias "Standard_EXPORT ~TopOpeBRep_DSFiller() {Destroy();}"
--modified by NIZNHY-PKV Mon Dec 16 10:25:22 2002 t
PShapeClassifier(me) returns PShapeClassifier from TopOpeBRepTool;
---Purpose: return field myPShapeClassifier.
--modified by NIZNHY-PKV Mon Dec 16 11:30:17 2002 f
-- SetPShapeClassifier(me : in out; PSC : PShapeClassifier from TopOpeBRepTool);
---Purpose: set field myPShapeClassifier.
--modified by NIZNHY-PKV Mon Dec 16 11:30:23 2002 t
Insert(me : in out; S1,S2 : Shape from TopoDS;
HDS : HDataStructure;
orientFORWARD : Boolean = Standard_True)
---Purpose: Stores in <DS> the intersections of <S1> and <S2>.
-- if orientFORWARD = True
-- S FORWARD,REVERSED --> FORWARD
-- S EXTERNAL,INTERNAL --> EXTERNAL,INTERNAL
is static;
InsertIntersection(me : in out; S1,S2 : Shape from TopoDS;
HDS : HDataStructure;
orientFORWARD : Boolean = Standard_True)
---Purpose: Stores in <DS> the intersections of <S1> and <S2>.
-- if orientFORWARD = True
-- S FORWAR,REVERSED --> FORWARD
-- S EXTERNAL,INTERNAL --> EXTERNAL,INTERNAL
is static;
Complete(me : in out; HDS : HDataStructure)
is static;
Insert2d(me : in out; S1,S2 : Shape from TopoDS;
HDS : HDataStructure)
---Purpose: Stores in <DS> the intersections of <S1> and <S2>.
-- S1 et S2 contain only SameDomain Face
is static;
InsertIntersection2d(me : in out; S1,S2 : Shape from TopoDS;
HDS : HDataStructure)
---Purpose: S1, S2 set of tangent face
-- lance les intersections 2d pour coder correctement
-- les faces SameDomain.
is static;
IsMadeOf1d (me; S : Shape from TopoDS)
returns Boolean;
IsContext1d(me; S : Shape from TopoDS)
returns Boolean;
Insert1d(me : in out; S1,S2 : Shape from TopoDS;
F1,F2 : Face from TopoDS;
HDS : HDataStructure;
orientFORWARD : Boolean = Standard_False)
---Purpose: Stores in <DS> the intersections of <S1> and <S2>.
-- S1 and S2 are edges or wires.
-- S1 edges have a 2d representation in face F1
-- S2 edges have a 2d representation in face F2
-- F1 is the face which surface is taken as reference
-- for 2d description of S1 and S2 edges.
-- if orientFORWARD = True
-- S FORWARD,REVERSED --> FORWARD
-- S EXTERNAL,INTERNAL --> EXTERNAL,INTERNAL
is static;
CheckInsert(me; S1,S2 : Shape from TopoDS)
returns Boolean is static private ;
ClearShapeSameDomain(me : in out; S1,S2 : Shape from TopoDS;
HDS : HDataStructure)
returns Boolean is static private ;
ChangeShapeIntersector(me : in out)
returns ShapeIntersector from TopOpeBRep
---C++: return &
is static;
ChangeShapeIntersector2d(me : in out)
returns ShapeIntersector2d from TopOpeBRep
---C++: return &
is static;
ChangeFacesFiller(me : in out)
returns FacesFiller from TopOpeBRep
---C++: return &
is static;
ChangeEdgesFiller(me : in out)
returns EdgesFiller from TopOpeBRep
---C++: return &
is static;
ChangeFaceEdgeFiller(me : in out)
returns FaceEdgeFiller from TopOpeBRep
---C++: return &
is static;
GapFiller(me; HDS : HDataStructure) is static;
CompleteDS(me; HDS : HDataStructure)
---Purpose: Update the data structure with relevant
-- informations deduced from the intersections.
--
-- Shells containing an intersected face.
-- Wires containing an intersected edge.
--
is static;
Filter(me; HDS : HDataStructure)
is static;
Reducer(me; HDS : HDataStructure)
is static;
RemoveUnsharedGeometry(me : in out; HDS : HDataStructure)
is static;
Checker(me; HDS : HDataStructure)
is static;
CompleteDS2d(me; HDS : HDataStructure)
---Purpose: Update the data structure with relevant
-- informations deduced from the intersections 2d.
--
-- Shells containing an intersected face.
-- Wires containing an intersected edge.
--
is static;
-- CheckIGap(me; S1,S2 : Shape; HDS : HDataStructure) is static; //NYI
---Purpose: search for interference identity using edge connexity //NYI
fields
myShapeIntersector : ShapeIntersector from TopOpeBRep;
myShapeIntersector2d : ShapeIntersector2d from TopOpeBRep;
myFacesFiller : FacesFiller from TopOpeBRep;
myEdgesFiller : EdgesFiller from TopOpeBRep;
myFaceEdgeFiller : FaceEdgeFiller from TopOpeBRep;
myPShapeClassifier : PShapeClassifier from TopOpeBRepTool;
end DSFiller from TopOpeBRep;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
-- File: TopOpeBRep_EdgesFiller.cdl
-- Created: Wed Oct 12 14:25:35 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class EdgesFiller from TopOpeBRep
---Purpose: Fills a TopOpeBRepDS_DataStructure with Edge/Edge
-- instersection data described by TopOpeBRep_EdgesIntersector.
uses
Edge from TopoDS,
Face from TopoDS,
Shape from TopoDS,
EdgesIntersector from TopOpeBRep,
Point2d from TopOpeBRep,
PEdgesIntersector from TopOpeBRep,
HDataStructure from TopOpeBRepDS,
DataStructure from TopOpeBRepDS,
PDataStructure from TopOpeBRepDS,
Interference from TopOpeBRepDS,
ListOfInterference from TopOpeBRepDS,
ListIteratorOfListOfInterference from TopOpeBRepDS,
Kind from TopOpeBRepDS,
Transition from TopOpeBRepDS,
Config from TopOpeBRepDS
is
Create returns EdgesFiller;
Insert(me:out;E1,E2:Shape;EI:out EdgesIntersector;HDS:HDataStructure);
Face(me:out;I:Integer;F:Shape);
Face(me;I:Integer) returns Shape;---C++: return const &
-- -------
-- private
-- -------
GetGeometry(me;IT:out ListIteratorOfListOfInterference;
P:Point2d;G:out Integer;K:out Kind)
returns Boolean is private;
MakeGeometry(me;P:Point2d;G:out Integer;K:out Kind)
returns Boolean is private;
SetShapeTransition(me;P:Point2d;T1,T2:out Transition from TopOpeBRepDS)
is private;
StorePI(me:out;P:Point2d;T:Transition from TopOpeBRepDS;
EI,PI:Integer;p:Real;IE:Integer)
returns Interference is private;
StoreVI(me:out;P:Point2d;T:Transition from TopOpeBRepDS;
EI,VI:Integer;VB:Boolean;C:Config;p:Real;IE:Integer)
returns Interference is private;
ToRecompute(me:out;P:Point2d;I:Interference;IEmother:Integer)
returns Boolean is private;
StoreRecompute(me:out;I:Interference;IEmother:Integer) is private;
RecomputeInterferences(me:out;E:Edge;LOI:out ListOfInterference) is private;
fields
myE1:Edge from TopoDS;
myE2:Edge from TopoDS;
myF1:Face from TopoDS;
myF2:Face from TopoDS;
myHDS:HDataStructure from TopOpeBRepDS;
myPDS:PDataStructure from TopOpeBRepDS;
myPEI:PEdgesIntersector from TopOpeBRep;
myLI1:ListOfInterference from TopOpeBRepDS;
myLI2:ListOfInterference from TopOpeBRepDS;
end EdgesFiller from TopOpeBRep;

View File

@@ -0,0 +1,558 @@
// File: TopOpeBRep_EdgesFiller.cxx
// Created: Wed Oct 12 16:18:53 1994
// Author: Jean Yves LEBEY
// <jyl@bravox>
#include <TopOpeBRep_EdgesFiller.ixx>
#include <TopOpeBRep_PointGeomTool.hxx>
#include <TopOpeBRep_Point2d.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopOpeBRepDS_Config.hxx>
#include <TopOpeBRepDS_Point.hxx>
#include <TopOpeBRepDS_EXPORT.hxx>
#include <TopOpeBRepDS_TKI.hxx>
#include <TopOpeBRepDS_InterferenceTool.hxx>
#include <TopOpeBRepTool_EXPORT.hxx>
#include <TopOpeBRepDS.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopOpeBRep_define.hxx>
#ifdef DEB
#include <TopOpeBRepDS_reDEB.hxx>
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceEDSF();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_IMPORT Standard_Boolean TopOpeBRep_GettraceEEFF();
Standard_EXPORT void debefre(const Standard_Integer IE) {cout<<"+++ debefre E"<<IE<<endl;}
Standard_EXPORT void debposesd(void) {/*cout<<"+++ debposesd"<<endl;*/}
Standard_EXPORT void debposnesd(void) {cout<<"+++ debposnesd"<<endl;}
Standard_EXPORT void debeeff() {}
#endif
#define M_REVERSED(O) (O == TopAbs_REVERSED)
#define M_FORWARD( O) (O == TopAbs_FORWARD)
#define M_INTERNAL(O) (O == TopAbs_INTERNAL)
#define M_EXTERNAL(O) (O == TopAbs_EXTERNAL)
//=======================================================================
//function : TopOpeBRep_EdgesFiller
//purpose :
//=======================================================================
TopOpeBRep_EdgesFiller::TopOpeBRep_EdgesFiller() : myPDS(NULL),myPEI(NULL) {}
void rototo() {}
//=======================================================================
//function : Insert
//purpose :
//=======================================================================
void TopOpeBRep_EdgesFiller::Insert(const TopoDS_Shape& E1,const TopoDS_Shape& E2,TopOpeBRep_EdgesIntersector& EDGINT,const Handle(TopOpeBRepDS_HDataStructure)& HDS)
{
myPEI = &EDGINT;
myPDS = &(HDS->ChangeDS());
myE1 = TopoDS::Edge(E1);
myE2 = TopoDS::Edge(E2);
myLI1.Clear();
myLI2.Clear();
myHDS = HDS;
#ifdef DEB
Standard_Boolean trc = TopOpeBRepDS_GettraceDSF();
trc = trc || TopOpeBRepDS_GettraceEDSF();
trc = trc || TopOpeBRep_GettraceEEFF();
if (trc) {
if (TopOpeBRep_GettraceEEFF()) debeeff();
TCollection_AsciiString str="EdgesFiller dim";str=str+myPEI->Dimension();
myPEI->Dump(str,myPDS->Shape(myE1),myPDS->Shape(myE2));
}
#endif
#ifdef DEB
Standard_Boolean hs =
#endif
myPEI->HasSegment();
Standard_Boolean esd = myPEI->SameDomain();
if (esd) myPDS->FillShapesSameDomain(E1,E2);
// exit if no point.
myPEI->InitPoint(); if ( !myPEI->MorePoint() ) return;
#ifdef DEB
Standard_Boolean reducesegment = (hs && !esd);
#endif
#ifdef DEB
TopAbs_Orientation E1ori =
#endif
E1.Orientation();
#ifdef DEB
TopAbs_Orientation E2ori =
#endif
E2.Orientation();
// --- Add <E1,E2> in BDS
Standard_Integer E1index = myPDS->AddShape(E1,1);
Standard_Integer E2index = myPDS->AddShape(E2,2);
// --- get list of interferences connected to edges <E1>,<E2>
TopOpeBRepDS_ListOfInterference& EIL1 = myPDS->ChangeShapeInterferences(E1);
#ifdef DEB
TopOpeBRepDS_ListOfInterference& EIL2 =
#endif
myPDS->ChangeShapeInterferences(E2);
Handle(TopOpeBRepDS_Interference) EPI; //edge/point interference
Handle(TopOpeBRepDS_Interference) EVI; //edge/vertex interference
// TopOpeBRepDS_Transition TposF,TposL;
for (; myPEI->MorePoint(); myPEI->NextPoint() ) {
const TopOpeBRep_Point2d P2D = myPEI->Point();
Standard_Real par1 = P2D.Parameter(1);
Standard_Real par2 = P2D.Parameter(2);
Standard_Integer if1 = 0; if ( ! myF1.IsNull() ) if1 = myPDS->AddShape(myF1,1);
Standard_Integer if2 = 0; if ( ! myF2.IsNull() ) if2 = myPDS->AddShape(myF2,2);
#ifdef DEB
Standard_Boolean pointofsegment =
#endif
P2D.IsPointOfSegment();
#ifdef DEB
Standard_Boolean reducesegmentpoint = (reducesegment && pointofsegment);
#endif
#ifdef DEB
if (trc) {
if (pointofsegment && esd) debposesd();
else if (pointofsegment && !esd) debposnesd();
}
#endif
TopOpeBRepDS_Transition T1 = P2D.Transition(1);
TopOpeBRepDS_Transition T2 = P2D.Transition(2);
SetShapeTransition(P2D,T1,T2);
Standard_Boolean isvertex1 = P2D.IsVertex(1);
TopoDS_Vertex V1; if (isvertex1) V1 = P2D.Vertex(1);
Standard_Boolean isvertex2 = P2D.IsVertex(2);
TopoDS_Vertex V2; if (isvertex2) V2 = P2D.Vertex(2);
Standard_Boolean isvertex = isvertex1 || isvertex2;
#ifdef DEB
if (isvertex1 && isvertex2) {
gp_Pnt P3D1 = BRep_Tool::Pnt(V1);
gp_Pnt P3D2 = BRep_Tool::Pnt(V2);
Standard_Real tol1 = BRep_Tool::Tolerance(V1);
Standard_Real tol2 = BRep_Tool::Tolerance(V2);
Standard_Real dpp = P3D1.Distance(P3D2);
if (dpp> tol1+tol2) {
cout<<endl;
cout<<"*** TopOpeBRep_EdgesFiller : isvertex1 && isvertex2 : P3D non confondus"<<endl;
cout<<"point PV1 "<<P3D1.X()<<" "<<P3D1.Y()<<" "<<P3D1.Z()<<endl;
cout<<"point PV2 "<<P3D2.X()<<" "<<P3D2.Y()<<" "<<P3D2.Z()<<endl;
cout<<endl;
}
}
#endif
// xpu : 080498 : CTS20072 (e12,e3,p8)
// edgesintersector called for tolerances = 0.
// facesintersector called for greater tolerances
// we assume facesintersector's ouput data to be valid
// and we use it for correcting edgesintersector's ouput data
TopOpeBRepDS_ListIteratorOfListOfInterference itloI1( myPDS->ShapeInterferences(E1) );
Standard_Integer G; TopOpeBRepDS_Kind K;
Standard_Boolean found = GetGeometry(itloI1,P2D,G,K);
if (!found) MakeGeometry(P2D,G,K);
Standard_Boolean foundpoint = (found) && (K == TopOpeBRepDS_POINT);
#ifdef DEB
Standard_Boolean foundvertex = (found) && (K == TopOpeBRepDS_VERTEX);
#endif
Standard_Boolean isnewpoint = (!found) && (K == TopOpeBRepDS_POINT);
Standard_Boolean isnewvertex = (!found) && (K == TopOpeBRepDS_VERTEX);
Standard_Boolean faulty = (isvertex && isnewpoint) || (!isvertex && isnewvertex);
if (faulty) {
#ifdef DEB
cout<<"- - - faulty EdgesFiller : G "<<G<<" K ";TopOpeBRepDS::Print(K,cout);cout.flush();
cout<<" isvertex="<<isvertex;cout.flush();
cout<<" isop="<<foundpoint<<" isov="<<foundvertex;cout.flush();
cout<<" isnp="<<isnewpoint<<" isnv="<<isnewvertex<<endl;cout.flush();
#endif
}
if (isvertex && foundpoint) {
Standard_Integer is = 1, ns = myPDS->NbShapes();
for (;is<=ns;is++) {
const TopoDS_Shape& s = myPDS->Shape(is);
if (s.ShapeType() != TopAbs_EDGE) continue;
const TopoDS_Edge& e = TopoDS::Edge(s);
TopOpeBRepDS_ListOfInterference linew;
TopOpeBRepDS_ListOfInterference& li = myPDS->ChangeShapeInterferences(e); TopOpeBRepDS_ListIteratorOfListOfInterference it(li);
while (it.More()) {
Handle(TopOpeBRepDS_Interference) I=it.Value(); TopOpeBRepDS_Kind ki=I->GeometryType(); Standard_Integer gi=I->Geometry();
Handle(Standard_Type) DTI = I->DynamicType();
Standard_Boolean iscpi = (DTI == STANDARD_TYPE(TopOpeBRepDS_CurvePointInterference)) ;
Standard_Boolean condcpi = ((ki==TopOpeBRepDS_POINT) && (gi==G) && iscpi);
if (condcpi) { // remplacer G,K de I par le vertex courant
#ifdef DEB
rototo();
#endif
Handle(TopOpeBRepDS_CurvePointInterference) epi = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I);
const TopOpeBRepDS_Transition& tevi = epi->Transition();
Standard_Integer sevi = epi->Support();
#ifdef DEB
Standard_Integer gevi;
#else
Standard_Integer gevi=0;
#endif
if (isvertex1) gevi = myPDS->AddShape(V1,1);
else if (isvertex2) gevi = myPDS->AddShape(V2,2);
Standard_Boolean bevi = Standard_False;
TopOpeBRepDS_Config cevi = TopOpeBRepDS_UNSHGEOMETRY;
Standard_Real pevi = epi->Parameter();
Handle(TopOpeBRepDS_Interference) evi;
evi = TopOpeBRepDS_InterferenceTool::MakeEdgeVertexInterference(tevi,sevi,gevi,bevi,cevi,pevi);
const TopOpeBRepDS_Kind& kevi = epi->SupportType();
evi->SupportType(kevi);
#ifdef DEB
TopOpeBRepDS::Print(K,G,cout,"TopOpeBRep_EdgesFiller : remplacer "," ");
TopOpeBRepDS::Print(TopOpeBRepDS_VERTEX,gevi,cout,"par "," dans les courbes NYI\n");
#endif
linew.Append(evi);
li.Remove(it);
} // cond
else {
it.Next();
}
} // it.More()
if (!linew.IsEmpty()) {
myHDS->StoreInterferences(linew,is,"EdgesFiller modif : ");
}
} // (is<=ns)
} // (isvertex && foundpoint)
if (isvertex1) {
const TopoDS_Vertex& VV1 = V1;
// const TopoDS_Vertex& VV1 = TopoDS::Vertex(V1);
const TopoDS_Edge& EE1 = TopoDS::Edge(E1);
par1 = BRep_Tool::Parameter(VV1,EE1);
}
if (isvertex2) {
const TopoDS_Vertex& VV2 = V2;
// const TopoDS_Vertex& VV2 = TopoDS::Vertex(V2);
const TopoDS_Edge& EE2 = TopoDS::Edge(E2);
par2 = BRep_Tool::Parameter(VV2,EE2);
}
if ( isvertex1 && isvertex2 ) {
myPDS->FillShapesSameDomain(V1,V2);
}
Standard_Integer DSPindex;
Standard_Boolean EPIfound;
if ( ! isvertex ) {
TopOpeBRepDS_Kind KKK;
TopOpeBRepDS_ListIteratorOfListOfInterference itEIL1(EIL1);
EPIfound = GetGeometry(itEIL1,P2D,DSPindex,KKK);
if ( ! EPIfound ) MakeGeometry(P2D,DSPindex,KKK);
SetShapeTransition(P2D,T1,T2);
if (KKK == TopOpeBRepDS_POINT) {
EPI = StorePI(P2D,T1,E2index,DSPindex,par1,1);
EPI = StorePI(P2D,T2,E1index,DSPindex,par2,2);
}
else if ( KKK == TopOpeBRepDS_VERTEX) {
Standard_Integer Vindex = DSPindex;
Standard_Boolean bevi = Standard_False;
TopOpeBRepDS_Config cevi = TopOpeBRepDS_UNSHGEOMETRY;
EVI = StoreVI(P2D,T1,E2index,Vindex,bevi,cevi,par1,1);
EVI = StoreVI(P2D,T2,E1index,Vindex,bevi,cevi,par2,2);
}
} // ( ! isvertex )
else {
SetShapeTransition(P2D,T1,T2);
if (isvertex1) {
const TopoDS_Shape V = V1;
Standard_Integer Vindex = myPDS->AddShape(V,1);
TopOpeBRepDS_Config SSC = P2D.EdgesConfig();
EVI = StoreVI(P2D,T1,E2index,Vindex,Standard_True,SSC,par1,1);
EVI = StoreVI(P2D,T2,E1index,Vindex,Standard_False,SSC,par2,2);
}
if (isvertex2) {
const TopoDS_Shape V = V2;
Standard_Integer Vindex = myPDS->AddShape(V,2);
TopOpeBRepDS_Config SSC = P2D.EdgesConfig();
EVI = StoreVI(P2D,T1,E2index,Vindex,Standard_False,SSC,par1,1);
EVI = StoreVI(P2D,T2,E1index,Vindex,Standard_True,SSC,par2,2);
}
} // ( isvertex )
} // MorePoint()
RecomputeInterferences(myE1,myLI1);
RecomputeInterferences(myE2,myLI2);
} // Insert
// ===============
// private methods
// ===============
//=======================================================================
//function : SetShapeTransition
//purpose :
//=======================================================================
void TopOpeBRep_EdgesFiller::SetShapeTransition(const TopOpeBRep_Point2d& P2D,
TopOpeBRepDS_Transition& T1,TopOpeBRepDS_Transition& T2) const
{
Standard_Boolean pointofsegment = P2D.IsPointOfSegment();
Standard_Boolean esd = myPEI->SameDomain();
Standard_Integer ie1=0,ie2=0,if1=0,if2=0;
if (pointofsegment && esd) {
T1.ShapeBefore(TopAbs_EDGE);T1.ShapeAfter(TopAbs_EDGE);
T2.ShapeBefore(TopAbs_EDGE);T2.ShapeAfter(TopAbs_EDGE);
if ( ! myE1.IsNull() ) ie1 = myPDS->AddShape(myE1,1);
if ( ! myE2.IsNull() ) ie2 = myPDS->AddShape(myE2,2);
if ( ! myE2.IsNull() ) T1.Index(ie2);
if ( ! myE1.IsNull() ) T2.Index(ie1);
}
else if (pointofsegment && !esd) {
T1.ShapeBefore(TopAbs_FACE);T1.ShapeAfter(TopAbs_FACE);
T2.ShapeBefore(TopAbs_FACE);T2.ShapeAfter(TopAbs_FACE);
if ( ! myF1.IsNull() ) if1 = myPDS->AddShape(myF1,1);
if ( ! myF2.IsNull() ) if2 = myPDS->AddShape(myF2,2);
if ( ! myF1.IsNull() ) T2.Index(if1);
if ( ! myF2.IsNull() ) T1.Index(if2);
}
else {
T1.ShapeBefore(TopAbs_FACE);T1.ShapeAfter(TopAbs_FACE);
T2.ShapeBefore(TopAbs_FACE);T2.ShapeAfter(TopAbs_FACE);
if ( ! myF1.IsNull() ) if1 = myPDS->AddShape(myF1,1);
if ( ! myF2.IsNull() ) if2 = myPDS->AddShape(myF2,2);
if ( ! myF1.IsNull() ) T2.Index(if1);
if ( ! myF2.IsNull() ) T1.Index(if2);
}
}
//=======================================================================
//function : GetGeometry
//purpose : private
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesFiller::GetGeometry(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,const TopOpeBRep_Point2d& P2D,Standard_Integer& G,TopOpeBRepDS_Kind& K) const
{
TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(P2D);
Standard_Boolean b = myHDS->GetGeometry(IT,DSP,G,K);
return b;
}
//=======================================================================
//function : MakeGeometry
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesFiller::MakeGeometry(const TopOpeBRep_Point2d& P2D,Standard_Integer& G,TopOpeBRepDS_Kind& K) const
{
Standard_Boolean isvertex1 = P2D.IsVertex(1);
Standard_Boolean isvertex2 = P2D.IsVertex(2);
if (isvertex1 && isvertex2) {
Standard_Integer G1 = myPDS->AddShape(P2D.Vertex(1),1);
#ifdef DEB
Standard_Integer G2 =
#endif
myPDS->AddShape(P2D.Vertex(2),2);
G = G1;
K = TopOpeBRepDS_VERTEX;
}
else if (isvertex1) {
G = myPDS->AddShape(P2D.Vertex(1),1);
K = TopOpeBRepDS_VERTEX;
}
else if (isvertex2) {
G = myPDS->AddShape(P2D.Vertex(2),2);
K = TopOpeBRepDS_VERTEX;
}
else {
G = myPDS->AddPoint(TopOpeBRep_PointGeomTool::MakePoint(P2D));
K = TopOpeBRepDS_POINT;
}
return Standard_True;
}
//=======================================================================
//function : Face
//purpose :
//=======================================================================
void TopOpeBRep_EdgesFiller::Face(const Standard_Integer ISI,const TopoDS_Shape& F)
{
if (ISI == 1) myF1 = TopoDS::Face(F);
else if (ISI == 2) myF2 = TopoDS::Face(F);
else Standard_Failure::Raise("Face(i,f) : ISI incorrect");
}
//=======================================================================
//function : Face
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_EdgesFiller::Face(const Standard_Integer ISI) const
{
if (ISI == 1) return myF1;
else if (ISI == 2) return myF2;
else Standard_Failure::Raise("Face(i) : ISI incorrect");
return myF1;
}
//=======================================================================
//function : StorePI
//purpose :
//=======================================================================
Handle(TopOpeBRepDS_Interference) TopOpeBRep_EdgesFiller::StorePI(const TopOpeBRep_Point2d& P2D,
const TopOpeBRepDS_Transition& T,const Standard_Integer SI,const Standard_Integer GI,
const Standard_Real param,const Standard_Integer IEmother)
{
Handle(TopOpeBRepDS_Interference) I = TopOpeBRepDS_InterferenceTool::MakeEdgeInterference(T,TopOpeBRepDS_EDGE,SI,TopOpeBRepDS_POINT,GI,param);
TopoDS_Shape Emother;
if (IEmother == 1) Emother = myE1;
else if (IEmother == 2) Emother = myE2;
myHDS->StoreInterference(I,Emother);
Standard_Boolean b = ToRecompute(P2D,I,IEmother);
if (b) StoreRecompute(I,IEmother);
return I;
}
//=======================================================================
//function : StoreVI
//purpose :
//=======================================================================
Handle(TopOpeBRepDS_Interference) TopOpeBRep_EdgesFiller::StoreVI(const TopOpeBRep_Point2d& P2D,
const TopOpeBRepDS_Transition& T,const Standard_Integer EI,const Standard_Integer VI,
const Standard_Boolean VisB,const TopOpeBRepDS_Config C,
const Standard_Real param,const Standard_Integer IEmother)
{
Handle(TopOpeBRepDS_Interference) I = TopOpeBRepDS_InterferenceTool::MakeEdgeVertexInterference(T,EI,VI,VisB,C,param);
TopoDS_Shape Emother;
if (IEmother == 1) Emother = myE1;
else if (IEmother == 2) Emother = myE2;
myHDS->StoreInterference(I,Emother);
Standard_Boolean b = ToRecompute(P2D,I,IEmother);
if (b) StoreRecompute(I,IEmother);
return I;
}
//=======================================================================
//function : ToRecompute
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesFiller::ToRecompute(const TopOpeBRep_Point2d& P2D,const Handle(TopOpeBRepDS_Interference)& I,const Standard_Integer IEmother)
{
Standard_Boolean b = Standard_True;
const TopOpeBRepDS_Transition& T = I->Transition();
#ifdef DEB
TopAbs_State sb =
#endif
T.Before();
#ifdef DEB
TopAbs_State sa =
#endif
T.After();
Standard_Boolean pointofsegment = P2D.IsPointOfSegment();
Standard_Boolean esd = myPEI->SameDomain();
b = b && (pointofsegment && !esd);
return b;
}
//=======================================================================
//function : StoreRecompute
//purpose :
//=======================================================================
void TopOpeBRep_EdgesFiller::StoreRecompute(const Handle(TopOpeBRepDS_Interference)& I,const Standard_Integer IEmother)
{
if (IEmother == 1) myLI1.Append(I);
else if (IEmother == 2) myLI2.Append(I);
}
//=======================================================================
//function : RecomputeInterferences
//purpose :
//=======================================================================
void TopOpeBRep_EdgesFiller::RecomputeInterferences(const TopoDS_Edge& E,TopOpeBRepDS_ListOfInterference& LI)
{
if (LI.IsEmpty()) return;
TopOpeBRepDS_TKI tki; tki.FillOnGeometry(LI);
#ifdef DEB
Standard_Integer EIX = myPDS->Shape(E); Standard_Boolean TRC=DSREDUEDGETRCE(EIX);
if (TRC) cout<<endl<<"RecomputeInterferences E"<<EIX<<" <- "<<LI.Extent()<<endl;
if (TRC) tki.DumpTKIIterator("","\n");
if (TRC) debefre(EIX);
#endif
for (tki.Init(); tki.More(); tki.Next()) {
TopOpeBRepDS_Kind K; Standard_Integer G; tki.Value(K,G);
TopOpeBRepDS_ListOfInterference& loi = tki.ChangeValue(K,G); TopOpeBRepDS_ListOfInterference Rloi;
Standard_Integer nloi = loi.Extent();
if (nloi == 0) continue;
#ifdef DEB
if (nloi > 1) {cout<<"TopOpeBRep_EdgesFiller : > 1 I on UNUN/F on E"<<EIX<<" A FAIRE"<<endl;}
#endif
Handle(TopOpeBRepDS_Interference)& iloi = loi.First();
TopOpeBRepDS_Transition& TU = iloi->ChangeTransition();
Standard_Integer ifb = TU.IndexBefore();
Standard_Integer ifa = TU.IndexAfter();
const TopoDS_Face& fb = TopoDS::Face(myPDS->Shape(ifb));
#ifdef DEB
const TopoDS_Face& fa =
#endif
TopoDS::Face(myPDS->Shape(ifa));
#ifdef DEB
if (ifb != ifa) {cout<<"TopOpeBRep_EdgesFiller : ifb != ifa on E"<<EIX<<" NYI"<<endl;}
#endif
Standard_Real pE = FDS_Parameter(iloi); TopOpeBRepDS_Transition TN;
TN.ShapeBefore(TU.ShapeBefore());TN.IndexBefore(TU.IndexBefore());
TN.ShapeAfter(TU.ShapeAfter());TN.IndexAfter(TU.IndexAfter());
#ifdef DEB
Standard_Boolean ok =
#endif
FDS_stateEwithF2d(*myPDS,E,pE,K,G,fb,TN);
#ifdef DEB
if (TRC) {
TopOpeBRepDS_ListOfInterference l1;l1.Append(iloi);
TopOpeBRepDS_TKI dt;dt.FillOnGeometry(l1);dt.DumpTKIIterator("","");
if (ok) {
cout<<" ";TU.Dump(cout);cout<<endl;
cout<<"--> ";TN.Dump(cout);cout<<endl;
}
else {
cout<<"--> TN ko"<<endl;
}
}
#endif
} // tki.More
} // RecomputeInterferences

View File

@@ -0,0 +1,164 @@
-- File: TopOpeBRep_EdgesIntersector.cdl
-- Created: Thu Oct 13 11:19:34 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class EdgesIntersector from TopOpeBRep
uses
Pnt from gp,
Orientation from TopAbs,
Shape from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
Transition from TopOpeBRepDS,
Config from TopOpeBRepDS,
Curve from Geom2dAdaptor,
Domain from IntRes2d,
IntersectionPoint from IntRes2d,
IntersectionSegment from IntRes2d,
Transition from IntRes2d,
GInter from Geom2dInt,
SequenceOfIntersectionPoint from IntRes2d,
SequenceOfIntersectionSegment from IntRes2d,
P2Dstatus from TopOpeBRep,
Point2d from TopOpeBRep,
SequenceOfPoint2d from TopOpeBRep,
SurfaceType from GeomAbs,
Surface from BRepAdaptor,
HSurface from BRepAdaptor,
AsciiString from TCollection,
Box from Bnd
is
Create returns EdgesIntersector from TopOpeBRep;
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~TopOpeBRep_EdgesIntersector(){Delete() ; }"
SetFaces(me : in out; F1,F2 : Shape);
SetFaces(me : in out; F1,F2 : Shape;B1,B2 : Box from Bnd);
ForceTolerances(me : in out; Tol1,Tol2 : Real); -- Set myTol1,myTol2
Dimension(me : in out; D:Integer);
Dimension(me) returns Integer;
---Purpose: set working space dimension D = 1 for E &|| W, 2 for E in F
Perform(me : in out; E1,E2 : Shape;
ReduceSegments : Boolean = Standard_True);
IsEmpty(me : in out) returns Boolean;
HasSegment(me) returns Boolean; ---Purpose: true if at least one intersection segment.
SameDomain(me) returns Boolean; ---Purpose: = mySameDomain.
Edge(me; Index : Integer) returns Shape; ---C++: return const &
Curve(me; Index : Integer) returns Curve from Geom2dAdaptor; ---C++: return const &
Face(me; Index : Integer) returns Shape; ---C++: return const &
Surface(me; Index : Integer) returns Surface from BRepAdaptor; ---C++: return const &
SurfacesSameOriented(me) returns Boolean;
FacesSameOriented(me) returns Boolean;
ToleranceMax(me) returns Real;
Tolerances(me;tol1,tol2 : out Real); -- = myTol1,myTol2
Tolerance2(me) returns Real; -- = myTol2
NbPoints(me) returns Integer; -- = nyNbPoints
NbSegments(me) returns Integer; -- = myNbSegments
Dump(me:in out;str:AsciiString from TCollection;ie1:Integer = 0;ie2:Integer = 0);
-- Intersection points
InitPoint(me : in out; selectkeep : Boolean = Standard_True);
MorePoint(me) returns Boolean;
NextPoint(me : in out);
Find(me : in out) is private;
Points(me) returns SequenceOfPoint2d from TopOpeBRep;---C++: return const &
Point(me) returns Point2d from TopOpeBRep;---C++: return const &
Point(me;I:Integer) returns Point2d from TopOpeBRep;---C++: return const &
-- -------
-- private
-- -------
ComputeSameDomain(me : in out) returns Boolean is private;
---Purpose: process if current edges can be considered as SameDomain
SetSameDomain(me : in out; B : Boolean) returns Boolean is private;
---Purpose: set field mySameDomain to B and return B value
MakePoints2d(me:in out) is private;
ReduceSegments(me:in out) is private;
ReduceSegment(me;P1,P2:out Point2d;Pn:out Point2d) returns Boolean is virtual;
Segment1(me) returns IntersectionSegment from IntRes2d is private; ---C++: return const &
IsOpposite1(me) returns Boolean is private;
InitPoint1(me : in out) is private;
MorePoint1(me) returns Boolean is private;
NextPoint1(me : in out) is private;
Point1(me) returns IntersectionPoint from IntRes2d is private;---C++: return const &
Status1(me) returns P2Dstatus from TopOpeBRep;
Transition1(me; Index : Integer; EO : Orientation) returns Transition from TopOpeBRepDS is private;
Parameter1(me; Index : Integer) returns Real is private;
IsVertex1(me : in out; Index : Integer) returns Boolean is private;
Vertex1(me : in out; Index : Integer) returns Shape is private;---C++ : return const &
Value1(me) returns Pnt from gp is private;
IsPointOfSegment1(me) returns Boolean is private;
Index1(me) returns Integer is private;
EdgesConfig1(me) returns Config from TopOpeBRepDS is private;
---Purpose: geometric configuration of E1,E2 at current intersection point :
-- UNSHGEOMETRY if the edges do not share geometry.
-- SAMEORIENTED if the edges share geometry and are same oriented.
-- DIFFORIENTED if the edges share geometry and are not same oriented.
fields
myFace1 : Face from TopoDS;
myFace2 : Face from TopoDS;
mySurface1 : HSurface from BRepAdaptor;
mySurface2 : HSurface from BRepAdaptor;
mySurfaceType1 : SurfaceType from GeomAbs;
mySurfaceType2 : SurfaceType from GeomAbs;
mySurfacesSameOriented : Boolean;
myFacesSameOriented : Boolean;
myDomain1 : Domain from IntRes2d;
myDomain2 : Domain from IntRes2d;
myEdge1 : Edge from TopoDS;
myEdge2 : Edge from TopoDS;
myCurve1 : Curve from Geom2dAdaptor;
myCurve2 : Curve from Geom2dAdaptor;
myTol1 : Real;
myTol2 : Real;
myTolForced : Boolean;
myIntersector : GInter from Geom2dInt;
mylpnt : SequenceOfIntersectionPoint from IntRes2d;
mylseg : SequenceOfIntersectionSegment from IntRes2d;
myNbPoints : Integer; -- myIntersector.NbPoints()
myNbSegments : Integer; -- myIntersector.Segments()
myTrueNbPoints : Integer; -- myNbPoints + (2*myNbSegments)
myPointIndex : Integer; -- [1..myTrueNbPoints]
-- IsVertex() private fields
myIsVertexPointIndex : Integer;
myIsVertexIndex : Integer; -- value = 0,1,2
myIsVertexValue : Boolean;
myIsVertexVertex : Vertex from TopoDS;
myDimension : Integer;
-- tangent edges
myHasSegment : Boolean;
mySameDomain : Boolean;
myf1surf1F_sameoriented : Boolean;
myf2surf1F_sameoriented : Boolean;
mysp2d : SequenceOfPoint2d from TopOpeBRep;
myip2d, mynp2d : Integer;
myselectkeep : Boolean;
end EdgesIntersector from TopOpeBRep;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,411 @@
// File: TopOpeBRep_EdgesIntersector_1.cxx
// Created: Fri Oct 7 14:16:31 1994
// Author: Jean Yves LEBEY
// <jyl@bravox>
#include <TopOpeBRep_EdgesIntersector.ixx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <Precision.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <gp_Pnt2d.hxx>
#include <Standard_Failure.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopOpeBRep_define.hxx>
//=======================================================================
//function : Segment1
//purpose :
//=======================================================================
const IntRes2d_IntersectionSegment& TopOpeBRep_EdgesIntersector::Segment1() const
{
if ( ! IsPointOfSegment1() )
Standard_Failure::Raise("TopOpeBRep_EdgesIntersector : Not a segment point");
Standard_Integer iseg = 1 + (myPointIndex - myNbPoints - 1) / 2;
return mylseg.Value(iseg);
}
//=======================================================================
//function : IsOpposite1
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesIntersector::IsOpposite1() const
{
Standard_Boolean b = Segment1().IsOpposite();
return b;
}
//=======================================================================
//function : InitPoint1
//purpose :
//=======================================================================
void TopOpeBRep_EdgesIntersector::InitPoint1()
{
myPointIndex = 1;
myIsVertexPointIndex = 0;
myIsVertexIndex = 0;
myIsVertexValue = Standard_False;
}
//=======================================================================
//function : MorePoint1
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesIntersector::MorePoint1() const
{
return myPointIndex <= myTrueNbPoints;
}
//=======================================================================
//function : NextPoint1
//purpose :
//=======================================================================
void TopOpeBRep_EdgesIntersector::NextPoint1()
{
myPointIndex++;
}
//=======================================================================
//function : Point1
//purpose :
//=======================================================================
const IntRes2d_IntersectionPoint& TopOpeBRep_EdgesIntersector::Point1() const
{
if ( ! IsPointOfSegment1() ) { // point is an intersection point
return mylpnt.Value(myPointIndex);
}
else { // point is a point of segment
Standard_Integer i = myPointIndex - myNbPoints - 1;
if (i % 2 == 0) return Segment1().FirstPoint();
else return Segment1().LastPoint();
}
}
//=======================================================================
//function : Status1
//purpose :
//=======================================================================
TopOpeBRep_P2Dstatus TopOpeBRep_EdgesIntersector::Status1() const
{
if ( ! IsPointOfSegment1() ) { // point is an intersection point
return TopOpeBRep_P2DINT;
}
else { // point is a point of segment
Standard_Integer i = myPointIndex - myNbPoints - 1;
if (i % 2 == 0) return TopOpeBRep_P2DSGF;
else return TopOpeBRep_P2DSGL;
}
}
//=======================================================================
//function : IsPointOfSegment1
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesIntersector::IsPointOfSegment1() const
{
Standard_Boolean b = (myPointIndex > myNbPoints);
return b;
}
//=======================================================================
//function : Index1
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_EdgesIntersector::Index1() const
{
return myPointIndex;
}
//=======================================================================
//function : EdgesConfig1
//purpose :
//=======================================================================
TopOpeBRepDS_Config TopOpeBRep_EdgesIntersector::EdgesConfig1() const
{
TopOpeBRepDS_Config c = TopOpeBRepDS_UNSHGEOMETRY;
Standard_Boolean ps = IsPointOfSegment1();
if ( ps ) {
Standard_Boolean so;
so = TopOpeBRepTool_ShapeTool::EdgesSameOriented(myEdge2,myEdge1);
c = (so) ? TopOpeBRepDS_SAMEORIENTED : TopOpeBRepDS_DIFFORIENTED;
}
return c;
}
//=======================================================================
//function : Transition1
//purpose :
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_EdgesIntersector::Transition1(const Standard_Integer Index,const TopAbs_Orientation EdgeOrientation) const
{
Standard_Boolean pointofsegment = IsPointOfSegment1();
Standard_Boolean pur1d = (pointofsegment && mySameDomain);
#ifdef DEB
TopAbs_State staB,staA; TopAbs_ShapeEnum shaB,shaA; Standard_Boolean pextremity;
#else
TopAbs_State staB=TopAbs_UNKNOWN,staA=TopAbs_UNKNOWN;
TopAbs_ShapeEnum shaB=TopAbs_COMPOUND,shaA=TopAbs_COMPOUND; Standard_Boolean pextremity;
#endif
TopAbs_State staINON = TopAbs_IN;
Standard_Integer dim = myDimension;
if (dim == 1) { shaA = shaB = TopAbs_EDGE; }
else if (dim == 2 && pur1d) { shaA = shaB = TopAbs_EDGE; }
else if (dim == 2 && !pur1d) { shaA = shaB = TopAbs_FACE; }
if ( (EdgeOrientation == TopAbs_INTERNAL) ||
(EdgeOrientation == TopAbs_EXTERNAL) ) {
TopOpeBRepDS_Transition TR(staINON,staINON,shaB,shaA);
TR.Set(EdgeOrientation);
return TR;
}
pextremity = Standard_False; // JYL290998 corr regr cto100K1 fex6 fex4 : 5eme inters E/E
const IntRes2d_IntersectionPoint& IP = Point1();
const IntRes2d_Transition& T = (Index == 1) ?
IP.TransitionOfFirst() : IP.TransitionOfSecond();
switch (T.TransitionType()) {
case IntRes2d_In :
staB = TopAbs_OUT;
staA = staINON;
break;
case IntRes2d_Out :
staB = staINON;
staA = TopAbs_OUT;
break;
case IntRes2d_Touch :
switch (T.Situation()) {
case IntRes2d_Inside :
staB = staINON;
staA = staINON;
break;
case IntRes2d_Outside :
staB = TopAbs_OUT;
staA = TopAbs_OUT;
break;
case IntRes2d_Unknown : {
// get posindex = position on of point on edge <Index>
IntRes2d_Position posindex =
(Index == 1) ?
IP.TransitionOfFirst().PositionOnCurve() :
IP.TransitionOfSecond().PositionOnCurve();
if (pointofsegment) {
// get posother = position of point on the other edge
IntRes2d_Position posother =
(Index == 1) ?
IP.TransitionOfSecond().PositionOnCurve() :
IP.TransitionOfFirst().PositionOnCurve();
if (posother == IntRes2d_Middle) {
if (posindex != IntRes2d_Middle) {
staB = staINON;
staA = staINON;
}
else // Middle/Middle is impossible
Standard_Failure::Raise("TopOpeBRep_EdgesIntersector : Situation Unknown MM");
}
else { // posother = Head or End
Standard_Boolean opposite = IsOpposite1();
if (opposite) {
if (posother == IntRes2d_Head) {
staB = staINON;
staA = TopAbs_OUT;
}
else if (posother == IntRes2d_End) {
staB = TopAbs_OUT;
staA = staINON;
}
}
else {
if (posother == IntRes2d_Head) {
staB = TopAbs_OUT;
staA = staINON;
}
else if (posother == IntRes2d_End) {
staB = staINON;
staA = TopAbs_OUT;
}
}
}
} // point is a segment point
else { // point is not a segment point
// two edges intersect on a vertex
// the vertex is shared by the two edges
// the edges are tangent on vertex.
pextremity = Standard_True;
shaA = shaB = TopAbs_EDGE;
if ( posindex == IntRes2d_Head ) {
staB = staINON;
staA = TopAbs_OUT;
}
else if (posindex == IntRes2d_End) {
staB = TopAbs_OUT;
staA = staINON;
}
else { // Middle is impossible
Standard_Failure::Raise("TopOpeBRep_EdgesIntersector : Situation Unknown M");
}
} // point is not a segment point
} // T.Situation == IntRes2d_Unknown
break;
} // switch T.Situation()
break;
case IntRes2d_Undecided :
Standard_Failure::Raise("TopOpeBRep_EdgesIntersector : TransitionType Undecided");
break;
} // switch TransitionType()
TopOpeBRepDS_Transition TR;
if (pur1d || pextremity) {
TR.Set(staB,staA,shaB,shaA);
}
else { // +ooOO
Standard_Boolean composori = Standard_False;
composori = composori || ((Index == 1) && (!myf2surf1F_sameoriented));
composori = composori || ((Index == 2) && (!myf1surf1F_sameoriented));
// Index = 1 <==> on demande la transition sur
// une arete de la 1ere face par rapport a une arete orientee de
// la 2eme face.
// EdgeOrientation est l'orientation d'une arete de la 2eme face
// de l'appel SetFaces(), i.e ume arete de la face dont la surface
// n'est PAS la surface de reference de l'intersecteur 2d.
// Cette orientation d'arete dans la face doit etre composee avec
// l'orientation relative de la topologie de la 2eme face par rapport
// a la topologie de la 1ere face orientee FORWARD (car la
// geometrie naturelle de la 1ere face est la reference).
TopAbs_Orientation eori = EdgeOrientation;
if (composori) {
eori = TopAbs::Reverse(eori);
}
// retournement des etats en fonction de l'orientation de l'arete
// croisee dans l'espace geometrique de reference.
TR.Set(staB,staA,shaB,shaA);
if (eori == TopAbs_REVERSED) {
TR = TR.Complement();
}
}
return TR;
}
//=======================================================================
//function : Parameter1
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_EdgesIntersector::Parameter1(const Standard_Integer Index) const
{
if (Index == 1) return Point1().ParamOnFirst();
else return Point1().ParamOnSecond();
}
//=======================================================================
//function : IsVertex1
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_EdgesIntersector::IsVertex1(const Standard_Integer Index)
{
// check if last IsVertex1() call has been performed
// on current point and with same <Index>.
if ( myIsVertexPointIndex == myPointIndex &&
myIsVertexIndex == Index )
return myIsVertexValue;
// search if current point is a vertex of edge <Index>
myIsVertexValue = Standard_False;
IntRes2d_Position pos;
if (Index == 1) pos = Point1().TransitionOfFirst().PositionOnCurve();
else pos = Point1().TransitionOfSecond().PositionOnCurve();
if ( pos == IntRes2d_Middle ) {
// search for an INTERNAL vertex on edge <Index> with
// a 2d parameter <parV> equal to current point parameter <par>
Standard_Real par = Parameter1(Index);
const TopoDS_Edge *pE = NULL;
pE = (Index == 1) ? &myEdge1 : &myEdge2;
const TopoDS_Edge& E = *pE;
TopExp_Explorer ex;
for (ex.Init(E,TopAbs_VERTEX); ex.More(); ex.Next()) {
// for (TopExp_Explorer ex(E,TopAbs_VERTEX); ex.More(); ex.Next()) {
const TopoDS_Vertex& V = TopoDS::Vertex(ex.Current());
if ( V.Orientation() == TopAbs_INTERNAL) {
Standard_Real parV = BRep_Tool::Parameter(V,E,myFace1);
if (Abs(par-parV) <= Precision::PConfusion()) {
myIsVertexValue = Standard_True;
myIsVertexVertex = V;
break;
}
}
}
}
else { // pos = head or end
TopoDS_Vertex V1,V2;
if (Index == 1) TopExp::Vertices(myEdge1,V1,V2);
else TopExp::Vertices(myEdge2,V1,V2);
if ( pos == IntRes2d_Head && !V1.IsNull()) {
myIsVertexValue = Standard_True;
myIsVertexVertex = V1;
}
else if ( pos == IntRes2d_End && !V2.IsNull()) {
myIsVertexValue = Standard_True;
myIsVertexVertex = V2;
}
// ... else myIsVertexValue has been set to False
}
// memorize that IsVertex1() has been called :
// - on point myPointIndex
// - on edge <Index>
myIsVertexPointIndex = myPointIndex;
myIsVertexIndex = Index;
return myIsVertexValue;
}
//=======================================================================
//function : Vertex1
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_EdgesIntersector::Vertex1(const Standard_Integer Index)
{
if ( ! IsVertex1(Index) )
Standard_Failure::Raise("TopOpeBRep_EdgesIntersector : Vertex1");
return myIsVertexVertex;
}
//=======================================================================
//function : Value1
//purpose :
//=======================================================================
gp_Pnt TopOpeBRep_EdgesIntersector::Value1() const
{
gp_Pnt2d p2 = Point1().Value();
gp_Pnt p;
if (Precision::IsInfinite(p2.X()) || Precision::IsInfinite(p2.Y())) {
Standard_Real inf = Precision::Infinite();
p.SetCoord (inf, inf, inf);
}
else
mySurface1->Surface().D0(p2.X(),p2.Y(), p);
return p;
}

View File

@@ -0,0 +1,40 @@
-- File: TopOpeBRep_FFDumper.cdl
-- Created: Wed Oct 23 15:36:43 1996
-- Author: Jean Yves LEBEY
-- <jyl@bistrox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1996
class FFDumper from TopOpeBRep inherits TShared from MMgt
uses
DataMapOfShapeInteger from TopTools,
PFacesFiller from TopOpeBRep,
LineInter from TopOpeBRep,
VPointInter from TopOpeBRep,
VPointInterIterator from TopOpeBRep,
Kind from TopOpeBRepDS,
Shape from TopoDS,
Face from TopoDS
is
Create(PFF:PFacesFiller) returns mutable FFDumper from TopOpeBRep;
Init(me:mutable;PFF:PFacesFiller);
DumpLine(me:mutable;I:Integer);
DumpLine(me:mutable;L:LineInter);
DumpVP(me:mutable;VP:VPointInter);
DumpVP(me:mutable;VP:VPointInter;ISI:Integer);
ExploreIndex(me;S:Shape;ISI:Integer) returns Integer;
DumpDSP(me;VP:VPointInter;GK:Kind;G:Integer;newinDS:Boolean);
PFacesFillerDummy(me) returns PFacesFiller;
fields
myPFF:PFacesFiller from TopOpeBRep;
myF1,myF2:Face from TopoDS;
myEM1,myEM2:DataMapOfShapeInteger from TopTools;
myEn1,myEn2:Integer;
myLineIndex : Integer;
end FFDumper from TopOpeBRep;

View File

@@ -0,0 +1,290 @@
// File: TopOpeBRep_FFDumper.cxx
// Created: Wed Oct 23 14:54:04 1996
// Author: Jean Yves LEBEY
// Copyright: OPEN CASCADE 1996
#include <TopOpeBRep_FFDumper.ixx>
#include <TopExp_Explorer.hxx>
#include <TopAbs.hxx>
#include <TopOpeBRep_FacesIntersector.hxx>
#include <TopOpeBRep_VPointInterIterator.hxx>
#include <TopOpeBRep_VPointInter.hxx>
#include <TopOpeBRep.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <BRep_Tool.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <TopOpeBRep_FacesFiller.hxx>
#include <TopOpeBRep_define.hxx>
#include <IntPatch_GLine.hxx>
#ifdef DEB
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSNC();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSFK();
static TCollection_AsciiString PRODINP("dinp ");
#endif
//=======================================================================
//function : TopOpeBRep_FFDumper
//purpose :
//=======================================================================
#ifndef DEB
TopOpeBRep_FFDumper::TopOpeBRep_FFDumper(const TopOpeBRep_PFacesFiller& )
{
#else
TopOpeBRep_FFDumper::TopOpeBRep_FFDumper(const TopOpeBRep_PFacesFiller& PFF)
{
Init(PFF);
#endif
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
#ifndef DEB
void TopOpeBRep_FFDumper::Init(const TopOpeBRep_PFacesFiller& )
{
#else
void TopOpeBRep_FFDumper::Init(const TopOpeBRep_PFacesFiller& PFF)
{
myPFF = PFF;
const TopoDS_Face& fpff1 = myPFF->Face(1);
const TopoDS_Face& fpff2 = myPFF->Face(2);
Standard_Boolean f1diff = (!myF1.IsEqual(fpff1));
Standard_Boolean f2diff = (!myF2.IsEqual(fpff2));
Standard_Boolean init = f1diff || f2diff;
if (init) {
myF1 = myPFF->Face(1);
myF2 = myPFF->Face(2);
myEM1.Clear(); myEn1 = 0;
myEM2.Clear(); myEn2 = 0;
TopExp_Explorer x;
for (x.Init(myF1,TopAbs_EDGE);x.More();x.Next()) myEM1.Bind(x.Current(),++myEn1);
for (x.Init(myF2,TopAbs_EDGE);x.More();x.Next()) myEM2.Bind(x.Current(),++myEn2);
myLineIndex = 0;
}
#endif
}
//=======================================================================
//function : DumpLine
//purpose :
//=======================================================================
#ifndef DEB
void TopOpeBRep_FFDumper::DumpLine(const Standard_Integer )
{
#else
void TopOpeBRep_FFDumper::DumpLine(const Standard_Integer I)
{
const TopOpeBRep_LineInter& L = myPFF->ChangeFacesIntersector().ChangeLine(I);
DumpLine(L);
#endif
}
//=======================================================================
//function : DumpLine
//purpose :
//=======================================================================
#ifndef DEB
void TopOpeBRep_FFDumper::DumpLine(const TopOpeBRep_LineInter& )
{
#else
void TopOpeBRep_FFDumper::DumpLine(const TopOpeBRep_LineInter& LI)
{
Standard_Integer il = LI.Index();
myLineIndex = il;
Standard_Integer nl = myPFF->ChangeFacesIntersector().NbLines();
Standard_Boolean HasVPonR = LI.HasVPonR();
Standard_Boolean IsVClosed = LI.IsVClosed();
Standard_Boolean IsPeriodic = LI.IsPeriodic();
Standard_Boolean isrest = (LI.TypeLineCurve() == TopOpeBRep_RESTRICTION);
cout<<endl<<"--------------------------------------------------"<<endl;
cout<<"line "<<il<<"/"<<nl<<" is a "; LI.DumpType();
if ( isrest) {
Standard_Boolean isedge1 = LI.ArcIsEdge(1);
Standard_Boolean isedge2 = LI.ArcIsEdge(2);
if ( isedge1 ) cout<<" of 1";
else if ( isedge2 ) cout<<" of 2";
else cout<<"of 0(BUG)";
}
cout<<endl;
if ( isrest) {
const TopoDS_Shape& Erest = LI.Arc();
Standard_Boolean FIisrest = myPFF->ChangeFacesIntersector().IsRestriction(Erest);
cout<<"++++ line restriction";
if (FIisrest) {
cout<<" edge restriction";
Standard_Integer iErest = 0;
if (myPFF->ChangeDataStructure().HasShape(Erest))
iErest = myPFF->ChangeDataStructure().Shape(Erest);
cout<<" "<<iErest;
}
cout<<endl;
}
if (HasVPonR) cout<<"has vertex on restriction"<<endl;
else cout<<"has no vertex on restriction"<<endl;
if (IsVClosed) cout<<"is closed by vertices"<<endl;
else cout<<"is not closed by vertices"<<endl;
if (IsPeriodic) cout<<"is periodic"<<endl;
else cout<<"is not periodic"<<endl;
TopOpeBRep_VPointInterIterator VPI;
VPI.Init(LI); if (VPI.More()) cout<<endl;
for (;VPI.More();VPI.Next()) {
TCollection_AsciiString stol("; #draw ");
stol = stol + VPI.CurrentVP().Tolerance() + "\n";
LI.DumpVPoint(VPI.CurrentVPIndex(),PRODINP,stol);
}
VPI.Init(LI);
if (VPI.More()) cout<<endl;
for (;VPI.More();VPI.Next()) {
const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
Standard_Boolean dump = VP.Keep() || TopOpeBRepDS_GettraceDSFK();
if (dump) { DumpVP(VP); cout<<endl; }
}
if (LI.TypeLineCurve() == TopOpeBRep_LINE) {
gp_Dir D = LI.LineG()->Line().Direction();
TopOpeBRep::Print(LI.TypeLineCurve(),cout); Standard_Real x,y,z; D.Coord(x,y,z);
cout<<" dir : "<<x<<" "<<y<<" "<<z<<endl;
}
LI.DumpLineTransitions(cout);
cout<<endl<<"--------------------------------------------------"<<endl;
#endif
}
//=======================================================================
//function : DumpVP
//purpose :
//=======================================================================
#ifndef DEB
void TopOpeBRep_FFDumper::DumpVP(const TopOpeBRep_VPointInter& )
{
#else
void TopOpeBRep_FFDumper::DumpVP(const TopOpeBRep_VPointInter& VP)
{
Standard_Integer il = myLineIndex;
cout<<"VP "<<VP.Index()<<" on "<<VP.ShapeIndex()<<" :";
Standard_Real Cpar = VP.ParameterOnLine(); cout<<" on curve : "<<Cpar;
if (!VP.Keep()) cout<<" NOT kept";
cout<<endl;
Standard_Boolean k = VP.Keep();
const gp_Pnt& P = VP.Value();
cout<<PRODINP<<"L"<<il<<"P"<<VP.Index();if (k) cout<<"K";cout<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z();
cout<<"; #draw"<<endl;
if (TopOpeBRepDS_GettraceDSFK()) {
Standard_Real u,v;
VP.ParametersOnS1(u,v); cout<<"u1,v1 : "<<u<<" "<<v; cout<<" ";
VP.ParametersOnS2(u,v); cout<<"u2,v2 : "<<u<<" "<<v; cout<<endl;
}
if (VP.ShapeIndex() == 1)
DumpVP(VP,1);
else if (VP.ShapeIndex() == 2)
DumpVP(VP,2);
else if (VP.ShapeIndex() == 3) {
DumpVP(VP,1);
DumpVP(VP,2);
}
#endif
}
//=======================================================================
//function : DumpVP
//purpose :
//=======================================================================
#ifndef DEB
void TopOpeBRep_FFDumper::DumpVP(const TopOpeBRep_VPointInter& ,const Standard_Integer )
{
#else
void TopOpeBRep_FFDumper::DumpVP(const TopOpeBRep_VPointInter& VP,const Standard_Integer ISI)
{
const Handle(TopOpeBRepDS_HDataStructure)& HDS = myPFF->HDataStructure();
const TopoDS_Edge& E = TopoDS::Edge(VP.Edge(ISI));
Standard_Real Epar = VP.EdgeParameter(ISI);
TopAbs_Orientation O = E.Orientation();
TopOpeBRepDS_Transition T = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ISI,O);
const TopoDS_Face F = myPFF->Face(ISI);
Standard_Boolean Closed = TopOpeBRepTool_ShapeTool::Closed(E,F);
Standard_Boolean Degen = BRep_Tool::Degenerated(E);
Standard_Integer exi = ExploreIndex(E,ISI);
Standard_Integer dsi = (HDS->HasShape(E)) ? HDS->Shape(E) : 0;
Standard_Boolean isv = VP.IsVertex(ISI);
if (isv) cout<<"is vertex of "<<ISI<<endl;
if (Closed) cout<<"on closing edge "; else cout<<"on edge ";
if (Degen) cout<<" on degenerated edge ";
TopAbs::Print(O,cout); cout<<" (ds"<<dsi<<") (ex"<<exi<<") of face of "<<ISI;
cout<<" : par : "<<Epar<<endl;
if (Closed) cout<<"on closing edge "; else cout<<"on edge ";
if (Degen) cout<<" on degenerated edge ";
TopAbs::Print(O,cout); cout<<" (ds"<<dsi<<") (ex"<<exi<<") of face of "<<ISI;
cout<<" : line transition : ";T.Dump(cout);cout<<endl;
#endif
}
//=======================================================================
//function : ExploreIndex
//purpose :
//=======================================================================
#ifndef DEB
Standard_Integer TopOpeBRep_FFDumper::ExploreIndex(const TopoDS_Shape& , const Standard_Integer ) const
{
#else
Standard_Integer TopOpeBRep_FFDumper::ExploreIndex(const TopoDS_Shape& S, const Standard_Integer ISI) const
{
Standard_Integer r = 0;
if (ISI == 1) r = myEM1.Find(S);
if (ISI == 2) r = myEM2.Find(S);
return r;
#endif
return 0;
}
//=======================================================================
//function : DumpDSP
//purpose :
//=======================================================================
#ifndef DEB
void TopOpeBRep_FFDumper::DumpDSP(const TopOpeBRep_VPointInter& ,const TopOpeBRepDS_Kind ,const Standard_Integer ,
const Standard_Boolean ) const
{
#else
void TopOpeBRep_FFDumper::DumpDSP(const TopOpeBRep_VPointInter& VP,const TopOpeBRepDS_Kind GK,const Standard_Integer G,
const Standard_Boolean newinDS) const
{
cout<<"VP "<<VP.Index()<<" on "<<VP.ShapeIndex();
if (newinDS) {
if (GK == TopOpeBRepDS_VERTEX) cout<<" gives new DSV";
else if (GK == TopOpeBRepDS_POINT) cout<<" gives new DSP";
else cout<<" gives new DS???";
}
else {
if (GK == TopOpeBRepDS_VERTEX) cout<<" equals new DSV";
else if (GK == TopOpeBRepDS_POINT) cout<<" equals new DSP";
else cout<<" equals new DS???";
}
cout<<" "<<G;
const Handle(TopOpeBRepDS_HDataStructure)& HDS = myPFF->HDataStructure();
Standard_Real tol;
if (GK == TopOpeBRepDS_VERTEX) tol = BRep_Tool::Tolerance(TopoDS::Vertex(HDS->Shape(G)));
else if (GK == TopOpeBRepDS_POINT) tol = HDS->Point(G).Tolerance();
cout<<" tol = "<<tol;
cout<<endl;
#endif
}
TopOpeBRep_PFacesFiller TopOpeBRep_FFDumper::PFacesFillerDummy() const {return myPFF;}

View File

@@ -0,0 +1,60 @@
-- File: TopOpeBRep_FFTransitionTool.cdl
-- Created: Thu Oct 27 11:03:17 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class FFTransitionTool from TopOpeBRep
uses
LineInter from TopOpeBRep,
VPointInter from TopOpeBRep,
Orientation from TopAbs,
Transition from TopOpeBRepDS,
Shape from TopoDS
is
ProcessLineTransition(myclass;
P : VPointInter from TopOpeBRep;
Index : Integer from Standard;
EdgeOrientation : Orientation from TopAbs)
returns Transition from TopOpeBRepDS;
ProcessLineTransition(myclass;
P : VPointInter from TopOpeBRep;
L : LineInter from TopOpeBRep)
returns Transition from TopOpeBRepDS;
ProcessEdgeTransition(myclass;
P : VPointInter from TopOpeBRep;
Index : Integer from Standard;
LineOrientation : Orientation from TopAbs)
returns Transition from TopOpeBRepDS;
ProcessFaceTransition(myclass;
L : LineInter from TopOpeBRep;
Index : Integer from Standard;
FaceOrientation : Orientation from TopAbs)
returns Transition from TopOpeBRepDS;
ProcessEdgeONTransition(myclass;
VP : VPointInter from TopOpeBRep;
Index : Integer; -- index of face <F>
R : Shape from TopoDS; -- edge "IntPatch_Restriction"
E : Shape from TopoDS; -- edge supporting <VP>
F : Shape from TopoDS) -- face <Index> containing E
---Purpose: compute transition on "IntPatch_Restriction line" edge <R>
-- when crossing edge <E> of face <F> at point <VP>.
-- VP is given on edge <E> of face <F> of index <Index> (1 or 2).
-- <VP> has been classified by FacesFiller as TopAbs_ON an edge <R>
-- of the other face than <F> of current (face/face) intersection.
-- Transition depends on the orientation of E in F.
-- This method should be provided by IntPatch_Line (NYI)
returns Transition from TopOpeBRepDS;
end FFTransitionTool from TopOpeBRep;

View File

@@ -0,0 +1,391 @@
// File: TopOpeBRep_FFTransitionTool.cxx
// Created: Thu Oct 27 11:14:38 1994
// Author: Jean Yves LEBEY
// <jyl@bravox>
#include <TopOpeBRepDS_SolidSurfaceInterference.hxx>
#include <TopOpeBRepDS_CurvePointInterference.hxx>
#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
#include <TopAbs.hxx>
#include <IntSurf_Transition.hxx>
#include <IntSurf_TypeTrans.hxx>
#include <IntSurf_Situation.hxx>
#include <TopOpeBRep_FFTransitionTool.ixx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <gp_Vec.hxx>
#ifdef DEB
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
#endif
//-----------------------------------------------------------------------
//function : TransitionToOrientation
//purpose : static
//-----------------------------------------------------------------------
static Standard_Boolean TransitionToOrientation
(const IntSurf_Transition& T,
TopAbs_Orientation& O)
{
Standard_Boolean Odefined = Standard_True;
TopAbs_Orientation result = TopAbs_FORWARD;
IntSurf_TypeTrans trans;
IntSurf_Situation situa;
trans = T.TransitionType();
switch (trans) {
case IntSurf_In : result = TopAbs_FORWARD; break;
case IntSurf_Out : result = TopAbs_REVERSED; break;
case IntSurf_Touch :
situa = T.Situation();
switch (situa) {
case IntSurf_Inside : result = TopAbs_INTERNAL; break;
case IntSurf_Outside : result = TopAbs_EXTERNAL; break;
case IntSurf_Unknown :
Odefined = Standard_False;
#ifdef DEB
// if ( TopOpeBRepDS_GettraceDSF() ) {
// cout<<"TopOpeBRepDS:TransitionToOrientation : unknown situation"<<endl;
// }
#endif
break;
}
break;
case IntSurf_Undecided :
Odefined = Standard_False;
#ifdef DEB
// if ( TopOpeBRepDS_GettraceDSF() ) {
// cout<<"TopOpeBRepDS:TransitionToOrientation : undecided transition"<<endl;
// }
#endif
break;
}
O = result;
return Odefined;
}
//=======================================================================
//function : ProcessLineTransition
//purpose : compute the transition of the intersection
// : point <P> on the intersected shape of index <Index> (1 or 2)
// : for a line crossing an edge
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FFTransitionTool::ProcessLineTransition
(const TopOpeBRep_VPointInter &P,
const Standard_Integer Index,
const TopAbs_Orientation EdgeOrientation)
{
TopOpeBRepDS_Transition TT;
if ((EdgeOrientation==TopAbs_INTERNAL)||(EdgeOrientation==TopAbs_EXTERNAL)) {
TT.Set(EdgeOrientation);
}
else {
TopAbs_Orientation O;
IntSurf_Transition T; {
switch (Index) {
case 1 : T = P.TransitionLineArc1(); break;
case 2 : T = P.TransitionLineArc2(); break;
}
Standard_Boolean Odefined = ::TransitionToOrientation(T,O);
if (Odefined) {
if (EdgeOrientation == TopAbs_REVERSED) O = TopAbs::Complement(O);
TT.Set(O);
}
else {
TT.Set(TopAbs_UNKNOWN,TopAbs_UNKNOWN);
}
}
}
return TT;
}
//=======================================================================
//function : ProcessLineTransition
//purpose : compute the transition of point P on line L, P lying on
// neither of the intersecting shapes
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FFTransitionTool::ProcessLineTransition
(const TopOpeBRep_VPointInter &P, const TopOpeBRep_LineInter& LI)
{
TopOpeBRepDS_Transition TT;
TopAbs_Orientation result;
// P.IsOnDomS1() and P.IsOnDomS2() are both false
Standard_Integer nbv = LI.NbVPoint();
TopOpeBRep_VPointInter P1 = LI.VPoint(1);
Standard_Real par1 = P1.ParameterOnLine();
TopOpeBRep_VPointInter Pn = LI.VPoint(nbv);
Standard_Real parn = Pn.ParameterOnLine();
Standard_Real par = P.ParameterOnLine();
if ( par == par1 ) result = TopAbs_FORWARD;
else if ( par == parn ) result = TopAbs_REVERSED;
else result = TopAbs_INTERNAL;
TT.Set(result);
return TT;
}
//=======================================================================
//function : ProcessEdgeTransition
//purpose : compute the transition from the transition of the intersection
// : point <P> on the intersected shape of index <Index> (1 or 2)
// : for an edge on a line on a Face
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FFTransitionTool::ProcessEdgeTransition
(const TopOpeBRep_VPointInter &P,
const Standard_Integer Index,
const TopAbs_Orientation FaceTransition)
{
TopOpeBRepDS_Transition TT;
if ((FaceTransition == TopAbs_INTERNAL) ||
(FaceTransition == TopAbs_EXTERNAL)) {
TT.Set(FaceTransition);
}
else {
IntSurf_Transition T;
if ( Index == 1 ) T = P.TransitionOnS1();
else if ( Index == 2 ) T = P.TransitionOnS2();
TopAbs_Orientation O;
Standard_Boolean defined = ::TransitionToOrientation(T,O);
if (defined) {
if (FaceTransition == TopAbs_REVERSED) O = TopAbs::Complement(O);
TT.Set(O);
}
else {
TT.Set(TopAbs_UNKNOWN,TopAbs_UNKNOWN);
}
}
return TT;
}
//=======================================================================
//function : ProcessFaceTransition
//purpose : compute the transition from a Line
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FFTransitionTool::ProcessFaceTransition
(const TopOpeBRep_LineInter& L,
const Standard_Integer Index,
const TopAbs_Orientation FaceOrientation)
{
// If Index == 1, on first shape
// If Index == 2, on second shape
TopOpeBRepDS_Transition TT;
if ((FaceOrientation == TopAbs_INTERNAL) ||
(FaceOrientation == TopAbs_EXTERNAL)) {
TT.Set(FaceOrientation);
}
else {
Standard_Boolean Odefined = Standard_True;
#ifdef DEB
TopAbs_Orientation O;
#else
TopAbs_Orientation O = TopAbs_FORWARD;
#endif
IntSurf_TypeTrans trans;
trans = (Index == 1) ? L.TransitionOnS1() : L.TransitionOnS2();
switch (trans) {
case IntSurf_In : O = TopAbs_FORWARD; break;
case IntSurf_Out : O = TopAbs_REVERSED; break;
case IntSurf_Touch : {
IntSurf_Situation situa;
situa = (Index == 1 ) ? L.SituationS1() : L.SituationS2();
switch (situa) {
case IntSurf_Inside : O = TopAbs_INTERNAL; break;
case IntSurf_Outside : O = TopAbs_EXTERNAL; break;
case IntSurf_Unknown :
Odefined = Standard_False;
#ifdef DEB
if ( TopOpeBRepDS_GettraceDSF() ) {
cout<<"ProcessFaceTransition : unknown situation"<<endl;
}
#endif
break;
}
break;
} // case Touch
case IntSurf_Undecided :
Odefined = Standard_False;
#ifdef DEB
if ( TopOpeBRepDS_GettraceDSF() ) {
cout<<"ProcessFaceTransition : undecided transition"<<endl;
}
#endif
break;
} // trans
if (Odefined) {
if (FaceOrientation == TopAbs_REVERSED) O = TopAbs::Complement(O);
TT.Set(O);
}
else {
TT.Set(TopAbs_UNKNOWN,TopAbs_UNKNOWN);
}
}
return TT;
}
// -------------------------------------------------
// input : P1 : point
// input : C2 : courbe, FC2,LC2 : bornes de C2
// output : T2 = parametre de P1 sur C2
// -------------------------------------------------
static Standard_Boolean FUN_ProjectPoint(const gp_Pnt& P1,
const Handle(Geom_Curve)& C2,
const Standard_Real FC2,
const Standard_Real LC2,
Standard_Real& T2)
{
if ( C2.IsNull() ) {
return Standard_False;
}
Standard_Real res = Standard_False;
GeomAPI_ProjectPointOnCurve mydist(P1,C2,FC2,LC2);
if ( mydist.Extrema().IsDone() ) {
if ( mydist.NbPoints() ) {
T2 = mydist.LowerDistanceParameter();
res = Standard_True;
}
}
//#ifdef DEB
// return res; // BUG ???
//#else
return (Standard_Boolean ) res ;
//#endif
}
// -------------------------------------------------
// input : S1,U1,V1,C1,T1 avec D0(S1(U1,V1)) = D0(C1(T1))
// input : C2,FC2,LC2 : courbe, bornes de C2
// output : Trans : transition sur C1 en T1 en croisant C2
// -------------------------------------------------
static Standard_Boolean FUN_GeomTrans(const Handle(Geom_Surface)& S1,
const Standard_Real U1,
const Standard_Real V1,
const Handle(Geom_Curve)& C1,
const Standard_Real T1,
const Handle(Geom_Curve)& C2,
const Standard_Real FC2,
const Standard_Real LC2,
TopOpeBRepDS_Transition& Trans)
{
if ( C1.IsNull() || C2.IsNull() ) {
return Standard_False;
}
// P1 : D0(C1(T1), D1_C1 : D1(C1(T1))
gp_Pnt P1; gp_Vec D1_C1; C1->D1(T1,P1,D1_C1);
// D1_C2 : D1(C2(P1))
Standard_Real T2;
Standard_Boolean projok = ::FUN_ProjectPoint(P1,C2,FC2,LC2,T2);
if ( !projok ) {
return Standard_False;
}
gp_Pnt P2; gp_Vec D1_C2; C2->D1(T2,P2,D1_C2);
// N1 : D1(S1(U1,V1))
gp_Vec N1,D1U,D1V;
gp_Pnt PS;
S1->D1(U1,V1,PS,D1U,D1V);
D1U.Normalize();
D1V.Normalize();
N1 = D1U.Crossed(D1V);
N1.Normalize();
gp_Vec N1D1_C1 = N1.Crossed(D1_C1);
Standard_Real dot = N1D1_C1.Dot(D1_C2);
if ( dot > 0 ) {
Trans.Before(TopAbs_OUT);
Trans.After(TopAbs_IN);
}
else {
Trans.Before(TopAbs_IN);
Trans.After(TopAbs_OUT);
}
return Standard_True;
}
//=======================================================================
//function : ProcessEdgeONTransition
//purpose :
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FFTransitionTool::ProcessEdgeONTransition
(const TopOpeBRep_VPointInter& VP,
const Standard_Integer ShapeIndex,
const TopoDS_Shape& RR,
const TopoDS_Shape& EE,
const TopoDS_Shape& FF)
{
const TopoDS_Edge& R = TopoDS::Edge(RR);
const TopoDS_Edge& E = TopoDS::Edge(EE);
const TopoDS_Face& F = TopoDS::Face(FF);
TopAbs_Orientation oriE = E.Orientation();
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F);
Standard_Real U,V;
if (ShapeIndex == 1) VP.ParametersOnS1(U,V);
else if (ShapeIndex == 2) VP.ParametersOnS2(U,V);
Standard_Real fE,lE;
const Handle(Geom_Curve)& CE = BRep_Tool::Curve(E,fE,lE);
Standard_Real TE = VP.EdgeParameter(ShapeIndex);
Standard_Real fR,lR;
const Handle(Geom_Curve)& CR = BRep_Tool::Curve(R,fR,lR);
TopOpeBRepDS_Transition Trans;
Standard_Boolean transok = ::FUN_GeomTrans(S,U,V,CE,TE,CR,fR,lR,Trans);
if ( transok ) {
// Trans : transition sur R en croisant l'arete E orientee dans la face F
if (oriE == TopAbs_REVERSED) Trans = Trans.Complement();
}
return Trans;
}

View File

@@ -0,0 +1,95 @@
-- File: TopOpeBRep_FaceEdgeFiller.cdl
-- Created: Wed Jun 14 16:45:28 1995
-- Author: Jean Yves LEBEY
-- <jyl@meteox>
---Copyright: Matra Datavision 1995
class FaceEdgeFiller from TopOpeBRep
uses
Shape from TopoDS,
FaceEdgeIntersector from TopOpeBRep,
HDataStructure from TopOpeBRepDS,
DataStructure from TopOpeBRepDS,
Interference from TopOpeBRepDS,
ListOfInterference from TopOpeBRepDS,
ListIteratorOfListOfInterference from TopOpeBRepDS,
Point from TopOpeBRepDS
is
Create returns FaceEdgeFiller from TopOpeBRep;
Insert(me : in out;
F,E : Shape from TopoDS;
FEINT : in out FaceEdgeIntersector from TopOpeBRep;
HDS : HDataStructure from TopOpeBRepDS)
is static;
-- -------
-- private
-- -------
ScanInterfList(me;
IT : in out ListIteratorOfListOfInterference from TopOpeBRepDS;
DSP : Point from TopOpeBRepDS;
BDS : DataStructure from TopOpeBRepDS)
---Purpose:
-- Search, among a list of interferences accessed by the iterator
-- <IT>, a geometry <G> whose 3D point is identical to the 3D point
-- of the TheDSPoint <DSP>.
-- returns True if such an interference has been found, False else.
-- if True, iterator It points (by the Value() method) on the first
-- interference accessing an identical 3D point.
returns Boolean from Standard
is static private;
GetGeometry(me ;
IT : in out ListIteratorOfListOfInterference from TopOpeBRepDS;
EI : FaceEdgeIntersector from TopOpeBRep;
G : in out Integer from Standard;
DS : DataStructure from TopOpeBRepDS)
---Purpose:
-- Search for an interference in list <IT> which 3D geometry
-- equals 3D geometry of the current intersection of <EI>.
-- The search is performed by ScanInterfList.
-- if found, set <G> to the geometry of the interference found.
-- returns found.
returns Boolean from Standard
is static private;
MakeGeometry(me ; EI : in out FaceEdgeIntersector from TopOpeBRep;
DS : in out DataStructure from TopOpeBRepDS)
returns Integer from Standard
is static private;
GetGeometry(me ; L : ListOfInterference from TopOpeBRepDS;
DSP : Point from TopOpeBRepDS;
G : in out Integer from Standard;
DS : in out DataStructure from TopOpeBRepDS)
---Purpose:
-- Get the geometry of a DS point <DSP>.
-- First, search it with ScanInterfList (previous method).
-- if found, set <G> to the geometry of the interference found.
-- else, add the point <DSP> in the <DS> and set <G> to the
-- value of the new geometry such created.
--
-- returns the value of ScanInterfList().
returns Boolean from Standard
is static private;
StoreInterference(me;
I : Interference from TopOpeBRepDS;
LI : in out ListOfInterference from TopOpeBRepDS;
BDS : in out DataStructure from TopOpeBRepDS)
---Purpose:
-- Add interference <I> to list <LI>.
-- Add <I> to the interference list of <I> geometry (via <BDS>).
is static private;
end FaceEdgeFiller from TopOpeBRep;

View File

@@ -0,0 +1,325 @@
// File: TopOpeBRep_FaceEdgeFiller.cxx
// Created: Wed Jun 14 16:54:03 1995
// Author: Jean Yves LEBEY
// <jyl@meteox>
#include <TopOpeBRep_FaceEdgeFiller.ixx>
#include <TopOpeBRep_PointGeomTool.hxx>
#include <TopOpeBRepDS_InterferenceTool.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TopOpeBRepDS_Point.hxx>
#include <TopOpeBRepDS_CurvePointInterference.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <gp_Pnt2d.hxx>
#ifdef DEB
Standard_IMPORT void FEINT_DUMPPOINTS(TopOpeBRep_FaceEdgeIntersector& FEINT,
const TopOpeBRepDS_DataStructure& BDS);
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
#endif
//=======================================================================
//function : TopOpeBRep_FaceEdgeFiller
//purpose :
//=======================================================================
TopOpeBRep_FaceEdgeFiller::TopOpeBRep_FaceEdgeFiller()
{
}
//=======================================================================
//function : Insert
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeFiller::Insert
(const TopoDS_Shape& F,
const TopoDS_Shape& E,
TopOpeBRep_FaceEdgeIntersector& FEINT,
const Handle(TopOpeBRepDS_HDataStructure)& HDS)
{
const TopoDS_Face& FF = TopoDS::Face(F);
const TopoDS_Edge& EE = TopoDS::Edge(E);
#ifdef DEB
if (TopOpeBRepDS_GettraceDSF()) {
FEINT_DUMPPOINTS(FEINT,HDS->DS());
}
#endif
// exit if no point.
FEINT.InitPoint();
if ( ! FEINT.MorePoint() ) return;
TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
TopAbs_Orientation FFori = FF.Orientation();
TopAbs_Orientation EEori = EE.Orientation();
// --- Add <FF,EE> in BDS
Standard_Integer FFindex = BDS.AddShape(FF,1);
#ifdef DEB
Standard_Integer EEindex =
#endif
BDS.AddShape(EE,2);
// --- get list of interferences connected to edges <FF>,<EE>
TopOpeBRepDS_ListOfInterference& EIL1 = BDS.ChangeShapeInterferences(FF);
TopOpeBRepDS_ListOfInterference& EIL2 = BDS.ChangeShapeInterferences(EE);
Handle(TopOpeBRepDS_Interference) EPI; //edge/point interference
Handle(TopOpeBRepDS_Interference) EVI; //edge/vertex interference
for (; FEINT.MorePoint(); FEINT.NextPoint() ) {
gp_Pnt2d pUV; FEINT.UVPoint(pUV);
#ifdef DEB
TopAbs_State sta =
#endif
FEINT.State();
Standard_Real parE = FEINT.Parameter();
#ifdef DEB
TopOpeBRepDS_Transition TFF =
#endif
FEINT.Transition(1,EEori); // EEori bidon = EXTERNAL
TopOpeBRepDS_Transition TEE = FEINT.Transition(2,FFori);
TEE.Index(FFindex);
TopoDS_Vertex V1;
Standard_Boolean isvertexF = FEINT.IsVertex(1,V1);
TopoDS_Vertex V2;
Standard_Boolean isvertexE = FEINT.IsVertex(2,V2);
Standard_Boolean isvertex = isvertexF || isvertexE;
Standard_Integer DSPindex;
Standard_Boolean EPIfound;
if ( ! isvertex ) {
// create a new geometry in DS ( and get its index <DSPindex> )
// or get the index <DSPindex> of an equal geometry
// among those of Edge/Point interferences connected to <FF> (or <EE>).
TopOpeBRepDS_ListIteratorOfListOfInterference itEIL1(EIL1);
EPIfound = GetGeometry(itEIL1,FEINT,DSPindex,BDS);
if ( ! EPIfound ) DSPindex = MakeGeometry(FEINT,BDS);
// sur FF
// NYI : FacePointInterference : on ajoute un point INTERNAL a F
// FPI = new TopOpeBRepDS_FacePointInterference(TopAbs_INTERNAL,
// TopOpeBRepDS_FACE,FFindex,
// TopOpeBRepDS_POINT,DSPindex,
// pUV);
// StoreInterference(FPI,EIL1,BDS);
// sur EE
EPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
(TEE,TopOpeBRepDS_FACE,FFindex,TopOpeBRepDS_POINT,DSPindex,parE);
StoreInterference(EPI,EIL2,BDS);
}
else if ( isvertexF ) {
// si aussi vertex de E, in privilegie le vertex de la face
Standard_Integer Vindex = BDS.AddShape(V1,1);
// sur FF
// NYI pour toute arete de F qui accede V , une EVI
// EVI = new TopOpeBRepDS_EdgeVertexInterference(Transition ?? <-> TFF,
// TopOpeBRepDS_EDGE,E de F,
// TopOpeBRepDS_VERTEX,Vindex,
// param de V sur E de F);
// StoreInterference(EVI,EIL1,BDS);
// sur EE
EPI = new TopOpeBRepDS_CurvePointInterference(TEE,
TopOpeBRepDS_FACE,FFindex,
TopOpeBRepDS_VERTEX,Vindex,
parE);
StoreInterference(EPI,EIL2,BDS);
}
else if ( isvertexE ) {
Standard_Integer Vindex = BDS.AddShape(V2,2);
// sur FF
// NYI : FaceVertexInterference : on ajoute un vertex INTERNAL a F
// FVI = new TopOpeBRepDS_FaceVertexInterference(TopAbs_INTERNAL,
// TopOpeBRepDS_FACE,FFindex,
// TopOpeBRepDS_VERTEX,Vindex,
// pUV);
// StoreInterference(FPI,EIL1,BDS);
// sur EE
EPI = new TopOpeBRepDS_CurvePointInterference(TEE,
TopOpeBRepDS_FACE,FFindex,
TopOpeBRepDS_VERTEX,Vindex,
parE);
StoreInterference(EPI,EIL2,BDS);
}
}
}
// ===============
// private methods
// ===============
//-----------------------------------------------------------------------
// Search, among a list of interferences accessed by the iterator <IT>,
// a geometry whose 3D point is identical yo the 3D point of a DS point <DSP>.
// TheDSPointGeomTool is a tool able to access the 3D point of the DS point
// DSP,and to test identity (according to tolerance connected to DSP) of the
// DS points.
// return True if such an interference has been found, False else.
// if True, iterator <IT> points (by the Value() method) on the first
// interference accessing an identical 3D point.
//-----------------------------------------------------------------------
//=======================================================================
//function : ScanInterfList
//purpose : private
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeFiller::ScanInterfList
(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
const TopOpeBRepDS_Point& DSP,
const TopOpeBRepDS_DataStructure& BDS) const
{
for ( ; IT.More(); IT.Next() ) {
Standard_Integer DSPG = IT.Value()->Geometry();
const TopOpeBRepDS_Point& otherDSP = BDS.Point(DSPG);
if (TopOpeBRep_PointGeomTool::IsEqual(DSP,otherDSP)) return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : GetGeometry
//purpose : private
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeFiller::GetGeometry
(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
const TopOpeBRep_FaceEdgeIntersector& FEINT,
Standard_Integer& G,
const TopOpeBRepDS_DataStructure& BDS) const
{
TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(FEINT);
Standard_Boolean found = ScanInterfList(IT,DSP,BDS);
if (found) G = IT.Value()->Geometry();
return found;
}
//=======================================================================
//function : GetGeometry
//purpose : private
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeFiller::GetGeometry
(const TopOpeBRepDS_ListOfInterference& L,
const TopOpeBRepDS_Point& DSP,
Standard_Integer& G,
TopOpeBRepDS_DataStructure& BDS) const
{
TopOpeBRepDS_ListIteratorOfListOfInterference itI(L);
Standard_Boolean Ifound = ScanInterfList(itI,DSP,BDS);
if (Ifound) G = itI.Value()->Geometry();
else G = BDS.AddPoint(DSP);
return Ifound; // interference found or not
}
//-----------------------------------------------------------------------
// StoreInterference : Append an interference I to a list of interference LI
// : Append I to the interf. list connected to I Geometry()
//-----------------------------------------------------------------------
//=======================================================================
//function : StoreInterference
//purpose : private
//=======================================================================
void TopOpeBRep_FaceEdgeFiller::StoreInterference
(const Handle(TopOpeBRepDS_Interference)& I,
TopOpeBRepDS_ListOfInterference& LI,
TopOpeBRepDS_DataStructure& BDS) const
{
// append I to list LI
LI.Append(I);
Standard_Boolean appendtoG = Standard_False;
Standard_Integer G = I->Geometry();
// append I to list of interference connected to G = I->Geometry()
switch (I->GeometryType()) {
case TopOpeBRepDS_SOLID : case TopOpeBRepDS_FACE :
case TopOpeBRepDS_EDGE : case TopOpeBRepDS_VERTEX :
// appendtoG = Standard_True;
// BDS.ChangeShapeInterferences(G).Append(I);
break;
case TopOpeBRepDS_SURFACE :
appendtoG = Standard_True;
BDS.ChangeSurfaceInterferences(G).Append(I);
break;
case TopOpeBRepDS_CURVE :
appendtoG = Standard_True;
BDS.ChangeCurveInterferences(G).Append(I);
break;
case TopOpeBRepDS_POINT :
// appendtoG = Standard_True;
// BDS.ChangePointInterferences(G).Append(I);
break;
#ifndef DEB
default:
break;
#endif
}
#ifdef DEB
if (TopOpeBRepDS_GettraceDSF()) {
cout<<"append "; I->Dump(cout);
if (appendtoG) cout<<" and to G"<<G<<" list";
cout<<endl;
}
#endif
}
//=======================================================================
//function : MakeGeometry
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_FaceEdgeFiller::MakeGeometry
(TopOpeBRep_FaceEdgeIntersector& FEINT,
TopOpeBRepDS_DataStructure& BDS) const
{
#ifdef DEB
Standard_Integer G;
#else
Standard_Integer G=0;
#endif
TopoDS_Vertex V1;
Standard_Boolean isvertexF = FEINT.IsVertex(1,V1);
TopoDS_Vertex V2;
Standard_Boolean isvertexE = FEINT.IsVertex(2,V2);
Standard_Boolean isvertex = isvertexF || isvertexE;
if ( isvertex ) {
if ( isvertexF ) G = BDS.AddShape(V1,1);
else if ( isvertexE ) G = BDS.AddShape(V2,2);
}
else
G = BDS.AddPoint(TopOpeBRep_PointGeomTool::MakePoint(FEINT));
return G;
}

View File

@@ -0,0 +1,76 @@
// File: TopOpeBRep_FaceEdgeFiller_DEB.cxx
// Created: Fri Jun 16 16:00:24 1995
// Author: Jean Yves LEBEY
// <jyl@meteox>
#ifdef DEB
#include <TCollection_AsciiString.hxx>
#include <TopOpeBRep_FaceEdgeIntersector.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TopOpeBRepDS.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopoDS_Shape.hxx>
#include <TopAbs.hxx>
#include <TopAbs_State.hxx>
#include <TopAbs_Orientation.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
//------------------------------------------------------------------
void FEINT_DUMPPOINTS(TopOpeBRep_FaceEdgeIntersector& FEINT,
const TopOpeBRepDS_DataStructure& BDS)
{
FEINT.InitPoint();
if ( ! FEINT.MorePoint() ) return;
cout<<endl;
cout<<"---------- F/E : "<<FEINT.NbPoints()<<" p ";
cout<<endl;
const TopoDS_Shape& FF = FEINT.Shape(1);
const TopoDS_Shape& EE = FEINT.Shape(2);
Standard_Integer FFindex = BDS.Shape(FF);
Standard_Integer EEindex = BDS.Shape(EE);
TopAbs_Orientation FFori = FF.Orientation();
TopAbs_Orientation EEori = EE.Orientation();
cout<<"FF = "<<FFindex<<" ";TopAbs::Print(FFori,cout);
cout<<", ";
cout<<"EE = "<<EEindex<<" ";TopAbs::Print(EEori,cout);
cout<<endl;
Standard_Integer ip = 1;
for (; FEINT.MorePoint(); FEINT.NextPoint(), ip++ ) {
gp_Pnt2d pUV; FEINT.UVPoint(pUV);
TopAbs_State sta = FEINT.State();
Standard_Real parE = FEINT.Parameter();
TopOpeBRepDS_Transition T1,T2;
T1 = FEINT.Transition(1,EEori); // EEori bidon
T2 = FEINT.Transition(2,FFori);
TopoDS_Vertex V1;
Standard_Boolean isvertexF = FEINT.IsVertex(1,V1);
TopoDS_Vertex V2;
Standard_Boolean isvertexE = FEINT.IsVertex(2,V2);
Standard_Boolean isvertex = isvertexF || isvertexE;
cout<<endl;
cout<<"P"<<ip<<" : ";
gp_Pnt P3D = FEINT.Value();
cout<<"\t"<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z()<<endl;
cout<<"\t"; if (isvertexF) cout<<"IS VERTEX, ";
cout<<"T on "<<FFindex<<" : "; T1.Dump(cout);
cout<<" pUV = "<<pUV.X()<<" "<<pUV.Y()<<endl;
cout<<" sta = "; TopAbs::Print(sta,cout);cout<<endl;
cout<<"\t"; if (isvertexE) cout<<"IS VERTEX, ";
cout<<"T on "<<EEindex<<" : "; T2.Dump(cout);
cout<<" parE = "<<parE<<endl;
}
}
#endif

View File

@@ -0,0 +1,152 @@
-- File: TopOpeBRep_FaceEdgeIntersector.cdl
-- Created: Thu Oct 13 11:19:34 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class FaceEdgeIntersector from TopOpeBRep
---Purpose:
uses
Shape from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
Transition from TopOpeBRepDS,
Inter from BRepIntCurveSurface,
SequenceOfPnt from IntCurveSurface,
SequenceOfInteger from TColStd,
Curve from GeomAdaptor,
Pnt from gp,
Pnt2d from gp,
Orientation from TopAbs,
ShapeEnum from TopAbs,
State from TopAbs,
Explorer from TopExp
is
Create returns FaceEdgeIntersector from TopOpeBRep;
Perform(me : in out; F,E : Shape from TopoDS)
is static;
IsEmpty(me : in out) returns Boolean from Standard
is static;
Shape(me; Index : Integer from Standard) returns Shape from TopoDS
---Purpose: returns intersected face or edge according to
-- value of <Index> = 1 or 2
---C++: return const &
is static;
--
ForceTolerance(me : in out; tol : Real from Standard)
is static;
---Purpose :
-- Force the tolerance values used by the next Perform(S1,S2) call.
Tolerance(me) returns Real from Standard is static;
---Purpose :
-- Return the tolerance value used in the last Perform() call
-- If ForceTolerance() has been called, return the given value.
-- If not, return value extracted from shapes.
--
NbPoints(me) returns Integer from Standard is static;
InitPoint(me : in out) is static;
MorePoint(me) returns Boolean from Standard is static;
NextPoint(me : in out) is static;
--- Methods on current Point
Value(me)
returns Pnt from gp
---Purpose: return the 3D point of the current intersection point.
is static;
Parameter(me)
---Purpose : parametre de Value() sur l'arete
returns Real from Standard is static;
UVPoint(me; P : out Pnt2d from gp)
---Purpose : parametre de Value() sur la face
is static;
State(me) returns State from TopAbs
---Purpose : IN ou ON / a la face. Les points OUT ne sont pas retournes.
is static;
-- <Index> = 1 means on face
-- <Index> = 2 means on edge
Transition(me; Index : Integer from Standard;
FaceOrientation : Orientation from TopAbs)
---Purpose:
-- Index = 1 transition par rapport a la face, en cheminant sur l'arete
returns Transition from TopOpeBRepDS is static;
IsVertex(me : in out; S : Shape from TopoDS;
P : Pnt from gp;
Tol : Real from Standard;
V : out Vertex from TopoDS)
returns Boolean is static;
IsVertex(me : in out; I : Integer from Standard;
V : out Vertex from TopoDS)
returns Boolean is static;
Index(me)
---Purpose: trace only
returns Integer from Standard is static;
-- -------
-- private
-- -------
ResetIntersection(me : in out)
is static private;
ShapeTolerances(me : in out; S1,S2 : Shape from TopoDS) is static private;
---Purpose: extract tolerance values from shapes <S1>,<S2>,
-- in order to perform intersection between <S1> and <S2>
-- with tolerance values "fitting" the shape tolerances.
-- (called by Perform() by default, when ForceTolerances() has not
-- been called)
ToleranceMax(me; S : Shape from TopoDS; T : ShapeEnum from TopAbs)
returns Real from Standard is static private;
---Purpose : returns the max tolerance of sub-shapes of type <T>
-- found in shape <S>. If no such sub-shape found, return
-- Precision::Intersection()
-- (called by ShapeTolerances())
fields
myFace : Face from TopoDS;
myEdge : Edge from TopoDS;
myTol : Real from Standard;
myForceTolerance : Boolean from Standard;
myCurve : Curve from GeomAdaptor;
myIntersectionDone : Boolean from Standard;
mySequenceOfPnt : SequenceOfPnt from IntCurveSurface;
mySequenceOfState : SequenceOfInteger from TColStd; -- 0 = IN, 1 = ON
myPointIndex : Integer;
myNbPoints : Integer;
myVertexExplorer : Explorer from TopExp;
myNullShape : Shape from TopoDS; -- dummy
myNullVertex : Vertex from TopoDS; -- dummy
end FaceEdgeIntersector from TopOpeBRep;

View File

@@ -0,0 +1,424 @@
// File: TopOpeBRep_FaceEdgeIntersector.cxx
// Created: Fri Oct 7 14:16:31 1994
// Author: Jean Yves LEBEY
// <jyl@bravox>
#include <TopOpeBRep_FaceEdgeIntersector.ixx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Curve.hxx>
#include <TopLoc_Location.hxx>
#include <IntCurveSurface_IntersectionPoint.hxx>
#include <IntCurveSurface_TransitionOnCurve.hxx>
#include <BRepIntCurveSurface_Inter.hxx>
#include <TopExp_Explorer.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <Precision.hxx>
#include <Standard_ProgramError.hxx>
#ifdef DEB
#include <TopAbs.hxx>
Standard_IMPORT Standard_Boolean TopOpeBRep_GettraceFITOL();
Standard_IMPORT Standard_Boolean TopOpeBRep_GettraceSAVFF();
#include <TCollection_AsciiString.hxx>
#include <Standard_CString.hxx>
#include <BRepTools.hxx>
static void SAVFE(const TopoDS_Face& F1,const TopoDS_Edge& E)
{
TCollection_AsciiString aname_1("FE_face"), aname_2("FE_edge");
Standard_CString name_1 = aname_1.ToCString(), name_2 = aname_2.ToCString();
cout<<"FaceEdgeIntersector : "<<name_1<<","<<name_2<<endl;
BRepTools::Write(F1,name_1); BRepTools::Write(E,name_2);
}
Standard_IMPORT Standard_Boolean TopOpeBRepTool_GettraceKRO();
#include <TopOpeBRepTool_KRO.hxx>
Standard_EXPORT TOPKRO KRO_DSFILLER_INTFE("intersection face/edge");
#endif
//=======================================================================
//function : TopOpeBRep_FaceEdgeIntersector
//purpose :
//=======================================================================
TopOpeBRep_FaceEdgeIntersector::TopOpeBRep_FaceEdgeIntersector()
{
ResetIntersection();
}
//=======================================================================
//function : ResetIntersection
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::ResetIntersection()
{
mySequenceOfPnt.Clear();
mySequenceOfState.Clear();
myNbPoints = 0;
myIntersectionDone = Standard_False;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::Perform(const TopoDS_Shape& SF,
const TopoDS_Shape& SE)
{
ResetIntersection();
if (!myForceTolerance) ShapeTolerances(SF,SE);
myTol = BRep_Tool::Tolerance(TopoDS::Edge(SE));
#ifdef DEB
if (TopOpeBRep_GettraceFITOL()) cout<<"Perform : myTol = "<<myTol<<endl;
#endif
myFace = TopoDS::Face(SF); myFace.Orientation(TopAbs_FORWARD);
myEdge = TopoDS::Edge(SE); myEdge.Orientation(TopAbs_FORWARD);
#ifdef DEB
if (TopOpeBRep_GettraceSAVFF()) SAVFE(myFace,myEdge);
#endif
Standard_Real f,l;
TopLoc_Location loc;
const Handle(Geom_Curve) C = BRep_Tool::Curve(myEdge,loc,f,l);
#ifdef DEB
gp_Trsf Tao1 =
#endif
loc.Transformation();
Handle(Geom_Geometry) GGao1 = C->Transformed(loc.Transformation());
Handle(Geom_Curve)* PGCao1 = (Handle(Geom_Curve)*)&GGao1;
myCurve.Load(*PGCao1,f,l);
#ifdef DEB
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFE.Start();
#endif
BRepIntCurveSurface_Inter FEINT;
FEINT.Init(myFace,myCurve,myTol);
#ifdef DEB
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFE.Stop();
#endif
for (FEINT.Init(myFace,myCurve,myTol); FEINT.More(); FEINT.Next()) {
mySequenceOfPnt.Append(FEINT.Point());
Standard_Integer i = (FEINT.State() == TopAbs_IN) ? 0 : 1;
mySequenceOfState.Append(i);
}
myNbPoints = mySequenceOfPnt.Length();
myIntersectionDone = Standard_True;
}
//=======================================================================
//function : IsEmpty
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeIntersector::IsEmpty ()
{
Standard_Boolean b = myNbPoints == 0;
return b;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_FaceEdgeIntersector::Shape
(const Standard_Integer Index) const
{
if ( Index == 1 ) return myFace;
else if ( Index == 2 ) return myEdge;
else Standard_ProgramError::Raise("TopOpeBRep_FaceEdgeIntersector::Shape");
return myNullShape;
}
//=======================================================================
//function : ForceTolerance
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::ForceTolerance(const Standard_Real Tol)
{
myTol = Tol;
myForceTolerance = Standard_True;
#ifdef DEB
if (TopOpeBRep_GettraceFITOL())
cout<<"ForceTolerance : myTol = "<<myTol<<endl;
#endif
}
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_FaceEdgeIntersector::Tolerance() const
{
return myTol;
}
//=======================================================================
//function : NbPoints
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_FaceEdgeIntersector::NbPoints() const
{
Standard_Integer n = myNbPoints;
return n;
}
//=======================================================================
//function : InitPoint
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::InitPoint()
{
myPointIndex = 1;
}
//=======================================================================
//function : MorePoint
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeIntersector::MorePoint() const
{
Standard_Boolean b = myPointIndex <= myNbPoints;
return b;
}
//=======================================================================
//function : NextPoint
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::NextPoint()
{
myPointIndex++;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
gp_Pnt TopOpeBRep_FaceEdgeIntersector::Value() const
{
const IntCurveSurface_IntersectionPoint& IP = mySequenceOfPnt(myPointIndex);
const gp_Pnt& P = IP.Pnt();
return P;
}
//=======================================================================
//function : Parameter
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_FaceEdgeIntersector::Parameter() const
{
const IntCurveSurface_IntersectionPoint& IP = mySequenceOfPnt(myPointIndex);
Standard_Real p = IP.W();
return p;
}
//=======================================================================
//function : UVPoint
//purpose :
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::UVPoint(gp_Pnt2d& P2d) const
{
const IntCurveSurface_IntersectionPoint& IP = mySequenceOfPnt(myPointIndex);
Standard_Real u = IP.U();
Standard_Real v = IP.V();
P2d.SetCoord(u,v);
}
//=======================================================================
//function : State
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_FaceEdgeIntersector::State() const
{
Standard_Integer i = mySequenceOfState(myPointIndex);
TopAbs_State s = (i == 0 ) ? TopAbs_IN : TopAbs_ON;
return s;
}
//=======================================================================
//function : Transition
//purpose :
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FaceEdgeIntersector::Transition
(const Standard_Integer Index,
const TopAbs_Orientation FaceOrientation) const
{
// TopAbs_ShapeEnum onB = TopAbs_FACE, onA = TopAbs_FACE; // bidon
// if ((FaceOrientation == TopAbs_INTERNAL) ||
// (FaceOrientation == TopAbs_EXTERNAL)) {
// TopOpeBRepDS_Transition TR(TopAbs_IN,TopAbs_IN,onB,onA); // IN bidon
// TR.Set(FaceOrientation);
// return TR;
// }
TopAbs_State stB, stA;
const IntCurveSurface_IntersectionPoint& IP = mySequenceOfPnt(myPointIndex);
if ( Index == 2 ) { //-- Edge In <=> Rentre ds la matiere face
switch (IP.Transition()) {
case IntCurveSurface_In : stB = TopAbs_OUT; stA = TopAbs_IN; break;
case IntCurveSurface_Out : stB = TopAbs_IN; stA = TopAbs_OUT; break;
default : stB = TopAbs_IN; stA = TopAbs_IN; break;
}
TopOpeBRepDS_Transition TR;
TopAbs_ShapeEnum onB = TopAbs_FACE, onA = TopAbs_FACE;
if (FaceOrientation == TopAbs_FORWARD)
TR.Set(stB,stA,onB,onA);
else if (FaceOrientation == TopAbs_REVERSED)
TR.Set(stA,stB,onA,onB);
else if (FaceOrientation == TopAbs_EXTERNAL)
TR.Set(TopAbs_OUT,TopAbs_OUT,onA,onB);
else if (FaceOrientation == TopAbs_INTERNAL)
TR.Set(TopAbs_IN,TopAbs_IN,onA,onB);
return TR;
}
else if ( Index == 1 ) { //-- Face On est toujours ds la face .
switch (IP.Transition()) {
case IntCurveSurface_In : stB = stA = TopAbs_IN; break;
case IntCurveSurface_Out : stB = stA = TopAbs_IN; break;
default : stB = stA = TopAbs_IN; break;
}
TopAbs_ShapeEnum onB = TopAbs_FACE, onA = TopAbs_FACE;
TopOpeBRepDS_Transition TR;
TR.Set(stB,stA,onB,onA);
return TR;
}
else Standard_ProgramError::Raise("FEINT Transition Index");
// return(TopOpeBRepDS_Transition());
TopOpeBRepDS_Transition aValRet ;
return (aValRet);
}
//=======================================================================
//function : IsVertex
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeIntersector::IsVertex
(const TopoDS_Shape& S, const gp_Pnt& P,
const Standard_Real Tol, TopoDS_Vertex& VR)
{
Standard_Boolean isv = Standard_False;
VR = myNullVertex;
Standard_Real Tol2=Tol*Tol;
for (myVertexExplorer.Init(S,TopAbs_VERTEX);
myVertexExplorer.More();
myVertexExplorer.Next()) {
const TopoDS_Shape& SS = myVertexExplorer.Current();
const TopoDS_Vertex& VV = TopoDS::Vertex(SS);
gp_Pnt PV = BRep_Tool::Pnt(VV);
isv = P.SquareDistance(PV) < Tol2;
if (isv) {
VR = VV;
}
}
return isv;
}
//=======================================================================
//function : IsVertex
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FaceEdgeIntersector::IsVertex
(const Standard_Integer I, TopoDS_Vertex& VR)
{
Standard_Boolean isv = Standard_False;
gp_Pnt P = Value();
if (I == 1) isv = IsVertex(myFace,P,myTol,VR);
else if (I == 2) isv = IsVertex(myEdge,P,myTol,VR);
return isv;
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_FaceEdgeIntersector::Index() const
{
#ifdef DEB
return myPointIndex;
#else
return 0;
#endif
}
//=======================================================================
//function : ShapeTolerances
//purpose : (private)
//=======================================================================
void TopOpeBRep_FaceEdgeIntersector::ShapeTolerances(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
{
myTol = Max(ToleranceMax(S1,TopAbs_EDGE),ToleranceMax(S2,TopAbs_EDGE));
myForceTolerance = Standard_False;
#ifdef DEB
if (TopOpeBRep_GettraceFITOL()) {
cout<<"ShapeTolerances on S1 = ";TopAbs::Print(S1.ShapeType(),cout);
cout<<" S2 = ";TopAbs::Print(S2.ShapeType(),cout);
cout<<" : myTol = "<<myTol<<endl;
}
#endif
}
//=======================================================================
//function : ToleranceMax
//purpose : (private)
//=======================================================================
Standard_Real TopOpeBRep_FaceEdgeIntersector::ToleranceMax
(const TopoDS_Shape& S,
const TopAbs_ShapeEnum T)const
{
TopExp_Explorer e(S,T);
if ( ! e.More() ) return Precision::Intersection();
else {
Standard_Real tol = RealFirst();
for (; e.More(); e.Next())
tol = Max(tol,TopOpeBRepTool_ShapeTool::Tolerance(e.Current()));
return tol;
}
}

View File

@@ -0,0 +1,376 @@
-- File: TopOpeBRep_FacesFiller.cdl
-- Created: Mon Oct 10 17:13:35 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class FacesFiller from TopOpeBRep
---Purpose: Fills a DataStructure from TopOpeBRepDS with the result
-- of Face/Face instersection described by FacesIntersector from TopOpeBRep.
-- if the faces have same Domain, record it in the DS.
-- else record lines and points and attach list of interferences
-- to the faces, the lines and the edges.
uses
Orientation from TopAbs,
ShapeEnum from TopAbs,
State from TopAbs,
Shape from TopoDS,
Face from TopoDS,
Edge from TopoDS,
ListOfShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
Pnt from gp,
Vec from gp,
Curve from Geom,
Curve from Geom2d,
ShapeTool from TopOpeBRepTool,
PShapeClassifier from TopOpeBRepTool,
FacesIntersector from TopOpeBRep,
PFacesIntersector from TopOpeBRep,
PointGeomTool from TopOpeBRep,
PointClassifier from TopOpeBRep,
LineInter from TopOpeBRep,
PLineInter from TopOpeBRep,
VPointInter from TopOpeBRep,
VPointInterIterator from TopOpeBRep,
VPointInterClassifier from TopOpeBRep,
FFTransitionTool from TopOpeBRep,
FFDumper from TopOpeBRep,
Interference from TopOpeBRepDS,
ListOfInterference from TopOpeBRepDS,
ListIteratorOfListOfInterference from TopOpeBRepDS,
InterferenceTool from TopOpeBRepDS,
PointIterator from TopOpeBRepDS,
Transition from TopOpeBRepDS,
Kind from TopOpeBRepDS,
HDataStructure from TopOpeBRepDS,
DataStructure from TopOpeBRepDS,
PDataStructure from TopOpeBRepDS,
Curve from TopOpeBRepDS,
Point from TopOpeBRepDS
is
Create returns FacesFiller from TopOpeBRep;
Insert(me : in out; F1,F2 : Shape from TopoDS;
FACINT : in out FacesIntersector from TopOpeBRep;
HDS : HDataStructure from TopOpeBRepDS) is static;
---Purpose: Stores in <DS> the intersections of <S1> and <S2>.
ProcessSectionEdges(me : in out);
ChangePointClassifier(me : in out)
returns PointClassifier from TopOpeBRep;
---C++: return &
PShapeClassifier(me) returns PShapeClassifier from TopOpeBRepTool;
---Purpose: return field myPShapeClassifier.
SetPShapeClassifier(me : in out; PSC : PShapeClassifier from TopOpeBRepTool);
---Purpose: set field myPShapeClassifier.
-- -------
-- private
-- -------
LoadLine(me : in out; L : in out LineInter from TopOpeBRep) is static;
-- Complete informations given on intersection line.
-- Set current intersection line to process myLine to <L>.
CheckLine(me; L : in out LineInter from TopOpeBRep)
returns Boolean is static;
VP_Position(me : in out; FACINT : in out FacesIntersector from TopOpeBRep)
---Purpose: compute position of VPoints of lines
is static;
VP_Position(me : in out; L : in out LineInter from TopOpeBRep)
---Purpose: compute position of VPoints of line L
is static;
VP_PositionOnL(me : in out; L : in out LineInter from TopOpeBRep)
---Purpose: compute position of VPoints of non-restriction line L.
is static;
VP_PositionOnR(me : in out; L : in out LineInter from TopOpeBRep)
---Purpose: compute position of VPoints of restriction line L.
is static;
VP_Position(me : in out; VP : in out VPointInter from TopOpeBRep;
VPC : in out VPointInterClassifier from TopOpeBRep)
is static;
---Purpose: compute position of VP with current faces,
-- according to VP.ShapeIndex() .
-- --------------------------------
-- current line (myLine) processing
-- --------------------------------
ProcessLine(me : in out) is static;
---Purpose: Process current intersection line (set by LoadLine)
ResetDSC(me : in out) is static;
ProcessRLine(me : in out) is static;
---Purpose: Process current restriction line, adding restriction edge
-- and computing face/edge interference.
FillLineVPonR(me : in out) is static;
---Purpose: VP processing for restriction line and line sharing
-- same domain with section edges :
-- - if restriction :
-- Adds restriction edges as section edges and compute
-- face/edge interference.
-- - if same domain :
-- If line share same domain with section edges, compute
-- parts of line IN/IN the two faces, and compute curve/point
-- interference for VP boundaries.
FillLine(me : in out) is static;
AddShapesLine(me : in out) is static;
---Purpose: compute 3d curve, pcurves and face/curve interferences
-- for current NDSC. Add them to the DS.
GetESL(me : in out; LES : out ListOfShape from TopTools) is static;
---Purpose: Get map <mapES > of restriction edges having parts IN one
-- of the 2 faces.
KeepRLine(me;
Lrest : LineInter from TopOpeBRep;
checkkeep : Boolean)
returns Boolean is static private;
ProcessVPR(me : in out;
FF : in out FacesFiller from TopOpeBRep;
VP : VPointInter from TopOpeBRep);
---Purpose: calling the followings ProcessVPIonR and ProcessVPonR.
ProcessVPIonR(me : in out; VPI : in out VPointInterIterator from TopOpeBRep;
trans1 : Transition from TopOpeBRepDS; F1 : Shape from TopoDS;
ShapeIndex : Integer)
is static;
---Purpose: processing ProcessVPonR for VPI.
ProcessVPonR(me : in out; VP : VPointInter from TopOpeBRep;
trans1 : Transition from TopOpeBRepDS; F1 : Shape from TopoDS;
ShapeIndex : Integer)
is static;
---Purpose: adds <VP>'s geometric point (if not stored) and
-- computes (curve or edge)/(point or vertex) interference.
ProcessVPonclosingR(me : in out; VP : VPointInter from TopOpeBRep;
F1 : Shape from TopoDS; ShapeIndex : Integer;
transEdge : Transition from TopOpeBRepDS;
PVKind : Kind from TopOpeBRepDS; PVIndex : Integer;
EPIfound : Boolean; IEPI : Interference from TopOpeBRepDS)
is static;
---Purpose: VP processing on closing arc.
ProcessVPondgE(me : in out; VP : VPointInter from TopOpeBRep;
ShapeIndex : Integer;
PVKind : out Kind from TopOpeBRepDS; PVIndex : out Integer;
EPIfound : out Boolean; IEPI : out Interference from TopOpeBRepDS;
CPIfound : out Boolean; ICPI : out Interference from TopOpeBRepDS)
returns Boolean is static;
---Purpose: VP processing on degenerated arc.
ProcessVPInotonR(me : in out; VPI : in out VPointInterIterator from TopOpeBRep)
is static;
---Purpose: processing ProcessVPnotonR for VPI.
ProcessVPnotonR(me : in out; VP : VPointInter from TopOpeBRep)
is static;
---Purpose: adds <VP>'s geometrical point to the DS (if not stored)
-- and computes curve point interference.
GetGeometry(me : in out;
IT : in out ListIteratorOfListOfInterference from TopOpeBRepDS;
VP : VPointInter from TopOpeBRep;
G : in out Integer; K : in out Kind from TopOpeBRepDS)
returns Boolean is static;
---Purpose:
-- Get the geometry of a DS point <DSP>.
-- Search for it with ScanInterfList (previous method).
-- if found, set <G> to the geometry of the interference found.
-- else, add the point <DSP> in the <DS> and set <G> to the
-- value of the new geometry such created.
-- returns the value of ScanInterfList().
MakeGeometry(me : in out; VP : VPointInter from TopOpeBRep;
ShapeIndex : Integer; K : in out Kind from TopOpeBRepDS)
returns Integer is static;
StoreCurveInterference(me : in out; I : Interference from TopOpeBRepDS)
is static;
---Purpose:
-- Add interference <I> to list myDSCIL.
-- on a given line, at first call, add a new DS curve.
GetFFGeometry(me; DSP : Point from TopOpeBRepDS; K : out Kind; G : in out Integer)
returns Boolean is static;
---Purpose: search for G = geometry of Point which is identical to <DSP>
-- among the DS Points created in the CURRENT face/face
-- intersection ( current Insert() call).
GetFFGeometry(me; VP : VPointInter from TopOpeBRep; K : out Kind; G : in out Integer)
returns Boolean is static;
---Purpose: search for G = geometry of Point which is identical to <VP>
-- among the DS Points created in the CURRENT face/face
-- intersection ( current Insert() call).
GetEdgeTrans(me : in out;
VP : VPointInter from TopOpeBRep;
PVKind : Kind from TopOpeBRepDS;
PVIndex : Integer;
Sind : Integer;
F : Face from TopoDS)
returns Transition from TopOpeBRepDS is static private;
StateVPonFace(me;
VP : VPointInter from TopOpeBRep)
returns State from TopAbs is static private;
---Purpose: If <VP>'s index != 3, calls a classifier to determine
-- <VP>'s state on the face.
PequalVPonR(me;
P3D : Pnt from gp;
VPshapeindex : Integer;
VP : in out VPointInter from TopOpeBRep;
Lrest : in out LineInter from TopOpeBRep)
returns Boolean is static private;
---Purpose: <VP> is of geometry <P>.
-- Looks after a VPoint on RESTRICTION <Lrest> with
-- geometric value <P>. If true, updates states ON for <VP>.
StBipVPonF(me;
IVPf, IVPl : VPointInter from TopOpeBRep;
Lrest : LineInter from TopOpeBRep;
isonedge1 : Boolean)
returns State from TopAbs is static private;
---Purpose: Classifies (VPf, VPl) middle point on restriction edge
ChangeFacesIntersector(me:in out) returns FacesIntersector is static;
---C++: return &
HDataStructure(me:in out) returns HDataStructure is static;
ChangeDataStructure(me:in out) returns DataStructure is static;
---C++: return &
Face(me;I:Integer) returns Face from TopoDS is static;
---C++: return const &
FaceFaceTransition(me;L:LineInter;I:Integer)
returns Transition from TopOpeBRepDS;
---C++: return const &
-- transition from face I(1,2) through line L with face (2,1)
FaceFaceTransition(me;I:Integer)
returns Transition from TopOpeBRepDS;
---C++: return const &
-- transition from face I(1,2) through current line with face (2,1)
PFacesIntersectorDummy(me) returns PFacesIntersector from TopOpeBRep;
PDataStructureDummy(me) returns PDataStructure from TopOpeBRepDS;
PLineInterDummy(me) returns PLineInter from TopOpeBRep;
SetTraceIndex(me:in out; exF1,exF2 : Integer) is static;
GetTraceIndex(me; exF1,exF2 : out Integer) is static;
-- <exf1,exf2> TopExp_Explorer exploration index of faces F1,F2
-- in ancestors shapes. (trace)
-------------------------
-- Class methods :
-------------------------
Lminmax(myclass; L : LineInter from TopOpeBRep;
pmin, pmax : out Real);
---Purpose: Computes <pmin> and <pmax> the upper and lower bounds of <L>
-- enclosing all vpoints.
LSameDomainERL(myclass; L : LineInter from TopOpeBRep;
ERL : ListOfShape from TopTools) returns Boolean;
---Purpose: Returns <True> if <L> shares a same geometric domain with
-- at least one of the section edges of <ERL>.
IsVPtransLok(myclass; L : LineInter from TopOpeBRep;
iVP, SI12 : Integer;
T : out Transition from TopOpeBRepDS)
returns Boolean;
---Purpose: Computes the transition <T> of the VPoint <iVP> on the edge
-- of <SI12>. Returns <False> if the status is unknown.
TransvpOK(myclass; L : LineInter from TopOpeBRep;
iVP, SI : Integer;
isINOUT : Boolean) returns Boolean;
---Purpose: Computes transition on line for VP<iVP> on edge
-- restriction of <SI>. If <isINOUT> : returns <true> if
-- transition computed is IN/OUT else : returns <true> if
-- transition computed is OUT/IN.
VPParamOnER(myclass; vp : VPointInter from TopOpeBRep;
Lrest : LineInter from TopOpeBRep) returns Real;
---Purpose: Returns parameter u of vp on the restriction edge.
EqualpPonR(myclass; Lrest : LineInter from TopOpeBRep;
VP1, VP2 : VPointInter from TopOpeBRep) returns Boolean;
EqualpP(myclass; L : LineInter from TopOpeBRep;
iVP1, iVP2 : Integer) returns Boolean;
fields
-- input
myF1 : Face from TopoDS;
myF2 : Face from TopoDS;
myF1ori : Orientation from TopAbs;
myF2ori : Orientation from TopAbs;
myFacesIntersector : PFacesIntersector from TopOpeBRep;
myHDS : HDataStructure from TopOpeBRepDS;
myDS : PDataStructure from TopOpeBRepDS;
-- current face/face intersection
myFFfirstDSP : Integer;
-- First DS point created by current face/face intersection
-- current line
myLine : PLineInter from TopOpeBRep;
myLineOK : Boolean;
myLineINL : Boolean; -- Is Null Length
myLineTonF1 : Transition from TopOpeBRepDS;
myLineTonF2 : Transition from TopOpeBRepDS;
myLineIsonEdge : Boolean;
myERL : ListOfShape from TopTools;
-- Stores the restriction edges found by the current faces intersector.
myDataforDegenEd : DataMapOfShapeListOfShape from TopTools;
-- If the line describes a VP on degenerated edge, stores
-- the vertex, the degenerated edge, the couture edge on same
-- shape.
myLastVPison0 : Boolean;-- only for walking.
mykeptVPnbr : Boolean; -- number of current line's VP kept
-- curve on current line
myDSCIndex : Integer;
myDSCIL : ListOfInterference from TopOpeBRepDS;
-- tools
myPointClassifier : PointClassifier from TopOpeBRep;
myPShapeClassifier : PShapeClassifier from TopOpeBRepTool;
-- trace
myexF1,myexF2 : Integer;
myHFFD : FFDumper from TopOpeBRep;
end FacesFiller from TopOpeBRep;

View File

@@ -0,0 +1,693 @@
// File: TopOpeBRep_FacesFiller.cxx
// Created: Mon Oct 10 17:31:13 1994
// Author: Jean Yves LEBEY
// <jyl@bravox>
#include <TopOpeBRep_FacesFiller.ixx>
#include <Standard_ProgramError.hxx>
//#include <BRepAdaptor_Curve2d.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
#include <TopOpeBRep.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Surface.hxx>
#include <GeomProjLib.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Line.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <TopOpeBRepTool_EXPORT.hxx>
#include <TopOpeBRepTool_2d.hxx>
#include <TopOpeBRep_define.hxx>
#include <TopOpeBRepTool_defineG.hxx>
#include <TopOpeBRepTool_SC.hxx>
Standard_EXPORT Standard_Boolean FUN_projPonL(const gp_Pnt& P,const TopOpeBRep_LineInter L,const TopOpeBRep_FacesFiller& FF,
Standard_Real& paramL)
{
Standard_Boolean paramLdef = Standard_False;
Standard_Integer Esi = (L.ArcIsEdge(1)) ? 1:2;
const TopoDS_Edge& E = TopoDS::Edge(L.Arc());
Standard_Boolean hasC3D = FC2D_HasC3D(E);
Standard_Real dist;
if (hasC3D) {
BRepAdaptor_Curve BAC(E);
paramLdef = FUN_tool_projPonC(P,BAC,paramL,dist);
}
else {
BRepAdaptor_Curve2d BAC2D;
if (Esi == 1) BAC2D.Initialize(E,FF.Face(1));
else if (Esi == 2) BAC2D.Initialize(E,FF.Face(2));
paramLdef = FUN_tool_projPonC2D(P,BAC2D,paramL,dist);
}
return paramLdef;
}
#ifdef DEB
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSFK();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSNC();
void debffsamdom(void){}
#endif
static void FUN_MakeERL(TopOpeBRep_FacesIntersector& FI,TopTools_ListOfShape& ERL)
{
ERL.Clear();
const TopTools_IndexedMapOfShape& mer = FI.Restrictions();
for ( Standard_Integer ie = 1, ne = mer.Extent(); ie <= ne; ie++) {
const TopoDS_Edge& E = TopoDS::Edge(mer.FindKey(ie));
ERL.Append(E);
}
}
// Unused :
#ifdef DEB
static void FUN_MakeERL(const TopTools_MapOfShape& mapES,TopTools_ListOfShape& ERL)
{
ERL.Clear();
TopTools_MapIteratorOfMapOfShape itES;
for (itES.Initialize(mapES);itES.More();itES.Next()) {
const TopoDS_Shape& E = itES.Key();
ERL.Append(E);
}
}
#endif
//=======================================================================
//function : TopOpeBRep_FacesFiller
//purpose :
//=======================================================================
TopOpeBRep_FacesFiller::TopOpeBRep_FacesFiller() : myPShapeClassifier(NULL)
{
myexF1 = myexF2 = 0;
#ifdef DEB
myHFFD = new TopOpeBRep_FFDumper(this);
#endif
}
//=======================================================================
//function : PShapeClassifier
//purpose :
//=======================================================================
TopOpeBRepTool_PShapeClassifier TopOpeBRep_FacesFiller::PShapeClassifier() const
{
return myPShapeClassifier;
}
//=======================================================================
//function : SetPShapeClassifier
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::SetPShapeClassifier(const TopOpeBRepTool_PShapeClassifier& PSC)
{
myPShapeClassifier = PSC;
}
//=======================================================================
//function : Insert
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::Insert(const TopoDS_Shape& S1,const TopoDS_Shape& S2,TopOpeBRep_FacesIntersector& FACINT,const Handle(TopOpeBRepDS_HDataStructure)& HDS)
{
myF1 = TopoDS::Face(S1); myF1ori = S1.Orientation();
myF2 = TopoDS::Face(S2); myF2ori = S2.Orientation();
myFacesIntersector = &FACINT;
myHDS = HDS;
myDS = &(HDS->ChangeDS());
if (myPShapeClassifier == NULL) myPShapeClassifier = new TopOpeBRepTool_ShapeClassifier();
#ifdef DEB
Standard_Integer exF1,exF2; GetTraceIndex(exF1,exF2);
myFacesIntersector->InitLine();
for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) myFacesIntersector->CurrentLine().SetTraceIndex(exF1,exF2);
myHFFD->Init(this);
#endif
Standard_Boolean samdom = myFacesIntersector->SameDomain();
if ( samdom ) {
myDS->FillShapesSameDomain(S1,S2);
return;
}
myFacesIntersector->InitLine();
for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
L.SetFaces(TopoDS::Face(S1),TopoDS::Face(S2));
}
VP_Position(FACINT);
myFacesIntersector->InitLine();
for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
L.SetHasVPonR();
L.SetINL();
L.SetIsVClosed();
}
ProcessSectionEdges();
myFFfirstDSP = myDS->NbPoints() + 1;
FUN_MakeERL((*myFacesIntersector), myERL); // BUG
myFacesIntersector->InitLine();
for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
LoadLine(L);
ProcessLine();
}
}
//=======================================================================
//function : ChangePointClassifier
//purpose :
//=======================================================================
TopOpeBRep_PointClassifier& TopOpeBRep_FacesFiller::ChangePointClassifier()
{
return myPointClassifier;
}
//=======================================================================
//function : LoadLine
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::LoadLine(TopOpeBRep_LineInter& L)
{
myLine = &L;
Standard_Boolean bchk = CheckLine(L);
Standard_Boolean binl = L.INL();
myLineINL = binl;
{
TopOpeBRep_TypeLineCurve t = L.TypeLineCurve();
if ( !bchk && binl && t == TopOpeBRep_LINE ) {
bchk = Standard_True;
}
}
L.SetOK(bchk);
myLineOK = bchk;
if (!myLineOK) return;
L.ComputeFaceFaceTransition();
} // LoadLine
//=======================================================================
//function : CheckLine
//purpose : private
// returns False if L is WALKING line with a number of VPoints < 2
// else returns True
//=======================================================================
Standard_Boolean TopOpeBRep_FacesFiller::CheckLine(TopOpeBRep_LineInter& L) const
{
Standard_Real tol1,tol2;
myFacesIntersector->GetTolerances(tol1,tol2);
Standard_Boolean check = Standard_True;
TopOpeBRep_TypeLineCurve t = L.TypeLineCurve();
Standard_Integer nbvp = L.NbVPoint();
#ifdef DEB
Standard_Boolean TDSF = TopOpeBRepDS_GettraceDSF();
if (TDSF) { cout<<"CheckLine ";TopOpeBRep::Print(t,cout);cout<<" "<<nbvp<<" points"<<endl; }
#endif
if ( t == TopOpeBRep_WALKING ) {
if ( nbvp < 2 ) {
#ifdef DEB
cout<<"\n=== Nb de IntPatch_Point sur WL incorrect : "<<nbvp<<" ===\n";
#endif
check = Standard_False;
}
}
else if (t == TopOpeBRep_LINE) {
Standard_Integer np = 0;
TopOpeBRep_VPointInterIterator VPI;
for ( VPI.Init(L); VPI.More(); VPI.Next()) {
const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
if ( VP.Keep() ) np++;
}
if ( np != 2 ) {
return Standard_True;
}
TopOpeBRep_VPointInter A,B;
np = 0;
for ( VPI.Init(L); VPI.More(); VPI.Next()) {
const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
if ( !VP.Keep() ) continue;
np++;
if ( np == 1 ) A = VP;
if ( np == 2 ) B = VP;
}
Standard_Boolean isAV1 = A.IsVertexOnS1();
Standard_Boolean isAV2 = A.IsVertexOnS2();
TopoDS_Shape V1;
if (isAV1) V1 = A.VertexOnS1();
if (isAV2) V1 = A.VertexOnS2();
Standard_Boolean isBV1 = B.IsVertexOnS1();
Standard_Boolean isBV2 = B.IsVertexOnS2();
TopoDS_Shape V2;
if (isBV1) V2 = B.VertexOnS1();
if (isBV2) V2 = B.VertexOnS2();
#ifdef DEB
if (TDSF) {
cout<<"CheckLine : isAV1 isAV2 isBV1 isBV2 ";
cout<<isAV1<<" "<<isAV2<<" "<<isBV1<<" "<<isBV2<<endl;
}
#endif
if ( !V1.IsNull() && ( V1.IsSame(V2) ) ) {
#ifdef DEB
Standard_Real parA = A.ParameterOnLine();
Standard_Real parB = B.ParameterOnLine();
if (TDSF) {
cout<<"kpart : parA parB delta "<<parA<<" "<<parB<<" "<<parA-parB<<endl;
cout<<"kpart : rejet de ligne"<<endl;
}
#endif
return Standard_False;
}
} // LINE
else {
Standard_Boolean notrnotw = (t != TopOpeBRep_RESTRICTION && t != TopOpeBRep_WALKING);
if (notrnotw) {
if (t == TopOpeBRep_CIRCLE) {
// cto 012 D2, faces 6 et 1, line 3 incorrecte.
Standard_Integer iINON1,iINONn,nINON;
myLine->VPBounds(iINON1,iINONn,nINON);
if ( nINON >= 2) {
const TopOpeBRep_VPointInter& A = myLine->VPoint(iINON1);
const TopOpeBRep_VPointInter& B = myLine->VPoint(iINONn);
Standard_Real parA = A.ParameterOnLine();
Standard_Real parB = B.ParameterOnLine();
Standard_Boolean conf = (fabs(parA-parB) < tol1);
if (conf) {
//modified by NIZHNY-MZV Wed Dec 1 09:53:08 1999
check = Msf;
//modified by NIZHNY-MZV Wed Dec 1 09:53:18 1999 Standard_Boolean isp = L.IsPeriodic();
//modified by NIZHNY-MZV Wed Dec 1 09:53:20 1999 if (isp) {
//modified by NIZHNY-MZV Wed Dec 1 09:53:21 1999 Handle(Geom_Circle) C = Handle(Geom_Circle)::DownCast(L.Curve());
//modified by NIZHNY-MZV Wed Dec 1 09:53:22 1999 Standard_Real per = C->Period();
//modified by NIZHNY-MZV Wed Dec 1 09:53:23 1999 parB = parA + per;
//modified by NIZHNY-MZV Wed Dec 1 09:53:25 1999 }
}
//modified by NIZHNY-MZV Wed Dec 1 09:53:32 1999 Standard_Real t = 0.2567899311;
//modified by NIZHNY-MZV Wed Dec 1 09:53:33 1999 Standard_Real p = (1-t)*parA + t*parB;
//modified by NIZHNY-MZV Wed Dec 1 09:53:34 1999 Handle(Geom_Curve) GC = myLine->Curve();
//modified by NIZHNY-MZV Wed Dec 1 09:53:34 1999 const TopoDS_Face& F1 = TopoDS::Face(myF1);
//modified by NIZHNY-MZV Wed Dec 1 09:53:35 1999 const TopoDS_Face& F2 = TopoDS::Face(myF2);
//modified by NIZHNY-MZV Wed Dec 1 09:53:36 1999 Handle(Geom_Surface) GS1 = BRep_Tool::Surface(F1);
//modified by NIZHNY-MZV Wed Dec 1 09:53:36 1999 Handle(Geom_Surface) GS2 = BRep_Tool::Surface(F2);
//modified by NIZHNY-MZV Wed Dec 1 09:53:37 1999 Handle(Geom2d_Curve) C1 = GeomProjLib::Curve2d(GC,parA,parB,GS1);
//modified by NIZHNY-MZV Wed Dec 1 09:53:38 1999 Handle(Geom2d_Curve) C2 = GeomProjLib::Curve2d(GC,parA,parB,GS2);
//modified by NIZHNY-MZV Wed Dec 1 09:53:39 1999 gp_Pnt2d P1 = C1->Value(p);
//modified by NIZHNY-MZV Wed Dec 1 09:53:44 1999 gp_Pnt2d P2 = C2->Value(p);
//modified by NIZHNY-MZV Wed Dec 1 09:53:45 1999 TopOpeBRep_PointClassifier* pcl = (TopOpeBRep_PointClassifier*)((void*)&myPointClassifier);
//modified by NIZHNY-MZV Wed Dec 1 09:53:46 1999 TopAbs_State staP1 = pcl->Classify(F1,P1,tol1);
//modified by NIZHNY-MZV Wed Dec 1 09:53:47 1999 TopAbs_State staP2 = pcl->Classify(F2,P2,tol1);
//modified by NIZHNY-MZV Wed Dec 1 09:53:48 1999Standard_Boolean ok1 = (staP1 == TopAbs_IN || staP1 == TopAbs_ON);
//modified by NIZHNY-MZV Wed Dec 1 09:53:49 1999 Standard_Boolean ok2 = (staP2 == TopAbs_IN || staP2 == TopAbs_ON);
//modified by NIZHNY-MZV Wed Dec 1 09:53:50 1999 check = (ok1 && ok2);
}
} // CIRCLE
else if (t == TopOpeBRep_HYPERBOLA) {
Standard_Integer iINON1,iINONn,nINON;
myLine->VPBounds(iINON1,iINONn,nINON);
if ( nINON < 2 ) {
check = Standard_False;
}
}
else if (t == TopOpeBRep_ELLIPSE) {
Standard_Integer iINON1,iINONn,nINON;
myLine->VPBounds(iINON1,iINONn,nINON);
if ( nINON < 2 ) {
check = Standard_False;
}
else {
const TopOpeBRep_VPointInter& A = myLine->VPoint(iINON1);
const TopOpeBRep_VPointInter& B = myLine->VPoint(iINONn);
Standard_Real parA = A.ParameterOnLine();
Standard_Real parB = B.ParameterOnLine();
Standard_Boolean conf = (fabs(parA-parB) < tol1);
if (conf) {
check = Standard_False;
}
}
}
}
}
#ifdef DEB
if (!check) { cout<<"# DEB CheckLine : rejet de ";TopOpeBRep::Print(t,cout);cout<<" a "<<nbvp<<" points"<<endl; }
#endif
return check;
}
//=======================================================================
//function : VP_Position
//purpose :
//=======================================================================
//void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_FacesIntersector& FACINT)
void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_FacesIntersector& )
{
for (myFacesIntersector->InitLine();
myFacesIntersector->MoreLine();
myFacesIntersector->NextLine()) {
TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
const TopOpeBRep_TypeLineCurve tl = L.TypeLineCurve();
Standard_Boolean ok = (tl == TopOpeBRep_RESTRICTION) ;
if ( ok ) VP_Position(L);
}
for (myFacesIntersector->InitLine();
myFacesIntersector->MoreLine();
myFacesIntersector->NextLine()) {
TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
const TopOpeBRep_TypeLineCurve tl = L.TypeLineCurve();
Standard_Boolean ok = (tl != TopOpeBRep_RESTRICTION) ;
if ( ok ) VP_Position(L);
}
}
//=======================================================================
//function : VP_Position
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_LineInter& L)
{
myLine = &L;
#ifdef DEB
if (TopOpeBRepDS_GettraceDSFK()) {
cout<<endl<<"VP_Position on line "<<L.Index()<<" ";L.DumpType();cout<<endl;
}
#endif
Standard_Boolean isrest = (L.TypeLineCurve() == TopOpeBRep_RESTRICTION) ;
if (!isrest) VP_PositionOnL(L);
else VP_PositionOnR(L);
L.SetVPBounds();
#ifdef DEB
if (TopOpeBRepDS_GettraceDSFK()) {
Standard_Integer VPF,VPL,VPN; L.VPBounds(VPF,VPL,VPN);
cout<<"SetVPBounds : VPF,VPL,VPN = "<<VPF<<","<<VPL<<","<<VPN;
if (VPN != 0) cout<<" : VP(s) kept"<<endl;
else cout<<" : NO VP kept"<<endl;
}
#endif
}
//=======================================================================
//function : VP_PositionOnL
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::VP_PositionOnL(TopOpeBRep_LineInter& L)
{
TopOpeBRep_VPointInterIterator VPI(L);
Standard_Integer Lindex = L.Index();
TopOpeBRep_VPointInterClassifier VPC;
for (; VPI.More(); VPI.Next()) {
TopOpeBRep_VPointInter& VP = VPI.ChangeCurrentVP();
Standard_Integer VPsi = VP.ShapeIndex();
const gp_Pnt& P3D = VP.Value();
Standard_Boolean VPequalVPONRESTRICTION = Standard_False;
TopOpeBRep_FacesIntersector& FI = *((TopOpeBRep_FacesIntersector*)((void*)myFacesIntersector));
Standard_Integer iOL = 1,n = FI.NbLines();
for (iOL=1; iOL<=n; iOL++ ) {
if (iOL == Lindex ) continue;
TopOpeBRep_LineInter& OL = FI.ChangeLine(iOL);
VPequalVPONRESTRICTION = PequalVPonR(P3D,VPsi,VP,OL);
if ( VPequalVPONRESTRICTION ) break;
}
if ( !VPequalVPONRESTRICTION ) {
VP_Position(VP,VPC);
}
}
}
//=======================================================================
//function : VP_PositionOnR
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::VP_PositionOnR(TopOpeBRep_LineInter& L)
{
TopOpeBRep_VPointInterClassifier VPC;
TopOpeBRep_VPointInterIterator VPI(L);
Standard_Integer Esi = (L.ArcIsEdge(1)) ? 1:2;
Standard_Integer OOEsi = (L.ArcIsEdge(1)) ? 2:1;
Standard_Boolean isline = Standard_False;
const TopoDS_Edge& earc = TopoDS::Edge(L.Arc());
Standard_Boolean hasc3d = FC2D_HasC3D(earc);
if (hasc3d) isline = FUN_tool_line(earc);
else {
BRepAdaptor_Curve2d BAC2D;
if (Esi == 1) BAC2D.Initialize(earc,myF1);
else if (Esi == 2) BAC2D.Initialize(earc,myF2);
GeomAbs_CurveType t = BAC2D.GetType();
isline = (t == GeomAbs_Line);
}
for (; VPI.More(); VPI.Next()) {
TopOpeBRep_VPointInter& VP = VPI.ChangeCurrentVP();
#ifdef DEB
Standard_Integer VPsi = VP.ShapeIndex();
#endif
Standard_Boolean isvertex = VP.IsVertex(Esi);
if ( isvertex ) {
if (!isline) VP_Position(VP,VPC);
continue;
}
Standard_Boolean OOisvertex = VP.IsVertex(OOEsi);
if ( OOisvertex ) {
if (!isline) VP_Position(VP,VPC);
continue;
}
const gp_Pnt& P = VP.Value();
Standard_Boolean arcisE = L.ArcIsEdge(Esi);
Standard_Boolean arcisOOE = L.ArcIsEdge(OOEsi);
if (arcisE) {
Standard_Real paramC;Standard_Boolean paramCdef = FUN_projPonL(P,L,(*this),paramC);
if ( paramCdef ) {
const TopoDS_Edge& E = TopoDS::Edge(L.Arc());
VP.State(TopAbs_ON,Esi);
VP.EdgeON(E,paramC,Esi);
}
else {
// Standard_ProgramError::Raise("VP_Position projection failed on E");
VP.ChangeKeep(Standard_False); // xpu051198
}
}
if (arcisOOE) {
Standard_Real paramC;Standard_Boolean paramCdef = FUN_projPonL(P,L,(*this),paramC);
if ( paramCdef ) {
const TopoDS_Edge& OOE = TopoDS::Edge(L.Arc());
VP.State(TopAbs_ON,OOEsi);
VP.EdgeON(OOE,paramC,OOEsi);
}
else {
// Standard_ProgramError::Raise("VP_Position projection failed on OOE");
VP.ChangeKeep(Standard_False); // xpu051198
}
}
#ifdef DEB
if (TopOpeBRepDS_GettraceDSFK()) {
cout<<"VP "<<VP.Index()<<" on "<<Esi<<" : ";
TopAbs::Print(VP.State(Esi),cout);
cout<<"/"<<Esi<<" ";
if (VP.Keep()) { cout<<"kept"<<endl; }
else { cout<<"NOT kept"<<endl; }
}
#endif
}
}
//=======================================================================
//function : VP_Position
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::VP_Position(TopOpeBRep_VPointInter& VP,TopOpeBRep_VPointInterClassifier& VPC)
{
Standard_Integer si = VP.ShapeIndex();
Standard_Boolean c1=Standard_False,c2=Standard_False;
if (si == 0) { c1 = Standard_True; c2 = Standard_True; }
else if (si == 1) { c1 = Standard_False; c2 = Standard_True; }
else if (si == 2) { c1 = Standard_True; c2 = Standard_False; }
else if (si == 3) { c1 = Standard_True; c2 = Standard_True; }
Standard_Boolean AssumeINON = Standard_False;
if (myLine) AssumeINON = (myLine->TypeLineCurve() != TopOpeBRep_RESTRICTION);
// modified by NIZHNY-MKK Fri Oct 27 14:50:28 2000.BEGIN
// Standard_Real tol = Precision::Confusion();
Standard_Real tol1, tol2;
tol1 = tol2 = Precision::Confusion();
myFacesIntersector->GetTolerances(tol1, tol2);
Standard_Real tol = (tol1 > tol2) ? tol1 : tol2;
// modified by NIZHNY-MKK Fri Oct 27 14:50:36 2000.END
if (c1) VPC.VPointPosition(myF1,VP,1,myPointClassifier,AssumeINON,tol);
if (c2) VPC.VPointPosition(myF2,VP,2,myPointClassifier,AssumeINON,tol);
#ifdef DEB
if (TopOpeBRepDS_GettraceDSFK()) {
cout<<"VP "<<VP.Index()<<" on "<<si<<" : ";
if (c1) { TopAbs::Print(VP.State(1),cout);cout<<"/1 "; }
if (c2) { TopAbs::Print(VP.State(2),cout);cout<<"/2 "; }
if (VP.Keep()) { cout<<"kept"<<endl; }
else { cout<<"NOT kept"<<endl; }
}
#endif
}
//=======================================================================
//function : PequalVPonR
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FacesFiller::PequalVPonR(const gp_Pnt& P3D,const Standard_Integer VPsi,TopOpeBRep_VPointInter& VP,TopOpeBRep_LineInter& Lrest) const
{
const TopOpeBRep_TypeLineCurve tOL = Lrest.TypeLineCurve();
Standard_Boolean OLok = (tOL == TopOpeBRep_RESTRICTION) ;
if ( !OLok ) return Standard_False;
Standard_Boolean VPequalVPONRESTRICTION = Standard_False;
const TopoDS_Edge& EOL = TopoDS::Edge(Lrest.Arc());
Standard_Integer EOLsi = (Lrest.ArcIsEdge(1)) ? 1:2;
TopOpeBRep_VPointInterIterator VPIOL(Lrest);
for (; VPIOL.More(); VPIOL.Next()) {
TopOpeBRep_VPointInter& VPOL = VPIOL.ChangeCurrentVP();
Standard_Integer VPOLsi = VPOL.ShapeIndex();
Standard_Boolean VPOLisvertex = Standard_False;
VPOLisvertex = VPOL.IsVertex(1);
if (VPOLisvertex) continue;
Standard_Boolean diffsi = (VPOLsi != VPsi);
if ( diffsi ) continue;
TopAbs_State stateEsi = VPOL.State(EOLsi);
if (stateEsi != TopAbs_ON) continue;
const gp_Pnt& P3DOL = VPOL.Value();
Standard_Real tolE = BRep_Tool::Tolerance(EOL);
VPequalVPONRESTRICTION = P3DOL.IsEqual(P3D,tolE);
if ( VPequalVPONRESTRICTION ) {
Standard_Real paramCOL = VPOL.EdgeONParameter(EOLsi);
VP.State(TopAbs_ON,EOLsi);
VP.EdgeON(EOL,paramCOL,EOLsi);
break;
}
}
return VPequalVPONRESTRICTION;
}
//=======================================================================
//function : FacesIntersector
//purpose :
//=======================================================================
TopOpeBRep_FacesIntersector& TopOpeBRep_FacesFiller::ChangeFacesIntersector()
{
return (*myFacesIntersector);
}
//=======================================================================
//function : HDataStructure
//purpose :
//=======================================================================
Handle(TopOpeBRepDS_HDataStructure) TopOpeBRep_FacesFiller::HDataStructure()
{
return myHDS;
}
//=======================================================================
//function : DataStructure
//purpose :
//=======================================================================
TopOpeBRepDS_DataStructure& TopOpeBRep_FacesFiller::ChangeDataStructure()
{
return (*myDS);
}
//=======================================================================
//function : Face
//purpose :
//=======================================================================
const TopoDS_Face& TopOpeBRep_FacesFiller::Face(const Standard_Integer I) const
{
if (I == 1) return myF1;
else if (I == 2) return myF2;
Standard_ProgramError::Raise("FacesFiller::Face");
return myF1;
}
//=======================================================================
//function : FaceFaceTransition
//purpose :
//=======================================================================
const TopOpeBRepDS_Transition& TopOpeBRep_FacesFiller::FaceFaceTransition(const TopOpeBRep_LineInter& L,const Standard_Integer I) const
{
const TopOpeBRepDS_Transition& T = L.FaceFaceTransition(I);
return T;
}
//=======================================================================
//function : FaceFaceTransition
//purpose :
//=======================================================================
const TopOpeBRepDS_Transition& TopOpeBRep_FacesFiller::FaceFaceTransition(const Standard_Integer I) const
{
const TopOpeBRepDS_Transition& T = myLine->FaceFaceTransition(I);
return T;
}
TopOpeBRep_PFacesIntersector TopOpeBRep_FacesFiller::PFacesIntersectorDummy() const
{return myFacesIntersector;}
TopOpeBRepDS_PDataStructure TopOpeBRep_FacesFiller::PDataStructureDummy() const
{return myDS;}
TopOpeBRep_PLineInter TopOpeBRep_FacesFiller::PLineInterDummy() const
{return myLine;}
//=======================================================================
//function : SetTraceIndex
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::SetTraceIndex(const Standard_Integer exF1,const Standard_Integer exF2)
{
myexF1 = exF1;
myexF2 = exF2;
}
//=======================================================================
//function : GetTraceIndex
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::GetTraceIndex(Standard_Integer& exF1,Standard_Integer& exF2)const
{
exF1 = myexF1;
exF2 = myexF2;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
// File: TopOpeBRep_FacesFiller_VPonR.cxx
// Created: Fri Aug 4 10:57:30 1995
// Author: Jean Yves LEBEY et XPU surtout
// <jyl@meteox>

View File

@@ -0,0 +1,185 @@
-- File: TopOpeBRep_FacesIntersector.cdl
-- Created: Tue Oct 11 17:53:13 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class FacesIntersector from TopOpeBRep
---Purpose:
uses
Shape from TopoDS,
Face from TopoDS,
IndexedMapOfShape from TopTools,
LineInter from TopOpeBRep,
HArray1OfLineInter from TopOpeBRep,
Intersection from IntPatch,
HSurface from BRepAdaptor,
SurfaceType from GeomAbs,
TopolTool from BRepTopAdaptor,
ShapeEnum from TopAbs,
Box from Bnd
is
Create returns FacesIntersector from TopOpeBRep;
Perform(me : in out; S1,S2 : Shape from TopoDS)
---Purpose: Computes the intersection of faces S1 and S2.
is static;
Perform(me : in out; S1,S2 : Shape from TopoDS;
B1,B2 : Box from Bnd)
---Purpose: Computes the intersection of faces S1 and S2.
is static;
IsEmpty(me : in out) returns Boolean from Standard
is static;
IsDone(me) returns Boolean from Standard
is static;
SameDomain(me) returns Boolean from Standard
---Purpose: Returns True if Perform() arguments are two faces with the
-- same surface.
is static;
Face(me; Index : Integer from Standard) returns Shape from TopoDS
---Purpose : returns first or second intersected face.
---C++: return const &
is static;
SurfacesSameOriented(me) returns Boolean from Standard
---Purpose: Returns True if Perform() arguments are two faces
-- SameDomain() and normals on both side.
-- Raise if SameDomain is False
is static;
IsRestriction(me; E : Shape from TopoDS)
---Purpose: returns true if edge <E> is found as same as the edge
-- associated with a RESTRICTION line.
returns Boolean from Standard
is static;
Restrictions(me)
---Purpose: returns the map of edges found as TopeBRepBRep_RESTRICTION
returns IndexedMapOfShape from TopTools
---C++: return const&
is static;
-- ==========================
-- Intersection line iterator
-- ==========================
PrepareLines(me : in out)
is static;
Lines(me : in out ) returns HArray1OfLineInter from TopOpeBRep
is static;
NbLines(me) returns Integer from Standard
is static;
InitLine(me : in out)
is static;
FindLine(me : in out)
is static private;
MoreLine(me) returns Boolean from Standard
is static;
NextLine(me : in out)
is static;
CurrentLine(me : in out) returns LineInter from TopOpeBRep
---C++: return &
is static;
CurrentLineIndex(me) returns Integer from Standard
is static;
ChangeLine(me:in out; IL:Integer) returns LineInter from TopOpeBRep
---C++: return &
is static;
-- -------
-- private
-- -------
ResetIntersection(me : in out)
is static private;
-- ====================
-- Tolerance management :
--
-- Face/Face (not same domain) algorithm needs two tolerance values.
-- By default, these tolerances are deduced from shapes to intersect
-- such as : Tol1 = Tol2 = MAX(tolerance of shape edges)
-- (We may force these tolerances to values using ForceTolerances()).
--
-- The intersection tolerance values used by Perform() are
-- useful to the programs calling intersection in order to homogeinize
-- subsequent process, such as a "sensical" approximation of intersection
-- result curves (performed with MAX(intersection tolerances))
--
-- ====================
ForceTolerances(me : in out; tolarc,toltang : Real from Standard)
is static;
---Purpose :
-- Force the tolerance values used by the next Perform(S1,S2) call.
GetTolerances(me ; tolarc,toltang : in out Real from Standard) is static;
---Purpose :
-- Return the tolerance values used in the last Perform() call
-- If ForceTolerances() has been called, return the given values.
-- If not, return values extracted from shapes.
-- -------
-- private
-- -------
ShapeTolerances(me : in out; S1,S2 : Shape from TopoDS) is static private;
---Purpose: extract tolerance values from shapes <S1>,<S2>,
-- in order to perform intersection between <S1> and <S2>
-- with tolerance values "fitting" the shape tolerances.
-- (called by Perform() by default, when ForceTolerances() has not
-- been called)
ToleranceMax(me; S : Shape from TopoDS; T : ShapeEnum from TopAbs)
returns Real from Standard is static private;
---Purpose : returns the max tolerance of sub-shapes of type <T>
-- found in shape <S>. If no such sub-shape found, return
-- Precision::Intersection()
-- (called by ShapeTolerances())
fields
myIntersector : Intersection from IntPatch;
myIntersectionDone : Boolean from Standard;
myTol1 : Real from Standard; -- "TolArc"
myTol2 : Real from Standard; -- "TolTang"
myForceTolerances : Boolean from Standard;
myHAL : HArray1OfLineInter from TopOpeBRep;
myLine : LineInter from TopOpeBRep;
myLineIndex : Integer from Standard;
myLineFound : Boolean;
myLineNb : Integer from Standard;
myFace1 : Face from TopoDS;
myFace2 : Face from TopoDS;
mySurface1 : HSurface from BRepAdaptor;
mySurface2 : HSurface from BRepAdaptor;
mySurfaceType1 : SurfaceType from GeomAbs;
mySurfaceType2 : SurfaceType from GeomAbs;
mySurfacesSameOriented : Boolean from Standard;
myDomain1 : TopolTool from BRepTopAdaptor;
myDomain2 : TopolTool from BRepTopAdaptor;
myEdgeRestrictionMap : IndexedMapOfShape from TopTools;
myNullShape : Shape from TopoDS; -- dummy
end FacesIntersector from TopOpeBRep;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
-- File: TopOpeBRep_GeomTool.cdl
-- Created: Thu Jun 24 17:20:00 1993
-- Author: Jean Yves LEBEY
-- <jyl@zerox>
---Copyright: Matra Datavision 1993
class GeomTool from TopOpeBRep
---Purpose: Provide services needed by the DSFiller
uses
Curve from Geom,
Curve from Geom2d,
Face from TopoDS,
Shape from TopoDS,
Curve from TopOpeBRepDS,
LineInter from TopOpeBRep
is
Create returns GeomTool from TopOpeBRep;
MakeCurves(myclass;
min,max:Real;L:LineInter from TopOpeBRep;
S1,S2:Shape from TopoDS;
C:out Curve from TopOpeBRepDS;
PC1,PC2:out Curve from Geom2d);
---Purpose: Make the DS curve <C> and the pcurves <PC1,PC2> from
-- intersection line <L> lying on shapes <S1,S2>. <min,max> = <L> bounds
MakeCurve(myclass;
min,max:Real;L:LineInter from TopOpeBRep;
C : out Curve from Geom);
MakePrivateCurves
(myclass;
min,max:Real;L:LineInter from TopOpeBRep;S1,S2:Shape from TopoDS;
C:out Curve from Geom;
PC1,PC2:out Curve from Geom2d;
New:out Boolean;
tolreached2d1,tolreached2d2:out Real);
MakeBSpline1fromWALKING3d
(myclass; L:LineInter from TopOpeBRep) returns Curve from Geom;
MakeBSpline1fromWALKING2d
(myclass;L:LineInter from TopOpeBRep;SI:Integer) returns Curve from Geom2d;
end GeomTool from TopOpeBRep;

View File

@@ -0,0 +1,166 @@
// File: TopOpeBRep_GeomTool.cxx
// Created: Thu Jun 24 18:45:58 1993
// Author: Jean Yves LEBEY
// <jyl@zerox>
#include <TopOpeBRep_GeomTool.ixx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopOpeBRep_TypeLineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_ProgramError.hxx>
#include <TopOpeBRep_WPointInter.hxx>
#include <TopOpeBRep_WPointInterIterator.hxx>
#include <TopOpeBRepTool_CurveTool.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
//=======================================================================
//function : TopOpeBRep_GeomTool
//purpose :
//=======================================================================
TopOpeBRep_GeomTool::TopOpeBRep_GeomTool()
{
}
//=======================================================================
//function : MakeCurves
//purpose :
//=======================================================================
void TopOpeBRep_GeomTool::MakeCurves
(const Standard_Real min,const Standard_Real max,
const TopOpeBRep_LineInter& L,
const TopoDS_Shape& S1,const TopoDS_Shape& S2,
TopOpeBRepDS_Curve& C,
Handle(Geom2d_Curve)& PC1,Handle(Geom2d_Curve)& PC2)
{
Standard_Boolean IsWalk = Standard_False;
Handle(Geom_Curve) C3D;
TopOpeBRep_TypeLineCurve typeline = L.TypeLineCurve();
switch (typeline) {
case TopOpeBRep_WALKING : {
// make BSplines of degree 1
C3D = MakeBSpline1fromWALKING3d(L);
PC1 = MakeBSpline1fromWALKING2d(L,1);
PC2 = MakeBSpline1fromWALKING2d(L,2);
if (!PC1.IsNull())
C.Curve1(PC1);
if (!PC2.IsNull())
C.Curve2(PC2);
IsWalk = Standard_True;
break;
}
case TopOpeBRep_LINE :
case TopOpeBRep_CIRCLE :
case TopOpeBRep_ELLIPSE : {
C3D = L.Curve();
break;
}
case TopOpeBRep_PARABOLA :
case TopOpeBRep_HYPERBOLA : {
C3D = L.Curve(min,max); // Trimmed
break;
}
case TopOpeBRep_ANALYTIC :
case TopOpeBRep_RESTRICTION :
case TopOpeBRep_OTHERTYPE :
default :
Standard_ProgramError::Raise("TopOpeBRep_GeomTool::MakePrivateCurves");
break;
}
Standard_Real tol = C.Tolerance();
C.DefineCurve(C3D,tol,IsWalk);
C.SetRange(min,max);
}
//=======================================================================
//function : MakeCurve
//purpose :
//=======================================================================
void TopOpeBRep_GeomTool::MakeCurve
(const Standard_Real min,const Standard_Real max,
const TopOpeBRep_LineInter& L,
Handle(Geom_Curve)& C3D)
{
TopOpeBRep_TypeLineCurve typeline = L.TypeLineCurve();
switch (typeline) {
case TopOpeBRep_WALKING :
C3D = MakeBSpline1fromWALKING3d(L);
break;
case TopOpeBRep_LINE :
C3D = L.Curve();
break;
case TopOpeBRep_CIRCLE :
case TopOpeBRep_ELLIPSE :
case TopOpeBRep_PARABOLA :
case TopOpeBRep_HYPERBOLA :
if (typeline == TopOpeBRep_CIRCLE)
C3D = L.Curve();
else if (typeline == TopOpeBRep_ELLIPSE)
C3D = L.Curve();
else if (typeline == TopOpeBRep_PARABOLA)
C3D = L.Curve(min,max); // Trimmed
else if (typeline == TopOpeBRep_HYPERBOLA)
C3D = L.Curve(min,max); //Trimmed
break;
case TopOpeBRep_ANALYTIC :
case TopOpeBRep_RESTRICTION :
case TopOpeBRep_OTHERTYPE :
default :
Standard_ProgramError::Raise("TopOpeBRep_GeomTool::MakePrivateCurves");
break;
}
}
//=======================================================================
//function : MakeBSpline1fromWALKING3d
//purpose :
//=======================================================================
Handle(Geom_Curve) TopOpeBRep_GeomTool::MakeBSpline1fromWALKING3d
(const TopOpeBRep_LineInter& L)
{
Standard_Integer ip;
TopOpeBRep_WPointInterIterator itW(L);
Standard_Integer nbpoints = L.NbWPoint();
// Define points3d with the walking 3d points of <L>
TColgp_Array1OfPnt points3d(1,nbpoints);
for (ip = 1, itW.Init(); itW.More(); ip++, itW.Next()) {
points3d.SetValue(ip,itW.CurrentWP().Value());
}
Handle(Geom_Curve) C=TopOpeBRepTool_CurveTool::MakeBSpline1fromPnt(points3d);
return C;
}
//=======================================================================
//function : MakeBSpline1fromWALKING2d
//purpose :
//=======================================================================
Handle(Geom2d_Curve) TopOpeBRep_GeomTool::MakeBSpline1fromWALKING2d
(const TopOpeBRep_LineInter& L, const Standard_Integer SI)
{
Standard_Integer ip;
TopOpeBRep_WPointInterIterator itW(L);
Standard_Integer nbpoints = L.NbWPoint();
// Define points2d with the walking 2d points of <L>
TColgp_Array1OfPnt2d points2d(1,nbpoints);
for (ip = 1, itW.Init(); itW.More(); ip++, itW.Next()) {
if (SI == 1) points2d.SetValue(ip,itW.CurrentWP().ValueOnS1());
else if (SI == 2) points2d.SetValue(ip,itW.CurrentWP().ValueOnS2());
}
Handle(Geom2d_Curve) C=TopOpeBRepTool_CurveTool::MakeBSpline1fromPnt2d(points2d);
return C;
}

View File

@@ -0,0 +1,39 @@
-- File: TopOpeBRep_Hctxee2d.cdl
-- Created: Thu Oct 29 12:39:50 1998
-- Author: Jean Yves LEBEY
-- <jyl@langdox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1998
class Hctxee2d from TopOpeBRep inherits TShared from MMgt
uses
Shape from TopoDS,
Edge from TopoDS,
Surface from BRepAdaptor,
Face from TopoDS,
Curve from Geom2dAdaptor,
CurveType from GeomAbs,
Domain from IntRes2d
is
Create returns mutable Hctxee2d from TopOpeBRep;
SetEdges(me:mutable;E1,E2:Edge;BAS1,BAS2:Surface from BRepAdaptor);
Edge(me;I:Integer) returns Shape;---C++ : return const &
Curve(me;I:Integer) returns Curve from Geom2dAdaptor; ---C++ : return const &
Domain(me;I:Integer) returns Domain from IntRes2d; ---C++ : return const &
fields
myEdge1 : Edge from TopoDS;
myCurve1 : Curve from Geom2dAdaptor;
myCurveType1 : CurveType from GeomAbs;
myDomain1 : Domain from IntRes2d;
myEdge2 : Edge from TopoDS;
myCurve2 : Curve from Geom2dAdaptor;
myCurveType2 : CurveType from GeomAbs;
myDomain2 : Domain from IntRes2d;
end Hctxee2d from TopOpeBRep;

View File

@@ -0,0 +1,208 @@
// File: TopOpeBRep_Hctxee2d.cxx
// Created: Thu Oct 29 12:46:21 1998
// Author: Jean Yves LEBEY
// <jyl@langdox.paris1.matra-dtv.fr>
#include <TopOpeBRep_Hctxee2d.ixx>
#include <TopOpeBRep_define.hxx>
#include <TopOpeBRepTool_CurveTool.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopOpeBRepTool_2d.hxx>
#include <TopOpeBRepTool_GEOMETRY.hxx>
#include <TopOpeBRepTool_PROJECT.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#ifdef DEB
#include <GeomTools_SurfaceSet.hxx>
#include <GeomTools_CurveSet.hxx>
#include <GeomTools_Curve2dSet.hxx>
Standard_EXPORT Standard_Boolean TopOpeBRep_GettracePROEDG();
#endif
//=======================================================================
//function : TopOpeBRep_Hctxee2d
//purpose :
//=======================================================================
TopOpeBRep_Hctxee2d::TopOpeBRep_Hctxee2d()
{
}
//=======================================================================
//function : SetEdges
//purpose :
//=======================================================================
void TopOpeBRep_Hctxee2d::SetEdges(const TopoDS_Edge& E1,const TopoDS_Edge& E2,
const BRepAdaptor_Surface& BAS1,
const BRepAdaptor_Surface& BAS2)
{
const TopoDS_Face& F1 = BAS1.Face();
GeomAbs_SurfaceType ST1 = BAS1.GetType();
const TopoDS_Face& F2 = BAS2.Face();
#ifdef DEb
GeomAbs_SurfaceType ST2 = BAS2.GetType();
#endif
myEdge1 = TopoDS::Edge(E1);
myEdge2 = TopoDS::Edge(E2);
Standard_Real first,last,tole,tolpc;
gp_Pnt2d pfirst,plast;
Handle(Geom2d_Curve) PC1;
PC1 = FC2D_CurveOnSurface(myEdge1,F1,first,last,tolpc);
if (PC1.IsNull()) Standard_Failure::Raise("TopOpeBRep_Hctxee2d::SetEdges : no 2d curve");
myCurve1.Load(PC1);
BRep_Tool::UVPoints(myEdge1,F1,pfirst,plast);
tole = BRep_Tool::Tolerance(myEdge1);
myDomain1.SetValues(pfirst,first,tole,plast,last,tole);
#ifdef DEB
Standard_Boolean trc = Standard_False;
if (trc) {
cout<<"ed1 on fa1 : {pfirst=("<<pfirst.X()<<" "<<pfirst.Y()<<"),first="<<first<<"\n";
cout<<" plast =("<<plast.X()<<" "<<plast.Y()<<"),last="<<last<<"}"<<endl;}
#endif
Standard_Boolean memesfaces = F1.IsSame(F2);
Standard_Boolean memesupport = Standard_False;
TopLoc_Location L1,L2;
const Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1,L1);
const Handle(Geom_Surface) S2 = BRep_Tool::Surface(F2,L2);
if (S1 == S2 && L1 == L2) memesupport=Standard_True;
if ( ST1 == GeomAbs_Plane || memesfaces || memesupport) {
Handle(Geom2d_Curve) PC2 = FC2D_CurveOnSurface(myEdge2,F1,first,last,tolpc);
myCurve2.Load(PC2);
BRep_Tool::UVPoints(myEdge2,F1,pfirst,plast);
tole = BRep_Tool::Tolerance(myEdge2);
myDomain2.SetValues(pfirst,first,tole,plast,last,tole);
#ifdef DEB
if (trc) {
cout<<"ed2 on fa1 : {pfirst=("<<pfirst.X()<<" "<<pfirst.Y()<<"),first="<<first<<"\n";
cout<<" plast =("<<plast.X()<<" "<<plast.Y()<<"),last="<<last<<"}"<<endl;}
#endif
}
else {
Handle(Geom2d_Curve) PC2on1; Handle(Geom_Curve) NC;
Standard_Boolean dgE2 = BRep_Tool::Degenerated(myEdge2);
if (dgE2) { //xpu210998 : cto900Q3
TopExp_Explorer exv(myEdge2,TopAbs_VERTEX);
const TopoDS_Vertex& v2 = TopoDS::Vertex(exv.Current());
gp_Pnt pt2 = BRep_Tool::Pnt(v2);
gp_Pnt2d uv2; Standard_Real d; Standard_Boolean ok = FUN_tool_projPonF(pt2,F1,uv2,d);
if (!ok) return;//nyiRaise
Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1);
Standard_Boolean apex = FUN_tool_onapex(uv2,S1);
if (apex) {
TopoDS_Vertex vf,vl; TopExp::Vertices(myEdge1,vf,vl);
gp_Pnt ptf = BRep_Tool::Pnt(vf); Standard_Real df = pt2.Distance(ptf);
gp_Pnt ptl = BRep_Tool::Pnt(vl);
#ifdef DEB
Standard_Real dl =
#endif
pt2.Distance(ptl);
Standard_Real tolf = BRep_Tool::Tolerance(vf);
#ifdef DEB
Standard_Real toll =
#endif
BRep_Tool::Tolerance(vl);
#ifdef DEB
Standard_Real tol = Max (tolf,toll);
#endif
Standard_Boolean onf = (df < tolf);
#ifdef DEB
Standard_Boolean onl = (dl < toll);
#endif
TopoDS_Vertex v1 = onf ? vf : vl;
TopTools_IndexedDataMapOfShapeListOfShape mapVE; TopExp::MapShapesAndAncestors(F1,TopAbs_VERTEX,TopAbs_EDGE,mapVE);
const TopTools_ListOfShape& Edsanc = mapVE.FindFromKey(v1);
TopTools_ListIteratorOfListOfShape it(Edsanc);
for (; it.More(); it.Next()){
const TopoDS_Edge& ee = TopoDS::Edge(it.Value());
Standard_Boolean dgee = BRep_Tool::Degenerated(ee);
if (!dgee) continue;
// Standard_Real f,l;
PC2on1 = BRep_Tool::CurveOnSurface(ee,F1,first,last);
}
}
else {} // NYIxpu210998
} //dgE2
else {
// project curve of edge 2 on surface of face 1
TopLoc_Location loc ;
Handle(Geom_Curve) C = BRep_Tool::Curve(myEdge2,loc,first,last);
NC = Handle(Geom_Curve)::DownCast(C->Transformed(loc.Transformation()));
Standard_Real tolreached2d; PC2on1 = TopOpeBRepTool_CurveTool::MakePCurveOnFace(F1,NC,tolreached2d);
}
if (!PC2on1.IsNull()) {
myCurve2.Load(PC2on1);
tole = BRep_Tool::Tolerance(myEdge2);
PC2on1->D0(first,pfirst);
PC2on1->D0(last,plast);
myDomain2.SetValues(pfirst,first,tole,plast,last,tole);
#ifdef DEB
if ( TopOpeBRep_GettracePROEDG() ) {
cout<<"------------ projection de curve"<<endl;
cout<<"--- Curve : "<<endl;GeomTools_CurveSet::PrintCurve(NC,cout);
cout<<"--- nouvelle PCurve : "<<endl;GeomTools_Curve2dSet::PrintCurve2d(PC2on1,cout);
Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1);
cout<<"--- sur surface : "<<endl;GeomTools_SurfaceSet::PrintSurface(S1,cout);
cout<<endl;
}
#endif
}
}
#ifdef DEB
GeomAbs_CurveType myCurveType1 = myCurve1.GetType();
GeomAbs_CurveType myCurveType2 = myCurve2.GetType();
#endif
} // SetEdges
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_Hctxee2d::Edge(const Standard_Integer Index) const
{
if ( Index == 1 ) return myEdge1;
else if ( Index == 2 ) return myEdge2;
else Standard_Failure::Raise("TopOpeBRep_Hctxee2d::Edge");
return myEdge1;
}
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
const Geom2dAdaptor_Curve& TopOpeBRep_Hctxee2d::Curve(const Standard_Integer Index) const
{
if ( Index == 1 ) return myCurve1;
else if ( Index == 2 ) return myCurve2;
else Standard_Failure::Raise("TopOpeBRep_Hctxee2d::Curve");
return myCurve1;
}
//=======================================================================
//function : Domain
//purpose :
//=======================================================================
const IntRes2d_Domain& TopOpeBRep_Hctxee2d::Domain(const Standard_Integer Index) const
{
if ( Index == 1 ) return myDomain1;
else if ( Index == 2 ) return myDomain2;
else Standard_Failure::Raise("TopOpeBRep_Hctxee2d::Domain");
return myDomain1;
}

View File

@@ -0,0 +1,49 @@
-- File: TopOpeBRep_Hctxff2d.cdl
-- Created: Thu Oct 29 12:39:50 1998
-- Author: Jean Yves LEBEY
-- <jyl@langdox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1998
class Hctxff2d from TopOpeBRep inherits TShared from MMgt
uses
Shape from TopoDS,
Face from TopoDS,
HSurface from BRepAdaptor,
Surface from BRepAdaptor,
SurfaceType from GeomAbs
is
Create returns mutable Hctxff2d from TopOpeBRep;
SetFaces(me:mutable; F1,F2:Face);
SetHSurfaces(me:mutable; S1,S2:HSurface from BRepAdaptor);
SetHSurfacesPrivate(me:mutable) is private;
SetTolerances(me:mutable;Tol1,Tol2:Real);
GetTolerances(me;Tol1,Tol2:out Real);
GetMaxTolerance(me) returns Real;
Face(me;I:Integer) returns Face;---C++ : return const &
HSurface(me;I:Integer) returns HSurface from BRepAdaptor;
SurfacesSameOriented(me) returns Boolean;
FacesSameOriented(me) returns Boolean;
FaceSameOrientedWithRef(me;I:Integer) returns Boolean;
fields
myFace1 : Face from TopoDS;
mySurface1 : HSurface from BRepAdaptor;
mySurfaceType1 : SurfaceType from GeomAbs;
myf1surf1F_sameoriented : Boolean;
myFace2 : Face from TopoDS;
mySurface2 : HSurface from BRepAdaptor;
mySurfaceType2 : SurfaceType from GeomAbs;
myf2surf1F_sameoriented : Boolean;
mySurfacesSameOriented : Boolean;
myFacesSameOriented : Boolean;
myTol1,myTol2 : Real;
end Hctxff2d from TopOpeBRep;

View File

@@ -0,0 +1,196 @@
// File: TopOpeBRep_Hctxff2d.cxx
// Created: Thu Oct 29 12:46:21 1998
// Author: Jean Yves LEBEY
// <jyl@langdox.paris1.matra-dtv.fr>
#include <TopOpeBRep_Hctxff2d.ixx>
#include <TopOpeBRep_define.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : TopOpeBRep_Hctxff2d
//purpose :
//=======================================================================
TopOpeBRep_Hctxff2d::TopOpeBRep_Hctxff2d()
{
myf1surf1F_sameoriented = Standard_True;
myf2surf1F_sameoriented = Standard_True;
mySurfacesSameOriented = Standard_False;
myFacesSameOriented = Standard_False;
myTol1 = 0.;
myTol2 = 0.;
}
//=======================================================================
//function : SetFaces
//purpose :
//=======================================================================
void TopOpeBRep_Hctxff2d::SetFaces(const TopoDS_Face& F1,const TopoDS_Face& F2)
{
Standard_Boolean newf1 = !F1.IsEqual(myFace1);
Standard_Boolean newf2 = !F2.IsEqual(myFace2);
Standard_Boolean yaduneuf = (newf1 || newf2); if (!yaduneuf) return;
Standard_Boolean computerestriction = Standard_False;
if (newf1) {
if (mySurface1.IsNull()) mySurface1 = new BRepAdaptor_HSurface();
mySurface1->ChangeSurface().Initialize(F1,computerestriction);
}
if (newf2) {
if (mySurface2.IsNull()) mySurface2 = new BRepAdaptor_HSurface();
mySurface2->ChangeSurface().Initialize(F2,computerestriction);
}
SetHSurfacesPrivate();
} // SetFaces
//=======================================================================
//function : SetHSurfaces
//purpose :
//=======================================================================
void TopOpeBRep_Hctxff2d::SetHSurfaces(const Handle(BRepAdaptor_HSurface)& HS1,
const Handle(BRepAdaptor_HSurface)& HS2)
{
Standard_Boolean newf1 = Standard_False; Standard_Boolean newf2 = Standard_False;
if (!HS1.IsNull()) newf1 = !HS1->ChangeSurface().Face().IsEqual(myFace1);
if (!HS2.IsNull()) newf2 = !HS2->ChangeSurface().Face().IsEqual(myFace2);
Standard_Boolean yaduneuf = (newf1 || newf2); if (!yaduneuf) return;
mySurface1 = HS1;
mySurface2 = HS2;
SetHSurfacesPrivate();
} // SetHSurfaces
//=======================================================================
//function : SetHSurfacesPrivate
//purpose :
//=======================================================================
void TopOpeBRep_Hctxff2d::SetHSurfacesPrivate()
{
BRepAdaptor_Surface& S1 = mySurface1->ChangeSurface();
myFace1 = S1.Face();
mySurfaceType1 = S1.GetType();
BRepAdaptor_Surface& S2 = mySurface2->ChangeSurface();
myFace2 = S2.Face();
mySurfaceType2 = S2.GetType();
mySurfacesSameOriented = Standard_True;
myFacesSameOriented = Standard_True;
Standard_Boolean so11 = Standard_True; myf1surf1F_sameoriented = so11;
Standard_Boolean so21 = Standard_True; myf2surf1F_sameoriented = so21;
TopoDS_Face face1forward = myFace1; face1forward.Orientation(TopAbs_FORWARD);
so11 = TopOpeBRepTool_ShapeTool::FacesSameOriented(face1forward,myFace1);
myf1surf1F_sameoriented = so11;
so21 = TopOpeBRepTool_ShapeTool::FacesSameOriented(face1forward,myFace2);
myf2surf1F_sameoriented = so21;
mySurfacesSameOriented = TopOpeBRepTool_ShapeTool::SurfacesSameOriented(S1,S2);
myFacesSameOriented = TopOpeBRepTool_ShapeTool::FacesSameOriented(myFace1,myFace2);
#ifdef DEB
Standard_Integer DEBi = 0;
if ( DEBi ) {
cout<<"TopOpeBRep_Hctxff2d::SetSurfacesPrivate : ";
cout<<"f1 "; TopAbs::Print(myFace1.Orientation(),cout);
cout<< " / f1F : ";
if (so11) cout<<"sameoriented"; else cout<<"difforiented"; cout<<endl;
cout <<" ";
cout<<"f2 "; TopAbs::Print(myFace2.Orientation(),cout);
cout<< " / f1F : ";
if (so21) cout<<"sameoriented"; else cout<<"difforiented"; cout<<endl;
}
#endif
} // SetHSurfacesPrivate
//=======================================================================
//function : SetTolerances
//purpose :
//=======================================================================
void TopOpeBRep_Hctxff2d::SetTolerances(const Standard_Real Tol1,const Standard_Real Tol2)
{
myTol1 = Tol1;
myTol2 = Tol2;
}
//=======================================================================
//function : GetTolerances
//purpose :
//=======================================================================
void TopOpeBRep_Hctxff2d::GetTolerances(Standard_Real& Tol1,Standard_Real& Tol2) const
{
Tol1 = myTol1;
Tol2 = myTol2;
}
//=======================================================================
//function : GetMaxTolerance
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_Hctxff2d::GetMaxTolerance() const
{
Standard_Real tol = Max(myTol1,myTol2);
return tol;
}
//=======================================================================
//function : Face
//purpose :
//=======================================================================
const TopoDS_Face& TopOpeBRep_Hctxff2d::Face(const Standard_Integer Index) const
{
if ( Index == 1 ) return myFace1;
else if ( Index == 2 ) return myFace2;
else Standard_Failure::Raise("TopOpeBRep_Hctxff2d::Face");
return myFace1;
}
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
Handle(BRepAdaptor_HSurface) TopOpeBRep_Hctxff2d::HSurface(const Standard_Integer Index) const
{
if ( Index == 1 ) return mySurface1;
else if ( Index == 2 ) return mySurface2;
else Standard_Failure::Raise("TopOpeBRep_Hctxff2d::HSurface");
return mySurface1;
}
//=======================================================================
//function : SurfacesSameOriented
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_Hctxff2d::SurfacesSameOriented () const
{
return mySurfacesSameOriented;
}
//=======================================================================
//function : FacesSameOriented
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_Hctxff2d::FacesSameOriented () const
{
return myFacesSameOriented;
}
//=======================================================================
//function : FaceSameOrientedwithNatural1
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_Hctxff2d::FaceSameOrientedWithRef (const Standard_Integer Index) const
{
if ( Index == 1 ) return myf1surf1F_sameoriented;
else if ( Index == 2 ) return myf2surf1F_sameoriented;
else Standard_Failure::Raise("TopOpeBRep_Hctxff2d::FSO");
return Standard_True;
}

View File

@@ -0,0 +1,202 @@
-- File: TopOpeBRep_LineInter.cdl
-- Created: Wed Nov 10 17:20:37 1993
-- Author: Jean Yves LEBEY
---Copyright: Matra Datavision 1993
class LineInter from TopOpeBRep
uses
Line from IntPatch,
TypeLineCurve from TopOpeBRep,
ALine from IntPatch,
RLine from IntPatch,
WLine from IntPatch,
GLine from IntPatch,
VPointInter from TopOpeBRep,
HArray1OfVPointInter from TopOpeBRep,
WPointInter from TopOpeBRep,
Bipoint from TopOpeBRep,
Transition from TopOpeBRepDS,
Curve from Geom,
Surface from BRepAdaptor,
Face from TopoDS,
TypeTrans from IntSurf,
Situation from IntSurf,
Shape from TopoDS,
AsciiString from TCollection
is
Create returns LineInter from TopOpeBRep;
---C++: inline
SetLine(me:in out;
L : Line from IntPatch;
S1,S2:Surface from BRepAdaptor)
is static;
SetFaces(me:in out;F1,F2:Face from TopoDS);
---C++: inline
TypeLineCurve(me) returns TypeLineCurve from TopOpeBRep
---C++: inline
is static;
NbVPoint(me) returns Integer
---C++: inline
is static;
VPoint(me; I : Integer) returns VPointInter from TopOpeBRep
---C++: return const &
is static;
ChangeVPoint(me:in out; I : Integer)
returns VPointInter from TopOpeBRep
---C++: return &
is static;
SetINL(me : in out); -- Is Null Length
INL(me) returns Boolean;
---C++: inline
SetIsVClosed(me : in out);
IsVClosed(me) returns Boolean;
---C++: inline
SetOK(me : in out; B : Boolean);
OK(me) returns Boolean;
---C++: inline
SetHasVPonR(me : in out)
is static;
HasVPonR(me) returns Boolean
---C++: inline
is static;
SetVPBounds(me : in out)
is static;
VPBounds(me; f,l,n : out Integer)
is static;
IsPeriodic(me) returns Boolean
is static;
Period(me) returns Real
is static;
Bounds(me; f,l : out Real)
is static;
HasVInternal(me : in out) returns Boolean
is static;
NbWPoint(me) returns Integer
is static;
WPoint(me : in out; I : Integer) returns WPointInter from TopOpeBRep
---C++: return const &
is static;
TransitionOnS1(me) returns TypeTrans from IntSurf -- NYI const&
---C++: inline
is static;
TransitionOnS2(me) returns TypeTrans from IntSurf -- NYI const&
---C++: inline
is static;
SituationS1(me) returns Situation from IntSurf
---C++: inline
is static;
SituationS2(me) returns Situation from IntSurf
---C++: inline
is static;
Curve(me) returns Curve from Geom
is static;
Curve(me; parmin,parmax : Real) returns Curve from Geom
is static;
Arc(me) returns Shape from TopoDS;
---Purpose: returns the edge of a RESTRICTION line (or a null edge).
---C++: return const &
ArcIsEdge(me; I : Integer) returns Boolean;
---Purpose: returns true if Arc() edge (of a RESTRICTION line) is
-- an edge of the original face <Index> (1 or 2).
LineW(me) returns WLine from IntPatch;
---C++: return const &
---C++: inline
LineG(me) returns GLine from IntPatch;
---C++: return const &
---C++: inline
LineR(me) returns RLine from IntPatch;
---C++: return const &
---C++: inline
HasFirstPoint(me) returns Boolean;
HasLastPoint(me) returns Boolean;
ComputeFaceFaceTransition(me:in out);
FaceFaceTransition(me;I:Integer) returns Transition from TopOpeBRepDS;
-- transition from face I(1,2) through me with face (2,1)
---C++: return const &
Index(me : in out; I : Integer from Standard) is static; -- debug
---C++: inline
Index(me) returns Integer from Standard is static; -- debug
---C++: inline
DumpType(me) is static; -- debug
DumpVPoint(me; I : Integer;
s1,s2 : AsciiString from TCollection) is static; -- debug
DumpBipoint(me; B : Bipoint from TopOpeBRep;
s1,s2 : AsciiString from TCollection) is static; -- debug
SetTraceIndex(me:in out; exF1,exF2 : Integer) is static;
GetTraceIndex(me; exF1,exF2 : out Integer) is static;
-- <exf1,exf2> TopExp_Explorer exploration index of faces
-- involved in current line. (trace)
DumpLineTransitions(me; OS : in out OStream) returns OStream is static;
---C++: return &
fields
myOK : Boolean;
myIndex : Integer;
myNbVPoint : Integer;
myIsVClosed : Boolean;
myHasVPonR : Boolean;
myINL : Boolean;
myVPBDefined : Boolean;
myVPF : Integer;
myVPL : Integer;
myVPN : Integer;
myTypeLineCurve : TypeLineCurve from TopOpeBRep;
myIL : Line from IntPatch;
myILA : ALine from IntPatch;
myILR : RLine from IntPatch;
myILW : WLine from IntPatch;
myILG : GLine from IntPatch;
myCurrentWP : WPointInter from TopOpeBRep;
myHAVP : HArray1OfVPointInter from TopOpeBRep;
myF1 : Face from TopoDS;
myF2 : Face from TopoDS;
myLineTonF1 : Transition from TopOpeBRepDS;
myLineTonF2 : Transition from TopOpeBRepDS;
myNullShape : Shape from TopoDS; --dummy
-- trace
myexF1,myexF2 : Integer;
end LineInter from TopOpeBRep;

View File

@@ -0,0 +1,675 @@
// File: TopOpeBRep_LineInter.cxx
// Created: Wed Nov 10 18:31:43 1993
// Author: Jean Yves LEBEY
// Copyright: OPEN CASCADE 1993
#include <TopOpeBRep_LineInter.ixx>
#include <TopOpeBRep.hxx>
#include <TopOpeBRep_VPointInter.hxx>
#include <TopOpeBRep_VPointInterIterator.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
#include <IntPatch_IType.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <IntPatch_ALineToWLine.hxx>
#include <IntSurf_Quadric.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <gp_Pnt.hxx>
#include <Adaptor2d_HCurve2d.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <TopAbs.hxx>
#include <Standard_ProgramError.hxx>
#include <Standard_NotImplemented.hxx>
#ifdef DEB
Standard_IMPORT Standard_Boolean TopOpeBRep_GetcontextALWLNBP(Standard_Integer&);
Standard_IMPORT Standard_Boolean TopOpeBRep_GettraceCONIC();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSNC();
#endif
//-----------------------------------------------------------------------
static Handle(IntPatch_WLine) FUN_ALINETOWLINE
(const Handle(IntPatch_ALine)& AL,
const BRepAdaptor_Surface surf1,const BRepAdaptor_Surface surf2)
//-----------------------------------------------------------------------
{
IntSurf_Quadric Quad1,Quad2;
switch(surf1.GetType())
{
case GeomAbs_Plane: Quad1.SetValue(surf1.Plane()); break;
case GeomAbs_Cylinder: Quad1.SetValue(surf1.Cylinder()); break;
case GeomAbs_Sphere: Quad1.SetValue(surf1.Sphere()); break;
case GeomAbs_Cone: Quad1.SetValue(surf1.Cone()); break;
default : Standard_ProgramError::Raise
("TopOpeBRep_LineInter::FUN_ALINETOWLINE"); break;
}
switch(surf2.GetType())
{
case GeomAbs_Plane: Quad2.SetValue(surf2.Plane()); break;
case GeomAbs_Cylinder: Quad2.SetValue(surf2.Cylinder()); break;
case GeomAbs_Sphere: Quad2.SetValue(surf2.Sphere()); break;
case GeomAbs_Cone: Quad2.SetValue(surf2.Cone()); break;
default : Standard_ProgramError::Raise
("TopOpeBRep_LineInter::FUN_ALINETOWLINE"); break;
}
const Standard_Real deflectionmax = 0.01;
const Standard_Real pasUVmax = 0.05;
Standard_Integer nbpointsmax = 200;
#ifdef DEB
Standard_Integer newnbp;
if (TopOpeBRep_GetcontextALWLNBP(newnbp)) nbpointsmax = newnbp;
#endif
IntPatch_ALineToWLine
AToL(Quad1,Quad2,deflectionmax,pasUVmax,nbpointsmax);
return AToL.MakeWLine(AL);
}
//=======================================================================
//function : SetLine
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetLine(const Handle(IntPatch_Line)& L,
const BRepAdaptor_Surface& S1,
const BRepAdaptor_Surface& S2)
{
// load line according to its type
myIL = L;
IntPatch_IType type = L->ArcType();
switch (type) {
case IntPatch_Analytic : myTypeLineCurve = TopOpeBRep_ANALYTIC; break;
case IntPatch_Restriction : myTypeLineCurve = TopOpeBRep_RESTRICTION; break;
case IntPatch_Walking : myTypeLineCurve = TopOpeBRep_WALKING; break;
case IntPatch_Lin : myTypeLineCurve = TopOpeBRep_LINE; break;
case IntPatch_Circle : myTypeLineCurve = TopOpeBRep_CIRCLE; break;
case IntPatch_Ellipse : myTypeLineCurve = TopOpeBRep_ELLIPSE; break;
case IntPatch_Parabola : myTypeLineCurve = TopOpeBRep_PARABOLA; break;
case IntPatch_Hyperbola : myTypeLineCurve = TopOpeBRep_HYPERBOLA; break;
default :
myTypeLineCurve = TopOpeBRep_OTHERTYPE;
SetOK(Standard_False);
break;
}
switch (type) {
case IntPatch_Analytic :
myILA = *((Handle(IntPatch_ALine)*)&L); break;
case IntPatch_Restriction :
myILR = *((Handle(IntPatch_RLine)*)&L); break;
case IntPatch_Walking :
myILW = *((Handle(IntPatch_WLine)*)&L); break;
default : //"geometric" line
myILG = *((Handle(IntPatch_GLine)*)&L); break;
}
// transform an analytic line to a walking line
if (myTypeLineCurve == TopOpeBRep_ANALYTIC) {
myILW = ::FUN_ALINETOWLINE(myILA,S1,S2);
myTypeLineCurve = TopOpeBRep_WALKING;
}
// number of points found on restriction(s)
Standard_Integer n = 0;
switch (myTypeLineCurve) {
case TopOpeBRep_ANALYTIC : n = myILA->NbVertex(); break;
case TopOpeBRep_RESTRICTION : n = myILR->NbVertex(); break;
case TopOpeBRep_WALKING : n = myILW->NbVertex(); break;
case TopOpeBRep_LINE : n = myILG->NbVertex(); break;
case TopOpeBRep_CIRCLE : n = myILG->NbVertex(); break;
case TopOpeBRep_ELLIPSE : n = myILG->NbVertex(); break;
case TopOpeBRep_PARABOLA : n = myILG->NbVertex(); break;
case TopOpeBRep_HYPERBOLA : n = myILG->NbVertex(); break;
default :
SetOK(Standard_False);
break;
}
myNbVPoint = n;
// prepare VPoints from intersection points
myHAVP = new TopOpeBRep_HArray1OfVPointInter(0,n);
for (Standard_Integer i=1;i<=n;i++) {
TopOpeBRep_VPointInter& VP = myHAVP->ChangeValue(i);
switch (myTypeLineCurve) {
case TopOpeBRep_ANALYTIC : VP.SetPoint(myILA->Vertex(i)); break;
case TopOpeBRep_RESTRICTION : VP.SetPoint(myILR->Vertex(i)); break;
case TopOpeBRep_WALKING : VP.SetPoint(myILW->Vertex(i)); break;
default : VP.SetPoint(myILG->Vertex(i)); break;
}
VP.Index(i);
}
}
//=======================================================================
//function : VPoint
//purpose :
//=======================================================================
const TopOpeBRep_VPointInter& TopOpeBRep_LineInter::VPoint(const Standard_Integer I) const
{
return myHAVP->Value(I);
}
//=======================================================================
//function : ChangeVPoint
//purpose :
//=======================================================================
TopOpeBRep_VPointInter& TopOpeBRep_LineInter::ChangeVPoint(const Standard_Integer I)
{
return myHAVP->ChangeValue(I);
}
//=======================================================================
//function : SetINL
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetINL()
{
TopOpeBRep_VPointInterIterator VPI(*this);
if (!VPI.More()) {
myINL = Standard_False;
return;
}
const Standard_Real p0 = VPI.CurrentVP().ParameterOnLine();
VPI.Next();
if (!VPI.More()) {
myINL = Standard_True;
return;
}
for (; VPI.More(); VPI.Next() ) {
const Standard_Real p = VPI.CurrentVP().ParameterOnLine();
if ( p != p0 ) {
myINL = Standard_False;
return;
}
}
myINL = Standard_True;
}
//=======================================================================
//function : SetIsVClosed
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetIsVClosed()
{
if (myINL) {
myIsVClosed = Standard_False;
return;
}
/*Standard_Boolean newV = Standard_True;
if (!newV) {
if (myTypeLineCurve != TopOpeBRep_WALKING) {
myIsVClosed = Standard_False;
return;
}
}*/
TopOpeBRep_VPointInterIterator VPI(*this);
Standard_Integer nV = myNbVPoint;
Standard_Real pmin = RealLast(),pmax = RealFirst();
Standard_Integer imin=0, imax = 0; // index of IsOnArc VPoints
if (nV >= 2) {
for (; VPI.More(); VPI.Next() ) {
const TopOpeBRep_VPointInter& P = VPI.CurrentVP();
if ( ! P.IsInternal() ) {
const Standard_Integer i = VPI.CurrentVPIndex();
const Standard_Real p = P.ParameterOnLine();
if ( p < pmin ) { imin = i; pmin = p; }
if ( p > pmax ) { imax = i; pmax = p; }
}
}
if ( imax == 0 ) { // no VPoint on restriction found
myIsVClosed = Standard_True;
return;
}
const TopOpeBRep_VPointInter& P1 = VPoint(imin);
const TopOpeBRep_VPointInter& P2 = VPoint(imax);
const gp_Pnt& pp1 = P1.Value();
const gp_Pnt& pp2 = P2.Value();
const Standard_Real tol1 = P1.Tolerance();
const Standard_Real tol2 = P2.Tolerance();
const Standard_Real tol = Max(tol1,tol2);
myIsVClosed = pp1.IsEqual(pp2,tol);
}
else {
SetOK(Standard_False);
myIsVClosed = Standard_False;
}
}
//=======================================================================
//function : SetHasVPonR
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetHasVPonR()
{
myHasVPonR = Standard_False;
TopOpeBRep_VPointInterIterator VPI(*this);
for (; VPI.More(); VPI.Next()) {
const TopOpeBRep_VPointInter& P = VPI.CurrentVP();
if (P.IsOnDomS1() || P.IsOnDomS2()) {
myHasVPonR = Standard_True;
break;
}
}
}
//=======================================================================
//function : SetVPBounds
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetVPBounds()
{
myVPF = myVPL = myVPN = 0;
myVPBDefined = Standard_True;
TopOpeBRep_VPointInterIterator VPI(*this);
Standard_Integer f = myNbVPoint + 1, l = 0, n = 0;
for (; VPI.More(); VPI.Next()) {
if (VPI.CurrentVP().Keep()) {
n++;
const Standard_Integer i = VPI.CurrentVPIndex();
if ( i < f ) f = i;
if ( i > l ) l = i;
}
}
myVPF = f; myVPL = l; myVPN = n;
}
//=======================================================================
//function : VPBounds
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::VPBounds
(Standard_Integer& f, Standard_Integer& l, Standard_Integer& n) const
{
if ( !myVPBDefined ) {
TopOpeBRep_LineInter* p = (TopOpeBRep_LineInter*)this; // NYI deconst
p->SetOK(Standard_False);
f = l = n = 0;
return;
}
f = myVPF;
l = myVPL;
n = myVPN;
}
//=======================================================================
//function : IsPeriodic
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_LineInter::IsPeriodic() const
{
switch (myTypeLineCurve)
{
case TopOpeBRep_CIRCLE :
case TopOpeBRep_ELLIPSE : return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : Period
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_LineInter::Period() const
{
Standard_Real f,l;
Bounds(f,l);
return (l - f);
}
//=======================================================================
//function : Bounds
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::Bounds(Standard_Real& First,Standard_Real& Last) const
{
if ( myILG.IsNull() ) {
TopOpeBRep_LineInter* p = (TopOpeBRep_LineInter*)this; // NYI deconst
p->SetOK(Standard_False);
return;
}
First = 0.; Last = 0.;
if ( IsPeriodic() )
Last = Curve()->Period();
if ( myILG->HasFirstPoint() )
First = myILG->FirstPoint().ParameterOnLine();
if ( myILG->HasLastPoint() )
Last = myILG->LastPoint().ParameterOnLine();
}
//=======================================================================
//function : HasVInternal
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_LineInter::HasVInternal()
{
TopOpeBRep_VPointInterIterator VPI(*this);
for (; VPI.More(); VPI.Next()) {
if (VPI.CurrentVP().IsInternal()) return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : NbWPoint
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_LineInter::NbWPoint() const
{
switch (myTypeLineCurve)
{
case TopOpeBRep_WALKING : return myILW->NbPnts();
}
return 0;
}
//=======================================================================
//function : WPoint
//purpose :
//=======================================================================
const TopOpeBRep_WPointInter& TopOpeBRep_LineInter::WPoint(const Standard_Integer IW)
{
switch (myTypeLineCurve)
{
case TopOpeBRep_RESTRICTION : myCurrentWP.Set(myILR->Point(IW)); break;
case TopOpeBRep_WALKING : myCurrentWP.Set(myILW->Point(IW)); break;
default : break;
}
return myCurrentWP;
}
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
Handle(Geom_Curve) TopOpeBRep_LineInter::Curve() const
{
// Build the 3d curve
Handle(Geom_Curve) C3D;
switch (myTypeLineCurve) {
case TopOpeBRep_LINE :
C3D = new Geom_Line(myILG->Line()); break;
case TopOpeBRep_CIRCLE :
C3D = new Geom_Circle(myILG->Circle()); break;
case TopOpeBRep_ELLIPSE :
C3D = new Geom_Ellipse(myILG->Ellipse()); break;
case TopOpeBRep_PARABOLA :
C3D = new Geom_Parabola(myILG->Parabola()); break;
case TopOpeBRep_HYPERBOLA :
C3D = new Geom_Hyperbola(myILG->Hyperbola()); break;
default :
TopOpeBRep_LineInter* p = (TopOpeBRep_LineInter*)this; // NYI deconst
p->SetOK(Standard_False);
break;
}
return C3D;
}
//=======================================================================
//function : Curve
//purpose :
//=======================================================================
Handle(Geom_Curve) TopOpeBRep_LineInter::Curve
(const Standard_Real parmin, const Standard_Real parmax) const
{
// Build the trimmed 3d curve
Handle(Geom_Curve) C3D = Curve();
Handle(Geom_TrimmedCurve) TC3D = new Geom_TrimmedCurve(C3D,parmin,parmax);
#ifdef DEB
if ( TopOpeBRep_GettraceCONIC() ) {
cout<<"TopOpeBRep_LineInter::Curve on a ";
TopOpeBRep::Print(myTypeLineCurve,cout);cout<<endl;
cout<<" ... Trimmed from "<<parmin<<" to "<<parmax<<endl;
}
#endif
return TC3D;
}
//=======================================================================
//function : Arc
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_LineInter::Arc() const
{
if (myTypeLineCurve == TopOpeBRep_RESTRICTION) {
if(myILR->IsArcOnS1()) {
const Handle(Adaptor2d_HCurve2d)& AHC2D = myILR->ArcOnS1();
const BRepAdaptor_Curve2d& BC2DP = *((BRepAdaptor_Curve2d*)&(AHC2D->Curve2d()));
const TopoDS_Shape& S = BC2DP.Edge();
return S;
}
else {
const Handle(Adaptor2d_HCurve2d)& AHC2D = myILR->ArcOnS2();
const BRepAdaptor_Curve2d& BC2DP = *((BRepAdaptor_Curve2d*)&(AHC2D->Curve2d()));
const TopoDS_Shape& S = BC2DP.Edge();
return S;
}
}
else
return myNullShape;
}
//=======================================================================
//function : ArcIsEdge
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_LineInter::ArcIsEdge(const Standard_Integer Index) const
{
if (myTypeLineCurve == TopOpeBRep_RESTRICTION) {
const Standard_Boolean r = myILR->IsArcOnS1();
return ( Index == 2 ? !r : r );
}
return Standard_False;
}
//=======================================================================
//function : HasFirstPoint
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_LineInter::HasFirstPoint() const
{
if (myILG.IsNull())
Standard_ProgramError::Raise("TopOpeBRep_LineInter::HasFirstPoint sur line != GLine");
return myILG->HasFirstPoint();
}
//=======================================================================
//function : HasLastPoint
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_LineInter::HasLastPoint() const
{
if (myILG.IsNull())
Standard_ProgramError::Raise("TopOpeBRep_LineInter::HasLastPoint sur line != GLine");
return myILG->HasLastPoint();
}
//=======================================================================
//function : ComputeFaceFaceTransition
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::ComputeFaceFaceTransition()
{
TopAbs_Orientation F1ori = myF1.Orientation();
TopAbs_Orientation F2ori = myF2.Orientation();
myLineTonF1=TopOpeBRep_FFTransitionTool::ProcessFaceTransition(*this,1,F2ori);
myLineTonF2=TopOpeBRep_FFTransitionTool::ProcessFaceTransition(*this,2,F1ori);
}
//=======================================================================
//function : FaceFaceTransition
//purpose :
//=======================================================================
const TopOpeBRepDS_Transition& TopOpeBRep_LineInter::FaceFaceTransition
(const Standard_Integer I) const
{
if (I == 1) return myLineTonF1;
if (I == 2) return myLineTonF2;
Standard_ProgramError::Raise("TopOpeBRep_LineInter::FaceFaceTransition");
return myLineTonF1;
}
//=======================================================================
//function : DumpType
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::DumpType()const
{
#ifdef DEB
TopOpeBRep::Print(myTypeLineCurve,cout);
#endif
}
//=======================================================================
//function : DumpVPoint
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::DumpVPoint
#ifndef DEB
(const Standard_Integer ,
const TCollection_AsciiString& ,
const TCollection_AsciiString& ) const
{
#else
(const Standard_Integer I,
const TCollection_AsciiString& s1,
const TCollection_AsciiString& s2) const
{
const TopOpeBRep_VPointInter& VP = VPoint(I);
const gp_Pnt& P = VP.Value();
cout<<s1;
cout<<"L"<<Index()<<"P"<<VP.Index();
if (VP.Keep()) cout<<"K";
cout<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z();
cout<<s2;
#endif
}
//=======================================================================
//function : DumpBipoint
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::DumpBipoint
#ifndef DEB
(const TopOpeBRep_Bipoint& ,
const TCollection_AsciiString& ,
const TCollection_AsciiString& ) const
{
#else
(const TopOpeBRep_Bipoint& bip,
const TCollection_AsciiString& s1,
const TCollection_AsciiString& s2) const
{
Standard_Integer i1 = bip.I1();
Standard_Integer i2 = bip.I2();
cout<<s1;
cout<<"("<<i1<<","<<i2<<")";
cout<<s2;
#endif
}
//=======================================================================
//function : SetOK
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetOK(const Standard_Boolean B)
{
#ifdef DEB
if (TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSNC()) {
if (myOK != B) {
cout<<"line "<<myIndex<<" (";
TopOpeBRep::Print(myTypeLineCurve,cout);cout<<") ";
if (!B) cout<<"OK->NOK"; else cout<<"NOK->OK";
cout<<endl;
}
}
#endif
myOK = B;
}
//=======================================================================
//function : SetTraceIndex
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::SetTraceIndex(const Standard_Integer exF1,
const Standard_Integer exF2)
{
myexF1 = exF1;
myexF2 = exF2;
}
//=======================================================================
//function : GetTraceIndex
//purpose :
//=======================================================================
void TopOpeBRep_LineInter::GetTraceIndex(Standard_Integer& exF1,
Standard_Integer& exF2)const
{
exF1 = myexF1;
exF2 = myexF2;
}
//=======================================================================
//function : DumpLineTransitions
//purpose :
//=======================================================================
Standard_OStream& TopOpeBRep_LineInter::DumpLineTransitions(Standard_OStream& OS) const
{
#ifdef DEB
OS<<"transition from f1 / f2 "; TopAbs::Print(myF2.Orientation(),OS);
OS<<" : "; myLineTonF1.Dump(OS); OS<<endl;
OS<<"transition from f2 / f1 "; TopAbs::Print(myF1.Orientation(),OS);
OS<<" : "; myLineTonF2.Dump(OS); OS<<endl;
#endif
return OS;
}

View File

@@ -0,0 +1,185 @@
// File: TopOpeBRep_LineInter.lxx
// Created: Wed Nov 10 18:31:43 1993
// Author: Jean Yves LEBEY
// Copyright: OPEN CASCADE 1993
#include <IntPatch_Line.hxx>
//=======================================================================
//function : TopOpeBRep_LineInter
//purpose :
//=======================================================================
inline TopOpeBRep_LineInter::TopOpeBRep_LineInter() :
myOK(Standard_True),
//myIndex, myNbVPoint,
myIsVClosed(Standard_False),
myHasVPonR(Standard_False),
myINL(Standard_False),
myVPBDefined(Standard_False)
//myVPF, myVPL, myVPN,
//myTypeLineCurve, myLineTonF1, myLineTonF2
{
}
//=======================================================================
//function : SetFaces
//purpose :
//=======================================================================
inline void TopOpeBRep_LineInter::SetFaces(const TopoDS_Face& F1, const TopoDS_Face& F2)
{
myF1 = F1;
myF2 = F2;
}
//=======================================================================
//function : TypeLineCurve
//purpose :
//=======================================================================
inline TopOpeBRep_TypeLineCurve TopOpeBRep_LineInter::TypeLineCurve() const
{
return myTypeLineCurve;
}
//=======================================================================
//function : NbVPoint
//purpose :
//=======================================================================
inline Standard_Integer TopOpeBRep_LineInter::NbVPoint() const
{
return myNbVPoint;
}
//=======================================================================
//function : INL
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_LineInter::INL() const
{
return myINL;
}
//=======================================================================
//function : IsVClosed
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_LineInter::IsVClosed() const
{
return myIsVClosed;
}
//=======================================================================
//function : HasVPonR
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_LineInter::HasVPonR() const
{
return myHasVPonR;
}
//=======================================================================
//function : TransitionOnS1
//purpose :
//=======================================================================
inline IntSurf_TypeTrans TopOpeBRep_LineInter::TransitionOnS1() const
{
return myIL->TransitionOnS1();
}
//=======================================================================
//function : TransitionOnS2
//purpose :
//=======================================================================
inline IntSurf_TypeTrans TopOpeBRep_LineInter::TransitionOnS2() const
{
return myIL->TransitionOnS2();
}
//=======================================================================
//function : SituationS1
//purpose :
//=======================================================================
inline IntSurf_Situation TopOpeBRep_LineInter::SituationS1() const
{
return myIL->SituationS1();
}
//=======================================================================
//function : SituationS2
//purpose :
//=======================================================================
inline IntSurf_Situation TopOpeBRep_LineInter::SituationS2() const
{
return myIL->SituationS2();
}
//=======================================================================
//function : LineW
//purpose :
//=======================================================================
inline const Handle(IntPatch_WLine)& TopOpeBRep_LineInter::LineW() const
{
return myILW;
}
//=======================================================================
//function : LineG
//purpose :
//=======================================================================
inline const Handle(IntPatch_GLine)& TopOpeBRep_LineInter::LineG() const
{
return myILG;
}
//=======================================================================
//function : LineR
//purpose :
//=======================================================================
inline const Handle(IntPatch_RLine)& TopOpeBRep_LineInter::LineR() const
{
return myILR;
}
//=======================================================================
//function : Index
//purpose : trace
//=======================================================================
inline void TopOpeBRep_LineInter::Index(const Standard_Integer I)
{
myIndex = I;
}
//=======================================================================
//function : Index
//purpose : trace
//=======================================================================
inline Standard_Integer TopOpeBRep_LineInter::Index() const
{
return myIndex;
}
//=======================================================================
//function : OK
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_LineInter::OK() const
{
return myOK;
}

View File

@@ -0,0 +1,99 @@
-- File: TopOpeBRep_Point2d.cdl
-- Created: Thu Oct 29 09:46:39 1998
-- Author: Jean Yves LEBEY
-- <jyl@langdox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1998
class Point2d from TopOpeBRep
uses
Pnt2d from gp,
Pnt from gp,
Vertex from TopoDS,
Edge from TopoDS,
Transition from TopOpeBRepDS,
Config from TopOpeBRepDS,
IntersectionPoint from IntRes2d,
P2Dstatus from TopOpeBRep,
Hctxff2d from TopOpeBRep,
Hctxee2d from TopOpeBRep
is
Create returns Point2d from TopOpeBRep;
Dump(me;ie1:Integer = 0;ie2:Integer = 0);
SetPint(me:in out;P:IntersectionPoint from IntRes2d);---C++ : inline
HasPint(me) returns Boolean;---C++ : inline
Pint(me) returns IntersectionPoint from IntRes2d;---C++ : inline
---C++ : return const &
SetIsVertex(me:in out;I:Integer;B:Boolean);---C++ : inline
IsVertex(me;I:Integer) returns Boolean;---C++ : inline
SetVertex(me:in out;I:Integer;V:Vertex);---C++ : inline
Vertex(me;I:Integer) returns Vertex;---C++: return const &
SetTransition(me:in out;I:Integer;T:Transition);---C++ : inline
Transition(me;I:Integer) returns Transition;---C++: return const &
ChangeTransition(me:out;I:Integer) returns Transition;---C++: return &
SetParameter(me:in out;I:Integer;P:Real);---C++ : inline
Parameter(me;I:Integer) returns Real;---C++ : inline
SetIsPointOfSegment(me:in out;B:Boolean);---C++ : inline
IsPointOfSegment(me) returns Boolean;---C++ : inline
SetSegmentAncestors(me:in out;IP1,IP2:Integer);---C++ : inline
SegmentAncestors(me;IP1,IP2:out Integer) returns Boolean;---C++ : inline
SetStatus(me:in out;S:P2Dstatus);---C++ : inline
Status(me) returns P2Dstatus;---C++ : inline
SetIndex(me:in out;X:Integer);---C++ : inline
Index(me) returns Integer;---C++ : inline
SetValue(me:in out;P:Pnt from gp);---C++ : inline
Value(me) returns Pnt from gp;---C++ : inline
---C++ : return const &
SetValue2d(me:in out;P:Pnt2d from gp);---C++ : inline
Value2d(me) returns Pnt2d from gp;---C++ : inline
---C++ : return const &
SetKeep(me:in out;B:Boolean);---C++ : inline
Keep(me) returns Boolean;---C++ : inline
SetEdgesConfig(me:in out;C:Config from TopOpeBRepDS);---C++ : inline
EdgesConfig(me) returns Config from TopOpeBRepDS;---C++ : inline
SetTolerance(me:in out;T:Real);---C++ : inline
Tolerance(me) returns Real;---C++ : inline
SetHctxff2d(me:in out;ff2d:Hctxff2d);---C++ : inline
Hctxff2d(me) returns Hctxff2d;---C++ : inline
SetHctxee2d(me:in out;ee2d:Hctxee2d);---C++ : inline
Hctxee2d(me) returns Hctxee2d;---C++ : inline
fields
mypint : IntersectionPoint from IntRes2d;
myhaspint : Boolean;
myisvertex1 : Boolean;
myvertex1 : Vertex;
mytransition1 : Transition;
myparameter1 : Real;
myisvertex2 : Boolean;
myvertex2 : Vertex;
mytransition2 : Transition;
myparameter2 : Real;
myispointofsegment : Boolean;
myips1,myips2 : Integer;
myhasancestors : Boolean;
mystatus : P2Dstatus from TopOpeBRep;
myindex : Integer;
mypnt : Pnt from gp;
mypnt2d : Pnt2d from gp;
mykeep : Boolean;
myedgesconfig : Config from TopOpeBRepDS;
mytolerance : Real;
myctxff2d : Hctxff2d from TopOpeBRep;
myctxee2d : Hctxee2d from TopOpeBRep;
friends
class EdgesIntersector from TopOpeBRep
end Point2d from TopOpeBRep;

View File

@@ -0,0 +1,132 @@
// File: TopOpeBRep_Point2d.cxx
// Created: Thu Oct 29 09:55:47 1998
// Author: Jean Yves LEBEY
// <jyl@langdox.paris1.matra-dtv.fr>
#ifdef DRAW
#include <TopOpeBRepTool_DRAW.hxx>
#endif
#include <TopOpeBRep_Point2d.ixx>
#include <TopOpeBRep_define.hxx>
#include <TopOpeBRepDS.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
//function : TopOpeBRep_Point2d
//purpose :
//=======================================================================
TopOpeBRep_Point2d::TopOpeBRep_Point2d() :
myhaspint(Standard_False),
myisvertex1(Standard_False),
myparameter1(0.),
myisvertex2(Standard_False),
myparameter2(0.),
myispointofsegment(Standard_False),
myips1(0),myips2(0),myhasancestors(Standard_False),
mystatus(TopOpeBRep_P2DUNK),
myindex(0),
mykeep(Standard_True),
myedgesconfig(TopOpeBRepDS_UNSHGEOMETRY),
mytolerance(0.)
{
}
//=======================================================================
//function : Vertex
//purpose :
//=======================================================================
const TopoDS_Vertex& TopOpeBRep_Point2d::Vertex(const Standard_Integer Index) const
{
if (!IsVertex(Index)) Standard_Failure::Raise("TopOpeBRep_Point2d::Vertex");
if (Index == 1) return myvertex1;
else if (Index == 2) return myvertex2;
else Standard_Failure::Raise("TopOpeBRep_Point2d::Vertex");
return myvertex1;
}
//=======================================================================
//function : Transition
//purpose :
//=======================================================================
const TopOpeBRepDS_Transition& TopOpeBRep_Point2d::Transition(const Standard_Integer Index) const
{
if (Index == 1) return mytransition1;
else if (Index == 2) return mytransition2;
else Standard_Failure::Raise("TopOpeBRep_Point2d::Transition");
return mytransition1;
}
//=======================================================================
//function : ChangeTransition
//purpose :
//=======================================================================
TopOpeBRepDS_Transition& TopOpeBRep_Point2d::ChangeTransition(const Standard_Integer Index)
{
if (Index == 1) return mytransition1;
else if (Index == 2) return mytransition2;
else Standard_Failure::Raise("TopOpeBRep_Point2d::ChangeTransition");
return mytransition1;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void TopOpeBRep_Point2d::Dump(const Standard_Integer E1index,const Standard_Integer E2index) const
{
#ifdef DEB
Standard_Real par1 = Parameter(1);
Standard_Real par2 = Parameter(2);
Standard_Integer index = Index();
Standard_Boolean keep = Keep();
Standard_Integer sts = Status();
Standard_Boolean pos = IsPointOfSegment();
Standard_Real tol = Tolerance();
const TopOpeBRepDS_Transition& T1 = Transition(1);
const TopOpeBRepDS_Transition& T2 = Transition(2);
Standard_Boolean isvertex1 = IsVertex(1); TopoDS_Vertex V1; if (isvertex1) V1 = Vertex(1);
Standard_Boolean isvertex2 = IsVertex(2); TopoDS_Vertex V2; if (isvertex2) V2 = Vertex(2);
Standard_Boolean isvertex = isvertex1 || isvertex2;
Standard_Integer ia1,ia2; SegmentAncestors(ia1,ia2);
cout<<endl<<"p2d "<<index<<" k="<<keep<<" pos="<<pos;
switch (sts) {
case TopOpeBRep_P2DUNK : cout<<" sts=u";break;
case TopOpeBRep_P2DSGF : cout<<" sts=f";break;
case TopOpeBRep_P2DSGL : cout<<" sts=l";break;
case TopOpeBRep_P2DNEW :
cout<<" sts=n";
cout<<" anc="<<ia1<<","<<ia2;
break;
case TopOpeBRep_P2DINT : cout<<" sts=i";break;
} // switch
cout<<" cfg=";TopOpeBRepDS::Print(myedgesconfig,cout);
cout<<endl;
gp_Pnt P3D = Value();
#ifdef DRAW
cout<<FUN_tool_PRODINP()<<"P"<<Index()<<" "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z()<<"; # tol = "<<tol<<endl;
#endif
cout<<" on (1) :"; cout<<" vertex(1) : "; cout<<(isvertex1)? 1:0;
cout<<" T "<<E1index<<"(1) : "; T1.Dump(cout);
cout<<" par(1) = "<<par1;
if (isvertex1) {
P3D = BRep_Tool::Pnt(V1);
cout<<" PV(1) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
}
cout<<endl;
cout<<" on (2) :"; cout<<" vertex(2) : "; cout<<(isvertex2)? 1:0;
cout<<" T "<<E2index<<"(2) : "; T2.Dump(cout);
cout<<" par(2) = "<<par2;
if (isvertex2) {
P3D = BRep_Tool::Pnt(V2);
cout<<" PV(2) : "<<P3D.X()<<" "<<P3D.Y()<<" "<<P3D.Z();
}
cout<<endl;
#endif
}

View File

@@ -0,0 +1,307 @@
// File: TopOpeBRep_Point2d.lxx
// Created: Thu Oct 29 09:55:47 1998
// Author: Jean Yves LEBEY
// <jyl@langdox.paris1.matra-dtv.fr>
#include <TopOpeBRep_define.hxx>
//=======================================================================
//function : SetPint
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetPint(const IntRes2d_IntersectionPoint& P)
{
mypint = P;
myhaspint = Standard_True;
}
//=======================================================================
//function : HasPint
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_Point2d::HasPint() const
{
return myhaspint;
}
//=======================================================================
//function : Pint
//purpose :
//=======================================================================
inline const IntRes2d_IntersectionPoint& TopOpeBRep_Point2d::Pint() const
{
if (!HasPint()) Standard_Failure::Raise("TopOpeBRep_Point2d::Pint");
return mypint;
}
//=======================================================================
//function : SetIsVertex
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetIsVertex(const Standard_Integer Index,const Standard_Boolean B)
{
if (Index == 1) myisvertex1 = B;
else if (Index == 2) myisvertex2 = B;
else Standard_Failure::Raise("TopOpeBRep_Point2d::SetIsVertex");
}
//=======================================================================
//function : IsVertex
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_Point2d::IsVertex(const Standard_Integer Index) const
{
if (Index == 1) return myisvertex1;
else if (Index == 2) return myisvertex2;
else Standard_Failure::Raise("TopOpeBRep_Point2d::IsVertex");
return myisvertex1;
}
//=======================================================================
//function : SetVertex
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetVertex(const Standard_Integer Index,const TopoDS_Vertex& V)
{
if (Index == 1) {myvertex1 = V; myisvertex1 = Standard_True;}
else if (Index == 2) {myvertex2 = V; myisvertex2 = Standard_True;}
else Standard_Failure::Raise("TopOpeBRep_Point2d::SetVertex");
}
//=======================================================================
//function : SetTransition
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetTransition(const Standard_Integer Index,const TopOpeBRepDS_Transition& T)
{
if (Index == 1) mytransition1 = T;
else if (Index == 2) mytransition2 = T;
else Standard_Failure::Raise("TopOpeBRep_Point2d::SetTransition");
}
//=======================================================================
//function : SetParameter
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetParameter(const Standard_Integer Index,const Standard_Real P)
{
if (Index == 1) myparameter1 = P;
else if (Index == 2) myparameter2 = P;
else Standard_Failure::Raise("TopOpeBRep_Point2d::SetParameter");
}
//=======================================================================
//function : Parameter
//purpose :
//=======================================================================
inline Standard_Real TopOpeBRep_Point2d::Parameter(const Standard_Integer Index) const
{
if (Index == 1) return myparameter1;
else if (Index == 2) return myparameter2;
else Standard_Failure::Raise("TopOpeBRep_Point2d::Parameter");
return myparameter1;
}
//=======================================================================
//function : SetIsPointOfSegment
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetIsPointOfSegment(const Standard_Boolean B)
{
myispointofsegment = B;
}
//=======================================================================
//function : IsPointOfSegment
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_Point2d::IsPointOfSegment() const
{
return myispointofsegment;
}
//=======================================================================
//function : SetSegmentAncestors
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetSegmentAncestors(const Standard_Integer IP1,const Standard_Integer IP2)
{
myips1 = IP1;
myips2 = IP2;
myhasancestors = (myips1 != 0 && myips2 != 0);
if (myhasancestors) mystatus = TopOpeBRep_P2DNEW;
}
//=======================================================================
//function : SegmentAncestors
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_Point2d::SegmentAncestors(Standard_Integer& IP1,Standard_Integer& IP2) const
{
IP1 = myips1;
IP2 = myips2;
return myhasancestors;
}
//=======================================================================
//function : SetStatus
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetStatus(const TopOpeBRep_P2Dstatus I)
{
mystatus = I;
}
//=======================================================================
//function : Status
//purpose :
//=======================================================================
inline TopOpeBRep_P2Dstatus TopOpeBRep_Point2d::Status() const
{
return mystatus;
}
//=======================================================================
//function : SetIndex
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetIndex(const Standard_Integer I)
{
myindex = I;
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
inline Standard_Integer TopOpeBRep_Point2d::Index() const
{
return myindex;
}
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetValue(const gp_Pnt& P)
{
mypnt = P;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline const gp_Pnt& TopOpeBRep_Point2d::Value() const
{
return mypnt;
}
//=======================================================================
//function : SetValue2d
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetValue2d(const gp_Pnt2d& P)
{
mypnt2d = P;
}
//=======================================================================
//function : Value2d
//purpose :
//=======================================================================
inline const gp_Pnt2d& TopOpeBRep_Point2d::Value2d() const
{
return mypnt2d;
}
//=======================================================================
//function : SetKeep
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetKeep(const Standard_Boolean B)
{
mykeep = B;
}
//=======================================================================
//function : Keep
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_Point2d::Keep() const
{
return mykeep;
}
//=======================================================================
//function : SetEdgesConfig
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetEdgesConfig(const TopOpeBRepDS_Config B)
{
myedgesconfig = B;
}
//=======================================================================
//function : EdgesConfig
//purpose :
//=======================================================================
inline TopOpeBRepDS_Config TopOpeBRep_Point2d::EdgesConfig() const
{
return myedgesconfig;
}
//=======================================================================
//function : SetTolerance
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetTolerance(const Standard_Real t)
{
mytolerance = t;
}
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_Real TopOpeBRep_Point2d::Tolerance() const
{
return mytolerance;
}
//=======================================================================
//function : SetHctxff2d
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetHctxff2d(const Handle(TopOpeBRep_Hctxff2d)& h)
{
myctxff2d = h;
}
//=======================================================================
//function : Hctxff2d
//purpose :
//=======================================================================
inline Handle(TopOpeBRep_Hctxff2d) TopOpeBRep_Point2d::Hctxff2d() const
{
return myctxff2d;
}
//=======================================================================
//function : SetHctxee2d
//purpose :
//=======================================================================
inline void TopOpeBRep_Point2d::SetHctxee2d(const Handle(TopOpeBRep_Hctxee2d)& h)
{
myctxee2d = h;
}
//=======================================================================
//function : Hctxee2d
//purpose :
//=======================================================================
inline Handle(TopOpeBRep_Hctxee2d) TopOpeBRep_Point2d::Hctxee2d() const
{
return myctxee2d;
}

View File

@@ -0,0 +1,39 @@
-- File: TopOpeBRep_PointClassifier.cdl
-- Created: Thu Dec 7 14:19:13 1995
-- Author: Jean Yves LEBEY
-- <jyl@meteox>
---Copyright: Matra Datavision 1995
class PointClassifier from TopOpeBRep
uses
State from TopAbs,
Face from TopoDS,
Pnt2d from gp,
TopolTool from BRepTopAdaptor,
HSurface from BRepAdaptor,
DataMapOfTopolTool from TopOpeBRep
is
Create returns PointClassifier from TopOpeBRep;
Init(me:in out) is static;
Load(me:in out;F:Face from TopoDS) is static;
Classify(me:in out;F:Face from TopoDS;P:Pnt2d from gp;Tol:Real)
---Purpose: compute position of point <P> regarding with the face <F>.
returns State from TopAbs is static;
State(me) returns State from TopAbs is static;
fields
myTopolTool : TopolTool from BRepTopAdaptor;
myHSurface : HSurface from BRepAdaptor;
myTopolToolMap : DataMapOfTopolTool from TopOpeBRep;
myState : State from TopAbs;
end PointClassifier from TopOpeBRep;

View File

@@ -0,0 +1,76 @@
// File: TopOpeBRep_PointClassifier.cxx
// Created: Thu Nov 18 10:35:11 1993
// Author: Jean Yves LEBEY
// <jyl@phobox>
#include <TopOpeBRep_PointClassifier.ixx>
#include <BRepAdaptor_Surface.hxx>
//=======================================================================
//function : TopOpeBRep_PointClassifier
//purpose :
//=======================================================================
TopOpeBRep_PointClassifier::TopOpeBRep_PointClassifier()
{
myHSurface = new BRepAdaptor_HSurface();
Init();
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_PointClassifier::Init()
{
myTopolToolMap.Clear();
myState = TopAbs_UNKNOWN;
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
void TopOpeBRep_PointClassifier::Load(const TopoDS_Face& F)
{
Standard_Boolean found = myTopolToolMap.IsBound(F);
if ( ! found ) {
myHSurface->ChangeSurface().Initialize(F);
myTopolTool = new BRepTopAdaptor_TopolTool(myHSurface);
myTopolToolMap.Bind(F,myTopolTool);
}
else {
myTopolTool = myTopolToolMap.Find(F);
}
}
//=======================================================================
//function : Classify
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_PointClassifier::Classify
(const TopoDS_Face& F,
const gp_Pnt2d& P2d,
const Standard_Real Tol)
{
myState = TopAbs_UNKNOWN;
Load(F);
myState = myTopolTool->Classify(P2d,Tol);
return myState;
}
//=======================================================================
//function : State
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_PointClassifier::State() const
{
return myState;
}

View File

@@ -0,0 +1,39 @@
-- File: TopOpeBRep_PointGeomTool.cdl
-- Created: Tue Oct 25 18:20:07 1994
-- Author: Jean Yves LEBEY
-- <jyl@bravox>
---Copyright: Matra Datavision 1994
class PointGeomTool from TopOpeBRep
---Purpose: Provide services needed by the Fillers
uses
VPointInter from TopOpeBRep, -- Value(), Tolerance()
Point2d from TopOpeBRep, -- Value(), Tolerance()
FaceEdgeIntersector from TopOpeBRep, -- Value(), Tolerance()
Point from TopOpeBRepDS,
Point from TopOpeBRepDS,
Shape from TopoDS
is
Create returns PointGeomTool from TopOpeBRep;
MakePoint(myclass; IP : VPointInter from TopOpeBRep)
returns Point from TopOpeBRepDS;
MakePoint(myclass; P2D : Point2d from TopOpeBRep)
returns Point from TopOpeBRepDS;
MakePoint(myclass; FEI : FaceEdgeIntersector from TopOpeBRep)
returns Point from TopOpeBRepDS;
MakePoint(myclass; S : Shape from TopoDS)
returns Point from TopOpeBRepDS;
IsEqual(myclass; DSP1,DSP2 : Point from TopOpeBRepDS)
returns Boolean from Standard;
end PointGeomTool from TopOpeBRep;

View File

@@ -0,0 +1,94 @@
// File: TopOpeBRep_PointGeomTool.cxx
// Created: Tue Oct 25 18:27:21 1994
// Author: Jean Yves LEBEY
// <jyl@bravox>
#include <TopOpeBRep_PointGeomTool.ixx>
#include <TopOpeBRep_Point2d.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
//function : TopOpeBRep_PointGeomTool
//purpose :
//=======================================================================
TopOpeBRep_PointGeomTool::TopOpeBRep_PointGeomTool()
{
}
//=======================================================================
//function : MakePoint
//purpose :
//=======================================================================
TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
(const TopOpeBRep_VPointInter& IP)
{
Standard_Real tolip = IP.Tolerance();
Standard_Real tolout = tolip;
Standard_Integer si = IP.ShapeIndex();
if ( si == 0 ) {
tolout = tolip;
} else if ( si == 1 ) {
const TopoDS_Edge& E = TopoDS::Edge(IP.Edge(si));
tolout = BRep_Tool::Tolerance(E);
} else if ( si == 2 ) {
const TopoDS_Edge& E = TopoDS::Edge(IP.Edge(si));
tolout = BRep_Tool::Tolerance(E);
} else if ( si == 3 ) {
const TopoDS_Edge& E1 = TopoDS::Edge(IP.Edge(1));
const TopoDS_Edge& E2 = TopoDS::Edge(IP.Edge(2));
Standard_Real t1 = BRep_Tool::Tolerance(E1);
Standard_Real t2 = BRep_Tool::Tolerance(E2);
// tolout = Max(t1,t2);
if (t1 > 0.9) t1 = 0.9;
if (t1 > 0.9) t1 = 0.9;
tolout = 2.5*(t1+t2);
}
tolout = Max(tolout,tolip);
return TopOpeBRepDS_Point(IP.Value(),tolout);
}
//=======================================================================
//function : MakePoint
//purpose :
//=======================================================================
TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
(const TopOpeBRep_Point2d& P2D)
{
Standard_Real tol = P2D.Tolerance();
return TopOpeBRepDS_Point(P2D.Value(),tol);
}
//=======================================================================
//function : MakePoint
//purpose :
//=======================================================================
TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
(const TopOpeBRep_FaceEdgeIntersector& FEI)
{
Standard_Real tol = FEI.Tolerance();
return TopOpeBRepDS_Point(FEI.Value(),tol);
}
//=======================================================================
//function : MakePoint
//purpose :
//=======================================================================
TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
(const TopoDS_Shape& S)
{
return TopOpeBRepDS_Point(S);
}
//=======================================================================
//function : IsEqual
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_PointGeomTool::IsEqual
(const TopOpeBRepDS_Point& DSP1,
const TopOpeBRepDS_Point& DSP2)
{
Standard_Boolean b = DSP1.IsEqual(DSP2);
return b;
}

View File

@@ -0,0 +1,381 @@
// File: TopOpeBRep_ProcessGR.cxx
// Created: Mon Feb 24 13:18:58 1997
// Author: Prestataire Xuan PHAM PHU
// <xpu@salgox.paris1.matra-dtv.fr>
#include <TopOpeBRep_FacesFiller.ixx>
#ifdef DRAW
#include <TopOpeBRep_DRAW.hxx>
#endif
#include <gp_Vec.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Surface.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
//#include <BRepAdaptor_Curve2d.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopOpeBRepDS_InterferenceTool.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
#include <TopOpeBRep_FacesIntersector.hxx>
#include <TopOpeBRep_LineInter.hxx>
#include <TopOpeBRep_VPointInter.hxx>
#include <TopOpeBRep_Bipoint.hxx>
#include <TopOpeBRep_ListOfBipoint.hxx>
#include <TopOpeBRep_ListIteratorOfListOfBipoint.hxx>
#include <TopOpeBRep_VPointInterIterator.hxx>
#include <TopOpeBRep_GeomTool.hxx>
#include <Precision.hxx>
#include <Standard_CString.hxx>
#include <Standard_ProgramError.hxx>
#include <TopOpeBRepDS_define.hxx>
#include <TopOpeBRep.hxx>
#include <TopOpeBRepTool_EXPORT.hxx>
#include <TopOpeBRepTool_SC.hxx>
#ifdef DEB
#include <TopOpeBRep_FFDumper.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Line.hxx>
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDSNC();
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDEGEN();
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceBIPS();
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceDEGEN();
Standard_EXPORT Standard_Boolean FUN_debnull(const TopoDS_Shape& s){Standard_Boolean isnull = s.IsNull(); if (isnull) cout <<"***"; return isnull;}
#endif
//Standard_EXPORT extern Standard_Real GLOBAL_tolFF;
Standard_EXPORTEXTERN Standard_Real GLOBAL_tolFF;
//=======================================================================
//function : StBipVPonF
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_FacesFiller::StBipVPonF
(const TopOpeBRep_VPointInter& vpf,const TopOpeBRep_VPointInter& vpl,
const TopOpeBRep_LineInter& Lrest,const Standard_Boolean isonedge1) const
{
#define M_OUT(st) (st == TopAbs_OUT);
#define M_IN(st) (st == TopAbs_IN);
Standard_Integer sind = isonedge1 ? 2 : 1;
TopAbs_State stf = vpf.State(sind);
TopAbs_State stl = vpl.State(sind);
Standard_Boolean isout = M_OUT(stf); isout = isout || M_OUT(stl);
Standard_Boolean isin = M_IN(stf); isin = isin || M_IN(stl);
if (isout) return TopAbs_OUT;
if (isin) return TopAbs_IN;
Standard_Boolean isperiodic;
const TopoDS_Edge& EArc = TopoDS::Edge(Lrest.Arc());
BRepAdaptor_Curve BAC(EArc);
GeomAbs_CurveType CT = BAC.GetType();
isperiodic = (CT == GeomAbs_Circle);
isperiodic = isperiodic || (CT == GeomAbs_Ellipse);
TopOpeBRep_VPointInter vpff = vpf;
TopOpeBRep_VPointInter vpll = vpl;
// xpu200798 : CTS21216, restriction edge 7, f8
// purpose : periodic restriction; vpf, vpl describing restriction bounds
// if the Rline is describing the portion on curve (vpl,vpf),
// we have to commutate these bounds.
if (isperiodic) {
#ifdef DEB
// TopOpeBRep_FFDumper FFD(*this);
// cout <<"vpf :"; FFD.DumpVP(vpf,cout);
// cout <<"vpl :"; FFD.DumpVP(vpl,cout);
#endif
Standard_Integer IArc = 0;
if (Lrest.ArcIsEdge(1)) IArc = 1;
if (Lrest.ArcIsEdge(2)) IArc = 2;
if (IArc == 0) {
#ifdef DEB
Standard_Failure::Raise("StBipVPonF");
#endif
return TopAbs_UNKNOWN;
}
Standard_Integer ISI = (IArc == 1) ? 2 : 1;
Standard_Integer sif = vpf.ShapeIndex();
Standard_Integer sil = vpl.ShapeIndex();
Standard_Boolean act = ((sif == 3)||(sif == ISI)) && ((sil == 3)||(sil == ISI));
if (act) {
TopOpeBRepDS_Transition Tf = TopOpeBRep_FFTransitionTool::ProcessLineTransition(vpf,ISI,vpf.Edge(ISI).Orientation());
TopOpeBRepDS_Transition Tl = TopOpeBRep_FFTransitionTool::ProcessLineTransition(vpl,ISI,vpl.Edge(ISI).Orientation());
Standard_Boolean toreverse = (Tf.Orientation(TopAbs_IN) == TopAbs_REVERSED);
toreverse = toreverse && (Tl.Orientation(TopAbs_IN) == TopAbs_FORWARD);
if (toreverse) {
vpff = vpl;
vpll = vpf;
}
} // act
} // isperiodic
TopoDS_Shape F;
if (isonedge1) F = myF2;
else F = myF1;
Standard_Real uf = TopOpeBRep_FacesFiller::VPParamOnER (vpff,Lrest);
Standard_Real ul = TopOpeBRep_FacesFiller::VPParamOnER (vpll,Lrest);
// NYI XPU: 16-05-97: INTPATCH -> the parametrization of a point on a
// periodized curve is INSUFFICIENT : parVP on line can be either 0.
// or period.
Standard_Boolean badparametrized = (uf > ul);
Standard_Real f,l; f = BAC.FirstParameter(); l = BAC.LastParameter();
if (badparametrized) {
if (isperiodic) {
if (uf == l) uf = f;
if (ul == f) ul = l;
}
}
const TopoDS_Edge& arc = TopoDS::Edge(Lrest.Arc());
BRepAdaptor_Curve BC( arc );
Standard_Real x = 0.789; Standard_Real parmil = (1-x)*uf + x*ul; //xpu170898
gp_Pnt pmil = BC.Value(parmil);
#ifdef DEB
Standard_Boolean trc = TopOpeBRep_GettraceBIPS();
#ifdef DRAW
if (trc) {TCollection_AsciiString aa("pmil"); FUN_brep_draw(aa,pmil);}
#endif
#endif
TopAbs_State st = FSC_StatePonFace (pmil,F,*myPShapeClassifier);
return st;
}
//=======================================================================
//function : StateVPonFace
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_FacesFiller::StateVPonFace(const TopOpeBRep_VPointInter& VP) const
{
Standard_Integer iVP = VP.ShapeIndex();
if (iVP == 3) return TopAbs_ON;
Standard_Integer iother = (iVP == 1) ? 2 : 1;
TopoDS_Shape F;
if (iother == 1) F = myF1;
else F = myF2;
Standard_Real u,v;
if (iother == 1) VP.ParametersOnS1(u,v);
else VP.ParametersOnS2(u,v);
myPShapeClassifier->SetReference(TopoDS::Face(F));
myPShapeClassifier->StateP2DReference(gp_Pnt2d(u,v));
TopAbs_State state = myPShapeClassifier->State();
return state;
}
// ----------------------------------------------------------------------
// Class methods
// ----------------------------------------------------------------------
//=======================================================================
//function : Lminmax
//purpose : Computes <pmin> and <pmax> the upper and lower bounds of <L>
// enclosing all vpoints.
//=======================================================================
void TopOpeBRep_FacesFiller::Lminmax(const TopOpeBRep_LineInter& L,
Standard_Real& pmin,Standard_Real& pmax)
{
pmin = RealLast();
pmax = RealFirst();
TopOpeBRep_VPointInterIterator VPI;
VPI.Init(L,Standard_False);
for (; VPI.More(); VPI.Next()) {
const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
#ifdef DEB
Standard_Integer iVP =
#endif
VPI.CurrentVPIndex();
Standard_Real p = VP.ParameterOnLine();
pmin = Min(pmin,p);
pmax = Max(pmax,p);
}
Standard_Real d = Abs(pmin-pmax);
Standard_Boolean id = (d <= Precision::PConfusion());
Standard_Boolean isper = L.IsPeriodic();
Standard_Integer n = L.NbVPoint();
if (id && isper && n >= 2) {
Standard_Real per = L.Period();
pmax = pmin + per;
}
}
//=======================================================================
//function : LSameDomainERL
//purpose : Returns <True> if GLine shares a same geometric domain with
// at least one of the restriction edges of <ERL>.
//=======================================================================
Standard_Boolean TopOpeBRep_FacesFiller::LSameDomainERL(const TopOpeBRep_LineInter& L,
const TopTools_ListOfShape& ERL)
{
Standard_Boolean isone = Standard_False;
if(L.TypeLineCurve() == TopOpeBRep_WALKING) return isone;
#ifdef DRAW
Standard_Boolean trc = Standard_False;
if (trc) {Handle(Geom_Curve) C = L.Curve(); TCollection_AsciiString aa("line"); FUN_brep_draw(aa,C);}
#endif
Standard_Real f,l; TopOpeBRep_FacesFiller::Lminmax(L,f,l);
Standard_Real d = Abs(f-l);
{
Standard_Boolean idINL = (L.INL() && (d == 0)); // null length line, made of VPoints only
if (idINL) return Standard_False;
} // INL
Standard_Boolean id = (d <= Precision::PConfusion());
if (id) return Standard_False;
Handle(Geom_Curve) CL; TopOpeBRep_GeomTool::MakeCurve(f,l,L,CL);
Standard_Real t = 0.417789; Standard_Real p = (1-t)*f + t*l;
gp_Pnt Pm = CL->Value(p);
TopTools_ListIteratorOfListOfShape it; it.Initialize(ERL);
for(; it.More(); it.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(it.Value());
Standard_Real tolE = BRep_Tool::Tolerance(E);
Standard_Real maxtol = Max(tolE,GLOBAL_tolFF);
BRepAdaptor_Curve BAC(E);
f = BAC.FirstParameter(); l = BAC.LastParameter();
Standard_Boolean pinc = FUN_tool_PinC(Pm,BAC,f,l,maxtol);
if (pinc) {isone = Standard_True; break;}
}
return isone;
}
//=======================================================================
//function : IsVPtransLok
//purpose : Computes the transition <T> of the VPoint <iVP> on the edge
// <SI12>. Returns <False> if the status is unknown.
//=======================================================================
Standard_Boolean TopOpeBRep_FacesFiller::IsVPtransLok(const TopOpeBRep_LineInter& L,
const Standard_Integer iVP,const Standard_Integer SI12,
TopOpeBRepDS_Transition& T)
{
const TopOpeBRep_VPointInter& VP = L.VPoint(iVP);
Standard_Boolean is1 = (SI12 == 1);
Standard_Boolean VPonEd = (is1 && VP.IsOnDomS1());
VPonEd = VPonEd || (!is1 && VP.IsOnDomS2());
if (!VPonEd) return Standard_False;
const TopoDS_Edge& E = TopoDS::Edge(VP.Edge(SI12));
TopAbs_Orientation O = E.Orientation();
T = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,SI12,O);
Standard_Boolean u = T.IsUnknown();
return (!u);
}
Standard_Boolean TopOpeBRep_FacesFiller::TransvpOK(const TopOpeBRep_LineInter& L,
const Standard_Integer ivp,
const Standard_Integer SI,
const Standard_Boolean isINOUT)
{
#define M_INOUT(stf,stl) ((stf == TopAbs_IN) && (stl == TopAbs_OUT))
#define M_OUTIN(stf,stl) ((stf == TopAbs_OUT) && (stl == TopAbs_IN))
TopOpeBRepDS_Transition T;
Standard_Boolean ok = TopOpeBRep_FacesFiller::IsVPtransLok(L,ivp,SI,T);
if (ok) {
TopAbs_State stb = T.Before();
TopAbs_State sta = T.After();
if (isINOUT) ok = M_INOUT(stb,sta);
else ok = M_OUTIN(stb,sta);
}
return ok;
}
//=======================================================================
//function : VPParamOnER
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_FacesFiller::VPParamOnER(const TopOpeBRep_VPointInter& vp,
const TopOpeBRep_LineInter& Lrest)
{
// If vp(index) is an edge boundary returns the point's parameter.
const TopoDS_Edge& E = TopoDS::Edge(Lrest.Arc());
#ifdef DEB
Standard_Boolean isdg =
#endif
BRep_Tool::Degenerated(E);
Standard_Boolean isedge1 = Lrest.ArcIsEdge(1);
Standard_Boolean isedge2 = Lrest.ArcIsEdge(2);
if (isedge1 && vp.IsVertexOnS1()) {
const TopoDS_Vertex& v1 = TopoDS::Vertex(vp.VertexOnS1());
Standard_Real rr = BRep_Tool::Parameter(v1,E);
return rr;
}
if (isedge2 && vp.IsVertexOnS2()) {
const TopoDS_Vertex& v2 = TopoDS::Vertex(vp.VertexOnS2());
Standard_Real rr = BRep_Tool::Parameter(v2,E);
return rr;
}
// vp is an intersection point,and we get it's parameter.
if (isedge1 && vp.IsOnDomS1()) return vp.ParameterOnArc1();
if (isedge2 && vp.IsOnDomS2()) return vp.ParameterOnArc2();
// Else,we have to project the point on the edge restriction
Standard_Real tolee = BRep_Tool::Tolerance(E);
tolee = tolee * 1.e2; //xpu290998 : PRO15369
Standard_Real param, dist; Standard_Boolean projok = FUN_tool_projPonE(vp.Value(),tolee,E,param,dist);
if (!projok) {
Standard_ProgramError::Raise("TopOpeBRep_FacesFiller::VPParamOnER");
}
return param;
}
//Standard_EXPORT Standard_Boolean FUN_EqualPonR(const TopOpeBRep_LineInter& Lrest,
Standard_EXPORT Standard_Boolean FUN_EqualPonR(const TopOpeBRep_LineInter& ,
const TopOpeBRep_VPointInter& VP1,
const TopOpeBRep_VPointInter& VP2)
{
gp_Pnt P1 = VP1.Value(); gp_Pnt P2 = VP2.Value();
Standard_Real Ptol1 = VP1.Tolerance(),Ptol2 = VP2.Tolerance();
Standard_Real Ptol = (Ptol1 > Ptol2) ? Ptol1 : Ptol2;
Standard_Boolean Pequal = P1.IsEqual(P2,Ptol);
return Pequal;
}
Standard_EXPORT Standard_Boolean FUN_EqualponR(const TopOpeBRep_LineInter& Lrest,
const TopOpeBRep_VPointInter& VP1,
const TopOpeBRep_VPointInter& VP2)
{
Standard_Real p1 = TopOpeBRep_FacesFiller::VPParamOnER(VP1,Lrest);
Standard_Real p2 = TopOpeBRep_FacesFiller::VPParamOnER(VP2,Lrest);
Standard_Boolean pequal = fabs(p1-p2) < Precision::PConfusion();
return pequal;
}
//=======================================================================
//function : EqualpPOnR
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FacesFiller::EqualpPonR(const TopOpeBRep_LineInter& Lrest,
const TopOpeBRep_VPointInter& VP1,
const TopOpeBRep_VPointInter& VP2)
{
Standard_Boolean Pequal = ::FUN_EqualPonR(Lrest,VP1,VP2);
Standard_Boolean pequal = ::FUN_EqualponR(Lrest,VP1,VP2);
Standard_Boolean pPequal = Pequal && pequal;
return pPequal;
}

View File

@@ -0,0 +1,414 @@
// File: TopOpeBRep_ProcessSectionEdges.cxx
// Created: Thu Jun 12 10:13:09 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#include <TopOpeBRep_FacesFiller.ixx>
#include <TopOpeBRepTool_TOOL.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <TopOpeBRep_define.hxx>
#include <TopOpeBRepTool_EXPORT.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <TopOpeBRep_define.hxx>
#include <TopTools_MapOfShape.hxx>
#ifdef DEB
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDSFK();
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDSNC();
#endif
Standard_EXPORT Standard_Boolean FUN_EqualponR(const TopOpeBRep_LineInter& Lrest,
const TopOpeBRep_VPointInter& VP1,
const TopOpeBRep_VPointInter& VP2);
Standard_EXPORT Standard_Boolean FUN_EqualPonR(const TopOpeBRep_LineInter& Lrest,
const TopOpeBRep_VPointInter& VP1,
const TopOpeBRep_VPointInter& VP2);
//=======================================================================
//function : GetESL
//purpose : Get list <LES> of restriction edges from the current faces
// intersector having part IN one of the 2 faces.
//=======================================================================
void TopOpeBRep_FacesFiller::GetESL(TopTools_ListOfShape& LES)
{
#ifdef DEB
Standard_Boolean b22 = TopOpeBRepDS_GettraceDSNC();
Standard_Boolean trRL=Standard_False;
#endif
TopTools_MapOfShape mapES;
// !! : do NOT use myFacesIntersector->Restrictions()
// the same map is filled for all couple of faces.
myFacesIntersector->InitLine();
for (; myFacesIntersector->MoreLine(); myFacesIntersector->NextLine()) {
const TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
TopOpeBRep_TypeLineCurve t = L.TypeLineCurve();
Standard_Boolean isrest = (t == TopOpeBRep_RESTRICTION);
if (isrest) {
const TopoDS_Edge& E = TopoDS::Edge(L.Arc());
#ifdef DEB
Standard_Boolean FIisrest =
#endif
myFacesIntersector->IsRestriction(E);
#ifdef DEB
if (trRL) {
TopOpeBRep_VPointInterIterator VPI;VPI.Init(L);
cout<<endl<<"------------ Dump Rline --------------------"<<endl;
for (; VPI.More(); VPI.Next()) myHFFD->DumpVP(VPI.CurrentVP());
}
#endif
Standard_Boolean add = !mapES.Contains(E);
if (add) {
Standard_Boolean checkkeep = Standard_False;
add = KeepRLine(L,checkkeep);
}
if (add) {
mapES.Add(E);
LES.Append(E);
}
#ifdef DEB
if (b22) {
if (add) cout<<" : add restriction edge of line ";
else cout<<" rejection of restriction edge of line ";
cout<<L.Index()<<endl;
}
#endif
}
} // loop on lines
}
//=======================================================================
//function : KeepRLine
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_FacesFiller::KeepRLine
(const TopOpeBRep_LineInter& L,const Standard_Boolean checkkeep) const
{
#ifdef DEB
Standard_Boolean trc = (TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSNC());
#endif
TopOpeBRep_TypeLineCurve t = L.TypeLineCurve();
Standard_Boolean isrest = (t == TopOpeBRep_RESTRICTION);
if (!isrest) return Standard_False;
const TopoDS_Edge& EL = TopoDS::Edge(L.Arc());
Standard_Boolean isdg = BRep_Tool::Degenerated(EL);
if (isdg) return Standard_False;
// look for a vpoint with transition IN/OUT or OUT/IN
TopOpeBRep_VPointInterIterator VPI; VPI.Init(L,checkkeep);
// With LineContructor, each RLine restricted by its vpbounds
// has its restrictions IN or ON the two faces
Standard_Boolean keeprline;
Standard_Boolean isedge1 = L.ArcIsEdge(1);
if (!VPI.More()) return Standard_False;
Standard_Boolean samevp = Standard_True;
const TopOpeBRep_VPointInter& vpf = VPI.CurrentVP();
TopOpeBRep_VPointInter vpl;
VPI.Init(L,checkkeep);
if (VPI.More()) VPI.Next();
Standard_Boolean middle = Standard_False; // xpu011098 : cto012U1
TopoDS_Vertex vv; Standard_Boolean closedE = TopOpeBRepTool_TOOL::ClosedE(EL,vv);
if (closedE) {
Standard_Real parf,parl; FUN_tool_bounds(EL,parf,parl);
for (; VPI.More(); VPI.Next()) {
vpl = VPI.CurrentVP();
Standard_Real pf = VPParamOnER(vpl,L);
Standard_Boolean middlept = (parf<pf) && (pf<parl);
if (middlept) {middle = Standard_True; samevp=Standard_False; break;}
}
if (middle) {
VPI.Init(L,checkkeep);
for (; VPI.More(); VPI.Next()) {
vpl = VPI.CurrentVP();
Standard_Boolean samept = FUN_EqualPonR(L,vpf,vpl);
if (samept) continue;
else break;
}
}
}
if (!middle) {
VPI.Init(L,checkkeep);
if (VPI.More()) VPI.Next();
for (; VPI.More(); VPI.Next()) {
vpl = VPI.CurrentVP();
samevp = FUN_EqualponR(L,vpf,vpl);
if (!samevp) break;
}
}
if (!samevp) {
// xpu151098 : cto 904 C8 : modif done tol2d > 0 => found restriction shared
// by circle/line
Standard_Boolean samept = FUN_EqualPonR(L,vpf,vpl);
if (samept) {
TopoDS_Vertex vclo; Standard_Boolean closedEL = TopOpeBRepTool_TOOL::ClosedE(EL,vclo);
if (closedEL) {
Standard_Real tolvclo = BRep_Tool::Tolerance(vclo);
// Standard_Real tolvclo = BRep_Tool::Tolerance(TopoDS::Vertex(vclo));
gp_Pnt ptclo = BRep_Tool::Pnt(vclo);
// gp_Pnt ptclo = BRep_Tool::Pnt(TopoDS::Vertex(vclo));
Standard_Real tolf = vpf.Tolerance(); gp_Pnt ptf = vpf.Value();
Standard_Real d = ptf.Distance(ptclo);
Standard_Boolean sameclo = (d < Max(tolvclo,tolf));
if (!sameclo) return Standard_False;
}
else return Standard_False;
}
}
Standard_Boolean out = Standard_False;
if (samevp) {
Standard_Boolean isper = TopOpeBRepTool_ShapeTool::BASISCURVE(EL)->IsPeriodic();
Standard_Integer f,l,n; L.VPBounds(f,l,n);
if (isper && n == 2) {
const TopOpeBRep_VPointInter& vpf1 = L.VPoint(f);
const TopOpeBRep_VPointInter& vpl1 = L.VPoint(l);
Standard_Integer ioo = (isedge1) ? 2 : 1;
TopAbs_State sf = vpf1.State(ioo), sl = vpl1.State(ioo);
Standard_Boolean bfl = Standard_True;
// xpu120898 : when projection fails we get unknown status
// recall VP are same. (CTS21182,restriction edge 6)
Standard_Boolean bf = (sf == TopAbs_IN || sf == TopAbs_ON);
Standard_Boolean bl = (sl == TopAbs_IN || sl == TopAbs_ON);
// bfl = bf && bl;
if((sf == TopAbs_UNKNOWN)||(sl == TopAbs_UNKNOWN)) bfl = bf || bl;
else bfl = bf && bl;
if ( bfl ) {
out = Standard_False;
}
else {
out = Standard_True;
}
}
else {
out = Standard_True;
}
}
if (out) {
return Standard_False;
}
TopAbs_State stVPbip = StBipVPonF(vpf,vpl,L,isedge1);
keeprline = (stVPbip == TopAbs_IN);
keeprline = keeprline||(stVPbip==TopAbs_ON); // REST1
#ifdef DEB
// if (trc) {
// cout<<" bip("<<vpf.Index()<<","<<vpl.Index()<<") of line restriction ";
// cout<<L.Index()<<" is ";TopAbs::Print(stVPbip,cout);
// if (keeprline) cout<<" : edge restriction kept"<<endl;
// else cout<<" : edge restriction kept not kept"<<endl;
// }
#endif
return keeprline;
}
Standard_EXPORT Standard_Boolean FUN_brep_sdmRE(const TopoDS_Edge& E1, const TopoDS_Edge& E2)
{ // prequesitory : E1, E2 are restriction edges of opposite rank
// found in the same FacesFiller
Standard_Boolean ok = Standard_False;
BRepAdaptor_Curve BAC;
TopoDS_Vertex v1,v2;TopExp::Vertices(E1,v1,v2);
TopoDS_Vertex v3,v4;TopExp::Vertices(E2,v3,v4);
if (!ok) {
BAC.Initialize(E1);
Standard_Real tol1 = BRep_Tool::Tolerance(E1);
Standard_Real tol2 = BRep_Tool::Tolerance(v3);
Standard_Real tol3 = BRep_Tool::Tolerance(v4);
Standard_Real tol4 = Max(tol1,Max(tol2,tol3));
if (!ok) {
const gp_Pnt& P3 = BRep_Tool::Pnt(v3);
ok = FUN_tool_PinC(P3,BAC,tol4);
}
if (!ok) {
const gp_Pnt& P4 = BRep_Tool::Pnt(v4);
ok = FUN_tool_PinC(P4,BAC,tol4);
}
}
if (!ok) {
BAC.Initialize(E2);
Standard_Real tol1 = BRep_Tool::Tolerance(E2);
Standard_Real tol2 = BRep_Tool::Tolerance(v1);
Standard_Real tol3 = BRep_Tool::Tolerance(v2);
Standard_Real tol4 = Max(tol1,Max(tol2,tol3));
if (!ok) {
const gp_Pnt& P1 = BRep_Tool::Pnt(v1);
ok = FUN_tool_PinC(P1,BAC,tol4);
}
if (!ok) {
const gp_Pnt& P2 = BRep_Tool::Pnt(v2);
ok = FUN_tool_PinC(P2,BAC,tol4);
}
}
return ok;
}
//=======================================================================
//function : ProcessSectionEdges
//purpose :
//=======================================================================
void TopOpeBRep_FacesFiller::ProcessSectionEdges()
{
#ifdef DEB
Standard_Boolean DSNC = TopOpeBRepDS_GettraceDSNC();
if (DSNC) cout<<endl<<"--- Section Edges Processing : ---"<<endl;
#endif
// recuperation des aretes d'intersection mapES
// MSV: replace map with list to achieve predictable order of edges
TopTools_ListOfShape LES;
GetESL(LES);
// add LES edges as section edges in the DS.
TopTools_ListIteratorOfListOfShape itLES;
for (itLES.Initialize(LES); itLES.More(); itLES.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(itLES.Value());
Standard_Boolean isdg = BRep_Tool::Degenerated(E); //xpu290698
if (isdg) continue; //xpu290698
#ifdef DEB
Standard_Integer iSE =
#endif
myDS->AddSectionEdge(E);
#ifdef DEB
Standard_Integer iE =
#endif
myDS->Shape(E);
#ifdef DEB
Standard_Integer rE =
#endif
myDS->AncestorRank(E);
#ifdef DEB
if (DSNC) cout<<"add section edge "<<iSE<<" : "<<iE<<"("<<rE<<")"<<endl;
#endif
}
TColStd_ListOfInteger LOI; TColStd_ListIteratorOfListOfInteger itLOI;
// LOI = liste des rank (1 ou 2 ) des aretes de section (liste LES)
for( itLES.Initialize(LES); itLES.More(); itLES.Next()) {
const TopoDS_Edge& ELES = TopoDS::Edge(itLES.Value());
Standard_Boolean is1 = Standard_False;
Standard_Boolean is2 = Standard_False;
myFacesIntersector->InitLine();
TopoDS_Edge ELI;
for(;myFacesIntersector->MoreLine();myFacesIntersector->NextLine()){
TopOpeBRep_LineInter& L = myFacesIntersector->CurrentLine();
if (L.TypeLineCurve() != TopOpeBRep_RESTRICTION) continue;
ELI = TopoDS::Edge(L.Arc());
if ( ELI.IsEqual(ELES) ) {
is1 = L.ArcIsEdge(1);
is2 = L.ArcIsEdge(2);
break;
}
}
Standard_Real toappend = Standard_True;
if (toappend) {
if (is1) LOI.Append(1);
else if (is2) LOI.Append(2);
}
}
// ajout des aretes de section dans la DS de shape,connaissant leur rank
for (itLES.Initialize(LES),itLOI.Initialize(LOI);
itLES.More(),itLOI.More();
itLES.Next(),itLOI.Next()) {
const TopoDS_Shape& E1 = itLES.Value();
Standard_Integer rE1 = itLOI.Value();
#ifdef DEB
Standard_Integer iE1 =
#endif
myDS->AddShape(E1,rE1);
}
// determination des aretes SameDomain en 3d pur
// mapELE(arete(1)) -> {arete(2)}
// mapELE(arete(2)) -> {arete(1)}
TopTools_DataMapOfShapeListOfShape mapELE;
for( itLES.Initialize(LES); itLES.More(); itLES.Next()) {
const TopoDS_Edge& E1 = TopoDS::Edge(itLES.Value());
Standard_Integer iE1 = myDS->Shape(E1);
Standard_Integer rE1 = myDS->AncestorRank(iE1);
if (rE1 != 1) continue;
TopTools_ListOfShape thelist;
mapELE.Bind(E1, thelist);
TopTools_ListIteratorOfListOfShape itLES2;
for (itLES2.Initialize(LES); itLES2.More(); itLES2.Next()) {
const TopoDS_Edge& E2 = TopoDS::Edge(itLES2.Value());
Standard_Integer iE2 = myDS->Shape(E2);
Standard_Integer rE2 = myDS->AncestorRank(iE2);
if ( rE2 == 0 || iE1 == iE2 || rE2 == rE1 ) continue;
Standard_Boolean toappend = FUN_brep_sdmRE(E1,E2);
if (toappend) {
mapELE.ChangeFind(E1).Append(E2);
}
}
}
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itmapELE;
#ifdef DEB
if (DSNC) {
for (itmapELE.Initialize(mapELE); itmapELE.More(); itmapELE.Next()) {
const TopoDS_Edge& E1 = TopoDS::Edge(itmapELE.Key());
Standard_Integer iE1 = myDS->Shape(E1);
Standard_Integer rE1 = myDS->AncestorRank(iE1);
cout<<"sd3d edge "<<iE1<<"("<<rE1<<") : ";
TopTools_ListIteratorOfListOfShape itL(itmapELE.Value());
for (; itL.More(); itL.Next()) {
const TopoDS_Edge& E2 = TopoDS::Edge(itL.Value());
Standard_Integer iE2 = myDS->Shape(E2);
Standard_Integer rE2 = myDS->AncestorRank(iE2);
cout<<iE2<<"("<<rE2<<") ";
}
cout<<endl;
}
}
#endif
for (itmapELE.Initialize(mapELE); itmapELE.More(); itmapELE.Next()) {
const TopoDS_Edge& E1 = TopoDS::Edge(itmapELE.Key());
Standard_Integer iE1 = myDS->Shape(E1);
Standard_Integer rE1 = myDS->AncestorRank(iE1);
const TopoDS_Face& aFace1 = TopoDS::Face(myFacesIntersector->Face(rE1));
Standard_Boolean isClosing1 = BRep_Tool::IsClosed(E1,aFace1);
TopTools_ListIteratorOfListOfShape itL(itmapELE.Value());
for (; itL.More(); itL.Next()) {
const TopoDS_Edge& E2 = TopoDS::Edge(itL.Value());
Standard_Integer iE2 = myDS->Shape(E2);
Standard_Integer rE2 = myDS->AncestorRank(iE2);
const TopoDS_Face& aFace2 = TopoDS::Face(myFacesIntersector->Face(rE2));
Standard_Boolean isClosing2 = BRep_Tool::IsClosed(E2,aFace2);
Standard_Boolean refFirst = isClosing1 || !isClosing2;
myDS->FillShapesSameDomain(E1,E2,TopOpeBRepDS_UNSHGEOMETRY,
TopOpeBRepDS_UNSHGEOMETRY, refFirst);
}
}
}

View File

@@ -0,0 +1,233 @@
-- File: TopOpeBRep_ShapeIntersector.cdl
-- Created: Fri May 7 17:03:26 1993
-- Author: Jean Yves LEBEY
-- <jyl@topsn3>
---Copyright: Matra Datavision 1993
class ShapeIntersector from TopOpeBRep
---Purpose: Intersect two shapes.
--
-- A GeomShape is a shape with a geometric domain, i.e.
-- a Face or an Edge.
--
-- The purpose of the ShapeIntersector is to find
-- couples of intersecting GeomShape in two Shapes
-- (which can be any kind of topologies : Compound,
-- Solid, Shell, etc... )
--
-- It is in charge of exploration of the shapes and
-- rejection. For this it is provided with two tools :
--
-- - ShapeExplorer from TopOpeBRepTool.
-- - ShapeScanner from TopOpeBRep which implements bounding boxes.
--
-- Let S1,S2 the shapes sent to InitIntersection(S1,S2) method :
-- - S1 is always SCANNED by a ShapeScanner from TopOpeBRep.
-- - S2 is always EXPLORED by a ShapeExplorer from TopOpeBRepTool.
uses
State from TopAbs,
Orientation from TopAbs,
Shape from TopoDS,
Face from TopoDS,
HBoxTool from TopOpeBRepTool,
ShapeTool from TopOpeBRepTool,
ShapeExplorer from TopOpeBRepTool,
ShapeScanner from TopOpeBRep,
FacesIntersector from TopOpeBRep,
EdgesIntersector from TopOpeBRep,
FaceEdgeIntersector from TopOpeBRep,
--modified by NIZNHY-PKV Fri Sep 24 11:02:16 1999 f
ListOfShape from TopTools
--modified by NIZNHY-PKV Fri Sep 24 11:02:19 1999 t
is
-- -------------------------------
-- intersection between two shapes
-- -------------------------------
Create returns ShapeIntersector from TopOpeBRep;
InitIntersection(me : in out; S1,S2 : Shape from TopoDS)
---Purpose: Initialize the intersection of shapes S1,S2.
is static;
InitIntersection(me : in out; S1,S2 : Shape from TopoDS;
F1,F2 : Face from TopoDS)
---Purpose: Initialize the intersection of shapes S1,S2.
is static;
Reset(me : in out) is static private;
Init(me : in out; S1,S2 : Shape from TopoDS) is static private;
Shape(me; Index : Integer from Standard) returns Shape from TopoDS
---Purpose: return the shape <Index> ( = 1 or 2) given to
-- InitIntersection().
-- Index = 1 will return S1, Index = 2 will return S2.
---C++: return const &
is static;
MoreIntersection(me) returns Boolean from Standard
---Purpose: returns True if there are more intersection
-- between two the shapes.
is static;
NextIntersection(me : in out)
---Purpose: search for the next intersection between the two shapes.
is static;
ChangeFacesIntersector(me : in out)
returns FacesIntersector from TopOpeBRep
---Purpose: return the current intersection of two Faces.
---C++: return &
is static;
ChangeEdgesIntersector(me : in out)
returns EdgesIntersector from TopOpeBRep
---Purpose: return the current intersection of two Edges.
---C++: return &
is static;
ChangeFaceEdgeIntersector(me : in out)
returns FaceEdgeIntersector from TopOpeBRep
---Purpose: return the current intersection of a Face and an Edge.
---C++: return &
is static;
-- -----------------------------------------
-- intersection between two geometric shapes
-- -----------------------------------------
CurrentGeomShape(me; Index : Integer from Standard)
returns Shape from TopoDS
---Purpose: return geometric shape <Index> ( = 1 or 2 ) of
-- current intersection.
---C++ : return const &
is static;
GetTolerances(me; tol1,tol2 : in out Real from Standard)
---Purpose: return MAX of intersection tolerances with
-- which FacesIntersector from TopOpeBRep was working.
is static;
SetIntersectionDone(me : in out) is static private;
-- ----------------------------
-- Faces intersection (private)
-- ----------------------------
InitFFIntersection(me : in out)
is static private;
FindFFIntersection(me : in out)
is static private;
MoreFFCouple(me) returns Boolean from Standard
is static private;
NextFFCouple(me : in out)
is static private;
-- ----------------------------
-- Edges intersection on SameDomain faces (private)
-- ----------------------------
InitEEFFIntersection(me : in out)
is static private;
FindEEFFIntersection(me : in out)
is static private;
MoreEEFFCouple(me) returns Boolean from Standard
is static private;
NextEEFFCouple(me : in out)
is static private;
-- ----------------------------
-- Face/Edge intersection (private)
-- ----------------------------
InitFEIntersection(me : in out)
is static private;
FindFEIntersection(me : in out)
is static private;
MoreFECouple(me) returns Boolean from Standard
is static private;
NextFECouple(me : in out)
is static private;
-- ----------------------------
-- Edge/Face intersection (private)
-- ----------------------------
InitEFIntersection(me : in out)
is static private;
FindEFIntersection(me : in out)
is static private;
MoreEFCouple(me) returns Boolean from Standard
is static private;
NextEFCouple(me : in out)
is static private;
-- ---------------------
-- Edge/Edge in 2d space (private)
-- ---------------------
InitEEIntersection(me : in out)
is static private;
FindEEIntersection(me : in out)
is static private;
MoreEECouple(me) returns Boolean from Standard
is static private;
NextEECouple(me : in out)
is static private;
-- debug
DumpCurrent(me; K : Integer from Standard) is static;
Index(me; K : Integer from Standard)
returns Integer from Standard
is static;
--modified by NIZNHY-PKV Fri Sep 24 10:59:59 1999 f
RejectedFaces (me:out;
anObj:Shape from TopoDS;
aReference:Shape from TopoDS;
aListOfShape:out ListOfShape from TopTools) ;
--modified by NIZNHY-PKV Fri Sep 24 11:00:03 1999 t
fields
myShape1 : Shape from TopoDS;
myShape2 : Shape from TopoDS;
myHBoxTool : HBoxTool from TopOpeBRepTool;
myFaceExplorer : ShapeExplorer from TopOpeBRepTool;
myFaceScanner : ShapeScanner from TopOpeBRep;
myFFIntersector : FacesIntersector from TopOpeBRep;
myFFSameDomain : Boolean from Standard;
myEdgeExplorer : ShapeExplorer from TopOpeBRepTool;
myEdgeScanner : ShapeScanner from TopOpeBRep;
myEEIntersector : EdgesIntersector from TopOpeBRep;
myFEIntersector : FaceEdgeIntersector from TopOpeBRep;
myEEFace1,myEEFace2 : Face from TopoDS;
myIntersectionDone : Boolean from Standard;
myTol1 : Real from Standard;
myTol2 : Real from Standard;
myFFDone : Boolean from Standard;
myEEFFDone : Boolean from Standard;
myEFDone : Boolean from Standard;
myFEDone : Boolean from Standard;
myEEDone : Boolean from Standard;
myFFInit : Boolean from Standard;
myEEFFInit : Boolean from Standard;
myEFInit : Boolean from Standard;
myFEInit : Boolean from Standard;
myEEInit : Boolean from Standard;
end ShapeIntersector from TopOpeBRep;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,148 @@
-- -- File: TopOpeBRep_ShapeIntersector2d.cdl
-- Created: Fri May 7 17:03:26 1993
-- Author: Jean Yves LEBEY
-- <jyl@topsn3>
---Copyright: Matra Datavision 1993
class ShapeIntersector2d from TopOpeBRep
---Purpose: Intersect two shapes.
--
-- A GeomShape is a shape with a geometric domain, i.e.
-- a Face or an Edge.
--
-- The purpose of the ShapeIntersector2d is to find
-- couples of intersecting GeomShape in two Shapes
-- (which can be any kind of topologies : Compound,
-- Solid, Shell, etc... )
--
-- It is in charge of exploration of the shapes and
-- rejection. For this it is provided with two tools :
--
-- - ShapeExplorer from TopOpeBRepTool.
-- - ShapeScanner from TopOpeBRep which implements bounding boxes.
--
-- Let S1,S2 the shapes sent to InitIntersection(S1,S2) method :
-- - S1 is always SCANNED by a ShapeScanner from TopOpeBRep.
-- - S2 is always EXPLORED by a ShapeExplorer from TopOpeBRepTool.
uses
State from TopAbs,
Orientation from TopAbs,
Shape from TopoDS,
Face from TopoDS,
HBoxTool from TopOpeBRepTool,
ShapeTool from TopOpeBRepTool,
ShapeExplorer from TopOpeBRepTool,
ShapeScanner from TopOpeBRep,
FacesIntersector from TopOpeBRep,
EdgesIntersector from TopOpeBRep,
FaceEdgeIntersector from TopOpeBRep
is
-- -------------------------------
-- intersection between two shapes
-- -------------------------------
Create returns ShapeIntersector2d from TopOpeBRep;
InitIntersection(me : in out; S1,S2 : Shape from TopoDS)
---Purpose: Initialize the intersection of shapes S1,S2.
is static;
Reset(me : in out) is static private;
Init(me : in out; S1,S2 : Shape from TopoDS) is static private;
Shape(me; Index : Integer from Standard) returns Shape from TopoDS
---Purpose: return the shape <Index> ( = 1 or 2) given to
-- InitIntersection().
-- Index = 1 will return S1, Index = 2 will return S2.
---C++: return const &
is static;
MoreIntersection(me) returns Boolean from Standard
---Purpose: returns True if there are more intersection
-- between two the shapes.
is static;
NextIntersection(me : in out)
---Purpose: search for the next intersection between the two shapes.
is static;
ChangeEdgesIntersector(me : in out)
returns EdgesIntersector from TopOpeBRep
---Purpose: return the current intersection of two Edges.
---C++: return &
is static;
-- -----------------------------------------
-- intersection between two geometric shapes
-- -----------------------------------------
CurrentGeomShape(me; Index : Integer from Standard)
returns Shape from TopoDS
---Purpose: return geometric shape <Index> ( = 1 or 2 ) of
-- current intersection.
---C++ : return const &
is static;
SetIntersectionDone(me : in out) is static private;
-- ----------------------------
-- Faces intersection (private)
-- ----------------------------
InitFFIntersection(me : in out)
is static private;
FindFFIntersection(me : in out)
is static private;
MoreFFCouple(me) returns Boolean from Standard
is static private;
NextFFCouple(me : in out)
is static private;
-- ----------------------------
-- Edges intersection on SameDomain faces (private)
-- ----------------------------
InitEEFFIntersection(me : in out)
is static private;
FindEEFFIntersection(me : in out)
is static private;
MoreEEFFCouple(me) returns Boolean from Standard
is static private;
NextEEFFCouple(me : in out)
is static private;
-- debug
DumpCurrent(me; K : Integer from Standard) is static;
Index(me; K : Integer from Standard)
returns Integer from Standard
is static;
fields
myShape1 : Shape from TopoDS;
myShape2 : Shape from TopoDS;
myHBoxTool : HBoxTool from TopOpeBRepTool;
myFaceExplorer : ShapeExplorer from TopOpeBRepTool;
myFaceScanner : ShapeScanner from TopOpeBRep;
myEdgeExplorer : ShapeExplorer from TopOpeBRepTool;
myEdgeScanner : ShapeScanner from TopOpeBRep;
myEEIntersector : EdgesIntersector from TopOpeBRep;
myIntersectionDone : Boolean from Standard;
myFFDone : Boolean from Standard;
myEEFFDone : Boolean from Standard;
myFFInit : Boolean from Standard;
myEEFFInit : Boolean from Standard;
end ShapeIntersector2d from TopOpeBRep;

View File

@@ -0,0 +1,440 @@
// File: TopOpeBRep_ShapeIntersector2d.cxx
// Created: Fri May 7 17:36:28 1993
// Author: Jean Yves LEBEY
// <jyl@topsn3>
#include <TopOpeBRep_ShapeIntersector2d.ixx>
#include <Standard_ProgramError.hxx>
#include <Standard_NotImplemented.hxx>
#include <TopAbs.hxx>
#include <Bnd_Box.hxx>
#include <TopOpeBRepTool_box.hxx>
#ifdef DEB
extern Standard_Boolean TopOpeBRep_GettraceSI();
extern Standard_Boolean TopOpeBRep_GetcontextFFOR();
#endif
//=======================================================================
//function : TopOpeBRep_ShapeIntersector2d
//purpose :
//=======================================================================
TopOpeBRep_ShapeIntersector2d::TopOpeBRep_ShapeIntersector2d()
{
Reset();
myHBoxTool = FBOX_GetHBoxTool();
myFaceScanner.ChangeBoxSort().SetHBoxTool(myHBoxTool);
myEdgeScanner.ChangeBoxSort().SetHBoxTool(myHBoxTool);
}
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::Reset()
{
myIntersectionDone = Standard_False;
myFFDone = Standard_False;
myEEFFDone = Standard_False;
myFFInit = Standard_False;
myEEFFInit = Standard_False;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::Init
(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
{
Reset();
myShape1 = S1;
myShape2 = S2;
myHBoxTool->Clear();
}
//=======================================================================
//function : SetIntersectionDone
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::SetIntersectionDone()
{
myIntersectionDone = (myFFDone ||
myEEFFDone);
}
//=======================================================================
//function : CurrentGeomShape
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_ShapeIntersector2d::CurrentGeomShape
(const Standard_Integer Index) const
{
if ( myIntersectionDone ) {
if (myFFDone) {
if ( Index == 1 ) return myFaceScanner.Current();
else if ( Index == 2 ) return myFaceExplorer.Current();
}
else if (myEEFFDone) {
if ( Index == 1 ) return myEdgeScanner.Current();
else if ( Index == 2 ) return myEdgeExplorer.Current();
}
}
Standard_ProgramError::Raise("CurrentGeomShape : no intersection 2d");
TopoDS_Shape* bid = new TopoDS_Shape();
return *bid;
}
//=======================================================================
//function : InitIntersection
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::InitIntersection
(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
{
Init(S1,S2);
InitFFIntersection();
}
//=======================================================================
//function : MoreIntersection
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_ShapeIntersector2d::MoreIntersection() const
{
Standard_Boolean res = myIntersectionDone;
#ifdef DEB
Standard_Integer i1 = Index(1);
Standard_Integer i2 = Index(2);
if (TopOpeBRep_GettraceSI() && res) {
if ( myFFDone ) cout<<"FF : ";
else if ( myEEFFDone ) cout<<" EE : ";
DumpCurrent(1);
DumpCurrent(2);
}
#endif
return res;
}
//=======================================================================
//function : DumpCurrent
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::DumpCurrent(const Standard_Integer K) const
{
#ifdef DEB
if ( myFFDone ) {
if ( K == 1 ) myFaceScanner.DumpCurrent(cout);
else if ( K == 2 ) myFaceExplorer.DumpCurrent(cout);
}
else if ( myEEFFDone ) {
if ( K == 1 ) myEdgeScanner.DumpCurrent(cout);
else if ( K == 2 ) myEdgeExplorer.DumpCurrent(cout);
}
#endif
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_ShapeIntersector2d::Index
(const Standard_Integer K)const
{
Standard_Integer i = 0;
#ifdef DEB
if ( myFFDone ) {
if ( K == 1 ) i = myFaceScanner.Index();
else if ( K == 2 ) i = myFaceExplorer.Index();
}
else if ( myEEFFDone ) {
if ( K == 1 ) i = myEdgeScanner.Index();
else if ( K == 2 ) i = myEdgeExplorer.Index();
}
#endif
return i;
}
//=======================================================================
//function : NextIntersection
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::NextIntersection()
{
myIntersectionDone = Standard_False;
if (myFFDone) {
// precedant etat du More() : 2 faces
myFFDone = Standard_False;
InitEEFFIntersection();
FindEEFFIntersection();
if ( !myIntersectionDone ) {
NextFFCouple();
FindFFIntersection();
}
}
else if ( myEEFFDone ) {
NextEEFFCouple();
FindEEFFIntersection();
if ( !myIntersectionDone ) {
NextFFCouple();
FindFFIntersection();
}
}
if ( !myIntersectionDone ) {
InitFFIntersection();
}
}
// ========
// FFFFFFFF
// ========
//=======================================================================
//function : InitFFIntersection
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::InitFFIntersection()
{
if ( !myFFInit) {
TopAbs_ShapeEnum tscann = TopAbs_FACE;
TopAbs_ShapeEnum texplo = TopAbs_FACE;
myFaceScanner.Clear();
myFaceScanner.AddBoxesMakeCOB(myShape1,tscann);
myFaceExplorer.Init(myShape2,texplo);
myFaceScanner.Init(myFaceExplorer);
FindFFIntersection();
}
myFFInit = Standard_True;
}
//=======================================================================
//function : FindFFIntersection
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::FindFFIntersection()
{
myFFDone = Standard_False;
// myFFSameDomain = Standard_False;
while ( MoreFFCouple() ) {
// The two candidate intersecting GeomShapes GS1,GS2 and their types t1,t2
const TopoDS_Shape& GS1 = myFaceScanner.Current();
const TopoDS_Shape& GS2 = myFaceExplorer.Current();
#ifdef DEB
if (TopOpeBRep_GettraceSI()) {
Standard_Integer i1 = myFaceScanner.Index();
Standard_Integer i2 = myFaceExplorer.Index();
cout<<"?? FF : ";
myFaceScanner.DumpCurrent(cout);
myFaceExplorer.DumpCurrent(cout);
cout<<endl;
}
#endif
const TopOpeBRepTool_BoxSort& BS = myFaceScanner.BoxSort();
#ifdef DEB
const Bnd_Box& B1 =
#endif
BS.Box(GS1);
#ifdef DEB
const Bnd_Box& B2 =
#endif
BS.Box(GS2);
myFFDone = Standard_True;
break;
NextFFCouple();
}
SetIntersectionDone();
}
//=======================================================================
//function : MoreFFCouple
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_ShapeIntersector2d::MoreFFCouple() const
{
Standard_Boolean more1 = myFaceScanner.More();
Standard_Boolean more2 = myFaceExplorer.More();
return (more1 && more2);
}
//=======================================================================
//function : NextFFCouple
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::NextFFCouple()
{
myFaceScanner.Next();
Standard_Boolean b1,b2;
b1 = (!myFaceScanner.More());
b2 = (myFaceExplorer.More());
while ( b1 && b2 ) {
myFaceExplorer.Next();
myFaceScanner.Init(myFaceExplorer);
b1 = (!myFaceScanner.More());
b2 = (myFaceExplorer.More());
}
}
// ========
// EEFFEEFF
// ========
//=======================================================================
//function : InitEEFFIntersection
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::InitEEFFIntersection()
{
// prepare exploration of the edges of the two current SameDomain faces
TopoDS_Shape face1 = myFaceScanner.Current(); // -26-08-96
TopoDS_Shape face2 = myFaceExplorer.Current(); // -26-08-96
#ifdef DEB
if (TopOpeBRep_GetcontextFFOR()) {
face1.Orientation(TopAbs_FORWARD); //-05/07
face2.Orientation(TopAbs_FORWARD); //-05/07
cout<<"ctx : InitEEFFIntersection : faces FORWARD"<<endl;
}
#endif
myEEIntersector.SetFaces(face1,face2);
TopAbs_ShapeEnum tscann = TopAbs_EDGE;
TopAbs_ShapeEnum texplo = TopAbs_EDGE;
myEdgeScanner.Clear();
myEdgeScanner.AddBoxesMakeCOB(face1,tscann);
myEdgeExplorer.Init(face2,texplo);
myEdgeScanner.Init(myEdgeExplorer);
myEEFFInit = Standard_True;
}
//=======================================================================
//function : FindEEFFIntersection
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::FindEEFFIntersection()
{
myEEFFDone = Standard_False;
while ( MoreEEFFCouple() ) {
const TopoDS_Shape& GS1 = myEdgeScanner.Current();
const TopoDS_Shape& GS2 = myEdgeExplorer.Current();
myEEIntersector.Perform(GS1,GS2);
#ifdef DEB
Standard_Integer i1 = Index(1);
Standard_Integer i2 = Index(2);
if (TopOpeBRep_GettraceSI() && myEEIntersector.IsEmpty()) {
cout<<" EE : ";
myEdgeScanner.DumpCurrent(cout);
myEdgeExplorer.DumpCurrent(cout);
cout<<"(EE of FF SameDomain)";
cout<<" : EMPTY INTERSECTION";
cout<<endl;
}
#endif
myEEFFDone = ! (myEEIntersector.IsEmpty());
if (myEEFFDone) break;
else NextEEFFCouple();
}
SetIntersectionDone();
}
//=======================================================================
//function : MoreEEFFCouple
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_ShapeIntersector2d::MoreEEFFCouple() const
{
Standard_Boolean more1 = myEdgeScanner.More();
Standard_Boolean more2 = myEdgeExplorer.More();
return (more1 && more2);
}
//=======================================================================
//function : NextEEFFCouple
//purpose :
//=======================================================================
void TopOpeBRep_ShapeIntersector2d::NextEEFFCouple()
{
myEdgeScanner.Next();
while ( ! myEdgeScanner.More() && myEdgeExplorer.More() ) {
myEdgeExplorer.Next();
myEdgeScanner.Init(myEdgeExplorer);
}
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_ShapeIntersector2d::Shape
( const Standard_Integer Index )const
{
if ( Index == 1 ) return myShape1;
else if ( Index == 2 ) return myShape2;
Standard_ProgramError::Raise("ShapeIntersector : no shape");
TopoDS_Shape* bid = new TopoDS_Shape();
return *bid;
}
//=======================================================================
//function : ChangeEdgesIntersector
//purpose :
//=======================================================================
TopOpeBRep_EdgesIntersector&
TopOpeBRep_ShapeIntersector2d::ChangeEdgesIntersector()
{ return myEEIntersector; }

View File

@@ -0,0 +1,42 @@
-- File: TopOpeBRep_ShapeScanner.cdl
-- Created: Wed Jul 7 19:56:26 1993
-- Author: Jean Yves LEBEY
-- <jyl@zerox>
---Copyright: Matra Datavision 1993
class ShapeScanner from TopOpeBRep
---Purpose: Find, among the subshapes SS of a reference shape
-- RS, the ones which 3D box interfers with the box of
-- a shape S (SS and S are of the same type).
uses
ShapeEnum from TopAbs,
Shape from TopoDS,
ListIteratorOfListOfInteger from TColStd,
ShapeExplorer from TopOpeBRepTool,
BoxSort from TopOpeBRepTool
is
Create returns ShapeScanner from TopOpeBRep;
Clear(me:in out);
AddBoxesMakeCOB(me:in out;S:Shape;TS:ShapeEnum;TA:ShapeEnum=TopAbs_SHAPE);
Init(me:in out;E:Shape);
Init(me:in out;X:in out ShapeExplorer from TopOpeBRepTool);
More(me) returns Boolean;
Next(me:in out);
Current(me) returns Shape;---C++: return const &
BoxSort(me) returns BoxSort from TopOpeBRepTool;---C++:return const &
ChangeBoxSort(me:in out) returns BoxSort from TopOpeBRepTool;---C++:return &
Index(me) returns Integer;
DumpCurrent(me; OS:in out OStream) returns OStream;---C++: return &
fields
myBoxSort:BoxSort from TopOpeBRepTool;
myListIterator:ListIteratorOfListOfInteger from TColStd;
end ShapeScanner from TopOpeBRep;

View File

@@ -0,0 +1,139 @@
// File: TopOpeBRep_ShapeScanner.cxx
// Created: Wed Jul 7 20:10:58 1993
// Author: Jean Yves LEBEY
// <jyl@zerox>
#include <TopOpeBRep_ShapeScanner.ixx>
#include <TopOpeBRepTool_define.hxx>
#include <TopAbs.hxx>
//=======================================================================
//function : TopOpeBRep_ShapeScanner
//purpose :
//=======================================================================
TopOpeBRep_ShapeScanner::TopOpeBRep_ShapeScanner()
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void TopOpeBRep_ShapeScanner::Clear()
{
myBoxSort.Clear();
}
//=======================================================================
//function : AddBoxesMakeCOB
//purpose :
//=======================================================================
void TopOpeBRep_ShapeScanner::AddBoxesMakeCOB(const TopoDS_Shape& S,const TopAbs_ShapeEnum TS,const TopAbs_ShapeEnum TA)
{
myBoxSort.AddBoxesMakeCOB(S,TS,TA);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_ShapeScanner::Init(TopOpeBRepTool_ShapeExplorer &E)
{
TColStd_ListOfInteger anEmptyList;
myListIterator.Initialize(anEmptyList);
for (; E.More(); E.Next() ) {
const TopoDS_Shape& cur = E.Current();
// TopAbs_ShapeEnum t = cur.ShapeType();
Init(cur);
Standard_Boolean b = More();
if ( b ) break;
}
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_ShapeScanner::Init(const TopoDS_Shape &E)
{
myListIterator = myBoxSort.Compare(E);
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_ShapeScanner::More() const
{
Standard_Boolean b = myListIterator.More();
return b;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void TopOpeBRep_ShapeScanner::Next()
{
myListIterator.Next();
}
//=======================================================================
//function : Current
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_ShapeScanner::Current() const
{
const TopoDS_Shape& E = myBoxSort.TouchedShape(myListIterator);
return E;
}
//=======================================================================
//function : BoxSort
//purpose :
//=======================================================================
const TopOpeBRepTool_BoxSort& TopOpeBRep_ShapeScanner::BoxSort() const
{
return myBoxSort;
}
//=======================================================================
//function : BoxSort
//purpose :
//=======================================================================
TopOpeBRepTool_BoxSort& TopOpeBRep_ShapeScanner::ChangeBoxSort()
{
return myBoxSort;
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_ShapeScanner::Index()const
{
Standard_Integer n = 0;
if ( myListIterator.More() ) n = myListIterator.Value();
return n;
}
//=======================================================================
//function : DumpCurrent
//purpose :
//=======================================================================
Standard_OStream& TopOpeBRep_ShapeScanner::DumpCurrent(Standard_OStream& OS)const
{
#ifdef DEB
if ( More() ) {
const TopoDS_Shape& S = Current();
TopAbs_ShapeEnum T = S.ShapeType();
TopAbs_Orientation O = S.Orientation();
Standard_Integer I = Index();
TopAbs::Print(T,cout);
cout<<"("<<I<<","; TopAbs::Print(O,cout); cout<<") ";
}
#endif
return OS;
}

View File

@@ -0,0 +1,299 @@
-- File: TopOpeBRep_VPointInter.cdl
-- Created: Wed Nov 10 18:26:49 1993
-- Author: Jean Yves LEBEY
---Copyright: Matra Datavision 1993
class VPointInter from TopOpeBRep
uses
State from TopAbs,
Point from IntPatch,
PThePointOfIntersection from TopOpeBRep,
Transition from IntSurf,
Shape from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Pnt from gp,
Pnt2d from gp
raises
DomainError from Standard
is
Create returns VPointInter from TopOpeBRep;
---C++: inline
SetPoint(me : in out; P : Point from IntPatch)
is static;
SetShapes(me:out;I1,I2:Integer);
---C++: inline
GetShapes(me;I1,I2:out Integer);
---C++: inline
TransitionOnS1(me)
returns Transition from IntSurf
---C++: inline
is static;
TransitionOnS2(me)
returns Transition from IntSurf
---C++: inline
is static;
TransitionLineArc1(me)
returns Transition from IntSurf
---C++: inline
is static;
TransitionLineArc2(me)
returns Transition from IntSurf
---C++: inline
is static;
IsOnDomS1(me)
returns Boolean from Standard
---C++: inline
is static;
IsOnDomS2(me)
returns Boolean from Standard
---C++: inline
is static;
ParametersOnS1(me; u,v : out Real from Standard)
---C++: inline
is static;
ParametersOnS2(me; u,v : out Real from Standard)
---C++: inline
is static;
Value(me)
returns Pnt from gp
---C++: return const &
---C++: inline
is static;
Tolerance(me)
returns Real from Standard
---C++: inline
is static;
ArcOnS1(me)
returns Shape from TopoDS
---C++: return const &
is static;
ArcOnS2(me)
returns Shape from TopoDS
---C++: return const &
is static;
ParameterOnLine(me)
returns Real from Standard
---C++: inline
is static;
ParameterOnArc1(me)
returns Real from Standard
---C++: inline
is static;
IsVertexOnS1(me)
---Purpose: Returns TRUE if the point is a vertex on the initial
-- restriction facet of the first surface.
returns Boolean from Standard
---C++: inline
is static;
VertexOnS1(me)
---Purpose: Returns the information about the point when it is
-- on the domain of the first patch, i-e when the function
-- IsVertexOnS1 returns True.
-- Otherwise, an exception is raised.
---C++: return const&
returns Shape from TopoDS
raises DomainError from Standard
is static;
ParameterOnArc2(me)
returns Real from Standard
---C++: inline
is static;
IsVertexOnS2(me)
---Purpose: Returns TRUE if the point is a vertex on the initial
-- restriction facet of the second surface.
returns Boolean from Standard
---C++: inline
is static;
VertexOnS2(me)
---Purpose: Returns the information about the point when it is
-- on the domain of the second patch, i-e when the function
-- IsVertexOnS2 returns True.
-- Otherwise, an exception is raised.
---C++: return const&
returns Shape from TopoDS
raises DomainError from Standard
is static;
IsInternal(me)
returns Boolean from Standard
---C++: inline
is static;
-- dummy method
IsMultiple(me)
---Purpose: Returns True if the point belongs to several intersection
-- lines.
returns Boolean from Standard
---C++: inline
is static;
State(me; I : Integer from Standard)
---Purpose: get state of VPoint within the domain of geometric shape
-- domain <I> (= 1 or 2).
returns State from TopAbs
is static;
State(me : in out; S : State from TopAbs; I : Integer from Standard)
---Purpose: Set the state of VPoint within the domain of
-- the geometric shape <I> (= 1 or 2).
is static;
EdgeON(me : in out; Eon : Shape from TopoDS;
Par : Real from Standard;
I : Integer from Standard)
---Purpose: set the shape Eon of shape I (1,2) containing the point,
-- and parameter <Par> of point on <Eon>.
is static;
EdgeON(me; I : Integer from Standard)
---Purpose: get the edge of shape I (1,2) containing the point.
---C++: return const &
returns Shape from TopoDS
is static;
EdgeONParameter(me; I : Integer from Standard)
---Purpose: get the parameter on edge of shape I (1,2) containing the point.
returns Real from Standard
is static;
ShapeIndex(me)
---Purpose: returns value of filed myShapeIndex = 0,1,2,3
-- 0 means the VPoint is on no restriction
-- 1 means the VPoint is on the restriction 1
-- 2 means the VPoint is on the restriction 2
-- 3 means the VPoint is on the restrictions 1 and 2
returns Integer from Standard
---C++: inline
is static;
ShapeIndex(me : in out; I : Integer from Standard)
---Purpose: set value of shape supporting me (0,1,2,3).
---C++: inline
is static;
Edge(me; I : Integer from Standard)
---Purpose: get the edge of shape I (1,2) containing the point.
-- Returned shape is null if the VPoint is not on an edge
-- of shape I (1,2).
---C++: return const &
returns Shape from TopoDS
is static;
EdgeParameter(me; I : Integer from Standard)
---Purpose: get the parameter on edge of shape I (1,2) containing the point
returns Real from Standard
is static;
SurfaceParameters(me; I : Integer from Standard) returns Pnt2d from gp;
---Purpose: get the parameter on surface of shape I (1,2) containing the point
IsVertex(me; I : Integer from Standard)
returns Boolean from Standard
is static;
Vertex(me; I : Integer from Standard)
---C++: return const &
returns Shape from TopoDS
is static;
UpdateKeep(me : in out)
---Purpose: set myKeep value according to current states.
is static;
Keep(me) returns Boolean from Standard
---Purpose:
-- Returns value of myKeep (does not evaluate states)
-- False at creation of VPoint.
-- Updated by State(State from TopAbs,Integer from Standard)
---C++: inline
is static;
ChangeKeep(me : in out;
keep : Boolean from Standard )
---Purpose: updates VPointInter flag "keep" with <keep>.
---C++: inline
is static;
-- other
--
EqualpP(me; VP : VPointInter from TopOpeBRep)
returns Boolean;
---Purpose: returns <True> if the 3d points and the parameters of the
-- VPoints are same
ParonE(me; E : Edge from TopoDS; par : out Real)
returns Boolean;
---Purpose: returns <false> if the vpoint is not given on arc <E>,
-- else returns <par> parameter on <E>
-- =====
-- trace
-- =====
Index(me : in out; I : Integer from Standard) is static;
---C++: inline
Index(me) returns Integer from Standard is static;
---C++: inline
Dump(me; I : Integer from Standard;
F : Face from TopoDS;
OS : in out OStream from Standard)
returns OStream from Standard is static;
---C++: return &
Dump(me; F1 : Face from TopoDS;
F2 : Face from TopoDS;
OS : in out OStream from Standard)
returns OStream from Standard is static;
---C++: return &
PThePointOfIntersectionDummy(me) returns PThePointOfIntersection from TopOpeBRep;
fields
myPPOI : PThePointOfIntersection from TopOpeBRep;
myShapeIndex : Integer from Standard;
myState1 : State from TopAbs;
myState2 : State from TopAbs;
myKeep : Boolean from Standard;
myEdgeON1 : Shape from TopoDS;
myEdgeON2 : Shape from TopoDS;
myEdgeONPar1 : Real from Standard;
myEdgeONPar2 : Real from Standard;
myIndex : Integer from Standard; -- trace
myNullShape : Shape from TopoDS; -- dummy
myS1,myS2 : Integer;
end VPointInter;

View File

@@ -0,0 +1,371 @@
// File: TopOpeBRep_VPointInter.cxx
// Created: Wed Nov 10 18:56:49 1993
// Author: Jean Yves LEBEY
// Copyright: OPEN CASCADE 1993
#include <TopOpeBRep_VPointInter.ixx>
#include <Standard_DomainError.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <BRepAdaptor_HCurve2d.hxx>
#include <BRepTopAdaptor_HVertex.hxx>
#include <Adaptor3d_HVertex.hxx>
#include <Adaptor2d_HCurve2d.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <TCollection_AsciiString.hxx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
#include <TopOpeBRep_define.hxx>
#ifdef DEB
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSFK();
static TCollection_AsciiString PRODINP("dinp ");
#endif
//=======================================================================
//function : SetPoint
//purpose :
//=======================================================================
void TopOpeBRep_VPointInter::SetPoint(const IntPatch_Point& P)
{
myPPOI = (IntPatch_Point*)&P;
Standard_Boolean isOn1 = P.IsOnDomS1();
Standard_Boolean isOn2 = P.IsOnDomS2();
if (isOn1 && isOn2) myShapeIndex = 3;
else if (isOn2) myShapeIndex = 2;
else if (isOn1) myShapeIndex = 1;
else myShapeIndex = 0;
}
//=======================================================================
//function : ArcOnS1
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::ArcOnS1() const
{
const Handle(Adaptor2d_HCurve2d)& HAHC2 = myPPOI->ArcOnS1();
const BRepAdaptor_Curve2d& BRAC2P = *((BRepAdaptor_Curve2d*)&(HAHC2->Curve2d()));
return BRAC2P.Edge();
}
//=======================================================================
//function : ArcOnS2
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::ArcOnS2() const
{
const Handle(Adaptor2d_HCurve2d)& HAHC2 = myPPOI->ArcOnS2();
const BRepAdaptor_Curve2d& BRAC2P = *((BRepAdaptor_Curve2d*)&(HAHC2->Curve2d()));
return BRAC2P.Edge();
}
//=======================================================================
//function : VertexOnS1
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::VertexOnS1() const
{
if ( !myPPOI->IsVertexOnS1() )
Standard_DomainError::Raise("TopOpeBRep_VPointInter::VertexOnS1");
const Handle(BRepTopAdaptor_HVertex)* HBRTAHV = (Handle(BRepTopAdaptor_HVertex)*)&(myPPOI->VertexOnS1());
return (*HBRTAHV)->Vertex();
}
//=======================================================================
//function : VertexOnS2
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::VertexOnS2() const
{
if ( !myPPOI->IsVertexOnS2() )
Standard_DomainError::Raise("TopOpeBRep_VPointInter::VertexOnS2");
const Handle(BRepTopAdaptor_HVertex)* HBRTAHV = (Handle(BRepTopAdaptor_HVertex)*)&(myPPOI->VertexOnS2());
return (*HBRTAHV)->Vertex();
}
//=======================================================================
//function : State
//purpose :
//=======================================================================
void TopOpeBRep_VPointInter::State(const TopAbs_State S,const Standard_Integer I)
{
if (I == 1) myState1 = S;
else if (I == 2) myState2 = S;
else Standard_DomainError::Raise("TopOpeBRep_VPointInter::State");
UpdateKeep();
}
//=======================================================================
//function : State
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_VPointInter::State(const Standard_Integer I) const
{
if (I == 1) return myState1;
else if (I == 2) return myState2;
else { Standard_DomainError::Raise("TopOpeBRep_VPointInter::State"); return TopAbs_UNKNOWN; }
}
//=======================================================================
//function : EdgeON
//purpose :
//=======================================================================
void TopOpeBRep_VPointInter::EdgeON(const TopoDS_Shape& Eon,const Standard_Real Par,const Standard_Integer I)
{
if (I == 1) {
myEdgeON1 = Eon;
myEdgeONPar1 = Par;
}
else if (I == 2) {
myEdgeON2 = Eon;
myEdgeONPar2 = Par;
}
}
//=======================================================================
//function : EdgeON
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::EdgeON(const Standard_Integer I) const
{
if (I == 1) return myEdgeON1;
else if (I == 2) return myEdgeON2;
else Standard_DomainError::Raise("TopOpeBRep_VPointInter::EdgeON");
return myNullShape;
}
//=======================================================================
//function : EdgeONParameter
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_VPointInter::EdgeONParameter(const Standard_Integer I) const
{
if (I == 1) return myEdgeONPar1;
else if (I == 2) return myEdgeONPar2;
else Standard_DomainError::Raise("TopOpeBRep_VPointInter::EdgeONParameter");
return 0.;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::Edge(const Standard_Integer I) const
{
if (I == 1 && IsOnDomS1() ) return ArcOnS1();
else if (I == 2 && IsOnDomS2() ) return ArcOnS2();
return myNullShape;
}
//=======================================================================
//function : EdgeParameter
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_VPointInter::EdgeParameter(const Standard_Integer I) const
{
if (I == 1 && IsOnDomS1() ) return ParameterOnArc1();
else if (I == 2 && IsOnDomS2() ) return ParameterOnArc2();
return 0.;
}
//=======================================================================
//function : EdgeParameter
//purpose :
//=======================================================================
gp_Pnt2d TopOpeBRep_VPointInter::SurfaceParameters(const Standard_Integer I) const
{
Standard_Real u = 0., v = 0.;
//if (I == 1 && IsOnDomS1() ) ParametersOnS1(u,v);
//else if (I == 2 && IsOnDomS1() ) ParametersOnS2(u,v);
if (I == 1 ) ParametersOnS1(u,v);
else if (I == 2 ) ParametersOnS2(u,v);
gp_Pnt2d p2d(u,v);
return p2d;
}
//=======================================================================
//function : IsVertex
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_VPointInter::IsVertex(const Standard_Integer I) const
{
if ( I == 0 ) return Standard_False;
if ( I == 1 && IsVertexOnS1() ) return Standard_True;
else if ( I == 2 && IsVertexOnS2() ) return Standard_True;
return Standard_False;
}
//=======================================================================
//function : Vertex
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInter::Vertex(const Standard_Integer I) const
{
if ( I == 1 && IsVertexOnS1() ) return VertexOnS1();
else if ( I == 2 && IsVertexOnS2() ) return VertexOnS2();
return myNullShape;
}
//=======================================================================
//function : UpdateKeep
//purpose :
//=======================================================================
void TopOpeBRep_VPointInter::UpdateKeep()
{
#define M_SINON(s) (((s) == TopAbs_IN) || ((s) == TopAbs_ON))
TopAbs_State pos1 = State(1);
TopAbs_State pos2 = State(2);
Standard_Integer SI = ShapeIndex();
#ifdef DEB
Standard_Boolean condition;
#else
Standard_Boolean condition=Standard_False;
#endif
if (SI == 1) condition = M_SINON(pos2);
else if (SI == 2) condition = M_SINON(pos1);
else if (SI == 0) condition = M_SINON(pos1) && M_SINON(pos2);
else if (SI == 3) condition = M_SINON(pos1) && M_SINON(pos2);
// NYI : SI == 3 --> le VP devrait toujours etre Keep() (par definition)
myKeep = condition;
}
//=======================================================================
//function : EqualpP
//purpose : returns <True> if the 3d points and the parameters of the
// VPoints are same.
//=======================================================================
Standard_Boolean TopOpeBRep_VPointInter::EqualpP(const TopOpeBRep_VPointInter& VP) const
{
Standard_Real p1 = ParameterOnLine();
Standard_Real p2 = VP.ParameterOnLine();
Standard_Boolean pequal = fabs(p1-p2) < Precision::PConfusion();
gp_Pnt P1 = Value(); gp_Pnt P2 = VP.Value();
Standard_Real Ptol1 = Tolerance(), Ptol2 = VP.Tolerance();
Standard_Real Ptol = (Ptol1 > Ptol2) ? Ptol1 : Ptol2;
Standard_Boolean Pequal = P1.IsEqual(P2,Ptol);
Standard_Boolean pPequal = ( pequal && Pequal );
return pPequal;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_VPointInter::ParonE(const TopoDS_Edge& E,Standard_Real& par) const
{
Standard_Boolean found = Standard_False;
if (IsOnDomS1()) {
if(E.IsSame(ArcOnS1())) found = Standard_True;
if (found) {par = ParameterOnArc1(); return found;}
}
if (IsOnDomS2()) {
if(E.IsSame(ArcOnS2())) found = Standard_True;
if (found) {par = ParameterOnArc2(); return found;}
}
for (Standard_Integer i = 1; i <= 2; i++) {
if (State(i) != TopAbs_ON) continue;
if (EdgeON(i).IsSame(E)) {
par = EdgeONParameter(i);
return Standard_True;
}
}
return found;
}
//=======================================================================
//function : DumpEdge
//purpose :
//=======================================================================
Standard_OStream& TopOpeBRep_VPointInter::Dump(const Standard_Integer I,const TopoDS_Face& F,Standard_OStream& OS) const
{
const TopoDS_Edge& E = TopoDS::Edge(Edge(I));
#ifdef DEB
Standard_Real Epar =
#endif
EdgeParameter(I);
#ifdef DEB
TopAbs_Orientation O =
#endif
E.Orientation();
#ifdef DEB
Standard_Boolean closingedge =
#endif
TopOpeBRepTool_ShapeTool::Closed(E,F);
#ifdef DEB
if (closingedge) OS<<"on closing edge "; else OS<<"on edge "; TopAbs::Print(O,cout);
cout<<" of "<<I<<" : par : "<<Epar<<endl;
TopOpeBRepDS_Transition T = TopOpeBRep_FFTransitionTool::ProcessLineTransition(*this,I,O);
OS<<"line transition ";
if (closingedge) OS<<"on closing edge "; else OS<<"on edge "; TopAbs::Print(O,cout);
OS<<" of "<<I<<" : "; T.Dump(OS);OS<<endl;
#endif
return OS;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
Standard_OStream& TopOpeBRep_VPointInter::Dump(const TopoDS_Face& FF1,const TopoDS_Face& FF2,Standard_OStream& OS) const
{
#ifdef DEB
const TopoDS_Face& F1 = TopoDS::Face(FF1);
const TopoDS_Face& F2 = TopoDS::Face(FF2);
OS<<"VP "<<myIndex<<" on "<<myShapeIndex<<" :";
Standard_Real Cpar = ParameterOnLine(); OS<<" on curve : "<<Cpar;
if (!myKeep) OS<<" NOT kept";
OS<<endl;
const gp_Pnt& P = Value();
OS<<PRODINP<<"P"<<myIndex<<" "; OS<<P.X()<<" "<<P.Y()<<" "<<P.Z();
OS<<"; #draw"<<endl;
if (TopOpeBRepDS_GettraceDSFK()) { Standard_Real u,v;
ParametersOnS1(u,v); OS<<"u1,v1 : "<<u<<" "<<v; OS<<" ";
ParametersOnS2(u,v); OS<<"u2,v2 : "<<u<<" "<<v; OS<<endl;
}
if (IsVertexOnS1()) { OS<<"is vertex of 1"<<endl; }
if (IsVertexOnS2()) { OS<<"is vertex of 2"<<endl; }
if (IsMultiple()) { OS<<"is multiple"<<endl; }
if (IsInternal()) { OS<<"is internal"<<endl; }
if (myShapeIndex == 1) {
Dump(1,F1,OS);
}
else if (myShapeIndex == 2) {
Dump(2,F2,OS);
}
else if (myShapeIndex == 3) {
Dump(1,F1,OS);
Dump(2,F2,OS);
}
#endif
return OS;
}
//=======================================================================
//function : PThePointOfIntersectionDummy
//purpose :
//=======================================================================
TopOpeBRep_PThePointOfIntersection TopOpeBRep_VPointInter::PThePointOfIntersectionDummy() const
{
return myPPOI;
}

View File

@@ -0,0 +1,276 @@
// File: TopOpeBRep_VPointInter.lxx
// Created: Wed Nov 10 18:56:49 1993
// Author: Jean Yves LEBEY
// Copyright: OPEN CASCADE 1993
#include <IntPatch_Point.hxx>
//=======================================================================
//function : TopOpeBRep_VPointInter
//purpose :
//=======================================================================
inline TopOpeBRep_VPointInter::TopOpeBRep_VPointInter() :
myPPOI(NULL),
myShapeIndex(0),
myState1(TopAbs_UNKNOWN),
myState2(TopAbs_UNKNOWN),
myKeep(Standard_False),
//myEdgeONPar1, myEdgeONPar2,
myIndex(0),
myS1(0),myS2(0)
{
}
//=======================================================================
//function : SetShapes
//purpose :
//=======================================================================
inline void TopOpeBRep_VPointInter::SetShapes(const Standard_Integer I1,const Standard_Integer I2)
{
myS1 = I1;
myS2 = I2;
}
//=======================================================================
//function : GetShapes
//purpose :
//=======================================================================
inline void TopOpeBRep_VPointInter::GetShapes(Standard_Integer& I1,Standard_Integer& I2) const
{
I1 = myS1;
I2 = myS2;
}
//=======================================================================
//function : TransitionOnS1
//purpose :
//=======================================================================
inline IntSurf_Transition TopOpeBRep_VPointInter::TransitionOnS1() const
{
return myPPOI->TransitionOnS1();
}
//=======================================================================
//function : TransitionOnS2
//purpose :
//=======================================================================
inline IntSurf_Transition TopOpeBRep_VPointInter::TransitionOnS2() const
{
return myPPOI->TransitionOnS2();
}
//=======================================================================
//function : TransitionLineArc1
//purpose :
//=======================================================================
inline IntSurf_Transition TopOpeBRep_VPointInter::TransitionLineArc1() const
{
return myPPOI->TransitionLineArc1();
}
//=======================================================================
//function : TransitionLineArc2
//purpose :
//=======================================================================
inline IntSurf_Transition TopOpeBRep_VPointInter::TransitionLineArc2() const
{
return myPPOI->TransitionLineArc2();
}
//=======================================================================
//function : IsOnDomS1
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::IsOnDomS1() const
{
return myPPOI->IsOnDomS1();
}
//=======================================================================
//function : IsOnDomS2
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::IsOnDomS2() const
{
return myPPOI->IsOnDomS2();
}
//=======================================================================
//function : ParametersOnS1
//purpose :
//=======================================================================
inline void TopOpeBRep_VPointInter::ParametersOnS1(Standard_Real& u, Standard_Real& v) const
{
myPPOI->ParametersOnS1(u,v);
}
//=======================================================================
//function : ParametersOnS2
//purpose :
//=======================================================================
inline void TopOpeBRep_VPointInter::ParametersOnS2(Standard_Real& u, Standard_Real& v) const
{
myPPOI->ParametersOnS2(u,v);
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline const gp_Pnt& TopOpeBRep_VPointInter::Value() const
{
return myPPOI->Value();
}
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_Real TopOpeBRep_VPointInter::Tolerance() const
{
return myPPOI->Tolerance();
}
//=======================================================================
//function : ParameterOnLine
//purpose :
//=======================================================================
inline Standard_Real TopOpeBRep_VPointInter::ParameterOnLine() const
{
return myPPOI->ParameterOnLine();
}
//=======================================================================
//function : ParameterOnArc1
//purpose :
//=======================================================================
inline Standard_Real TopOpeBRep_VPointInter::ParameterOnArc1() const
{
return myPPOI->ParameterOnArc1();
}
//=======================================================================
//function : ParameterOnArc2
//purpose :
//=======================================================================
inline Standard_Real TopOpeBRep_VPointInter::ParameterOnArc2() const
{
return myPPOI->ParameterOnArc2();
}
//=======================================================================
//function : IsVertexOnS1
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::IsVertexOnS1() const
{
return myPPOI->IsVertexOnS1();
}
//=======================================================================
//function : IsVertexOnS2
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::IsVertexOnS2() const
{
return myPPOI->IsVertexOnS2();
}
//=======================================================================
//function : IsMultiple
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::IsMultiple() const
{
return myPPOI->IsMultiple();
}
//=======================================================================
//function : IsInternal
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::IsInternal() const
{
return Standard_False;
}
//=======================================================================
//function : ShapeIndex
//purpose :
//=======================================================================
inline Standard_Integer TopOpeBRep_VPointInter::ShapeIndex() const
{
return myShapeIndex;
}
//=======================================================================
//function : ShapeIndex
//purpose :
//=======================================================================
inline void TopOpeBRep_VPointInter::ShapeIndex(const Standard_Integer I)
{
myShapeIndex = I;
}
//=======================================================================
//function : Keep
//purpose :
//=======================================================================
inline Standard_Boolean TopOpeBRep_VPointInter::Keep() const
{
return myKeep;
}
//=======================================================================
//function : ChangeKeep
//purpose :
//=======================================================================
inline void TopOpeBRep_VPointInter::ChangeKeep(const Standard_Boolean keep)
{
myKeep = keep;
}
//=======================================================================
//function : Index
//purpose : trace
//=======================================================================
inline void TopOpeBRep_VPointInter::Index(const Standard_Integer I)
{
myIndex = I;
}
//=======================================================================
//function : Index
//purpose : trace
//=======================================================================
inline Standard_Integer TopOpeBRep_VPointInter::Index() const
{
return myIndex;
}

View File

@@ -0,0 +1,50 @@
-- File: TopOpeBRep_VPointInterClassifier.cdl
-- Created: Wed Nov 17 19:26:36 1993
-- Author: Jean Yves LEBEY
-- <jyl@phobox>
---Copyright: Matra Datavision 1993
class VPointInterClassifier from TopOpeBRep
uses
State from TopAbs,
Shape from TopoDS,
VPointInter from TopOpeBRep,
FaceClassifier from BRepClass,
PointClassifier from TopOpeBRep
is
Create returns VPointInterClassifier from TopOpeBRep;
VPointPosition(me : in out; F : Shape from TopoDS;
VP : in out VPointInter from TopOpeBRep;
ShapeIndex : Integer from Standard;
PC : in out PointClassifier from TopOpeBRep;
AssumeINON : Boolean from Standard; Tol : Real)
---Purpose: compute position of VPoint <VP> regarding with face <F>.
-- <ShapeIndex> (= 1,2) indicates which (u,v) point of <VP> is used.
-- when state is ON, set VP.EdgeON() with the edge containing <VP>
-- and associated parameter.
-- returns state of VP on ShapeIndex.
returns State from TopAbs is static;
Edge(me)
---Purpose: returns the edge containing the VPoint <VP> used in the
-- last VPointPosition() call. Edge is defined if the state previously
-- computed is ON, else Edge is a null shape.
---C++: return const &
returns Shape from TopoDS is static;
EdgeParameter(me)
---Purpose: returns the parameter of the VPoint <VP> on Edge()
returns Real from Standard is static;
fields
mySlowFaceClassifier : FaceClassifier from BRepClass;
myState : State from TopAbs;
myNullShape : Shape from TopoDS; -- dummy, needed by Edge()
end VPointInterClassifier from TopOpeBRep;

View File

@@ -0,0 +1,257 @@
// File: TopOpeBRep_VPointInterClassifier.cxx
// Created: Thu Nov 18 10:35:11 1993
// Author: Jean Yves LEBEY
// <jyl@phobox>
#include <TopOpeBRep_VPointInterClassifier.ixx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <Standard_ProgramError.hxx>
#include <BRepAdaptor_Surface.hxx>
//modified by NIZHNY-MKK Fri Jun 16 15:04:09 2000.BEGIN
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <BRep_Tool.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <TopoDS_Vertex.hxx>
//modified by NIZHNY-MKK Fri Jun 16 15:04:09 2000.END
//modified by NIZHNY-MKK Mon Jun 19 11:47:48 2000.BEGIN
static TopAbs_State SlowClassifyOnBoundary(const gp_Pnt& thePointToClassify,
const gp_Pnt2d& thePoint2dToClassify,
BRepClass_FaceClassifier& theSlowClassifier,
const TopoDS_Face& theFace);
//modified by NIZHNY-MKK Mon Jun 19 11:47:51 2000.END
//=======================================================================
//function : TopOpeBRep_VPointInterClassifier
//purpose :
//=======================================================================
TopOpeBRep_VPointInterClassifier::TopOpeBRep_VPointInterClassifier() :
myState(TopAbs_UNKNOWN)
{
}
//=======================================================================
//function : VPointPosition
//purpose :
//=======================================================================
TopAbs_State TopOpeBRep_VPointInterClassifier::VPointPosition
(const TopoDS_Shape& F,
TopOpeBRep_VPointInter& VP,
const Standard_Integer FaceClassifyIndex,
TopOpeBRep_PointClassifier& PC,
const Standard_Boolean AssumeINON,
const Standard_Real Tol)
{
myState = TopAbs_UNKNOWN;
Standard_Real u,v;
switch (FaceClassifyIndex) {
case 1 : {
VP.ParametersOnS1(u,v);
if(VP.IsOnDomS1()) {
VP.State(TopAbs_ON,1);
const TopoDS_Edge& E = TopoDS::Edge(VP.ArcOnS1());
const Standard_Real pE = VP.ParameterOnArc1();
VP.EdgeON(E,pE,1);
myState = TopAbs_ON;
return myState;
}
break;
}
case 2 : {
VP.ParametersOnS2(u,v);
if(VP.IsOnDomS2()) {
VP.State(TopAbs_ON,2);
const TopoDS_Edge& E = TopoDS::Edge(VP.ArcOnS2());
const Standard_Real pE = VP.ParameterOnArc2();
VP.EdgeON(E,pE,2);
myState = TopAbs_ON;
return myState;
}
break;
}
default : Standard_ProgramError::Raise("VPointClassifier : wrong Index");
}
if (myState == TopAbs_ON) {
return myState;
}
#ifdef DEB
const gp_Pnt& P3D = VP.Value();
#endif
TopoDS_Face FF = TopoDS::Face(F);
TopOpeBRepTool_ShapeTool::AdjustOnPeriodic(FF,u,v);
gp_Pnt2d p2d(u,v);
TopAbs_State statefast = PC.Classify(FF,p2d,Tol);
myState = statefast;
VP.State(myState,FaceClassifyIndex);
// AssumeINON = True <=> on considere que tout VP rendu par les
// intersections est sur une frontiere de la face FF (ON)ou dans la face FF (IN)
Standard_Integer VPSI = VP.ShapeIndex();
if (AssumeINON && FaceClassifyIndex == VPSI) {
mySlowFaceClassifier.Perform(FF,p2d,Tol);
myState = mySlowFaceClassifier.State();
if (myState == TopAbs_ON) {
//modified by NIZHNY-MKK Mon Jun 19 11:45:36 2000.BEGIN
myState = SlowClassifyOnBoundary(VP.Value(), p2d, mySlowFaceClassifier, FF);
if(myState == TopAbs_ON) {
//modified by NIZHNY-MKK Mon Jun 19 11:45:36 2000.END
VP.EdgeON(mySlowFaceClassifier.Edge().Edge(),
mySlowFaceClassifier.EdgeParameter(),
FaceClassifyIndex);
}
}
else if ( myState == TopAbs_OUT) {
myState = TopAbs_IN;
// ou biwn myState = TopAbs_OUT ce qui va entrainer VP.UnKeep()
// si on privilegie le classifieur / donnees d'intersection.
}
} // (AssumeINON && FaceClassifyIndex == VPSI)
else if (!AssumeINON) {
if (statefast == TopAbs_OUT || statefast == TopAbs_ON) {
mySlowFaceClassifier.Perform(FF,p2d,Tol);
myState = mySlowFaceClassifier.State();
if (myState == TopAbs_ON) {
//modified by NIZHNY-MKK Mon Jun 19 11:45:36 2000.BEGIN
myState = SlowClassifyOnBoundary(VP.Value(), p2d, mySlowFaceClassifier, FF);
if(myState == TopAbs_ON) {
//modified by NIZHNY-MKK Mon Jun 19 11:45:36 2000.END
VP.EdgeON(mySlowFaceClassifier.Edge().Edge(),
mySlowFaceClassifier.EdgeParameter(),
FaceClassifyIndex);
}
}
}
}
else if (FaceClassifyIndex != VPSI) {
// AssumeINON = True
//modified by NIZNHY-PKV Mon Feb 5 19:04:01 2001 f
if (statefast == TopAbs_ON || statefast == TopAbs_OUT) {
//if (statefast == TopAbs_ON) {
mySlowFaceClassifier.Perform(FF, p2d, Tol);
myState = mySlowFaceClassifier.State();
if (myState == TopAbs_ON || myState == TopAbs_OUT) {
//if (myState == TopAbs_ON) {
//modified by NIZNHY-PKV Mon Feb 5 19:04:49 2001 t
myState = SlowClassifyOnBoundary(VP.Value(), p2d, mySlowFaceClassifier, FF);
if(myState==TopAbs_ON) {
VP.EdgeON(mySlowFaceClassifier.Edge().Edge(),
mySlowFaceClassifier.EdgeParameter(),
FaceClassifyIndex);
}
}
}
}
VP.State(myState,FaceClassifyIndex);
return myState;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRep_VPointInterClassifier::Edge() const
{
if (myState == TopAbs_ON) {
const TopoDS_Shape& S = mySlowFaceClassifier.Edge().Edge();
return S;
}
else {
return myNullShape;
}
}
//=======================================================================
//function : EdgeParameter
//purpose :
//=======================================================================
Standard_Real TopOpeBRep_VPointInterClassifier::EdgeParameter() const
{
if (myState == TopAbs_ON) return mySlowFaceClassifier.EdgeParameter();
else return 0;
}
//modified by NIZHNY-MKK Mon Jun 19 11:47:23 2000.BEGIN
//=======================================================================
//static function : SlowClassifyOnBoundary
//purpose :
//=======================================================================
static TopAbs_State SlowClassifyOnBoundary(const gp_Pnt& thePointToClassify,
const gp_Pnt2d& thePoint2dToClassify,
BRepClass_FaceClassifier& theSlowClassifier,
const TopoDS_Face& theFace) {
Standard_Real aParameterOnEdge = theSlowClassifier.EdgeParameter();
const TopoDS_Edge& anEdge = theSlowClassifier.Edge().Edge();
Standard_Real parf, parl;
Handle(Geom_Curve) anEdgeCurve = BRep_Tool::Curve(anEdge, parf, parl);
if(!anEdgeCurve.IsNull()) {
Standard_Real minparameterdiff = parl - parf;
Standard_Real aDistanceToCompare = 0;
Standard_Boolean samewithvertex = Standard_False;
TopExp_Explorer anExp(anEdge, TopAbs_VERTEX);
for(;anExp.More() && !samewithvertex; anExp.Next()) {
TopoDS_Vertex aVertex = TopoDS::Vertex(anExp.Current());
Standard_Real aVertexTolerance = BRep_Tool::Tolerance(aVertex);
gp_Pnt anEdgeVertexPoint = BRep_Tool::Pnt(aVertex);
if(thePointToClassify.IsEqual(anEdgeVertexPoint, aVertexTolerance))
samewithvertex = Standard_True;
}
if(samewithvertex)
return TopAbs_ON;
GeomAPI_ProjectPointOnCurve aProjTool(thePointToClassify, anEdgeCurve);
for(Standard_Integer i=1; i<=aProjTool.NbPoints(); i++) {
Standard_Real curparamdiff = Abs(aProjTool.Parameter(i) - aParameterOnEdge);
if(curparamdiff < minparameterdiff) {
minparameterdiff = curparamdiff;
aDistanceToCompare = aProjTool.Distance(i);
}
}
Standard_Real anEdgeTolerance = BRep_Tool::Tolerance(anEdge);
if((aProjTool.NbPoints()==0) || (aDistanceToCompare >= anEdgeTolerance)) {
Handle(Geom2d_Curve) anEdgePCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, parf, parl);
if(!anEdgePCurve.IsNull()) {
gp_Pnt2d aPoint2dOnEdge = anEdgePCurve->Value(aParameterOnEdge);
Standard_Real aTol2d = thePoint2dToClassify.Distance(aPoint2dOnEdge) / 3;
theSlowClassifier.Perform(theFace, thePoint2dToClassify, aTol2d);
if(theSlowClassifier.State() == TopAbs_IN)
return TopAbs_IN;
else
return TopAbs_OUT;
}
else {
return TopAbs_OUT;
}
}
} //end if(!anEdgeCurve.IsNull())
return TopAbs_ON;
}
//modified by NIZHNY-MKK Mon Jun 19 11:47:26 2000.END

View File

@@ -0,0 +1,48 @@
-- File: TopOpeBRep_VPointInterIterator.cdl
-- Created: Fri May 7 17:03:26 1993
-- Author: Jean Yves LEBEY
-- <jyl@topsn3>
---Copyright: Matra Datavision 1993
class VPointInterIterator from TopOpeBRep
-- ==========================
-- Restriction Point iterator
-- ==========================
uses
LineInter from TopOpeBRep,
PLineInter from TopOpeBRep,
VPointInter from TopOpeBRep
is
Create returns VPointInterIterator from TopOpeBRep;
Create(LI : LineInter from TopOpeBRep)
returns VPointInterIterator from TopOpeBRep;
Init(me:in out; LI : LineInter from TopOpeBRep;
checkkeep : Boolean from Standard = Standard_False) is static;
Init(me:in out) is static;
More(me) returns Boolean is static;
Next(me:in out) is static;
CurrentVP(me:in out) returns VPointInter from TopOpeBRep is static;
---C++: return const &
CurrentVPIndex(me) returns Integer is static;
ChangeCurrentVP(me:in out) returns VPointInter from TopOpeBRep is static;
---C++: return &
PLineInterDummy(me) returns PLineInter from TopOpeBRep;
fields
myLineInter : PLineInter from TopOpeBRep;
myVPointIndex : Integer;
myVPointNb : Integer;
mycheckkeep : Boolean from Standard;
end VPointInterIterator from TopOpeBRep;

View File

@@ -0,0 +1,134 @@
// File: TopOpeBRep_VPointIterator.cxx
// Created: Tue Nov 16 10:52:21 1993
// Author: Jean Yves LEBEY
// <jyl@phobox>
#include <TopOpeBRep_VPointInterIterator.ixx>
#include <Standard_ProgramError.hxx>
//=======================================================================
//function : VPointInterIterator
//purpose :
//=======================================================================
TopOpeBRep_VPointInterIterator::TopOpeBRep_VPointInterIterator() :
myLineInter(NULL),myVPointIndex(0),myVPointNb(0),mycheckkeep(Standard_False)
{}
//=======================================================================
//function : VPointInterIterator
//purpose :
//=======================================================================
TopOpeBRep_VPointInterIterator::TopOpeBRep_VPointInterIterator
(const TopOpeBRep_LineInter& LI)
{
Init(LI);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_VPointInterIterator::Init
(const TopOpeBRep_LineInter& LI,
const Standard_Boolean checkkeep)
{
myLineInter = (TopOpeBRep_LineInter*)&LI;
mycheckkeep = checkkeep;
Init();
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_VPointInterIterator::Init()
{
myVPointIndex = 1;
myVPointNb = myLineInter->NbVPoint();
if ( mycheckkeep ) {
while ( More() ) {
const TopOpeBRep_VPointInter& VP = CurrentVP();
#ifdef DEB
Standard_Integer iVP =
#endif
CurrentVPIndex();
if (VP.Keep()) break;
else myVPointIndex++;
}
}
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_VPointInterIterator::More() const
{
return (myVPointIndex <= myVPointNb);
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void TopOpeBRep_VPointInterIterator::Next()
{
myVPointIndex++;
if ( mycheckkeep ) {
while ( More() ) {
const TopOpeBRep_VPointInter& VP = CurrentVP();
#ifdef DEB
Standard_Integer iVP =
#endif
CurrentVPIndex();
if (VP.Keep()) break;
else myVPointIndex++;
}
}
}
//=======================================================================
//function : CurrentVP
//purpose :
//=======================================================================
const TopOpeBRep_VPointInter& TopOpeBRep_VPointInterIterator::CurrentVP()
{
if (!More())
Standard_ProgramError::Raise("TopOpeBRep_VPointInterIterator::CurrentVP");
const TopOpeBRep_VPointInter& VP = myLineInter->VPoint(myVPointIndex);
return VP;
}
//=======================================================================
//function : ChangeCurrentVP
//purpose :
//=======================================================================
TopOpeBRep_VPointInter& TopOpeBRep_VPointInterIterator::ChangeCurrentVP()
{
if (!More())
Standard_ProgramError::Raise("TopOpeBRep_VPointInterIterator::ChangeCurrentVP");
TopOpeBRep_VPointInter& VP = myLineInter->ChangeVPoint(myVPointIndex);
return VP;
}
//=======================================================================
//function : CurrentVPIndex
//purpose :
//=======================================================================
Standard_Integer TopOpeBRep_VPointInterIterator::CurrentVPIndex()const
{
if (!More())
Standard_ProgramError::Raise("TopOpeBRep_VPointInterIterator::CurrentVPIndex");
return myVPointIndex;
}
TopOpeBRep_PLineInter TopOpeBRep_VPointInterIterator::PLineInterDummy() const {return myLineInter;}

View File

@@ -0,0 +1,48 @@
-- File: TopOpeBRep_WPointInter.cdl
-- Created: Wed Nov 10 18:55:14 1993
-- Author: Jean Yves LEBEY
-- <jyl@phobox>
---Copyright: Matra Datavision 1993
class WPointInter from TopOpeBRep
-- as WPointTool from TopOpeLine
-- (PntOn2S from IntSurf)
--
---Purpose:
uses
PntOn2S from IntSurf,
PPntOn2S from TopOpeBRep,
Pnt2d from gp,
Pnt from gp
is
Create returns WPointInter from TopOpeBRep;
Set(me : in out; P : PntOn2S from IntSurf) is static;
ParametersOnS1(me; U,V : out Real from Standard) is static;
ParametersOnS2(me; U,V : out Real from Standard) is static;
Parameters(me; U1,V1,U2,V2 : out Real from Standard) is static;
ValueOnS1(me) returns Pnt2d from gp is static;
ValueOnS2(me) returns Pnt2d from gp is static;
Value(me) returns Pnt from gp is static;
---C++: return const &
PPntOn2SDummy(me) returns PPntOn2S from TopOpeBRep;
fields
myPP2S : PPntOn2S from TopOpeBRep;
end WPointInter;

View File

@@ -0,0 +1,94 @@
// File: TopOpeBRep_WPointInter.cxx
// Created: Wed Nov 10 18:55:48 1993
// Author: Jean Yves LEBEY
// <jyl@phobox>
#include <TopOpeBRep_WPointInter.ixx>
//=======================================================================
//function : WPointInter
//purpose :
//=======================================================================
TopOpeBRep_WPointInter::TopOpeBRep_WPointInter()
{}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void TopOpeBRep_WPointInter::Set(const IntSurf_PntOn2S& P)
{
myPP2S = (IntSurf_PntOn2S*)&P;
}
//=======================================================================
//function : ParametersOnS1
//purpose :
//=======================================================================
void TopOpeBRep_WPointInter::ParametersOnS1
(Standard_Real& U1, Standard_Real& V1) const
{
myPP2S->ParametersOnS1(U1,V1);
}
//=======================================================================
//function : ParametersOnS2
//purpose :
//=======================================================================
void TopOpeBRep_WPointInter::ParametersOnS2
(Standard_Real& U2, Standard_Real& V2) const
{
myPP2S->ParametersOnS2(U2,V2);
}
//=======================================================================
//function : Parameters
//purpose :
//=======================================================================
void TopOpeBRep_WPointInter::Parameters
(Standard_Real& U1, Standard_Real& V1,
Standard_Real& U2, Standard_Real& V2) const
{
myPP2S->Parameters(U1,V1,U2,V2);
}
//=======================================================================
//function : ValueOnS1
//purpose :
//=======================================================================
gp_Pnt2d TopOpeBRep_WPointInter::ValueOnS1() const
{
Standard_Real u,v;
myPP2S->ParametersOnS1(u,v);
return gp_Pnt2d(u,v);
}
//=======================================================================
//function : ValueOnS2
//purpose :
//=======================================================================
gp_Pnt2d TopOpeBRep_WPointInter::ValueOnS2() const
{
Standard_Real u,v;
myPP2S->ParametersOnS2(u,v);
return gp_Pnt2d(u,v);
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const gp_Pnt& TopOpeBRep_WPointInter::Value() const
{
return myPP2S->Value();
}
TopOpeBRep_PPntOn2S TopOpeBRep_WPointInter::PPntOn2SDummy() const { return myPP2S; }

View File

@@ -0,0 +1,42 @@
-- File: TopOpeBRep_WPointInterIterator.cdl
-- Created: Fri May 7 17:03:26 1993
-- Author: Jean Yves LEBEY
-- <jyl@topsn3>
---Copyright: Matra Datavision 1993
class WPointInterIterator from TopOpeBRep
uses
LineInter from TopOpeBRep,
PLineInter from TopOpeBRep,
WPointInter from TopOpeBRep
is
-- ==========================
-- Restriction Point iterator
-- ==========================
Create returns WPointInterIterator from TopOpeBRep;
Create (LI : LineInter from TopOpeBRep)
returns WPointInterIterator from TopOpeBRep;
Init(me:in out; LI : LineInter from TopOpeBRep) is static;
Init(me:in out) is static;
More(me) returns Boolean from Standard is static;
Next(me:in out) is static;
CurrentWP(me:in out) returns WPointInter from TopOpeBRep
---C++: return const &
is static;
PLineInterDummy(me) returns PLineInter from TopOpeBRep;
fields
myLineInter : PLineInter from TopOpeBRep;
myWPointIndex : Integer from Standard;
myWPointNb : Integer from Standard;
end WPointInterIterator from TopOpeBRep;

View File

@@ -0,0 +1,88 @@
// File: TopOpeBRep_WPointInterIterator.cxx
// Created: Tue Nov 16 10:52:21 1993
// Author: Jean Yves LEBEY
// <jyl@phobox>
#include <TopOpeBRep_WPointInterIterator.ixx>
#include <Standard_ProgramError.hxx>
//=======================================================================
//function : WPointIterator
//purpose :
//=======================================================================
TopOpeBRep_WPointInterIterator::TopOpeBRep_WPointInterIterator() :
myLineInter(NULL),myWPointIndex(0),myWPointNb(0)
{
}
//=======================================================================
//function : WPointIterator
//purpose :
//=======================================================================
TopOpeBRep_WPointInterIterator::TopOpeBRep_WPointInterIterator
(const TopOpeBRep_LineInter& LI)
{
Init(LI);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_WPointInterIterator::Init(const TopOpeBRep_LineInter& LI)
{
myLineInter = (TopOpeBRep_LineInter*)&LI;
Init();
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRep_WPointInterIterator::Init()
{
myWPointIndex = 1;
myWPointNb = myLineInter->NbWPoint();
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRep_WPointInterIterator::More() const
{
return (myWPointIndex <= myWPointNb);
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void TopOpeBRep_WPointInterIterator::Next()
{
myWPointIndex++;
}
//=======================================================================
//function : CurrentWP
//purpose :
//=======================================================================
const TopOpeBRep_WPointInter& TopOpeBRep_WPointInterIterator::CurrentWP()
{
if (!More())
Standard_ProgramError::Raise("TopOpeBRep_WPointInterIterator::Current");
const TopOpeBRep_WPointInter& WP = myLineInter->WPoint(myWPointIndex);
return WP;
}
TopOpeBRep_PLineInter TopOpeBRep_WPointInterIterator::PLineInterDummy() const {return myLineInter;}

View File

@@ -0,0 +1,22 @@
// File: TopOpeBRep_define.hxx
// Created: Mon Nov 10 11:50:55 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifndef _TopOpeBRep_define_HeaderFile
#define _TopOpeBRep_define_HeaderFile
#include <TopOpeBRepDS_define.hxx>
#define MTPvpic TopOpeBRep_VPointInterClassifier
#define MTPvpii TopOpeBRep_VPointInterIterator
#define MTPvpi TopOpeBRep_VPointInter
#define MTPli TopOpeBRep_LineInter
#define MTPfi TopOpeBRep_FacesIntersector
#define MTPei TopOpeBRep_EdgesIntersector
#define MTPfei TopOpeBRep_FaceEdgeIntersector
#define MTPff TopOpeBRep_FacesFiller
#define MTPef TopOpeBRep_EdgesFiller
#define MTPfef TopOpeBRep_FaceEdgeFiller
#define MTPpgt TopOpeBRep_PointGeomTool
#endif

View File

@@ -0,0 +1,779 @@
// File: TopOpeBRep_kpart.hxx
// Created: Thu Feb 17 11:02:12 1994
// Author: Jean Yves LEBEY
// <jyl@nonox>
#include <TopOpeBRep_FacesFiller.ixx>
#include <Standard_ProgramError.hxx>
#include <Standard_DomainError.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
#include <TopOpeBRep_PointGeomTool.hxx>
#include <TopOpeBRep.hxx>
#include <TopOpeBRepDS_InterferenceTool.hxx>
#include <TopOpeBRepDS_Config.hxx>
#include <TopOpeBRepDS_Curve.hxx>
#include <TopOpeBRepDS_PointIterator.hxx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopOpeBRepDS_define.hxx>
#ifdef DEB
Standard_IMPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_IMPORT Standard_Boolean TopOpeBRep_GetcontextNEWKP();
#endif
// VP<STATIC_lastVPind> is the vp on which was computed the last CPI.
// if no CPI is computed yet, <STATIC_lastVPind> = 0.
static Standard_Integer STATIC_lastVPind;
#define M_FORWARD( st) (st == TopAbs_FORWARD)
#define M_REVERSED(st) (st == TopAbs_REVERSED)
#define M_INTERNAL(st) (st == TopAbs_INTERNAL)
#define M_EXTERNAL(st) (st == TopAbs_EXTERNAL)
//-----------------------------------------------------------------------
static void FUNBREP_Periodize
(const TopOpeBRep_LineInter& L,const Handle(TopOpeBRepDS_Interference)& Ifound,Standard_Real& PIfound,Standard_Real& parline)
//-----------------------------------------------------------------------
{
const TopOpeBRepDS_Transition& TIfound = Ifound->Transition();
TopAbs_Orientation OTIfound = TIfound.Orientation(TopAbs_IN);
if (L.IsPeriodic()) {
Standard_Real f,l; L.Bounds(f,l);
Standard_Boolean onf = Abs(parline-f) < Precision::PConfusion();
Standard_Boolean onl = Abs(parline-l) < Precision::PConfusion();
Standard_Boolean onfl = onf || onl;
if ( onfl ) {
if ( OTIfound == TopAbs_FORWARD ) {
PIfound = f;
parline = l;
}
else if ( OTIfound == TopAbs_REVERSED ) {
PIfound = l;
parline = f;
}
else {
Standard_ProgramError::Raise("FUNBREP_Periodize");
}
} // onfl
else {
parline = PIfound = Min(parline,PIfound);
}
} // IsPeriodic
else {
parline = PIfound = Min(parline,PIfound);
}
}
//-----------------------------------------------------------------------
static Standard_Boolean FUNBREP_HasSameGPoint(const TopOpeBRepDS_Point& DSP,const Handle(TopOpeBRepDS_Interference)& I,
const TopOpeBRepDS_DataStructure& BDS)
//-----------------------------------------------------------------------
{
// returns <true> if <DSP> shares same geometric point with
// <I> geometry.
Standard_Integer G = I->Geometry();
Standard_Boolean samegp = Standard_False;
if ( I->GeometryType() == TopOpeBRepDS_POINT ) {
const TopOpeBRepDS_Point& P = BDS.Point(G);
samegp = DSP.IsEqual(P);
}
else if ( I->GeometryType() == TopOpeBRepDS_VERTEX ) {
TopOpeBRepDS_Point P(BDS.Shape(G));
samegp = DSP.IsEqual(P);
}
return samegp;
}
//-----------------------------------------------------------------------
static Standard_Boolean FUNBREP_SameUV(const TopOpeBRep_VPointInter& VP1,
const TopOpeBRep_VPointInter& VP2,
const Standard_Integer sind,const Standard_Real toluv)
//-----------------------------------------------------------------------
{
Standard_Real u1,v1,u2,v2;
if (sind == 1) {
VP1.ParametersOnS1(u1,v1); VP2.ParametersOnS1(u2,v2);
}
if (sind == 2) {
VP1.ParametersOnS2(u1,v1); VP2.ParametersOnS2(u2,v2);
}
gp_Pnt2d p1(u1,v1), p2(u2,v2);
Standard_Real dist = p1.Distance(p2);
Standard_Boolean sameuv = (dist < toluv);
return sameuv;
}
#ifdef DEB
//-------------------------------------------------------------------
void FUNBREP_topokpartDEB
(const Handle(TopOpeBRepDS_Interference)& Ifound,const TopOpeBRepDS_ListOfInterference& DSCIL,const TopOpeBRep_LineInter& L,
const TopOpeBRep_VPointInter& VP,const TopOpeBRepDS_Transition& lasttransLine,
const TopOpeBRepDS_DataStructure& BDS,const TopoDS_Shape& E,const TopoDS_Shape& F,const Standard_Real toluv,
const Standard_Boolean CPIfound,const Standard_Boolean samepar, const Standard_Boolean couture,
const Standard_Real& parline,const TopOpeBRepDS_Transition& transLine)
//-------------------------------------------------------------------
{
Standard_Integer iVP = VP.Index();
Standard_Boolean fermee = L.IsVClosed();
Standard_Boolean onsort = (transLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
Standard_Boolean lastdefinie = ! lasttransLine.IsUnknown();
Standard_Boolean lastonsort = Standard_False;
if (lastdefinie) lastonsort = (lasttransLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
Standard_Boolean LITdefinie = Standard_False;
Standard_Boolean LITonsort = Standard_False;
TopOpeBRepDS_Transition LIT;
Standard_Boolean nointerf = DSCIL.IsEmpty();
if (nointerf) STATIC_lastVPind = 0;
if (!nointerf) {
const Handle(TopOpeBRepDS_Interference)& I = DSCIL.Last();
LIT = I->Transition();
LITdefinie = ! LIT.IsUnknown();
if (LITdefinie) LITonsort = (LIT.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
}
Standard_Boolean iswalki = (L.TypeLineCurve() == TopOpeBRep_WALKING);
if (iswalki) cout<<"kpwalk ";
else cout<<"kpglin ";
cout<<"\tVP "<<iVP<<" : ";
if (CPIfound && samepar) cout<<"trouve ("<<parline<<")";
else if (CPIfound && !samepar) cout<<"trouve";
else cout<<"non trouve";
if (fermee) cout<<", fermee";
else cout<<", ouverte";
if (couture) cout<<", couture";
if (onsort) cout<<", sortant";
else cout<<", entrant";
if (lastdefinie && lastonsort) cout<<", prec = sortant";
else if (lastdefinie && !lastonsort) cout<<", prec = entrant";
else cout<<", prec = ?";
if (LITdefinie && LITonsort) cout<<", Lprec = sortant";
else if (LITdefinie && !LITonsort) cout<<", Lprec = entrant";
else cout<<", Lprec = ?";
cout<<endl;
if (!iswalki) {
cout<<"kpglin ";
Standard_Boolean hasfp = L.HasFirstPoint();
Standard_Boolean haslp = L.HasLastPoint();
Standard_Real f,l; L.Bounds(f,l);
if (hasfp) cout<<"\thas fp "<<f;
else cout<<"\thas NO fp";
if (haslp) cout<<", has lp "<<l;
else cout<<", has NO lp";
cout<<endl;
}
}
#endif
//----------------------------------------------------------------------
Standard_Boolean FUNBREP_topowalki_new
(const Handle(TopOpeBRepDS_Interference)& Ifound,const TopOpeBRepDS_ListOfInterference& DSCIL,const TopOpeBRep_LineInter& L,
const TopOpeBRep_VPointInter& VP,const TopoDS_Shape& E,const Standard_Boolean samepar,const Standard_Boolean couture,
TopOpeBRepDS_Transition& transLine)
//----------------------------------------------------------------------
{
#ifdef DEB
Standard_Boolean trc = TopOpeBRepDS_GettraceDSF();
#endif
if (L.TypeLineCurve() != TopOpeBRep_WALKING) {
Standard_ProgramError::Raise("FUNBREP_topowalki_new : line is not a walking");
return Standard_False;
}
Standard_Boolean CPIfound = !Ifound.IsNull();
Standard_Integer iVP = VP.Index();
Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
Standard_Boolean onsort = (transLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
Standard_Boolean LITdefinie = DSCIL.IsEmpty()? Standard_False: !DSCIL.Last()->Transition().IsUnknown();
// dealing with INTERNAL/EXTERNAL <E> :
// ------------------------------------
TopAbs_Orientation Eori = E.Orientation();
Standard_Boolean EFR = M_FORWARD(Eori) || M_REVERSED(Eori);
if (!EFR) { // E INTERNAL ou EXTERNAL
// we assume transition for first vp on non oriented edge to be FORWARD
// last vp on non oriented edge to be REVERSED
if (iVP == iINON1) transLine = TopOpeBRepDS_Transition(TopAbs_OUT,TopAbs_IN);
if (iVP == iINONn) transLine = TopOpeBRepDS_Transition(TopAbs_IN,TopAbs_OUT);
}
// no last defined transition :
// ----------------------------
if (!LITdefinie) {
if (onsort) return Standard_False;
if (iVP == iINONn) return Standard_False;
}
// has last defined transition :
// -----------------------------
Standard_Boolean keep = Standard_True;
if (LITdefinie) {
Handle(TopOpeBRepDS_Interference) I = DSCIL.Last();
TopOpeBRepDS_Transition LIT = I->Transition();
Standard_Boolean LITonsort = M_FORWARD( LIT.Orientation(TopAbs_OUT) );
Standard_Boolean LprecIsEntrant = !LITonsort;
Standard_Boolean entrantsortant = LprecIsEntrant && onsort;
if(EFR && !entrantsortant) keep = Standard_False;
if (couture) {
// vp describing the same geometric point on closing edge :
// it is the same vp described on the FORWARD and REVERSED closing edge -> we keep it only once
// INFO : on walking, vp line parameter is the vp index on the walking
// samepar => describes same CPI
Standard_Boolean samevponcouture = samepar && keep;
if (samevponcouture) {
keep = Standard_False;
#ifdef DEB
if (trc) cout<<"is same vp on couture";
#endif
}
}
{ // kpart JYL 971204 for closing walking, first and current VP same parameter,
// lastonentre && onsort,
// first VP is first walking point (PIfound == 1.0),
// current VP is the second one on walking and not the last.
const Handle(TopOpeBRepDS_Interference)& I = DSCIL.First();
const TopOpeBRepDS_Transition& lasttransLine = I->Transition();
// xpu12-12-97 : line is built on only 2 vp,
// DSCIL->First() == DSCIL->Last()
// lasttransLine = DSCIL's first transition
Standard_Real PIfound = TopOpeBRepDS_InterferenceTool::Parameter(Ifound);
Standard_Boolean fermee = L.IsVClosed();
Standard_Boolean lastonsort = LITdefinie && M_FORWARD(lasttransLine.Orientation(TopAbs_OUT));
Standard_Boolean kpartclosingwalki = (LITdefinie && !lastonsort);
kpartclosingwalki = kpartclosingwalki && CPIfound && samepar;
kpartclosingwalki = kpartclosingwalki && onsort;
kpartclosingwalki = kpartclosingwalki && fermee;
kpartclosingwalki = kpartclosingwalki && (PIfound == 1.0);
kpartclosingwalki = kpartclosingwalki && (iVP == iINON1+1) && (iVP != iINONn);
if (kpartclosingwalki) {
keep = Standard_False;
}
}
} // LITdefinie
return keep;
} // FUNBREP_topowalki_new
#ifdef DEB
Standard_IMPORT Standard_Boolean GLOBAL_bvpr;
Standard_EXPORT void debvpr2(void) {}
#endif
//----------------------------------------------------------------------
Standard_Boolean FUNBREP_topowalki
(const Handle(TopOpeBRepDS_Interference)& Ifound,const TopOpeBRepDS_ListOfInterference& DSCIL,const TopOpeBRep_LineInter& L,
const TopOpeBRep_VPointInter& VP,const TopOpeBRepDS_Transition& lasttransLine,
// const TopOpeBRepDS_DataStructure& BDS,
const TopOpeBRepDS_DataStructure& ,
const TopoDS_Shape& E,
// const TopoDS_Shape& F,
const TopoDS_Shape& ,
// const Standard_Real toluv,
const Standard_Real ,
const Standard_Boolean CPIfound,const Standard_Boolean samepar, const Standard_Boolean couture,
// Standard_Real& parline,
Standard_Real& ,
TopOpeBRepDS_Transition& transLine)
//----------------------------------------------------------------------
{
#ifdef DEB
Standard_Boolean trc = TopOpeBRepDS_GettraceDSF();
#endif
if (L.TypeLineCurve() != TopOpeBRep_WALKING) {
Standard_ProgramError::Raise("FUNBREP_topowalki : line is not a walking");
return Standard_False;
}
#ifdef DEB
Standard_Boolean newkp = TopOpeBRep_GetcontextNEWKP();
if (newkp) {
Standard_Boolean keep = FUNBREP_topowalki_new(Ifound,DSCIL,L,VP,E,samepar,couture,transLine);
return keep;
}
#endif
TopAbs_Orientation Eori = E.Orientation();
Standard_Integer iVP = VP.Index();
Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
Standard_Boolean fermee = L.IsVClosed();
Standard_Boolean onsort = (transLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
Standard_Boolean lastdefinie = ! lasttransLine.IsUnknown();
Standard_Boolean lastonsort = Standard_False;
Standard_Boolean lastinin = Standard_False;
if (lastdefinie) {
lastonsort = (lasttransLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
lastinin = (lasttransLine.Before() == TopAbs_IN);
lastinin = lastinin && (lasttransLine.After() == TopAbs_IN);
}
Standard_Boolean LIdefinie = Standard_False;
Standard_Boolean LITdefinie = Standard_False;
Standard_Boolean LITonsort = Standard_False;
TopOpeBRepDS_Transition LIT;
Handle(TopOpeBRepDS_Interference) I;
Standard_Boolean nointerf = DSCIL.IsEmpty();
if (!nointerf) {
I = DSCIL.Last();
LIdefinie = Standard_True;
LIT = I->Transition();
LITdefinie = ! LIT.IsUnknown();
if (LITdefinie) LITonsort = (LIT.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
}
Standard_Boolean keep = Standard_True;
Standard_Boolean EFR = (Eori == TopAbs_FORWARD || Eori == TopAbs_REVERSED);
if (!LITdefinie) {
if (onsort) {
Standard_Boolean condCTS19305 = Standard_False;
// start debug 971216 : CTS19305
condCTS19305 = (!CPIfound);
condCTS19305 = condCTS19305 && (!fermee);
condCTS19305 = condCTS19305 && (!lastdefinie);
condCTS19305 = condCTS19305 && (iVP == 1) && (iVP == iINON1);
if ( condCTS19305 ) {
keep = Standard_True;
transLine = TopOpeBRepDS_Transition(TopAbs_OUT,TopAbs_IN);
}
// end debug 971216 :
else keep = Standard_False;
}
if (iVP == iINONn) keep = Standard_False;
if (!EFR) { // E INTERNAL ou EXTERNAL
if (iVP == iINON1) {
transLine = TopOpeBRepDS_Transition(TopAbs_OUT,TopAbs_IN);
}
}
}
if (keep && LITdefinie) {
Standard_Boolean LprecIsEntrant = (LITdefinie && !LITonsort);
Standard_Boolean entrantsortant = LprecIsEntrant && onsort;
if (!EFR) {
if ( iVP == iINONn) {
transLine = TopOpeBRepDS_Transition(TopAbs_IN,TopAbs_OUT);
}
}
else {
Standard_Boolean condCTS19305 = Standard_False;
condCTS19305 = (!CPIfound);
condCTS19305 = condCTS19305 && (!fermee);
condCTS19305 = condCTS19305 && (lastdefinie && !lastonsort);
condCTS19305 = condCTS19305 && (LITdefinie && !LITonsort);
condCTS19305 = condCTS19305 && (iVP == iINONn);
if ( condCTS19305 ) {
keep = Standard_True;
transLine = TopOpeBRepDS_Transition(TopAbs_IN,TopAbs_OUT);
}
else {
if ( !entrantsortant ) {
keep = Standard_False;
}
}
}
// vp describing the same geometric point on closing edge :
// it is the same vp described on the FORWARD and REVERSED closing edge -> we keep it only once
// INFO : on walking, vp line parameter is the vp index on the walking
// samepar => describes same CPI
Standard_Boolean samevponcouture = samepar && couture;
if (keep && samevponcouture) {
keep = Standard_False;
#ifdef DEB
if (trc) cout<<"is same vp on couture";
#endif
}
if (keep) {
#ifdef DEB
if (GLOBAL_bvpr) debvpr2();
#endif
if (CPIfound && samepar) {
Standard_Real PIfound = TopOpeBRepDS_InterferenceTool::Parameter(Ifound);
// 971204
Standard_Boolean cond1 = Standard_True;
cond1 = cond1 && (lastdefinie && !lastonsort);
cond1 = cond1 && onsort;
cond1 = cond1 && fermee;
cond1 = cond1 && (CPIfound && samepar);
cond1 = cond1 && (PIfound == 1.0);
cond1 = cond1 && (iVP==iINON1+1) && (iVP != iINONn);
if ( cond1 ) {
keep = Standard_False;
return keep;
}
// PRO12107
Standard_Boolean cond2 = Standard_True;
cond2 = cond2 && (lastdefinie && !lastonsort);
cond1 = cond1 && onsort;
cond2 = cond2 && (!fermee);
cond2 = cond2 && (CPIfound && samepar);
cond2 = cond2 && (PIfound == 1.0);
cond2 = cond2 && (iVP==iINON1+1) && (iVP != iINONn);
if ( cond2 ) {
keep = Standard_False;
return keep;
}
}
} // keep
} // keep && LITdefinie
if (keep) STATIC_lastVPind = iVP;
return keep;
} // FUNBREP_topowalki
//----------------------------------------------------------------------
Standard_Boolean FUNBREP_topogline_new
(const TopOpeBRepDS_ListOfInterference& DSCIL,const TopOpeBRep_LineInter& L, const TopOpeBRep_VPointInter& VP,
const TopOpeBRepDS_DataStructure& BDS,const Standard_Real toluv,
const Standard_Boolean samepar, const Standard_Boolean couture,
Standard_Real& parline,TopOpeBRepDS_Transition& transLine)
//----------------------------------------------------------------------
{
if (L.TypeLineCurve() == TopOpeBRep_WALKING) {
Standard_ProgramError::Raise("FUNBREP_topogline_new : line is not a GLine");
return Standard_False;
}
#ifdef DEB
Standard_Boolean trc = TopOpeBRepDS_GettraceDSF();
#endif
Standard_Integer iVP = VP.Index();
Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
// if VP<iVP> is on 3
// and VP on 1 has transition OUT/IN,
// VP on 2 has transition IN/OUT,
// same VP will be kept.
// the line is described with (VPmin,VPmax) boundaries.
// if VP == VPmax, as we are only regarding IN/OUT transitions->ok
// if VP == VPmin :
Standard_Boolean dscilempty = DSCIL.IsEmpty();
Standard_Boolean notkept = !dscilempty && (iVP == 1);
if (notkept) return Standard_False;
// <transLine> : for unknown current transition
// ------------
// (see TopOpeBRep_FacesFiller::ProcessVPonR)
// vpmin with transition UNKNOWN => transLine-> OUT/IN
// vpmin OUT/IN, vpmax with transition UNKNOWN => transLine-> IN/OUT
TopOpeBRepDS_Transition LIT;
Handle(TopOpeBRepDS_Interference) I;
Standard_Boolean LITdefinie,LITonsort; LITdefinie = LITonsort = Standard_False;
if ( !dscilempty ) {
I = DSCIL.Last();
LIT = I->Transition();
LITdefinie = ! LIT.IsUnknown();
if (LITdefinie) LITonsort = M_FORWARD( LIT.Orientation(TopAbs_OUT) );
}
Standard_Boolean trliunk = transLine.IsUnknown();
Standard_Boolean isfirstvp = (iVP == iINON1);
Standard_Boolean islastvp = (iVP == iINONn);
if (trliunk) {
if (isfirstvp) transLine = TopOpeBRepDS_Transition(TopAbs_OUT,TopAbs_IN);
if (islastvp && LITdefinie && !LITonsort) transLine = LIT.Complement();
}
Standard_Boolean onsort = M_FORWARD( transLine.Orientation(TopAbs_OUT) );
Standard_Boolean hasfp = L.HasFirstPoint(), haslp = L.HasLastPoint();
Standard_Boolean hasfol = hasfp || haslp;
Standard_Boolean keep = Standard_True;
// no last defined transition :
// ----------------------------
if (!LITdefinie) {
if (onsort) keep = Standard_False;
if (iVP == iINONn) keep = Standard_False;
}
// has last defined transition :
// -----------------------------
if (LITdefinie) {
Standard_Boolean LprecIsEntrant = (LITdefinie && !LITonsort);
Standard_Boolean entrantsortant = LprecIsEntrant && onsort;
if(!entrantsortant) keep = Standard_False;
Standard_Boolean sameparoncouture = samepar && couture;
if (sameparoncouture && hasfol && keep) {
// INFO : on geometric line, vp parameter on line is the point on
// curve's parameter.
TopOpeBRepDS_Point pntVP = TopOpeBRep_PointGeomTool::MakePoint(VP);
Standard_Boolean samegp = FUNBREP_HasSameGPoint(pntVP,I,BDS);
// !fermee : same p3d && samepar => same CPI
// fermee : (same p3d && samepar
// && sameUVon1 && sameUVon2) => same CPI
Standard_Boolean fermee = L.IsVClosed();
if (!fermee && samegp) keep = Standard_False;
if (fermee && samegp) {
// 2 vp describing a closing line describe the same 3dpoint
// have same parameter, but do not describe the same uv
// points on the closed surface (cobo121)
const TopOpeBRep_VPointInter& lastVP = L.VPoint(STATIC_lastVPind);
Standard_Boolean sameUVon1 = FUNBREP_SameUV(VP,lastVP,1,toluv);
Standard_Boolean sameUVon2 = FUNBREP_SameUV(VP,lastVP,2,toluv);
keep = !(sameUVon1 && sameUVon2);
}
}
if (sameparoncouture && !hasfol) {
// we have to parametrize the found interference (parameter PIfound)
// and next interference (parline)
Handle(TopOpeBRepDS_Interference) Ifound = DSCIL.First();
Standard_Real PIfound = TopOpeBRepDS_InterferenceTool::Parameter(Ifound);
FUNBREP_Periodize(L,Ifound,PIfound,parline);
TopOpeBRepDS_InterferenceTool::Parameter(Ifound,PIfound);
transLine = LIT.Complement();
}
} // LITdefinie
if (keep) STATIC_lastVPind = iVP;
return keep;
} // FUNBREP_topogline_new
//----------------------------------------------------------------------
Standard_Boolean FUNBREP_topogline
(const Handle(TopOpeBRepDS_Interference)& Ifound,const TopOpeBRepDS_ListOfInterference& DSCIL,const TopOpeBRep_LineInter& L,
const TopOpeBRep_VPointInter& VP,const TopOpeBRepDS_Transition& lasttransLine,
const TopOpeBRepDS_DataStructure& BDS,const TopoDS_Shape& E,
// const TopoDS_Shape& F,
const TopoDS_Shape& ,
const Standard_Real toluv,
// const Standard_Boolean CPIfound,
const Standard_Boolean ,
const Standard_Boolean samepar,const Standard_Boolean couture,
Standard_Real& parline,TopOpeBRepDS_Transition& transLine)
//----------------------------------------------------------------------
{
#ifdef DEB
Standard_Boolean trc = TopOpeBRepDS_GettraceDSF();
#endif
if (L.TypeLineCurve() == TopOpeBRep_WALKING) {
Standard_ProgramError::Raise("FUNBREP_topogline : line is not a GLine");
return Standard_False;
}
#ifdef DEB
Standard_Boolean newkp = TopOpeBRep_GetcontextNEWKP();
if (newkp) {
Standard_Boolean keep = FUNBREP_topogline_new(DSCIL,L,VP,BDS,toluv,samepar,couture,parline,transLine);
return keep;
}
#endif
TopAbs_Orientation Eori = E.Orientation();
Standard_Boolean EFR = M_FORWARD(Eori) || M_REVERSED(Eori);
Standard_Integer iVP = VP.Index();
Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
Standard_Boolean fermee = L.IsVClosed();
if (!EFR) { // E INTERNAL ou EXTERNAL
if (iVP == iINON1) transLine = TopOpeBRepDS_Transition(TopAbs_OUT,TopAbs_IN);
if (iVP == iINONn) transLine = TopOpeBRepDS_Transition(TopAbs_IN,TopAbs_OUT);
}
Standard_Boolean onsort = (transLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
Standard_Boolean lastdefinie = ! lasttransLine.IsUnknown();
Standard_Boolean lastonsort = Standard_False;
if (lastdefinie) lastonsort = (lasttransLine.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
Standard_Boolean LITdefinie = Standard_False;
Standard_Boolean LITonsort = Standard_False;
TopOpeBRepDS_Transition LIT;
Handle(TopOpeBRepDS_Interference) I;
Standard_Boolean dscilempty = DSCIL.IsEmpty();
// xpu : 28-05-97 : if VP<iVP> is on 3 and
// VP on 1 has transition OUT/IN, VP on 2 has transition IN/OUT,
// same VP will be kept.
// the line is described with (VPmin,VPmax) boundaries.
// if VP is VPmax, as we are only regarding IN/OUT transitions->ok
// if VP is VPmin :
Standard_Boolean newvvv = Standard_True;// xpu : 28-05-97
if (newvvv) {
Standard_Boolean notkept = !dscilempty && (iVP == 1);
if (notkept) return Standard_False;
}// 28-05-97 : xpu
if ( !dscilempty ) {
I = DSCIL.Last();
LIT = I->Transition();
LITdefinie = ! LIT.IsUnknown();
if (LITdefinie) LITonsort = (LIT.Orientation(TopAbs_OUT) == TopAbs_FORWARD);
}
// xpu : 21-05-97 (see TopOpeBRep_FacesFiller::ProcessVPonR)
// vpmin with transition UNKNOWN =>transLine-> OUT/IN
// vpmin OUT/IN, vpmax with transition UNKNOWN =>transLine-> IN/OUT
Standard_Boolean trliunk = transLine.IsUnknown();
Standard_Boolean newvv = Standard_True;// xpu : 21-05-97
Standard_Boolean isfirstvp = (iVP == iINON1);
Standard_Boolean islastvp = (iVP == iINONn);
if (newvv && trliunk) {
if (isfirstvp) {
transLine = TopOpeBRepDS_Transition(TopAbs_OUT,TopAbs_IN);
onsort = Standard_False;
}
if (islastvp)
if (LITdefinie && !LITonsort) {
transLine = LIT.Complement();
onsort = Standard_True;
}
}//21-05-97 :xpu
Standard_Boolean hasfp = L.HasFirstPoint();
Standard_Boolean haslp = L.HasLastPoint();
Standard_Boolean hasfol = hasfp || haslp;
Standard_Boolean keep = Standard_True;
if (!LITdefinie) {
if (onsort) keep = Standard_False;
if (iVP == iINONn) keep = Standard_False;
}
if (LITdefinie) {
Standard_Boolean LprecIsEntrant = (LITdefinie && !LITonsort);
Standard_Boolean entrantsortant = LprecIsEntrant && onsort;
if(!entrantsortant) keep = Standard_False;
Standard_Boolean sameparoncouture = samepar && couture;
if (sameparoncouture && hasfol) {
if (keep) {
// INFO : on geometric line, vp parameter on line is the point on
// curve parameter.
TopOpeBRepDS_Point pntVP = TopOpeBRep_PointGeomTool::MakePoint(VP);
Standard_Boolean samegp = FUNBREP_HasSameGPoint(pntVP,I,BDS);
const TopOpeBRep_VPointInter& lastVP = L.VPoint(STATIC_lastVPind);
// if the line is not closed, same p3d and samepar represent
// same CPI.else :
if (fermee) {
// 2 vp describing a closing line describe the same 3dpoint
// have same parameter, but do not describe the same uv
// points on the closed surface (cobo121)
Standard_Boolean sameUVon1 = FUNBREP_SameUV(VP,lastVP,1,toluv);
Standard_Boolean sameUVon2 = FUNBREP_SameUV(VP,lastVP,2,toluv);
samegp = samegp && sameUVon1 && sameUVon2;
}
if (samegp) keep = Standard_False;
}
}
if (sameparoncouture && !hasfol) {
// parametrize Ifound (parameter PIfound) and next interference (parline)
Standard_Real PIfound = TopOpeBRepDS_InterferenceTool::Parameter(Ifound);
FUNBREP_Periodize(L,Ifound,PIfound,parline);
TopOpeBRepDS_InterferenceTool::Parameter(Ifound,PIfound);
if (LITdefinie) transLine = LIT.Complement();
}
}
if (keep) STATIC_lastVPind = iVP;
return keep;
} // end of FUNBREP_topogline
//-----------------------------------------------------------------------
static Standard_Boolean TopoParameter(const TopOpeBRep_LineInter& L,const Handle(TopOpeBRepDS_Interference)& I,
const Standard_Real parline,const Standard_Boolean closingedge)
//-----------------------------------------------------------------------
{
if ( I.IsNull() ) return Standard_False;
Standard_Boolean samepar = Standard_False;
Standard_Real pCPI = TopOpeBRepDS_InterferenceTool::Parameter(I);
if (! closingedge )
samepar = (Abs(parline-pCPI)<Precision::PConfusion());
else {
// trouve et couture et courbe periodique :
// on retourne vrai pour laisser a FUNBREP_topokpart
// le soin de definir correctement les couples
// (parametre, transition) pour les points confondus sur couture.
Standard_Boolean perio = L.IsPeriodic();
if ( perio ) {
samepar = Standard_True;
}
else {
samepar = (Abs(parline-pCPI)<Precision::PConfusion());
}
}
return samepar;
}
//----------------------------------------------------------------------
Standard_EXPORT Standard_Boolean FUNBREP_topokpart
(const Handle(TopOpeBRepDS_Interference)& Ifound,const TopOpeBRepDS_ListOfInterference& DSCIL,
const TopOpeBRep_LineInter& L,const TopOpeBRep_VPointInter& VP,
const TopOpeBRepDS_DataStructure& BDS,const TopoDS_Shape& E,const TopoDS_Shape& F,const Standard_Real toluv,
Standard_Real& parline,TopOpeBRepDS_Transition& transLine)
//----------------------------------------------------------------------
{
Standard_Boolean keep = Standard_True;
Standard_Boolean CPIfound = !Ifound.IsNull();
Standard_Boolean couture = TopOpeBRepTool_ShapeTool::Closed(TopoDS::Edge(E),TopoDS::Face(F));
Standard_Boolean samepar = Standard_False; // = True if current VPoint falls on an existing geometry with an equal parameter.
if (!CPIfound) samepar = Standard_False;
else samepar = CPIfound ? TopoParameter(L,Ifound,parline,couture) : Standard_False;
TopOpeBRepDS_Transition lasttransLine; if (!DSCIL.IsEmpty()) lasttransLine = DSCIL.Last()->Transition(); // xpu12-12-97
#ifdef DEB
if (TopOpeBRepDS_GettraceDSF()) {
FUNBREP_topokpartDEB(Ifound,DSCIL,L,VP,lasttransLine,BDS,E,F,toluv,
CPIfound,samepar,couture,parline,transLine);
}
#endif
// A line is valid if at least it has VPi1 and VPi2 with i1 < i2 and :
// transition on line for VPi1 : OUT/IN and for VPi2 : IN/OUT.
// When <VPj> is on j=i1/i2, we keep it (returning true).
// Rmq :VP internal to the face is given with transition on line
// OUT/IN or IN/OUT if it is on the beginning or on the end
// of the line.
if (L.TypeLineCurve() == TopOpeBRep_WALKING) {
keep = FUNBREP_topowalki(Ifound,DSCIL,L,VP,lasttransLine,BDS,E,F,toluv,
CPIfound,samepar,couture,parline,transLine);
}
else {
keep = FUNBREP_topogline(Ifound,DSCIL,L,VP,lasttransLine,BDS,E,F,toluv,
CPIfound,samepar,couture,parline,transLine);
}
return keep;
} // end of FUNBREP_tpokpart

View File

@@ -0,0 +1,131 @@
// File: TopOpeBRep_mergePDS.cxx
// Created: Thu Jun 24 11:15:21 1993
// Author: Jean Yves LEBEY
// <jyl@zerox>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopOpeBRepDS_CurveExplorer.hxx>
#include <TopOpeBRepDS_IndexedDataMapOfVertexPoint.hxx>
#include <TopOpeBRepDS_CurveExplorer.hxx>
#include <TopOpeBRepDS_Curve.hxx>
#include <TopOpeBRepDS_Point.hxx>
#include <TopOpeBRepDS.hxx>
#include <TopOpeBRep_define.hxx>
Standard_Integer BREP_findPDSamongIDMOVP(const TopOpeBRepDS_Point& PDS,const TopOpeBRepDS_IndexedDataMapOfVertexPoint& IDMOVP)
{
Standard_Integer iIDMOVP = 0;
Standard_Integer i = 1, n = IDMOVP.Extent();
for(; i <= n; i++) {
const TopOpeBRepDS_Point& PM = IDMOVP.FindFromIndex(i);
if (PDS.IsEqual(PM)) { iIDMOVP = i; break; }
}
return iIDMOVP;
}
void BREP_makeIDMOVP(const TopoDS_Shape& S,TopOpeBRepDS_IndexedDataMapOfVertexPoint& IDMOVP)
{
TopExp_Explorer Ex;
for (Ex.Init(S,TopAbs_VERTEX);Ex.More();Ex.Next()) {
const TopoDS_Vertex& v = TopoDS::Vertex(Ex.Current());
TopOpeBRepDS_Point PDS(v); IDMOVP.Add(v,PDS);
}
}
Standard_EXPORT void BREP_mergePDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
{
TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
TopOpeBRepDS_CurveExplorer cex(BDS);if (!cex.More()) return;
TopOpeBRepDS_IndexedDataMapOfVertexPoint Mvp1;
TopOpeBRepDS_IndexedDataMapOfVertexPoint Mvp2;
for (;cex.More();cex.Next()) {
const TopOpeBRepDS_Curve& c = cex.Curve(); const Standard_Integer ic = cex.Index();
TopOpeBRepDS_ListIteratorOfListOfInterference itI;itI.Initialize(BDS.ChangeCurveInterferences(ic));if (!itI.More()) continue;
const TopoDS_Face& f1 = TopoDS::Face(c.Shape1());
#ifdef DEB
Standard_Integer if1 =
#endif
BDS.Shape(f1);
const TopoDS_Face& f2 = TopoDS::Face(c.Shape2());
#ifdef DEB
Standard_Integer if2 =
#endif
BDS.Shape(f2);
Mvp1.Clear();BREP_makeIDMOVP(f1,Mvp1);
Mvp2.Clear();BREP_makeIDMOVP(f2,Mvp2);
for (; itI.More(); itI.Next()) {
Handle(TopOpeBRepDS_Interference) ITF = itI.Value();
Handle(TopOpeBRepDS_CurvePointInterference) CPI = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(ITF); if (CPI.IsNull()) continue;
TopOpeBRepDS_Kind GK = CPI->GeometryType(); if (GK != TopOpeBRepDS_POINT) continue;
Standard_Integer GI = CPI->Geometry();
//**!
if(GI > BDS.NbPoints()) continue;
//**!
const TopOpeBRepDS_Point& PDS = BDS.Point(GI);
#ifdef DEB
Standard_Integer ivp1; TopoDS_Shape v1; Standard_Boolean newv1 = Standard_False; TopOpeBRepDS_Kind k1; Standard_Integer iv1 = 0;
#else
Standard_Integer ivp1; TopoDS_Shape v1; Standard_Boolean newv1 = Standard_False; TopOpeBRepDS_Kind k1=TopOpeBRepDS_UNKNOWN; Standard_Integer iv1 = 0;
#endif
ivp1 = BREP_findPDSamongIDMOVP(PDS,Mvp1);
if (ivp1) {
v1 = Mvp1.FindKey(ivp1);
newv1 = !BDS.HasShape(v1);
iv1 = BDS.AddShape(v1);
k1 = TopOpeBRepDS_VERTEX;
}
#ifdef DEB
Standard_Integer ivp2; TopoDS_Shape v2; Standard_Boolean newv2 = Standard_False; TopOpeBRepDS_Kind k2; Standard_Integer iv2 = 0;
#else
Standard_Integer ivp2; TopoDS_Shape v2; Standard_Boolean newv2 = Standard_False; TopOpeBRepDS_Kind k2=TopOpeBRepDS_UNKNOWN; Standard_Integer iv2 = 0;
#endif
ivp2 = BREP_findPDSamongIDMOVP(PDS,Mvp2);
if (ivp2) {
v2 = Mvp2.FindKey(ivp2);
newv2 = !BDS.HasShape(v2);
iv2 = BDS.AddShape(v2);
k2 = TopOpeBRepDS_VERTEX;
}
if (ivp1 && ivp2) BDS.FillShapesSameDomain(v1,v2);
Standard_Boolean editITF = (ivp1 || ivp2);
if (editITF) {
if (ivp1) { CPI->GeometryType(k1); CPI->Geometry(iv1); }
else if (ivp2) { CPI->GeometryType(k2); CPI->Geometry(iv2); }
}
#ifdef DEB
if (editITF) {
if (ivp1 != 0) {
cout<<TopOpeBRepDS::SPrint(TopOpeBRepDS_CURVE,ic,"# BREP_mergePDS "," : ");
cout<<TopOpeBRepDS::SPrint(GK,GI,""," = ");
TCollection_AsciiString str; if (newv1) str = "new "; else str = "old ";
cout<<TopOpeBRepDS::SPrint(k1,iv1,str);
cout<<TopOpeBRepDS::SPrint(TopOpeBRepDS::ShapeToKind(f1.ShapeType()),if1," de ")<<endl;
}
if (ivp2 != 0) {
cout<<TopOpeBRepDS::SPrint(TopOpeBRepDS_CURVE,ic,"# BREP_mergePDS "," : ");
cout<<TopOpeBRepDS::SPrint(GK,GI,""," = ");
TCollection_AsciiString str; if (newv2) str = "new "; else str = "old ";
cout<<TopOpeBRepDS::SPrint(k2,iv2,str);
cout<<TopOpeBRepDS::SPrint(TopOpeBRepDS::ShapeToKind(f2.ShapeType()),if2," de ")<<endl;
}
ITF->Dump(cout,"# BREP_mergePDS resu ","\n");
}
#endif
} // itI.More()
}
} // BREP_mergePDS

View File

@@ -0,0 +1,51 @@
// File: TopOpeBRep_sort.cxx
// Created: Thu Jun 4 17:58:30 1998
// Author: Jean Yves LEBEY
// <jyl@langdox.paris1.matra-dtv.fr>
#include <TopOpeBRepDS_TKI.hxx>
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <stdlib.h>
#include <TopOpeBRep_define.hxx>
typedef Standard_Address BOA_t;
int compll(const void* v1, const void* v2) {
const TopOpeBRepDS_ListOfInterference* l1 = (const TopOpeBRepDS_ListOfInterference*)(*((long int*)v1));
const TopOpeBRepDS_ListOfInterference* l2 = (const TopOpeBRepDS_ListOfInterference*)(*((long int*)v2));
if (l1->Extent() == 0) return (0);
else if (l2->Extent() == 0) return (0);
Handle(TopOpeBRepDS_CurvePointInterference) i1 = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(l1->First()); if (i1.IsNull()) return (0);
Handle(TopOpeBRepDS_CurvePointInterference) i2 = Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(l2->First()); if (i2.IsNull()) return (0);
Standard_Real p1 = i1->Parameter();
Standard_Real p2 = i2->Parameter();
if (p1 < p2) return (-1);
else if (p1 > p2) return (1);
else return (0);
return (0);
}
Standard_EXPORT void BREP_sortonparameter2(TopOpeBRepDS_ListOfInterference& LOI)
{
TopOpeBRepDS_TKI tki;tki.FillOnGeometry(LOI);
Standard_Integer ng=0; for(tki.Init();tki.More();tki.Next()) ng++;
size_t sng=(size_t)ng;size_t sad=sizeof(BOA_t);
BOA_t* T = (BOA_t*)malloc((size_t)(sng*sad));TopOpeBRepDS_Kind K;Standard_Integer G;Standard_Integer j=0;
for(tki.Init();tki.More();tki.Next(),j++) T[j]=(BOA_t)&(tki.Value(K,G));
qsort(T,sng,sad,compll);
LOI.Clear();for(j=0;j<ng;j++) {TopOpeBRepDS_ListOfInterference& l=*((TopOpeBRepDS_ListOfInterference*)T[j]);LOI.Append(l);}
free(T);
}
Standard_EXPORT void BREP_sortonparameter(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
{
TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
Standard_Integer i=1, n=HDS->NbShapes();
for (; i<=n; i++) {
const TopoDS_Shape& s = HDS->Shape(i);
if (s.ShapeType() != TopAbs_EDGE) continue;
TopOpeBRepDS_ListOfInterference& LOI = BDS.ChangeShapeInterferences(s);
BREP_sortonparameter2(LOI);
}
}

View File

@@ -0,0 +1,11 @@
// File: TopOpeBRep_tools.hxx
// Created: Fri Nov 28 15:24:39 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifndef _TopOpeBRep_tools_HeaderFile
#define _TopOpeBRep_tools_HeaderFile
#include <TopOpeBRepDS_tools.hxx>
#endif

View File

@@ -0,0 +1,149 @@
// File: TopOpeBRep_trace.cxx
// Created: Mon Jan 29 16:34:39 1996
// Author: Jean Yves LEBEY
#ifdef DEB
#include <Standard_Type.hxx>
//#include <Standard_OStream.hxx>
//#include <stdio.h>
static Standard_Boolean TopOpeBRep_traceFITOL = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceFITOL(const Standard_Boolean b)
{ TopOpeBRep_traceFITOL = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceFITOL()
{ return TopOpeBRep_traceFITOL; }
static Standard_Boolean TopOpeBRep_traceFI = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceFI(const Standard_Boolean b)
{ TopOpeBRep_traceFI = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceFI()
{ return TopOpeBRep_traceFI; }
static Standard_Boolean TopOpeBRep_traceSAVFF = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceSAVFF(const Standard_Boolean b)
{ TopOpeBRep_traceSAVFF = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSAVFF()
{ return TopOpeBRep_traceSAVFF; }
static Standard_Boolean TopOpeBRep_tracePROEDG = Standard_False;
Standard_EXPORT void TopOpeBRep_SettracePROEDG(const Standard_Boolean b)
{ TopOpeBRep_tracePROEDG = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettracePROEDG()
{ return TopOpeBRep_tracePROEDG; }
static Standard_Boolean TopOpeBRep_contextNOPROEDG = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextNOPROEDG(const Standard_Boolean b)
{ TopOpeBRep_contextNOPROEDG = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNOPROEDG()
{ return TopOpeBRep_contextNOPROEDG; }
static Standard_Boolean TopOpeBRep_contextFFOR = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextFFOR(const Standard_Boolean b)
{ TopOpeBRep_contextFFOR = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextFFOR()
{ return TopOpeBRep_contextFFOR; }
static Standard_Boolean TopOpeBRep_contextNOPUNK = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextNOPUNK(const Standard_Boolean b)
{ TopOpeBRep_contextNOPUNK = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNOPUNK()
{ return TopOpeBRep_contextNOPUNK; }
static Standard_Boolean TopOpeBRep_contextNOFEI = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextNOFEI(const Standard_Boolean b)
{ TopOpeBRep_contextNOFEI = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNOFEI()
{ return TopOpeBRep_contextNOFEI; }
static Standard_Boolean TopOpeBRep_traceSI = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceSI(const Standard_Boolean b) { TopOpeBRep_traceSI = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSI() { return TopOpeBRep_traceSI; }
static Standard_Boolean TopOpeBRep_traceBIPS = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceBIPS(const Standard_Boolean b) { TopOpeBRep_traceBIPS = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceBIPS() { return TopOpeBRep_traceBIPS; }
static Standard_Boolean TopOpeBRep_traceCONIC = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceCONIC(const Standard_Boolean b) { TopOpeBRep_traceCONIC = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceCONIC() { return TopOpeBRep_traceCONIC; }
static Standard_Boolean TopOpeBRep_contextREST1 = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextREST1(const Standard_Boolean b) { TopOpeBRep_contextREST1 = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextREST1(char* str) {
if (TopOpeBRep_contextREST1) {
cout<<"context REST1 actif"; if (str!=NULL) cout<<str; cout<<endl;
}
return TopOpeBRep_contextREST1;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextREST1() {
if (TopOpeBRep_contextREST1) cout<<"context REST1 actif"<<endl;
return TopOpeBRep_contextREST1;
}
static Standard_Boolean TopOpeBRep_contextREST2 = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextREST2(const Standard_Boolean b) { TopOpeBRep_contextREST2 = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextREST2(char* str) {
if (TopOpeBRep_contextREST2) {
cout<<"context REST2 actif"; if (str!=NULL) cout<<str; cout<<endl;
}
return TopOpeBRep_contextREST2;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextREST2() {
if (TopOpeBRep_contextREST2) cout<<"context REST2 actif"<<endl;
return TopOpeBRep_contextREST2;
}
static Standard_Boolean TopOpeBRep_contextINL = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextINL(const Standard_Boolean b) { TopOpeBRep_contextINL = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextINL(char* str) {
if (TopOpeBRep_contextINL) {
cout<<"context INL actif"; if (str!=NULL) cout<<str; cout<<endl;
}
return TopOpeBRep_contextINL;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextINL() {
if (TopOpeBRep_contextINL) cout<<"context INL actif"<<endl;
return TopOpeBRep_contextINL;
}
static Standard_Boolean TopOpeBRep_contextNEWKP = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextNEWKP(const Standard_Boolean b) { TopOpeBRep_contextNEWKP = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNEWKP(char* str) {
if (TopOpeBRep_contextNEWKP) {
cout<<"context NEWKP actif"; if (str!=NULL) cout<<str; cout<<endl;
}
return TopOpeBRep_contextNEWKP;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNEWKP() {
if (TopOpeBRep_contextNEWKP) cout<<"context NEWKP actif"<<endl;
return TopOpeBRep_contextNEWKP;
}
static Standard_Boolean TopOpeBRep_contextTOL0 = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextTOL0(const Standard_Boolean b) { TopOpeBRep_contextTOL0 = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextTOL0(char* str) {
if (TopOpeBRep_contextTOL0) {
}
return TopOpeBRep_contextTOL0;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextTOL0() {
if (TopOpeBRep_contextTOL0) cout<<"context TOL0 actif"<<endl;
return TopOpeBRep_contextTOL0;
}
static Standard_Boolean TopOpeBRep_contextNONOG = Standard_False;
Standard_EXPORT void TopOpeBRep_SetcontextNONOG(const Standard_Boolean b) { TopOpeBRep_contextNONOG = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNONOG(char* str) {
if (TopOpeBRep_contextNONOG) {
cout<<"context NONOG actif"; if (str!=NULL) cout<<str; cout<<endl;
}
return TopOpeBRep_contextNONOG;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GetcontextNONOG() {
if (TopOpeBRep_contextNONOG) cout<<"context NONOG actif"<<endl;
return TopOpeBRep_contextNONOG;
}
// #ifdef DEB
#endif

View File

@@ -0,0 +1,114 @@
// File: TopOpeBRep_traceALWL.cxx
// Created: Wed Oct 22 17:38:26 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef DEB
#include <Standard_Type.hxx>
class TopOpeBRep_ALWL {
public:
TopOpeBRep_ALWL
(const char* name,const Standard_Boolean b = Standard_False);
void Set(const Standard_Boolean b)
{ mydefdef = mypasdef = mynbpdef = myonetrue = b; }
void SetDef(const Standard_Real p)
{ mydeflectionmax = p; mydefdef = Standard_True; }
void SetPas(const Standard_Real p)
{ mypasUVmax = p; mypasdef = Standard_True; }
void SetNbp(const Standard_Integer p)
{ mynbpointsmax = p; mynbpdef = Standard_True; }
Standard_Boolean GetDef(Standard_Real& p)
{ p = mydeflectionmax; return mydefdef; }
Standard_Boolean GetPas(Standard_Real& p)
{ p = mypasUVmax; return mypasdef; }
Standard_Boolean GetNbp(Standard_Integer& p)
{ p = mynbpointsmax; return mynbpdef; }
Standard_Boolean Get()
{ return myonetrue; }
void Set(const Standard_Boolean b, Standard_Integer n, char** a);
void Print();
private:
Standard_Real mydeflectionmax;
Standard_Boolean mydefdef;
Standard_Real mypasUVmax;
Standard_Boolean mypasdef;
Standard_Integer mynbpointsmax;
Standard_Boolean mynbpdef;
Standard_Boolean myonetrue;
char myname[100];
};
TopOpeBRep_ALWL::TopOpeBRep_ALWL(const char* name, const Standard_Boolean b) :
mydeflectionmax(0.01),mydefdef(Standard_False),
mypasUVmax(0.05),mypasdef(Standard_False),
mynbpointsmax(200),mynbpdef(Standard_False)
{
strcpy(myname,name);
Set(b);
}
void TopOpeBRep_ALWL::Set(const Standard_Boolean b,
Standard_Integer n, char** a)
{
if (!n) Set(b);
else {
Set(Standard_False);
for (Standard_Integer i=0; i < n; i++) {
const char *p = a[i];
if ( !strcasecmp(p,"def") ) {
if ( ++i < n ) SetDef(atof(a[i]));
}
else if ( !strcasecmp(p,"pas") ) {
if ( ++i < n ) SetPas(atof(a[i]));
}
else if ( !strcasecmp(p,"nbp") ) {
if ( ++i < n ) SetNbp(atoi(a[i]));
}
}
}
myonetrue = mydefdef || mypasdef || mynbpdef;
Print();
}
void TopOpeBRep_ALWL::Print()
{
cout<<myname<<" defined :";
Standard_Integer n = 0;
if (mydefdef) { cout<<" Def = "<<mydeflectionmax; n++; }
if (mypasdef) { cout<<" Pas = "<<mypasUVmax; n++; }
if (mynbpdef) { cout<<" Nbp = "<<mynbpointsmax; n++; }
if (!n) cout<<" none";
cout<<endl;
}
static TopOpeBRep_ALWL TopOpeBRep_contextALWL
("LineGeomTool ALWL parameters");
void TopOpeBRep_SetcontextALWL
(const Standard_Boolean b, Standard_Integer narg, char** a)
{ TopOpeBRep_contextALWL.Set(b,narg,a); }
Standard_Boolean TopOpeBRep_GetcontextALWLNBP(Standard_Integer& n)
{ Standard_Boolean b = TopOpeBRep_contextALWL.GetNbp(n);
return b;
}
// #ifdef DEB
#endif

View File

@@ -0,0 +1,137 @@
// File: TopOpeBRep_traceBOOPNINT.cxx
// Created: Wed Oct 22 17:37:04 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifdef DEB
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopOpeBRepTool_define.hxx>
#define AS(x) (Standard_PCharacter)TCollection_AsciiString((x)).ToCString();
#define I 10
#define J 10
#define OK(x,y) (x)<I&&(y)<J
#define T(x,y) myT[(x)][(y)]
#define L0(x,y) for((x)=0;(x)<(y);(x)++)
#define A(v) (atoi(a[(v)]))
class BOOPNINTL{
public:BOOPNINTL();
Standard_Boolean Get(Standard_Integer n,char**a);
Standard_Integer Set(const Standard_Boolean b,Standard_Integer n,char**a);
private:
TColStd_ListOfInteger myTL[I];
Standard_Boolean myTB[I];
Standard_Integer mynl;
};
BOOPNINTL::BOOPNINTL(){Set(Standard_False,0,NULL);}
Standard_Integer BOOPNINTL::Set(const Standard_Boolean b,Standard_Integer n,char**a)
{
if(n == 0) {
Standard_Integer i; L0(i,I) { myTB[i] = Standard_False; myTL[i].Clear(); }
mynl = 0;
return 0;
}
else if (mynl + 1 < I) {
myTB[mynl] = b; Standard_Integer i; L0(i,n) myTL[mynl].Append(atoi(a[i]));
mynl++;
return 0;
}
else {
return 1;
}
return 0;
}
Standard_Boolean BOOPNINTL::Get(Standard_Integer n,char**a){
if(!n)return Standard_False;
Standard_Integer il;
L0(il,mynl) {
const TColStd_ListOfInteger& L = myTL[il];
if (L.IsEmpty()) continue;
TColStd_ListIteratorOfListOfInteger itL(L);
Standard_Integer ia = 0;
Standard_Boolean found = Standard_True;
for (;itL.More() && (ia < n); itL.Next(),ia++) {
Standard_Integer Lval = itL.Value();
Standard_Integer aval = atoi(a[ia]);
if (Lval != aval) {
found = Standard_False;
break;
}
}
if (found) {
return myTB[il];
}
}
return Standard_False;
}
// ===========
static Standard_Boolean TopOpeBRep_traceEEFF = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceEEFF(const Standard_Boolean b) { TopOpeBRep_traceEEFF = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF() { return TopOpeBRep_traceEEFF; }
BOOPNINTL BOOPEEFF;
Standard_EXPORT Standard_Integer TopOpeBRep_SettraceEEFF(const Standard_Boolean b,Standard_Integer n,char**a)
{
Standard_Integer err = BOOPEEFF.Set(b,n,a); if (n==0) TopOpeBRep_SettraceEEFF(b); return err;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF(Standard_Integer n,char**a)
{ Standard_Boolean b = BOOPEEFF.Get(n,a); return b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceEEFF(const Standard_Integer i1,const Standard_Integer i2,const Standard_Integer i3,const Standard_Integer i4)
{
char* t[4]; t[0]=AS(i1);t[1]=AS(i2);t[2]=AS(i3);t[3]=AS(i4);
Standard_Boolean b = BOOPEEFF.Get(4,t); return b;
}
// ===========
static Standard_Boolean TopOpeBRep_traceNVP = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceNVP(const Standard_Boolean b) { TopOpeBRep_traceNVP = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP() { return TopOpeBRep_traceNVP; }
BOOPNINTL BOOPNVP;
Standard_EXPORT Standard_Integer TopOpeBRep_SettraceNVP(const Standard_Boolean b,Standard_Integer n,char**a)
{
Standard_Integer err = BOOPNVP.Set(b,n,a); if (n==0) TopOpeBRep_SettraceNVP(b); return err;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer n,char**a)
{ Standard_Integer b = BOOPNVP.Get(n,a); return b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer i1,Standard_Integer i2,Standard_Integer i3,Standard_Integer i4,Standard_Integer i5)
{
char* t[5]; t[0]=AS(i1);t[1]=AS(i2);t[2]=AS(i3);t[3]=AS(i4);t[4]=AS(i5);
Standard_Boolean b = BOOPNVP.Get(5,t);return b;
}
// ===========
static Standard_Boolean TopOpeBRep_traceSHA = Standard_False;
Standard_EXPORT void TopOpeBRep_SettraceSHA(const Standard_Boolean b) { TopOpeBRep_traceSHA = b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA() { return TopOpeBRep_traceSHA; }
BOOPNINTL BOOPSHA;
Standard_EXPORT Standard_Integer TopOpeBRep_SettraceSHA(const Standard_Boolean b,Standard_Integer n,char**a)
{
Standard_Integer err = BOOPSHA.Set(b,n,a); if (n==0) TopOpeBRep_SettraceSHA(b); return err;
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA(Standard_Integer n,char**a)
{ Standard_Integer b = BOOPSHA.Get(n,a); return b; }
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSHA(const Standard_Integer i1)
{
char* t[1]; t[0]=AS(i1);
Standard_Boolean b = BOOPSHA.Get(1,t);return b;
}
// #ifdef DEB
#endif

View File

@@ -0,0 +1,120 @@
// File: TopOpeBRep_traceSIFF.cxx
// Created: Wed Oct 22 18:57:02 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifdef DEB
#include <TopOpeBRep_traceSIFF.hxx>
#include <stdio.h>
TopOpeBRep_traceSIFF::TopOpeBRep_traceSIFF()
{
Reset();
}
void TopOpeBRep_traceSIFF::Reset()
{
mybrep1 = "";
mybrep2 = "";
myfilename = "";
myopen = Standard_False;
}
void TopOpeBRep_traceSIFF::Set(const Standard_Boolean b,
Standard_Integer n,
char**a)
{
if (n < 3 || !b || a == NULL) {
Reset();
return;
}
mybrep1 = a[0];
mybrep2 = a[1];
myfilename = a[2];
}
void TopOpeBRep_traceSIFF::Set(const TCollection_AsciiString& brep1,
const TCollection_AsciiString& brep2,
const TCollection_AsciiString& filename)
{
mybrep1 = brep1;
mybrep2 = brep2;
myfilename = filename;
}
TCollection_AsciiString TopOpeBRep_traceSIFF::Name1(const Standard_Integer I) const
{
TCollection_AsciiString s = mybrep1 + "_" + I;
return s;
}
TCollection_AsciiString TopOpeBRep_traceSIFF::Name2(const Standard_Integer I) const
{
TCollection_AsciiString s = mybrep2 + "_" + I;
return s;
}
const TCollection_AsciiString& TopOpeBRep_traceSIFF::File() const
{
return myfilename;
}
Standard_Boolean TopOpeBRep_traceSIFF::Start(const TCollection_AsciiString& s,
Standard_OStream& OS)
{
Standard_CString cs = myfilename.ToCString();
myopen = Standard_True;
if (!myfilebuf.open(cs,ios::out)) {
myopen = Standard_False;
}
if (!myopen) {
return myopen;
}
ostream osfic(&myfilebuf); osfic.precision(15);
if (s.Length()) {
OS<<s<<myfilename<<endl;
}
return myopen;
}
void TopOpeBRep_traceSIFF::Add(const Standard_Integer I1,
const Standard_Integer I2)
{
if (!myopen) {
return;
}
TCollection_AsciiString n1 = Name1(I1);
TCollection_AsciiString n2 = Name2(I2);
ostream osfic(&myfilebuf);
osfic<<n1<<" "<<n2<<"\n";
}
void TopOpeBRep_traceSIFF::End(const TCollection_AsciiString& s,
Standard_OStream& OS)
{
if (!myopen) {
return;
}
if (s.Length()) {
OS<<s<<myfilename<<endl;
}
myopen = Standard_False;
}
//////////////////////////////////////////////////////////////////////////
Standard_EXPORT TopOpeBRep_traceSIFF SIFF;
Standard_EXPORT void TopOpeBRep_SettraceSIFF(const Standard_Boolean b,
Standard_Integer n,char**a)
{
SIFF.Set(b,n,a);
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSIFF()
{
Standard_Boolean b = (SIFF.File().Length() != 0);
return b;
}
// #ifdef DEB
#endif

View File

@@ -0,0 +1,50 @@
// File: TopOpeBRep_traceSIFF.hxx
// Created: Wed Oct 22 18:57:02 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifndef _TopOpeBRep_traceSIFF_HeaderFile
#define _TopOpeBRep_traceSIFF_HeaderFile
#ifdef DEB
#include <TopOpeBRepTool_define.hxx>
#include <Standard_OStream.hxx>
#include <TopoDS_Shape.hxx>
class TopOpeBRep_traceSIFF {
public:
TopOpeBRep_traceSIFF();
void Reset();
void Set(const Standard_Boolean b,
Standard_Integer n,
char**a);
void Set(const TCollection_AsciiString& brep1,
const TCollection_AsciiString& brep2,
const TCollection_AsciiString& n);
TCollection_AsciiString Name1(const Standard_Integer I) const;
TCollection_AsciiString Name2(const Standard_Integer I) const;
const TCollection_AsciiString& File() const;
Standard_Boolean Start(const TCollection_AsciiString& s,
Standard_OStream& OS);
void Add(const Standard_Integer I1,
const Standard_Integer I2);
void End(const TCollection_AsciiString& s,
Standard_OStream& OS);
private:
TCollection_AsciiString mybrep1,mybrep2,myfilename;
filebuf myfilebuf;
Standard_Boolean myopen;
};
// #ifdef DEB
#endif
// #define _TopOpeBRep_traceSIFF_HeaderFile
#endif

1234
src/TopOpeBRep/TopOpeBRep_vpr.cxx Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,242 @@
// File: TopOpeBRep_FacesFiller_VPonR.cxx
// Created: Fri Aug 4 10:57:30 1995
// Author: Jean Yves LEBEY
// <jyl@meteox>
#include <TopOpeBRep_FacesFiller.ixx>
#include <TopOpeBRepTool_ShapeTool.hxx>
#include <TopOpeBRepTool_EXPORT.hxx>
#include <TopOpeBRepTool_makeTransition.hxx>
#include <TopOpeBRepDS_PointIterator.hxx>
#include <TopOpeBRepDS_define.hxx>
#include <TopOpeBRepDS_repvg.hxx> // LOIinfsup
#include <TopOpeBRepDS_EXPORT.hxx>
#include <TopOpeBRep_define.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <gp_Vec.hxx>
#define M_ON(st) (st == TopAbs_ON)
#define M_REVERSED(st) (st == TopAbs_REVERSED)
#ifdef DEB
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer i1);
Standard_EXPORT void debarc(const Standard_Integer i);
Standard_EXPORT void debooarc(const Standard_Integer i);
#endif
Standard_EXPORT Handle(TopOpeBRepDS_Interference) MakeEPVInterference
(const TopOpeBRepDS_Transition& T, // transition
const Standard_Integer S, // curve/edge index
const Standard_Integer G, // point/vertex index
const Standard_Real P, // parameter of G on S
const TopOpeBRepDS_Kind GK,
const Standard_Boolean B); // G is a vertex (or not) of the interference master
Standard_EXPORT Handle(TopOpeBRepDS_Interference) MakeEPVInterference
(const TopOpeBRepDS_Transition& T, // transition
const Standard_Integer S, // curve/edge index
const Standard_Integer G, // point/vertex index
const Standard_Real P, // parameter of G on S
const TopOpeBRepDS_Kind GK, // POINT/VERTEX
const TopOpeBRepDS_Kind SK,
const Standard_Boolean B); // G is a vertex (or not) of the interference master
static Standard_Boolean FUN_INlos(const TopoDS_Shape& S, const TopTools_ListOfShape& loS)
{
TopTools_ListIteratorOfListOfShape it(loS);
for (; it.More(); it.Next())
if (it.Value().IsSame(S)) return Standard_True;
return Standard_False;
}
//=======================================================================
//function : GetEdgeTrans
//purpose : Computes E<Sind> transition on <F> at point <VP>
// Computes FORWARD or REVERSED transitions,
// returns transition UNKNOWN elsewhere.
//=======================================================================
TopOpeBRepDS_Transition TopOpeBRep_FacesFiller::GetEdgeTrans(const TopOpeBRep_VPointInter& VP,const TopOpeBRepDS_Kind PVKind,
const Standard_Integer PVIndex,const Standard_Integer ShapeIndex,const TopoDS_Face& F)
{
// VP is on couture <Ec> of rank <sind>
// on face <F> of rank <oosind>.
Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
Standard_Integer vpsind = VP.ShapeIndex();
Standard_Boolean on2edges = (vpsind == 3);
Standard_Boolean isvalid = on2edges || (vpsind == ShapeIndex);
if (!isvalid) Standard_Failure::Raise("TopOpeBRep_FacesFiller::GetEdgeTrans");
const TopoDS_Edge& edge = TopoDS::Edge(VP.Edge(ShapeIndex));
Standard_Real paredge = VP.EdgeParameter(ShapeIndex);
TopoDS_Edge OOedge;
#ifdef DEB
Standard_Real OOparedge;
#else
Standard_Real OOparedge=0;
#endif
Standard_Boolean hasONedge = (VP.State(OOShapeIndex) == TopAbs_ON);
Standard_Boolean hasOOedge = (on2edges) ? Standard_True : hasONedge;
if ( hasOOedge ) {
if (on2edges) OOparedge = VP.EdgeParameter(OOShapeIndex);
else OOparedge = VP.EdgeONParameter(OOShapeIndex);
TopoDS_Shape OOe;
if (on2edges) OOe = VP.Edge(OOShapeIndex);
else OOe = VP.EdgeON(OOShapeIndex);
OOedge = TopoDS::Edge(OOe);
}
gp_Pnt2d OOuv = VP.SurfaceParameters(OOShapeIndex);
Standard_Real par1,par2;
Standard_Integer SIedgeIndex = (myHDS->HasShape(edge)) ? myHDS->Shape(edge) : 0;
// if (SIedgeIndex != 0) FDS_getupperlower(myHDS,SIedgeIndex,paredge,par1,par2);
if (SIedgeIndex != 0) {
Standard_Boolean isonboundper;
FDS_LOIinfsup(myHDS->DS(),edge,paredge,PVKind,PVIndex,
myHDS->DS().ShapeInterferences(edge),par1,par2,isonboundper);
}
else
FUN_tool_bounds(edge,par1,par2);
TopOpeBRepDS_Transition T;
// xpu : 16-01-98
// <Tr> relative to 3d <OOface> matter,
// we take into account <Tr> / 2d <OOface> only if <edge> is normal to <OOface>
Standard_Real tola = Precision::Angular()*1.e+2; //dealing with tolerances
Standard_Boolean EtgF = FUN_tool_EtgF(paredge,edge,OOuv,F,tola);
Standard_Boolean rest = FUN_INlos(edge,myERL);
Standard_Boolean isse = myHDS->DS().IsSectionEdge(edge);
rest = rest || isse;
Standard_Boolean interf2d = EtgF && hasOOedge && rest;
Standard_Real factor = 1.e-4;
TopOpeBRepTool_makeTransition MKT;
Standard_Boolean ok = MKT.Initialize(edge,par1,par2,paredge, F,OOuv, factor);
if (!ok) return T;
Standard_Boolean isT2d = MKT.IsT2d();
interf2d = interf2d && isT2d;
if (interf2d) ok = MKT.SetRest(OOedge,OOparedge);
if (!ok) return T;
TopAbs_State stb,sta; ok = MKT.MkTonE(stb,sta);
if (!ok) return T;
T.Before(stb); T.After(sta);
return T;
}
//=======================================================================
//function : ProcessVPonclosingR
//purpose : SUPPLYING INTPATCH when <VP> is on closing arc.
//=======================================================================
void TopOpeBRep_FacesFiller::ProcessVPonclosingR(const TopOpeBRep_VPointInter& VP,
// const TopoDS_Shape& GFace,
const TopoDS_Shape& ,
const Standard_Integer ShapeIndex,
const TopOpeBRepDS_Transition& transEdge,const TopOpeBRepDS_Kind PVKind, const Standard_Integer PVIndex,
// const Standard_Boolean EPIfound,
const Standard_Boolean ,
// const Handle(TopOpeBRepDS_Interference)& IEPI)
const Handle(TopOpeBRepDS_Interference)& )
{
// Standard_Boolean isvertex = VP.IsVertex(ShapeIndex);
Standard_Boolean isvertex = (PVKind == TopOpeBRepDS_VERTEX);
Standard_Integer absindex = VP.ShapeIndex(); // 0,1,2,3
#ifdef DEB
Standard_Integer iVP =
#endif
VP.Index();
Standard_Boolean OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
Standard_Boolean on2edges = (absindex == 3);
Standard_Boolean hasONedge = (VP.State(OOShapeIndex) == TopAbs_ON);
Standard_Boolean hasOOedge = (on2edges) ? Standard_True : hasONedge;
TopoDS_Face Face = (*this).Face(ShapeIndex);
#ifdef DEB
Standard_Integer iSIFace =
#endif
myDS->Shape(Face);
TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
Standard_Integer iOOFace = myDS->Shape(OOFace);
if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
// current VPoint is on <edge>
Standard_Integer SIedgeIndex = 0;
const TopoDS_Edge& edge = TopoDS::Edge(VP.Edge(ShapeIndex));
if (myDS->HasShape(edge)) SIedgeIndex = myDS->Shape(edge);
else myDS->AddShape(edge,ShapeIndex);
#ifdef DEB
Standard_Boolean isrest =
#endif
myDS->IsSectionEdge(edge);
#ifdef DEB
Standard_Boolean closing =
#endif
TopOpeBRepTool_ShapeTool::Closed(edge,Face);
Standard_Real paredge = VP.EdgeParameter(ShapeIndex);
// dummy if !<hasOOedge>
Standard_Integer OOedgeIndex = 0;
Standard_Boolean OOclosing,OOisrest; OOclosing = OOisrest = Standard_False;
TopoDS_Edge OOedge;
if ( hasOOedge ) {
TopoDS_Shape OOe;
if (on2edges) OOe = VP.Edge(OOShapeIndex);
else OOe = VP.EdgeON(OOShapeIndex);
OOedge = TopoDS::Edge(OOe);
OOisrest = myDS->IsSectionEdge(OOedge);
OOclosing = TopOpeBRepTool_ShapeTool::Closed(OOedge,OOFace);
if (myDS->HasShape(OOedge)) OOedgeIndex = myDS->Shape(OOedge);
else OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
}
#ifdef DEB
Standard_Boolean traceDSF = TopOpeBRepDS_GettraceDSF();
Standard_Boolean trce = TopOpeBRepDS_GettraceSPSX(SIedgeIndex); if(trce) debarc(SIedgeIndex);
Standard_Boolean trcooe = TopOpeBRepDS_GettraceSPSX(OOedgeIndex); if(trcooe) debooarc(OOedgeIndex);
#endif
// ===================================================================
// --- Edge/(POINT,VERTEX) Interference (EPI) creation ---
// ===================================================================
// 1. <edge> enters or outers myF<OOShapeIndex> at <VP>,
// transition <transEdge> returned by IntPatch is valid (FORWARD/REVERSED).
// 2. <edge> is tangent to myF<OOShapeIndex> :
// transEdge should be INTERNAL/EXTERNAL.
Standard_Boolean Tunk = transEdge.IsUnknown();
#ifdef DEB
if (!Tunk && traceDSF) cout<<"-> on closing : transAdd = "<<endl;
#endif
TopOpeBRepDS_Transition transAdd;
Standard_Boolean newtransEdge = Tunk;
if (newtransEdge) transAdd = GetEdgeTrans(VP,PVKind,PVIndex,ShapeIndex,OOFace);
else transAdd = transEdge;
// !!! if the compute of <transAdd> fails, we add transEdge.
// hasOOedge : <VP> is ON edge <edge> and ON <OOFace>
// !hasOOedge : <VP> is ON edge <edge> and IN <OOFace>
{
TopOpeBRepDS_Transition T = transAdd; T.Index(iOOFace);
Handle(TopOpeBRepDS_Interference) EPI = ::MakeEPVInterference
(T,iOOFace,PVIndex,paredge,PVKind,TopOpeBRepDS_FACE,isvertex);
myHDS->StoreInterference(EPI,edge);
}
if (hasOOedge) {
TopOpeBRepDS_Transition T = transAdd; T.Index(iOOFace);
Handle(TopOpeBRepDS_Interference) EPI = ::MakeEPVInterference
(T,OOedgeIndex,PVIndex,paredge,PVKind,isvertex);
myHDS->StoreInterference(EPI,edge);
}
} // ProcessVPonclosingR

File diff suppressed because it is too large Load Diff