mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-12 17:50:35 +05:00
Porting to new BOP
This commit is contained in:
parent
5c8f2ccfa7
commit
c03ae2d3bc
@ -1,4 +1,3 @@
|
||||
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
@ -20,579 +19,123 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_AlgoTools_1.cxx
|
||||
// File : GEOMAlgo_AlgoTools_2.cxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
#include <BRep_TVertex.hxx>
|
||||
#include <BRep_TEdge.hxx>
|
||||
#include <BRep_TFace.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_GCurve.hxx>
|
||||
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
|
||||
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
|
||||
#include <BRep_CurveRepresentation.hxx>
|
||||
#include <BRep_PointRepresentation.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom2dAdaptor.hxx>
|
||||
#include <GeomProjLib.hxx>
|
||||
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
void CheckEdge (const TopoDS_Edge& E,
|
||||
const Standard_Real aMaxTol);
|
||||
static
|
||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||
const TopoDS_Face& S,
|
||||
const Standard_Real aMaxTol);
|
||||
static
|
||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
const Adaptor3d_Curve& Other,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean SameParameter,
|
||||
Standard_Real& aNewTolerance);
|
||||
|
||||
//
|
||||
static
|
||||
void CorrectVertexTolerance(const TopoDS_Edge& aE);
|
||||
//
|
||||
void ProcessBlock(const TopoDS_Shape& aF,
|
||||
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
TopTools_IndexedMapOfShape& aProcessed,
|
||||
TopTools_IndexedMapOfShape& aChain);
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectTolerances
|
||||
// function: FindChains
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::CorrectTolerances(const TopoDS_Shape& aShape,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
GEOMAlgo_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol);
|
||||
GEOMAlgo_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectPointOnCurve
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::CorrectPointOnCurve(const TopoDS_Shape& S,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
Standard_Integer i, aNb;
|
||||
TopTools_IndexedMapOfShape Edges;
|
||||
TopExp::MapShapes (S, TopAbs_EDGE, Edges);
|
||||
aNb=Edges.Extent();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
|
||||
CheckEdge(E, aMaxTol);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectCurveOnSurface
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::CorrectCurveOnSurface(const TopoDS_Shape& S,
|
||||
const Standard_Real aMaxTol)
|
||||
{
|
||||
Standard_Integer i, aNbFaces, j, aNbEdges;
|
||||
TopTools_IndexedMapOfShape Faces;
|
||||
TopExp::MapShapes (S, TopAbs_FACE, Faces);
|
||||
|
||||
aNbFaces=Faces.Extent();
|
||||
for (i=1; i<=aNbFaces; i++) {
|
||||
const TopoDS_Face& F= TopoDS::Face(Faces(i));
|
||||
TopTools_IndexedMapOfShape Edges;
|
||||
TopExp::MapShapes (F, TopAbs_EDGE, Edges);
|
||||
aNbEdges=Edges.Extent();
|
||||
for (j=1; j<=aNbEdges; j++) {
|
||||
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
|
||||
CorrectEdgeTolerance (E, F, aMaxTol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CorrectEdgeTolerance
|
||||
// purpose : Correct tolerances for Edge
|
||||
//=======================================================================
|
||||
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
|
||||
const TopoDS_Face& S,
|
||||
const Standard_Real aMaxTol)
|
||||
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
|
||||
{
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
|
||||
//
|
||||
// 1. Minimum of conditions to Perform
|
||||
Handle (BRep_CurveRepresentation) myCref;
|
||||
Handle (Adaptor3d_HCurve) myHCurve;
|
||||
|
||||
myCref.Nullify();
|
||||
|
||||
Handle(BRep_TEdge)& TEx = *((Handle(BRep_TEdge)*)&myShape.TShape());
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcrx(TEx->Curves());
|
||||
Standard_Boolean Degenerated, SameParameterx, SameRangex;
|
||||
|
||||
Standard_Integer unique = 0;
|
||||
|
||||
Degenerated = TEx->Degenerated();
|
||||
SameParameterx = TEx->SameParameter();
|
||||
SameRangex = TEx->SameRange();
|
||||
|
||||
if (!SameRangex && SameParameterx) {
|
||||
aItCS.Initialize(aLCS);
|
||||
for (; aItCS.More(); aItCS.Next()) {
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value();
|
||||
//
|
||||
const TopoDS_Shape& aF1=aCS.Shape1();
|
||||
const TopoDS_Shape& aF2=aCS.Shape2();
|
||||
//
|
||||
//
|
||||
if (aMCV.Contains(aF1)) {
|
||||
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1);
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
aMCV.Add(aF1, aMV);
|
||||
}
|
||||
//
|
||||
if (aMCV.Contains(aF2)) {
|
||||
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2);
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
aMCV.Add(aF2, aMV);
|
||||
}
|
||||
}
|
||||
GEOMAlgo_AlgoTools::FindChains(aMCV, aMapChains);
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FindChains
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
|
||||
{
|
||||
Standard_Integer i, j, aNbCV, aNbV;
|
||||
TopTools_IndexedMapOfShape aProcessed, aChain;
|
||||
//
|
||||
aNbCV=aMCV.Extent();
|
||||
for (i=1; i<=aNbCV; ++i) {
|
||||
const TopoDS_Shape& aF=aMCV.FindKey(i);
|
||||
if (aProcessed.Contains(aF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aProcessed.Add(aF);
|
||||
aChain.Add(aF);
|
||||
//
|
||||
const TopTools_IndexedMapOfShape& aMV=aMCV(i);
|
||||
aNbV=aMV.Extent();
|
||||
for (j=1; j<=aNbV; ++j) {
|
||||
const TopoDS_Shape& aFx=aMV(j);
|
||||
ProcessBlock(aFx, aMCV, aProcessed, aChain);
|
||||
}
|
||||
aMapChains.Add(aF, aChain);
|
||||
aChain.Clear();
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: ProcessBlock
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void ProcessBlock(const TopoDS_Shape& aF,
|
||||
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
TopTools_IndexedMapOfShape& aProcessed,
|
||||
TopTools_IndexedMapOfShape& aChain)
|
||||
{
|
||||
Standard_Integer j, aNbV;
|
||||
//
|
||||
if (aProcessed.Contains(aF)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) C3d;
|
||||
while (itcrx.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
|
||||
if (cr->IsCurve3D()) {
|
||||
unique++;
|
||||
if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
|
||||
myCref = cr;
|
||||
}
|
||||
}
|
||||
itcrx.Next();
|
||||
}
|
||||
|
||||
if (unique==0) {
|
||||
return;//...No3DCurve
|
||||
}
|
||||
if (unique>1) {
|
||||
return;//...Multiple3DCurve;
|
||||
}
|
||||
|
||||
if (myCref.IsNull() && !Degenerated) {
|
||||
itcrx.Initialize(TEx->Curves());
|
||||
while (itcrx.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcrx.Value();
|
||||
if (cr->IsCurveOnSurface()) {
|
||||
myCref = cr;
|
||||
break;
|
||||
}
|
||||
itcrx.Next();
|
||||
}
|
||||
}
|
||||
|
||||
else if (!myCref.IsNull() && Degenerated){
|
||||
return ;//...InvalidDegeneratedFlag;
|
||||
}
|
||||
|
||||
if (!myCref.IsNull()) {
|
||||
const Handle(BRep_GCurve)& GCref = *((Handle(BRep_GCurve)*)&myCref);
|
||||
Standard_Real First,Last;
|
||||
GCref->Range(First,Last);
|
||||
if (Last<=First) {
|
||||
myCref.Nullify();
|
||||
return ;//InvalidRange;
|
||||
}
|
||||
|
||||
else {
|
||||
if (myCref->IsCurve3D()) {
|
||||
Handle(Geom_Curve) C3dx = Handle(Geom_Curve)::DownCast
|
||||
(myCref->Curve3D()->Transformed (myCref->Location().Transformation()));
|
||||
GeomAdaptor_Curve GAC3d(C3dx, First, Last);
|
||||
myHCurve = new GeomAdaptor_HCurve(GAC3d);
|
||||
}
|
||||
else { // curve on surface
|
||||
Handle(Geom_Surface) Sref = myCref->Surface();
|
||||
Sref = Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Transformation()));
|
||||
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
|
||||
Handle(GeomAdaptor_HSurface) GAHSref = new GeomAdaptor_HSurface(Sref);
|
||||
Handle(Geom2dAdaptor_HCurve) GHPCref = new Geom2dAdaptor_HCurve(PCref, First, Last);
|
||||
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
|
||||
myHCurve = new Adaptor3d_HCurveOnSurface(ACSref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===============================================
|
||||
// 2. Tolerances in InContext
|
||||
{
|
||||
if (myCref.IsNull())
|
||||
return;
|
||||
Standard_Boolean ok=Standard_True;;
|
||||
|
||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&myShape.TShape());
|
||||
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
|
||||
Standard_Real aNewTol=Tol;
|
||||
|
||||
Standard_Boolean SameParameter = TE->SameParameter();
|
||||
Standard_Boolean SameRange = TE->SameRange();
|
||||
Standard_Real First = myHCurve->FirstParameter();
|
||||
Standard_Real Last = myHCurve->LastParameter();
|
||||
Standard_Real Delta =1.e-14;
|
||||
|
||||
Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &S.TShape());
|
||||
const TopLoc_Location& Floc = S.Location();
|
||||
const TopLoc_Location& TFloc = TF->Location();
|
||||
const Handle(Geom_Surface)& Su = TF->Surface();
|
||||
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
|
||||
// Standard_Boolean checkclosed = Standard_False;
|
||||
Standard_Boolean pcurvefound = Standard_False;
|
||||
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
||||
while (itcr.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
|
||||
pcurvefound = Standard_True;
|
||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
|
||||
Standard_Real f,l;
|
||||
GC->Range(f,l);
|
||||
if (SameRange && (f != First || l != Last)) {
|
||||
return ;//BRepCheck_InvalidSameRangeFlag);
|
||||
if (SameParameter) {
|
||||
return; //BRepCheck_InvalidSameParameterFlag);
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Geom_Surface) Sb = cr->Surface();
|
||||
Sb = Handle(Geom_Surface)::DownCast (Su->Transformed(L.Transformation()));
|
||||
Handle(Geom2d_Curve) PC = cr->PCurve();
|
||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
|
||||
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
|
||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
||||
ok = Validate(myHCurve->Curve(), ACS, Tol, SameParameter, aNewTol);
|
||||
if (ok) {
|
||||
if (cr->IsCurveOnClosedSurface()) {
|
||||
//return ;// BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
||||
}
|
||||
else {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
||||
}
|
||||
if (SameParameter) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
||||
}
|
||||
aProcessed.Add(aF);
|
||||
aChain.Add(aF);
|
||||
//
|
||||
if (aNewTol<aMaxTol) {
|
||||
TE->UpdateTolerance(aNewTol+Delta);
|
||||
//
|
||||
CorrectVertexTolerance(myShape);
|
||||
}
|
||||
}
|
||||
|
||||
if (cr->IsCurveOnClosedSurface()) {
|
||||
// checkclosed = Standard_True;
|
||||
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
|
||||
ACS.Load(GAHS); // sans doute inutile
|
||||
ACS.Load(GHPC); // meme remarque...
|
||||
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
|
||||
if (ok) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
|
||||
if (SameParameter) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
||||
}
|
||||
if (aNewTol<aMaxTol) {
|
||||
TE->UpdateTolerance(aNewTol+Delta);
|
||||
CorrectVertexTolerance(myShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itcr.Next();
|
||||
}
|
||||
|
||||
if (!pcurvefound) {
|
||||
Handle(Geom_Plane) P;
|
||||
Handle(Standard_Type) styp = Su->DynamicType();
|
||||
if (styp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
P = Handle(Geom_Plane)::DownCast(Handle(Geom_RectangularTrimmedSurface)::
|
||||
DownCast(Su)->BasisSurface());
|
||||
}
|
||||
else {
|
||||
P = Handle(Geom_Plane)::DownCast(Su);
|
||||
}
|
||||
if (P.IsNull()) { // not a plane
|
||||
return;//BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
|
||||
}
|
||||
|
||||
else {// on fait la projection a la volee, comme BRep_Tool
|
||||
P = Handle(Geom_Plane)::DownCast(P->Transformed(L.Transformation()));
|
||||
//on projette Cref sur ce plan
|
||||
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(P);
|
||||
|
||||
// Dub - Normalement myHCurve est une GeomAdaptor_HCurve
|
||||
GeomAdaptor_Curve& Gac = Handle(GeomAdaptor_HCurve)::DownCast(myHCurve)->ChangeCurve();
|
||||
Handle(Geom_Curve) C3dx = Gac.Curve();
|
||||
Handle(Geom_Curve) ProjOnPlane = GeomProjLib::ProjectOnPlane
|
||||
(new Geom_TrimmedCurve(C3dx,First,Last), P, P->Position().Direction(), Standard_True);
|
||||
|
||||
Handle(GeomAdaptor_HCurve) aHCurve = new GeomAdaptor_HCurve(ProjOnPlane);
|
||||
|
||||
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
|
||||
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
||||
Handle(Geom2dAdaptor_HCurve) GHPC =
|
||||
new Geom2dAdaptor_HCurve(PC, myHCurve->FirstParameter(), myHCurve->LastParameter());
|
||||
|
||||
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
|
||||
|
||||
Standard_Boolean okx = Validate(myHCurve->Curve(),ACS,
|
||||
Tol,Standard_True, aNewTol); // voir dub...
|
||||
if (okx) {
|
||||
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
|
||||
if (aNewTol<aMaxTol) {
|
||||
TE->UpdateTolerance(aNewTol+Delta);
|
||||
CorrectVertexTolerance(myShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}//end of if (!pcurvefound) {
|
||||
} // end of 2. Tolerances in InContext
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CorrectVertexTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void CorrectVertexTolerance(const TopoDS_Edge& aE)
|
||||
{
|
||||
Standard_Integer k, aNbV;
|
||||
Standard_Real aTolE, aTolV;
|
||||
TopTools_IndexedMapOfShape aVMap;
|
||||
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
|
||||
TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap);
|
||||
aNbV=aVMap.Extent();
|
||||
for (k=1; k<=aNbV; ++k) {
|
||||
const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
if (aTolV<aTolE) {
|
||||
Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aV.TShape());
|
||||
aTV->UpdateTolerance(aTolE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define NCONTROL 23
|
||||
//=======================================================================
|
||||
//function : Validate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
const Adaptor3d_Curve& Other,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean SameParameter,
|
||||
Standard_Real& aNewTolerance)
|
||||
{
|
||||
Standard_Real First, Last, MaxDistance, aD, Tol2;
|
||||
|
||||
First = CRef.FirstParameter();
|
||||
Last = CRef.LastParameter();
|
||||
MaxDistance = 0.;
|
||||
Tol2 = Tol*Tol;
|
||||
|
||||
Standard_Integer i, aNC1=NCONTROL-1;
|
||||
|
||||
Standard_Boolean aFlag=Standard_False;
|
||||
Standard_Boolean proj = (!SameParameter ||
|
||||
First != Other.FirstParameter() ||
|
||||
Last != Other.LastParameter());
|
||||
//
|
||||
// 1.
|
||||
if (!proj) {
|
||||
for (i = 0; i < NCONTROL; i++) {
|
||||
Standard_Real prm = ((aNC1-i)*First + i*Last)/aNC1;
|
||||
gp_Pnt pref = CRef.Value(prm);
|
||||
gp_Pnt pother = Other.Value(prm);
|
||||
|
||||
aD=pref.SquareDistance(pother);
|
||||
|
||||
if (aD > Tol2) {
|
||||
if (aD>MaxDistance) {
|
||||
MaxDistance=aD;
|
||||
}
|
||||
aFlag=Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlag) {
|
||||
aNewTolerance=sqrt(MaxDistance);
|
||||
}
|
||||
return aFlag;
|
||||
}
|
||||
|
||||
//
|
||||
// 2.
|
||||
else {
|
||||
Extrema_LocateExtPC refd,otherd;
|
||||
Standard_Real OFirst, OLast;
|
||||
OFirst = Other.FirstParameter();
|
||||
OLast = Other.LastParameter();
|
||||
|
||||
gp_Pnt pd = CRef.Value(First);
|
||||
gp_Pnt pdo = Other.Value(OFirst);
|
||||
|
||||
aD = pd.SquareDistance(pdo);
|
||||
if (aD > Tol2) {
|
||||
if (aD>MaxDistance) {
|
||||
MaxDistance=aD;
|
||||
}
|
||||
aFlag=Standard_True;
|
||||
}
|
||||
|
||||
pd = CRef.Value(Last);
|
||||
pdo = Other.Value(OLast);
|
||||
aD = pd.SquareDistance(pdo);
|
||||
if (aD > Tol2 && aD > MaxDistance) {
|
||||
MaxDistance=aD;
|
||||
aFlag=Standard_True;
|
||||
}
|
||||
|
||||
refd.Initialize(CRef, First, Last, CRef.Resolution(Tol));
|
||||
otherd.Initialize(Other, OFirst, OLast, Other.Resolution(Tol));
|
||||
|
||||
for (i = 2; i< aNC1; i++) {
|
||||
Standard_Real rprm = ((aNC1-i)*First + i*Last)/aNC1;
|
||||
gp_Pnt pref = CRef.Value(rprm);
|
||||
|
||||
Standard_Real oprm = ((aNC1-i)*OFirst + i*OLast)/aNC1;
|
||||
gp_Pnt pother = Other.Value(oprm);
|
||||
|
||||
refd.Perform(pother,rprm);
|
||||
if (!refd.IsDone() || refd.SquareDistance() > Tol2) {
|
||||
if (refd.IsDone()) {
|
||||
aD=refd.SquareDistance();
|
||||
if (aD > Tol2 && aD>MaxDistance) {
|
||||
aFlag=Standard_True;
|
||||
MaxDistance=aD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otherd.Perform(pref,oprm);
|
||||
if (!otherd.IsDone() || otherd.SquareDistance() > Tol2) {
|
||||
|
||||
if (otherd.IsDone()) {
|
||||
aD=otherd.SquareDistance();
|
||||
if (aD > Tol2 && aD>MaxDistance) {
|
||||
aFlag=Standard_True;
|
||||
MaxDistance=aD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aD=sqrt (MaxDistance);
|
||||
aNewTolerance=aD;
|
||||
|
||||
return aFlag;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function : CheckEdge
|
||||
// purpose : Correct tolerances for Vertices on Edge
|
||||
//=======================================================================
|
||||
void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
|
||||
{
|
||||
TopoDS_Edge E=Ed;
|
||||
E.Orientation(TopAbs_FORWARD);
|
||||
|
||||
gp_Pnt Controlp;
|
||||
|
||||
TopExp_Explorer aVExp;
|
||||
aVExp.Init(E, TopAbs_VERTEX);
|
||||
for (; aVExp.More(); aVExp.Next()) {
|
||||
TopoDS_Vertex aVertex= TopoDS::Vertex(aVExp.Current());
|
||||
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &aVertex.TShape());
|
||||
const gp_Pnt& prep = TV->Pnt();
|
||||
|
||||
Standard_Real Tol, aD2, aNewTolerance, dd;
|
||||
|
||||
Tol =BRep_Tool::Tolerance(aVertex);
|
||||
Tol = Max(Tol, BRep_Tool::Tolerance(E));
|
||||
dd=0.1*Tol;
|
||||
Tol*=Tol;
|
||||
|
||||
const TopLoc_Location& Eloc = E.Location();
|
||||
BRep_ListIteratorOfListOfPointRepresentation itpr;
|
||||
|
||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&E.TShape());
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
||||
while (itcr.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||
const TopLoc_Location& loc = cr->Location();
|
||||
TopLoc_Location L = (Eloc * loc).Predivided(aVertex.Location());
|
||||
|
||||
if (cr->IsCurve3D()) {
|
||||
const Handle(Geom_Curve)& C = cr->Curve3D();
|
||||
if (!C.IsNull()) {
|
||||
itpr.Initialize(TV->Points());
|
||||
while (itpr.More()) {
|
||||
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
||||
if (pr->IsPointOnCurve(C,L)) {
|
||||
Controlp = C->Value(pr->Parameter());
|
||||
Controlp.Transform(L.Transformation());
|
||||
aD2=prep.SquareDistance(Controlp);
|
||||
if (aD2 > Tol) {
|
||||
aNewTolerance=sqrt(aD2)+dd;
|
||||
if (aNewTolerance<aMaxTol)
|
||||
TV->UpdateTolerance(aNewTolerance);
|
||||
}
|
||||
}
|
||||
itpr.Next();
|
||||
}
|
||||
|
||||
TopAbs_Orientation orv = aVertex.Orientation();
|
||||
if (orv == TopAbs_FORWARD || orv == TopAbs_REVERSED) {
|
||||
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
|
||||
|
||||
if (orv==TopAbs_FORWARD)
|
||||
Controlp = C->Value(GC->First());
|
||||
else
|
||||
Controlp = C->Value(GC->Last());
|
||||
|
||||
Controlp.Transform(L.Transformation());
|
||||
aD2=prep.SquareDistance(Controlp);
|
||||
|
||||
if (aD2 > Tol) {
|
||||
aNewTolerance=sqrt(aD2)+dd;
|
||||
if (aNewTolerance<aMaxTol)
|
||||
TV->UpdateTolerance(aNewTolerance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itcr.Next();
|
||||
}
|
||||
const TopTools_IndexedMapOfShape& aMV=aMCV.FindFromKey(aF);
|
||||
aNbV=aMV.Extent();
|
||||
for (j=1; j<=aNbV; ++j) {
|
||||
const TopoDS_Shape& aFx=aMV(j);
|
||||
ProcessBlock(aFx, aMCV, aProcessed, aChain);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,141 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : GEOMAlgo_AlgoTools_2.cxx
|
||||
// Created :
|
||||
// Author : Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <GEOMAlgo_CoupleOfShapes.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
void ProcessBlock(const TopoDS_Shape& aF,
|
||||
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
TopTools_IndexedMapOfShape& aProcessed,
|
||||
TopTools_IndexedMapOfShape& aChain);
|
||||
|
||||
//=======================================================================
|
||||
// function: FindChains
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
|
||||
{
|
||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
|
||||
//
|
||||
aItCS.Initialize(aLCS);
|
||||
for (; aItCS.More(); aItCS.Next()) {
|
||||
const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value();
|
||||
//
|
||||
const TopoDS_Shape& aF1=aCS.Shape1();
|
||||
const TopoDS_Shape& aF2=aCS.Shape2();
|
||||
//
|
||||
//
|
||||
if (aMCV.Contains(aF1)) {
|
||||
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1);
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
aMCV.Add(aF1, aMV);
|
||||
}
|
||||
//
|
||||
if (aMCV.Contains(aF2)) {
|
||||
TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2);
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
}
|
||||
else {
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
aMV.Add(aF1);
|
||||
aMV.Add(aF2);
|
||||
aMCV.Add(aF2, aMV);
|
||||
}
|
||||
}
|
||||
GEOMAlgo_AlgoTools::FindChains(aMCV, aMapChains);
|
||||
}
|
||||
//=======================================================================
|
||||
// function: FindChains
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_AlgoTools::FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains)
|
||||
{
|
||||
Standard_Integer i, j, aNbCV, aNbV;
|
||||
TopTools_IndexedMapOfShape aProcessed, aChain;
|
||||
//
|
||||
aNbCV=aMCV.Extent();
|
||||
for (i=1; i<=aNbCV; ++i) {
|
||||
const TopoDS_Shape& aF=aMCV.FindKey(i);
|
||||
if (aProcessed.Contains(aF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aProcessed.Add(aF);
|
||||
aChain.Add(aF);
|
||||
//
|
||||
const TopTools_IndexedMapOfShape& aMV=aMCV(i);
|
||||
aNbV=aMV.Extent();
|
||||
for (j=1; j<=aNbV; ++j) {
|
||||
const TopoDS_Shape& aFx=aMV(j);
|
||||
ProcessBlock(aFx, aMCV, aProcessed, aChain);
|
||||
}
|
||||
aMapChains.Add(aF, aChain);
|
||||
aChain.Clear();
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// function: ProcessBlock
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void ProcessBlock(const TopoDS_Shape& aF,
|
||||
const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
|
||||
TopTools_IndexedMapOfShape& aProcessed,
|
||||
TopTools_IndexedMapOfShape& aChain)
|
||||
{
|
||||
Standard_Integer j, aNbV;
|
||||
//
|
||||
if (aProcessed.Contains(aF)) {
|
||||
return;
|
||||
}
|
||||
aProcessed.Add(aF);
|
||||
aChain.Add(aF);
|
||||
//
|
||||
const TopTools_IndexedMapOfShape& aMV=aMCV.FindFromKey(aF);
|
||||
aNbV=aMV.Extent();
|
||||
for (j=1; j<=aNbV; ++j) {
|
||||
const TopoDS_Shape& aFx=aMV(j);
|
||||
ProcessBlock(aFx, aMCV, aProcessed, aChain);
|
||||
}
|
||||
}
|
||||
|
@ -1,97 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_CheckerSI.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_CheckerSI.hxx>
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <GEOMAlgo_IteratorCheckerSI.hxx>
|
||||
#include <BOPInt_Context.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_CheckerSI::GEOMAlgo_CheckerSI()
|
||||
:
|
||||
BOPAlgo_PaveFiller()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_CheckerSI::GEOMAlgo_CheckerSI(const BOPCol_BaseAllocator& theAllocator)
|
||||
:
|
||||
BOPAlgo_PaveFiller(theAllocator)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_CheckerSI::~GEOMAlgo_CheckerSI()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_CheckerSI::Init()
|
||||
{
|
||||
Standard_Integer aNb;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
aNb=myArguments.Extent();
|
||||
if (!aNb) {
|
||||
myErrorStatus=10;
|
||||
return;
|
||||
}
|
||||
if (aNb>1) {
|
||||
myErrorStatus=11;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 0 Clear
|
||||
Clear();
|
||||
//
|
||||
// 1.myDS
|
||||
myDS=new BOPDS_DS(myAllocator);
|
||||
myDS->SetArguments(myArguments);
|
||||
myDS->Init();
|
||||
//
|
||||
// 2.myIterator
|
||||
myIterator=new GEOMAlgo_IteratorCheckerSI(myAllocator);
|
||||
myIterator->SetDS(myDS);
|
||||
myIterator->Prepare();
|
||||
//
|
||||
// 3 myContext
|
||||
myContext=new BOPInt_Context;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_CheckerSI.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#ifndef _GEOMAlgo_CheckerSI_HeaderFile
|
||||
#define _GEOMAlgo_CheckerSI_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <BOPCol_BaseAllocator.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_CheckerSI : public BOPAlgo_PaveFiller {
|
||||
public:
|
||||
|
||||
//! Empty contructor <br>
|
||||
//! <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_CheckerSI();
|
||||
|
||||
//! Contructor <br>
|
||||
//! theAllocator - the allocator to manage the memory <br>
|
||||
//! <br>
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_CheckerSI(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
Standard_EXPORT
|
||||
virtual ~GEOMAlgo_CheckerSI();
|
||||
|
||||
protected:
|
||||
Standard_EXPORT
|
||||
virtual void Init() ;
|
||||
|
||||
};
|
||||
#endif
|
@ -463,7 +463,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
|
||||
aER.Orientation(TopAbs_FORWARD);
|
||||
if (!BRep_Tool::Degenerated(aER)) {
|
||||
// orient image
|
||||
Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse1(aER, aE, myContext);
|
||||
Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aER.Reverse();
|
||||
}
|
||||
@ -515,7 +515,7 @@ void GEOMAlgo_Gluer::MakeSolids()
|
||||
myResult=aCmp;
|
||||
//
|
||||
if (aMS.Extent()) {
|
||||
GEOMAlgo_AlgoTools::CorrectCurveOnSurface(myResult);
|
||||
BOPTools_AlgoTools::CorrectCurveOnSurface(myResult, 0.0001);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@ -977,7 +977,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
|
||||
|
||||
// orient image
|
||||
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse1(aER, aE, myContext);
|
||||
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aER.Reverse();
|
||||
}
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
|
||||
#include <GEOMAlgo_GlueDetector.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
@ -450,7 +452,7 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
|
||||
if (myOrigins.IsBound(aE)) {
|
||||
aEnew=myOrigins.Find(aE);
|
||||
//
|
||||
bToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aEnew, aE, myContext);
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aEnew, aE, myContext);
|
||||
if (bToReverse) {
|
||||
aEnew.Reverse();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||
}
|
||||
//modified by NIZNHY-PKV Fri Feb 03 11:18:20 2012t
|
||||
//
|
||||
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse1(aEx, aE, myContext);
|
||||
bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aEx, aE, myContext);
|
||||
if (bIsToReverse) {
|
||||
aEx.Reverse();
|
||||
}
|
||||
|
@ -31,8 +31,9 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
|
||||
#include <GEOMAlgo_BuilderShape.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : PrepareHistory
|
||||
@ -98,7 +99,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
|
||||
aSim.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSim.Reverse();
|
||||
}
|
||||
|
@ -1,190 +0,0 @@
|
||||
// File: GEOMAlgo_IteratorChecker.cxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
|
||||
#include <GEOMAlgo_IteratorCheckerSI.hxx>
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
//
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <BOPDS_BoxBndTree.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_PassKeyBoolean.hxx>
|
||||
#include <BOPDS_MapOfPassKeyBoolean.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPDS_Tools.hxx>
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerInteger.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
|
||||
#include <BOPCol_IndexedMapOfInteger.hxx>
|
||||
#include <BOPDS_ShapeInfo.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPCol_IndexedMapOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_IteratorCheckerSI::GEOMAlgo_IteratorCheckerSI()
|
||||
:
|
||||
BOPDS_Iterator()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_IteratorCheckerSI::GEOMAlgo_IteratorCheckerSI
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
BOPDS_Iterator(theAllocator)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_IteratorCheckerSI::~GEOMAlgo_IteratorCheckerSI()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Intersect
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void GEOMAlgo_IteratorCheckerSI::Intersect()
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Integer aNbS, i, aNbB;
|
||||
Standard_Integer aNbSD, iX, j, iDS, jB, k;;
|
||||
TopAbs_ShapeEnum aTi, aTj;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
BOPCol_ListIteratorOfListOfInteger aIt;
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
|
||||
//
|
||||
//-----------------------------------------------------scope_1 f
|
||||
aAllocator=new NCollection_IncAllocator();
|
||||
//
|
||||
BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPA(100, aAllocator);
|
||||
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
|
||||
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
|
||||
BOPDS_PassKeyBoolean aPKXB;
|
||||
//
|
||||
BOPDS_BoxBndTreeSelector aSelector;
|
||||
BOPDS_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
//
|
||||
// myPairsAvoid, aMSI, aMSB
|
||||
aNbS=myDS->NbSourceShapes();
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
//
|
||||
if (aSI.HasBRep()) {
|
||||
const TopoDS_Shape& aSi=aSI.Shape();
|
||||
aTi=aSI.ShapeType();
|
||||
if (aTi!=TopAbs_VERTEX) {
|
||||
//--
|
||||
const BOPCol_ListOfInteger& aLA=aSI.SubShapes();
|
||||
aIt.Initialize(aLA);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
iX=aIt.Value();
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, iX);
|
||||
aMPA.Add(aPKXB);
|
||||
}
|
||||
//--t
|
||||
}
|
||||
else {
|
||||
aPKXB.Clear();
|
||||
aPKXB.SetIds(i, i);
|
||||
aMPA.Add(aPKXB);
|
||||
}
|
||||
//
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
//
|
||||
aMSI.Bind(aSi, i);
|
||||
aMSB.Add(aSi, aBoxEx);
|
||||
}
|
||||
} // for (i=0; i<aNbS; ++i) {
|
||||
//
|
||||
// aMII
|
||||
aNbB=aMSB.Extent();
|
||||
for (i=1; i<=aNbB; ++i) {
|
||||
const TopoDS_Shape& aS=aMSB.FindKey(i);
|
||||
const Bnd_Box& aBoxEx=aMSB(i);
|
||||
//
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
//
|
||||
iDS=aMSI.Find(aS);
|
||||
aMII.Bind(i, iDS);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
aTi=aSI.ShapeType();
|
||||
if (!aSI.HasBRep()){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aSi=myDS->Shape(i);
|
||||
aTi=aSi.ShapeType();
|
||||
const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
|
||||
aSelector.Clear();
|
||||
aSelector.SetBox(aBoxEx);
|
||||
//
|
||||
aNbSD=aBBTree.Select(aSelector);
|
||||
if (!aNbSD){
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
|
||||
//
|
||||
k=0;
|
||||
//
|
||||
aIt.Initialize(aLI);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
jB=aIt.Value(); // box index in MII
|
||||
j=aMII.Find(jB); // DS index
|
||||
//
|
||||
aPKXB.SetIds(i, j);
|
||||
if (aMPA.Contains(aPKXB)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aMPKXB.Add(aPKXB)) {
|
||||
bFlag=Standard_False;// Bounding boxes are intersected
|
||||
const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
|
||||
const Bnd_Box& aBoxj=myDS->ShapeInfo(j).Box();
|
||||
if (aBoxi.IsOut(aBoxj)) {
|
||||
bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
|
||||
}
|
||||
aTj=myDS->ShapeInfo(j).ShapeType();//
|
||||
iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
|
||||
aPKXB.SetFlag(bFlag);
|
||||
myLists(iX).Append(aPKXB);
|
||||
}// if (aMPKXB.Add(aPKXB)) {
|
||||
}// for (; aIt.More(); aIt.Next()) {
|
||||
}//for (i=1; i<=aNbS; ++i) {
|
||||
//
|
||||
aMSI.Clear();
|
||||
aMII.Clear();
|
||||
aMPA.Clear();
|
||||
aMPKXB.Clear();
|
||||
aMSB.Clear();
|
||||
//
|
||||
aAllocator.Nullify();
|
||||
//-----------------------------------------------------scope_1 t
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
|
||||
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File: GEOMAlgo_CheckerSI.hxx
|
||||
// Created:
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#ifndef GEOMAlgo_IteratorCheckerSI_HeaderFile
|
||||
#define GEOMAlgo_IteratorCheckerSI_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <BOPDS_Iterator.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_CheckerSI
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class GEOMAlgo_IteratorCheckerSI : public BOPDS_Iterator {
|
||||
public:
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_IteratorCheckerSI();
|
||||
|
||||
Standard_EXPORT
|
||||
GEOMAlgo_IteratorCheckerSI(const Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
|
||||
Standard_EXPORT
|
||||
~GEOMAlgo_IteratorCheckerSI();
|
||||
|
||||
Standard_EXPORT
|
||||
virtual void Intersect();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -30,7 +30,6 @@ dist_libGEOMAlgo_la_SOURCES = \
|
||||
GEOMAlgo_Algo.cxx \
|
||||
GEOMAlgo_AlgoTools.cxx \
|
||||
GEOMAlgo_AlgoTools_1.cxx \
|
||||
GEOMAlgo_AlgoTools_2.cxx \
|
||||
GEOMAlgo_BndSphere.cxx \
|
||||
GEOMAlgo_BndSphereTree.cxx \
|
||||
GEOMAlgo_BoxBndTree.cxx \
|
||||
@ -72,9 +71,7 @@ dist_libGEOMAlgo_la_SOURCES = \
|
||||
GEOMAlgo_StateCollector.cxx \
|
||||
GEOMAlgo_SurfaceTools.cxx \
|
||||
GEOMAlgo_VertexSolid.cxx \
|
||||
GEOMAlgo_WireSolid.cxx \
|
||||
GEOMAlgo_CheckerSI.cxx \
|
||||
GEOMAlgo_IteratorCheckerSI.cxx
|
||||
GEOMAlgo_WireSolid.cxx
|
||||
|
||||
|
||||
# header files
|
||||
@ -135,9 +132,7 @@ salomeinclude_HEADERS = \
|
||||
GEOMAlgo_StateCollector.hxx \
|
||||
GEOMAlgo_SurfaceTools.hxx \
|
||||
GEOMAlgo_VertexSolid.hxx \
|
||||
GEOMAlgo_WireSolid.hxx \
|
||||
GEOMAlgo_CheckerSI.hxx \
|
||||
GEOMAlgo_IteratorCheckerSI.hxx
|
||||
GEOMAlgo_WireSolid.hxx
|
||||
|
||||
libGEOMAlgo_la_CPPFLAGS = \
|
||||
$(CAS_CPPFLAGS) \
|
||||
|
@ -117,7 +117,7 @@
|
||||
#include <BOPDS_MapOfPassKey.hxx>
|
||||
#include <BOPDS_PassKey.hxx>
|
||||
#include <GEOMAlgo_AlgoTools.hxx>
|
||||
#include <GEOMAlgo_CheckerSI.hxx>
|
||||
#include <BOPAlgo_CheckerSI.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
@ -1373,7 +1373,7 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
|
||||
BOPCol_ListOfShape aLCS;
|
||||
aLCS.Append(aScopy);
|
||||
//
|
||||
GEOMAlgo_CheckerSI aCSI; // checker of self-interferences
|
||||
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
|
||||
aCSI.SetArguments(aLCS);
|
||||
|
||||
// 1. Launch the checker
|
||||
|
Loading…
Reference in New Issue
Block a user