Removed obsolete functions from sources.
Some useful debug functions were 'defined' ( put into #ifdef ...#endif )
Removed some redundant code
static Standard_Integer IndexOfSection = 0;
extern Standard_Boolean Blend_GettraceDRAWSECT();
+#ifdef DEB_BBPP_N_TRDERIV
//-----------------------------------------------------
// For debug : visualisation of the section
static Standard_Boolean BBPP(const Standard_Real param,
cout<<"dy estimated : "<<scal*(TP2d1(i).Y()-TP2d2(i).Y())<<endl;
}
}
-
+#endif
//-----------------------------------------------------
static void Drawsect(const Standard_Real param,
while (!Arrive) {
Standard_Boolean bonpoint = 1;
-#if 0
+#ifdef DEB_BBPP_N_TRDERIV
//debdebdebdebdebdeb
Func.Set(param);
rsnld.Perform(Func, parinit, infbound, supbound);
#endif
static Standard_Integer IndexOfSection = 0;
extern Standard_Boolean Blend_GettraceDRAWSECT();
+#ifdef DEB_BBPP_N_TRDERIV
// for debug : visualisation of the section
static Standard_Boolean BBPP(const Standard_Real param,
Blend_SurfRstFunction& Func,
cout<<"dy estimated : "<<scal*(TP2d1(i).Y()-TP2d2(i).Y())<<endl;
}
}
-
+#endif
static void Drawsect(const Standard_Real param,
Blend_SurfRstFunction& Func)
{
while (!Arrive) {
Standard_Boolean bonpoint = 1;
-#if 0
+#ifdef DEB_BBPP_N_TRDERIV
//debdebdebdebdebdeb
Func.Set(param);
rsnld.Perform(Func,parinit,infbound,supbound);
#include <BRepBuilderAPI_BndBoxTreeSelector.hxx>
#include <NCollection_UBTreeFiller.hxx>
-static void SortBox (const Handle(Bnd_HArray1OfBox) hSetBoxes,
- const Bnd_Box& aBox,
- TColStd_ListOfInteger& listIndex)
-{
- Standard_Integer i, nbBoxes = hSetBoxes->Length();
- for (i = 1; i <= nbBoxes; i++)
- if (!aBox.IsOut(hSetBoxes->Value(i)))
- listIndex.Append(i);
-}
-
//=======================================================================
//function : SameRange
//purpose :
const TopoDS_Shape&, // Face
TopTools_MapOfShape&); // mapofface
-
-#ifdef DEB
-static TopAbs_Orientation GetOrientation(const TopoDS_Face&,
- const TopoDS_Shape&);
-#endif
-
-
inline Standard_Boolean IsOriented(const TopoDS_Shape& S)
{
return (S.Orientation() == TopAbs_FORWARD ||
return theSets.Extent();
}
-//=======================================================================
-//function : GetOrientation
-//purpose :
-//=======================================================================
-
-#ifdef DEB
-static TopAbs_Orientation GetOrientation(const TopoDS_Face& F,
- const TopoDS_Shape& S)
-
-{
- TopExp_Explorer exp;
- for (exp.Init(S,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(F)) {
- return exp.Current().Orientation();
- }
- }
- return TopAbs_FORWARD; // for compilation
-}
-#endif
-
-
//=======================================================================
//function : Propagate
//purpose :
TopoDS_Shape&, // myFShape
TopoDS_Shape&); // myLShape
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_DPrism&,
- TopTools_DataMapOfShapeShape&);
-
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& thePbase,
- Handle(Geom_Curve)& theBCurve,
- TColGeom_SequenceOfCurve& theCurves,
- LocOpe_DPrism& theDPrism,
- TopTools_DataMapOfShapeShape& theMap);
-#endif
-
static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
const TopoDS_Face& theSkface,
const TopoDS_Shape& theSFrom,
const TopoDS_Face& ff = TopoDS::Face(exp.Current());
if(ToFuse(ff, FFace)) {
TopTools_DataMapOfShapeListOfShape sl;
- //SetGluedFaces(ff, mySbase, FFace, sl, theDPrism, myGluedF);
break;
}
}
// management of gluing faces
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
if(!myGluedF.IsEmpty()) { // case gluing
myJustGluer = Standard_True;
return;
}
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
-
-
theDPrism.Curves(myCurves);
myBCurve = theDPrism.BarycCurve();
GlobalPerform();
GeneratedShapeValid();
// management of gluing faces
- //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
// mySbase, myPbase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
theDPrism.Curves(myCurves);
return;
}
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theDPrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theDPrism, myGluedF);
-
theDPrism.Curves(myCurves);
myBCurve = theDPrism.BarycCurve();
GlobalPerform();
return sens;
}
-
- //=======================================================================
-//function : SetGluedFaces
-//purpose :
-//=======================================================================
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_DPrism& theDPrism,
- TopTools_DataMapOfShapeShape& theMap)
-{
- TopExp_Explorer exp;
- if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
- for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(theSkface)) {
- theMap.Bind(thePbase,theSkface);
- break;
- }
- }
- }
- else {
- TopExp_Explorer exp2;
- for (exp.Init(thePbase,TopAbs_FACE);exp.More();exp.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(exp.Current());
- for (exp2.Init(theSbase,TopAbs_FACE);exp2.More();exp2.Next()) {
- if (exp2.Current().IsSame(fac)) {
- theMap.Bind(fac,fac);
- break;
- }
- }
- }
- }
-
- // Sliding
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
- if(!theSlmap.IsEmpty()) {
- for (; itm.More(); itm.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(itm.Key());
- const TopTools_ListOfShape& ledg = itm.Value();
- for (TopTools_ListIteratorOfListOfShape it(ledg); it.More(); it.Next()) {
- const TopTools_ListOfShape& gfac = theDPrism.Shapes(it.Value());
- if (gfac.Extent() != 1) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " BRepFeat_MakeDPrism : Pb SetGluedFace" << endl;
-#endif
- }
- theMap.Bind(gfac.First(),fac);
- }
- }
- }
-}
-
-
-//=======================================================================
-//function : VerifGluedFaces
-//purpose : Checking intersection Tool/theSkface = thePbase
-// if yes -> OK if no -> case without gluing
-//=======================================================================
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& thePbase,
- Handle(Geom_Curve)& theBCurve,
- TColGeom_SequenceOfCurve& theCurves,
- LocOpe_DPrism& theDPrism,
- TopTools_DataMapOfShapeShape& theMap)
-{
- Standard_Boolean GluedFaces = Standard_True;
- TopoDS_Shape VraiDPrism = theDPrism.Shape();
-
- TColGeom_SequenceOfCurve scur;
- theDPrism.Curves(theCurves);
- theBCurve = theDPrism.BarycCurve();
- scur.Clear();
- scur.Append(theBCurve);
- LocOpe_CSIntersector ASI(theSkface);
- ASI.Perform(scur);
- if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
- TopAbs_Orientation Or = ASI.Point(1,1).Orientation();
- TopoDS_Face FSk = ASI.Point(1,1).Face();
- TopoDS_Shape Comp;
- BRep_Builder B;
- B.MakeCompound(TopoDS::Compound(Comp));
- TopoDS_Solid S = BRepFeat::Tool(theSkface, FSk, Or);
- if (!S.IsNull()) B.Add(Comp,S);
- //modified by NIZNHY-PKV Thu Mar 21 17:48:45 2002 f
- //BRepAlgo_Cut trP(VraiDPrism,Comp);
- BRepAlgoAPI_Cut trP(VraiDPrism,Comp);
- //modified by NIZNHY-PKV Thu Mar 21 17:48:49 2002 t
- TopoDS_Shape Cutsh = trP.Shape();
- TopExp_Explorer ex(Cutsh, TopAbs_SOLID);
- for(; ex.More(); ex.Next()) {
- TopExp_Explorer ex1(ex.Current(), TopAbs_FACE);
- for(; ex1.More(); ex1.Next()) {
- const TopoDS_Face& fac1 = TopoDS::Face(ex1.Current());
- TopExp_Explorer ex2(thePbase, TopAbs_FACE);
- for(; ex2.More(); ex2.Next()) {
- const TopoDS_Face& fac2 = TopoDS::Face(ex2.Current());
- if(fac1.IsSame(fac2)) break;
- }
- if (ex2.More()) break;
- }
- if (ex1.More()) continue;
- GluedFaces = Standard_False;
- break;
- }
- if (!GluedFaces) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " Intersection DPrism/skface : no gluing" << endl;
-#endif
- theMap.Clear();
- }
- }
-}
-#endif
-
//=======================================================================
//function : MajMap
//purpose :
TopoDS_Shape&, // myFShape
TopoDS_Shape&); // myLShape
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape&
- theSlmap,
- LocOpe_Pipe&,
- TopTools_DataMapOfShapeShape&);
-
-
//=======================================================================
//function : Init
//purpose :
myGShape = VraiPipe;
GeneratedShapeValid();
- //SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePipe, myGluedF);
GluedFacesValid();
if(myGluedF.IsEmpty()) {
myGShape = VraiTuyau;
GeneratedShapeValid();
- //SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePipe, myGluedF);
GluedFacesValid();
myFShape = thePipe.FirstShape();
myGShape = VraiTuyau;
GeneratedShapeValid();
- //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
// mySbase, myPbase, mySlface, thePipe, myGluedF);
GluedFacesValid();
return myBCurve;
}
-
-//=======================================================================
-//function : SetGluedFaces
-//purpose : management of faces of gluing and sliding
-//=======================================================================
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_Pipe& thePipe,
- TopTools_DataMapOfShapeShape& theMap)
-{
- TopExp_Explorer exp;
- if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
- for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(theSkface)) {
- theMap.Bind(thePbase,theSkface);
- break;
- }
- }
- }
- else {
- TopExp_Explorer exp2;
- for (exp.Init(thePbase,TopAbs_FACE);exp.More();exp.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(exp.Current());
- for (exp2.Init(theSbase,TopAbs_FACE);exp2.More();exp2.Next()) {
- if (exp2.Current().IsSame(fac)) {
- theMap.Bind(fac,fac);
- break;
- }
- }
- }
- }
-
- // Sliding
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
- if(!theSlmap.IsEmpty()) {
- for (; itm.More(); itm.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(itm.Key());
- const TopTools_ListOfShape& ledg = itm.Value();
- TopTools_ListIteratorOfListOfShape it;
- for (it.Initialize(ledg); it.More(); it.Next()) {
- const TopTools_ListOfShape& gfac = thePipe.Shapes(it.Value());
- if (gfac.Extent() != 1) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " BRepFeat_MakeDPipe : Pb SetGluedFace" << endl;
-#endif
- }
- theMap.Bind(gfac.First(),fac);
- }
- }
- }
-}
-
-
//=======================================================================
//function : MajMap
//purpose : management of descendants
static Standard_Boolean ToFuse(const TopoDS_Face& ,
const TopoDS_Face&);
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_Prism&,
- TopTools_DataMapOfShapeShape&);
-
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& thePbase,
- Handle(Geom_Curve)& theBCurve,
- TColGeom_SequenceOfCurve& theCurves,
- LocOpe_Prism& thePrism,
- TopTools_DataMapOfShapeShape& theMap);
-#endif
-
static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
const TopoDS_Face& theSkface,
const TopoDS_Shape& theSFrom,
if(ToFuse(ff, FFace)) {
TopTools_DataMapOfShapeListOfShape sl;
if(!FFace.IsSame(myPbase) && BRepFeat::IsInside(ff, FFace))
-// SetGluedFaces(ff, mySbase, FFace, sl, thePrism, myGluedF);
break;
}
}
// management of faces of gluing given by the user
-// SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
if(!myGluedF.IsEmpty()) { // case gluing
myJustGluer = Standard_True;
MajMap(myPbase,thePrism,myMap,myFShape,myLShape);
myGShape = VraiPrism;
GeneratedShapeValid();
-
- //SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
-
thePrism.Curves(myCurves);
myBCurve = thePrism.BarycCurve();
GlobalPerform();
myGShape = VraiPrism;
GeneratedShapeValid();
-
- //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
- // mySbase, myPbase, mySlface, thePrism, myGluedF);
GluedFacesValid();
-//// VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
-
thePrism.Curves(myCurves);
myBCurve = thePrism.BarycCurve();
GlobalPerform();
myGShape = VraiPrism;
GeneratedShapeValid();
-
- //SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePrism, myGluedF);
GluedFacesValid();
-// VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
-
thePrism.Curves(myCurves);
myBCurve = thePrism.BarycCurve();
GlobalPerform();
return sens;
}
-
-//=======================================================================
-//function : SetGluedFaces
-//purpose : management of gluing faces
-//=======================================================================
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_Prism& thePrism,
- TopTools_DataMapOfShapeShape& theMap)
-{
- TopExp_Explorer exp;
- if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
- for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(theSkface)) {
- theMap.Bind(thePbase,theSkface);
- break;
- }
- }
- }
- else {
- for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(theSkface)) {
- TopExp_Explorer exp2;
- for (exp2.Init(thePbase,TopAbs_FACE);exp2.More();exp2.Next()) {
- theMap.Bind(exp2.Current(),theSkface);
- }
- break;
- }
- }
- }
-
- // Sliding
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
- if(!theSlmap.IsEmpty()) {
- for (; itm.More(); itm.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(itm.Key());
- const TopTools_ListOfShape& ledg = itm.Value();
- TopTools_ListIteratorOfListOfShape it;
- for (it.Initialize(ledg); it.More(); it.Next()) {
- const TopTools_ListOfShape& gfac = thePrism.Shapes(it.Value());
- if (gfac.Extent() != 1) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " BRepFeat_MakePrism : Pb SetGluedFace" << endl;
-#endif
- }
- theMap.Bind(gfac.First(),fac);
- }
- }
- }
-}
-
-
-//=======================================================================
-//function : VerifGluedFaces
-//purpose : Verification intersection Tool/theSkface = thePbase
-// If yes -> OK otherwise -> case without gluing
-//=======================================================================
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& thePbase,
- Handle(Geom_Curve)& theBCurve,
- TColGeom_SequenceOfCurve& theCurves,
- LocOpe_Prism& thePrism,
- TopTools_DataMapOfShapeShape& theMap)
-{
- Standard_Boolean GluedFaces = Standard_True;
- TopoDS_Shape VraiPrism = thePrism.Shape();
-
- TColGeom_SequenceOfCurve scur;
- thePrism.Curves(theCurves);
- theBCurve = thePrism.BarycCurve();
- scur.Clear();
- scur.Append(theBCurve);
- LocOpe_CSIntersector ASI(theSkface);
- ASI.Perform(scur);
- if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
- TopAbs_Orientation Or = ASI.Point(1,1).Orientation();
- TopoDS_Face FSk = ASI.Point(1,1).Face();
- TopoDS_Shape Comp;
- BRep_Builder B;
- B.MakeCompound(TopoDS::Compound(Comp));
- TopoDS_Solid S = BRepFeat::Tool(theSkface, FSk, Or);
- if (!S.IsNull()) B.Add(Comp,S);
- //modified by NIZNHY-PKV Thu Mar 21 18:07:35 2002 f
- //BRepAlgo_Cut trP(VraiPrism,Comp);
- BRepAlgoAPI_Cut trP(VraiPrism,Comp);
- //modified by NIZNHY-PKV Thu Mar 21 18:07:39 2002 t
- TopoDS_Shape Cutsh = trP.Shape();
- TopExp_Explorer ex(Cutsh, TopAbs_SOLID);
- for(; ex.More(); ex.Next()) {
- TopExp_Explorer ex1(ex.Current(), TopAbs_FACE);
- for(; ex1.More(); ex1.Next()) {
- const TopoDS_Face& fac1 = TopoDS::Face(ex1.Current());
- TopExp_Explorer ex2(thePbase, TopAbs_FACE);
- for(; ex2.More(); ex2.Next()) {
- const TopoDS_Face& fac2 = TopoDS::Face(ex2.Current());
- if(fac1.IsSame(fac2)) break;
- }
- if (ex2.More()) break;
- }
- if (ex1.More()) continue;
- GluedFaces = Standard_False;
- break;
- }
- if (!GluedFaces) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " Intersection Prism/skface : no gluing" << endl;
-#endif
- theMap.Clear();
- }
- }
-}
-#endif
-
//=======================================================================
//function : MajMap
//purpose : management of descendants
TopoDS_Shape&); // myLShape
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_Revol&,
- TopTools_DataMapOfShapeShape&);
-
-
static void VerifGluedFaces(const TopoDS_Face& theSkface,
const TopoDS_Shape& thePbase,
Handle(Geom_Curve)& theBCurve,
if(ToFuse(ff, FFace)) {
TopTools_DataMapOfShapeListOfShape sl;
if(!FFace.IsSame(myPbase) && BRepFeat::IsInside(ff, FFace))
- //SetGluedFaces(ff, mySbase, FFace, sl, theRevol, myGluedF);
break;
}
}
}
-
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theRevol, myGluedF);
GluedFacesValid();
if (!mySkface.IsNull()) {
VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theRevol, myGluedF);
myStatusError = BRepFeat_InvFirstShape;
return;
}
-
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theRevol, myGluedF);
GluedFacesValid();
//VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theRevol, myGluedF);
if(!Trff) {
myGShape = VraiRevol;
GeneratedShapeValid();
-
- //SetGluedFaces(TopoDS_Face(), mySbase, myPbase, mySlface, theRevol, myGluedF);
GluedFacesValid();
// VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theRevol, myGluedF);
myStatusError = BRepFeat_InvFirstShape;
return;
}
-
- //SetGluedFaces(mySkface, mySbase, theBase, mySlface, theRevol, myGluedF);
GluedFacesValid();
//VerifGluedFaces(mySkface, theBase, myBCurve, myCurves, theRevol, myGluedF);
return myBCurve;
}
-
-//=======================================================================
-//function : SetGluedFaces
-//purpose : management of gluing faces
-//=======================================================================
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
- const TopoDS_Shape& theSbase,
- const TopoDS_Shape& thePbase,
- const TopTools_DataMapOfShapeListOfShape& theSlmap,
- LocOpe_Revol& theRevol,
- TopTools_DataMapOfShapeShape& theMap)
-{
- TopExp_Explorer exp;
- if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
- for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
- if (exp.Current().IsSame(theSkface)) {
- theMap.Bind(thePbase,theSkface);
- break;
- }
- }
- }
- else {
- TopExp_Explorer exp2;
- for (exp.Init(thePbase,TopAbs_FACE);exp.More();exp.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(exp.Current());
- for (exp2.Init(theSbase,TopAbs_FACE);exp2.More();exp2.Next()) {
- if (exp2.Current().IsSame(fac)) {
- theMap.Bind(fac,fac);
- break;
- }
- }
- }
- }
-
- // Sliding
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
- if(!theSlmap.IsEmpty()) {
- for (; itm.More(); itm.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(itm.Key());
- const TopTools_ListOfShape& ledg = itm.Value();
- TopTools_ListIteratorOfListOfShape it;
- for (it.Initialize(ledg); it.More(); it.Next()) {
- const TopTools_ListOfShape& gfac = theRevol.Shapes(it.Value());
- if (gfac.Extent() != 1) {
-#ifdef DEB
- Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << " BRepFeat_MakeRevol : Pb SetGluedFace" << endl;
-#endif
- }
- theMap.Bind(gfac.First(),fac);
- }
- }
- }
-}
-
//=======================================================================
//function : VerifGluedFaces
//purpose : Check intersection Tool/theSkface = thePbase
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_SequenceOfReal.hxx>
-
+#ifdef DEB_EFV
static void EdgesFromVertex (const TopoDS_Wire& W,
const TopoDS_Vertex& V,
TopoDS_Edge& E1,
}
}
-
+#endif
static void SeqOfVertices (const TopoDS_Wire& W,
TopTools_SequenceOfShape& S)
{
newwire.Orientation( TopAbs_FORWARD );
myWork(i) = newwire;
}
+#ifdef DEB_EFV
-/*
for ( i=ideb; i<=myWork.Length(); i++) {
const TopoDS_Wire& wire = TopoDS::Wire(myWork(i));
if (!Vsuiv.IsNull()) Psuiv=BRep_Tool::Pnt(Vsuiv);
}
}
-*/
+#endif
// blocking sections ?
if (vClosed) myWork(myWork.Length()) = myWork(1);
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
-static Standard_Boolean IsFromFirstToSecond(const TopoDS_Edge& theEdge,
- const Standard_Real theParameterOnUEdge,
- const TopoDS_Edge& theUEdge1,
- const TopoDS_Edge& theUEdge2,
- const TopoDS_Face& theFace);
-
static Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
const Standard_Integer theEIndex1,
const Standard_Integer theEIndex2,
gp_Pln& resPlane,
Standard_Boolean& IsSingular);
-static Standard_Boolean ChoosePlane(const TopoDS_Shape& Comp,
- const gp_Ax2& bis,
- gp_Pln& resPlane,
- TopoDS_Compound& NewComp);
-
-
// ===========================================================================================
// function: Constructor
// purpose:
return bvertexfound;
}
-// ------------------------------------------------------------------------------------------
-// static function: IsFromFirstToSecond
-// purpose:
-// ------------------------------------------------------------------------------------------
-Standard_Boolean IsFromFirstToSecond(const TopoDS_Edge& theEdge,
- const Standard_Real theParameterOnUEdge,
- const TopoDS_Edge& theUEdge1,
- const TopoDS_Edge& theUEdge2,
- const TopoDS_Face& theFace) {
- TopoDS_Face aFace = theFace;
- aFace.Orientation(TopAbs_FORWARD);
- TopoDS_Edge E1, E2;
- TopExp_Explorer anExp(aFace, TopAbs_EDGE);
-
- for(; anExp.More(); anExp.Next()) {
- if(E1.IsNull() && theUEdge1.IsSame(anExp.Current())) {
- E1 = TopoDS::Edge(anExp.Current());
- }
- else if(E2.IsNull() && theUEdge2.IsSame(anExp.Current())) {
- E2 = TopoDS::Edge(anExp.Current());
- }
- }
-
- if(E1.IsNull() || E2.IsNull())
- return Standard_True;
-
- gp_Pnt2d PU1, PU2, pf, pl;
- Standard_Real f, l;
- Handle(Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E1, aFace, f, l);
- Handle(Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(E2, aFace, f, l);
- Handle(Geom2d_Curve) CC = BRep_Tool::CurveOnSurface(theEdge, aFace, f, l);
- PU1 = C1->Value(theParameterOnUEdge);
- PU2 = C2->Value(theParameterOnUEdge);
- BRep_Tool::Range(theEdge, f, l);
- pf = CC->Value(f);
- pl = CC->Value(l);
- Standard_Real aTolerance = Precision::Confusion();
-
- if(pf.Distance(PU1) < aTolerance)
- return Standard_True;
-
- if(pl.Distance(PU2) < aTolerance)
- return Standard_True;
-
- return Standard_False;
-}
-
// ----------------------------------------------------------------------------------------------------
// static function: GetUEdges
// purpose:
return Standard_False;
//end of simplest case
}
-
-//=======================================================================
-//function : ChoosePlane
-//purpose :
-//=======================================================================
-static Standard_Boolean ChoosePlane(const TopoDS_Shape& Comp,
- const gp_Ax2& bis,
- gp_Pln& resPlane,
- TopoDS_Compound& NewComp)
-{
- Standard_Real TolConf = 1.e-4, TolAng = 1.e-5;
-
- Standard_Integer N = 100;
- Standard_Integer Eind, ind, i, j;
- TopTools_SequenceOfShape Eseq;
- TopExp_Explorer Explo( Comp, TopAbs_EDGE );
- for (; Explo.More(); Explo.Next())
- Eseq.Append( Explo.Current() );
-
- Standard_Integer NumberOfEdges = Eseq.Length();
- TColgp_Array2OfPnt Points( 0, NumberOfEdges*2-1, 1, N/4 );
-
- for (Eind = 0; Eind < NumberOfEdges; Eind++)
- {
- TopoDS_Edge anEdge = TopoDS::Edge( Eseq(Eind+1) );
- BRepAdaptor_Curve aCurve(anEdge);
- GCPnts_UniformAbscissa Distribution( aCurve, N+1 );
- for (i = 1; i <= N/4; i++)
- {
- Standard_Real par = Distribution.Parameter(i);
- Points( Eind*2, i ) = aCurve.Value(par);
- }
- for (i = 3*N/4+2; i <= N+1; i++)
- {
- Standard_Real par = Distribution.Parameter(i);
- Points( Eind*2+1, i-3*N/4-1 ) = aCurve.Value(par);
- }
- }
-
- TColgp_Array1OfPnt Origins( 0, NumberOfEdges*2-1 );
- TColgp_Array1OfDir Normals( 0, NumberOfEdges*2-1 );
- TColStd_Array1OfBoolean IsSingular( 0, NumberOfEdges*2-1 );
- Standard_Real MinAngle = M_PI/2;
- Standard_Integer MinInd;
- for (ind = 0; ind < NumberOfEdges*2; ind++)
- {
- TColgp_Array1OfPnt pnts( 1, N/4 );
- for (i = 1; i <= N/4; i++)
- pnts(i) = Points( ind, i );
- gp_Ax2 Axe;
- GeomLib::AxeOfInertia( pnts, Axe, IsSingular(ind) );
- if (!IsSingular(ind))
- {
- Origins(ind) = Axe.Location();
- Normals(ind) = Axe.Direction();
- Standard_Real Angle = bis.Angle( Axe );
- if (Angle > M_PI/2)
- Angle = M_PI - Angle;
- if (Angle < MinAngle)
- {
- MinAngle = Angle;
- MinInd = ind;
- }
- }
- }
-
- gp_Ax2 TheAxe( Origins(MinInd), Normals(MinInd) );
- Standard_Real MaxAngleWithPln = M_PI/16;
- TColStd_SequenceOfInteger iseq;
- TColgp_SequenceOfPnt Pseq;
- for (ind = 0; ind < NumberOfEdges*2; ind++)
- if (!IsSingular(ind))
- {
- Standard_Real Angle = Normals(ind).Angle( TheAxe.Direction() );
- if (Angle > M_PI/2)
- Angle = M_PI - Angle;
- if (Angle <= MaxAngleWithPln)
- {
- iseq.Append(ind);
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(ind,j) );
- }
- }
-
- TColgp_Array1OfPnt Parray( 1, Pseq.Length() );
- for (i = 1; i <= Parray.Length(); i++)
- Parray(i) = Pseq(i);
- Standard_Boolean issing;
- GeomLib::AxeOfInertia( Parray, TheAxe, issing );
- resPlane = gp_Pln( TheAxe );
-
- i = 1;
- BRep_Builder B;
- B.MakeCompound(NewComp);
- while (i <= iseq.Length())
- {
- Standard_Integer ind0 = iseq(i);
- if (IsEven(ind0) && i < iseq.Length() && iseq(i+1) == ind0+1) //the whole edge
- {
- B.Add( NewComp, Eseq(ind0/2+1) );
- i += 2;
- }
- else
- i++;
- }
-
- Standard_Integer slen = Pseq.Length();
- for (ind = 0; ind < NumberOfEdges*2; ind += 2)
- {
- Standard_Integer IndSing = -1, IndNotSing = -1;
- gp_Lin aLine;
- if (IsSingular(ind) && IsSingular(ind+1))
- {
- Standard_Boolean OnPlane0 = Standard_False, OnPlane1 = Standard_False;
- aLine = gce_MakeLin( Points(ind, 1), Points(ind, N/4) );
- if (resPlane.Contains( aLine, TolConf, TolAng ))
- {
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(ind,j) );
- OnPlane0 = Standard_True;
- }
- aLine = gce_MakeLin( Points(ind+1, 1), Points(ind+1, N/4) );
- if (resPlane.Contains( aLine, TolConf, TolAng ))
- {
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(ind+1,j) );
- OnPlane1 = Standard_True;
- }
- if (OnPlane0 && OnPlane1)
- B.Add( NewComp, Eseq(ind/2+1) );
- }
- else if (IsSingular(ind))
- {
- IndSing = ind;
- IndNotSing = ind+1;
- }
- else if (IsSingular(ind+1))
- {
- IndNotSing = ind;
- IndSing = ind+1;
- }
- if (IndSing != -1 && IndNotSing != -1)
- {
- aLine = gce_MakeLin( Points(IndSing, 1), Points(IndSing, N/4) );
- if (resPlane.Contains( aLine, TolConf, TolAng ))
- {
- for (j = 1; j <= N/4; j++)
- Pseq.Append( Points(IndSing,j) );
-
- for (i = 1; i <= iseq.Length(); i++)
- if (iseq(i) == IndNotSing)
- break;
- if (i <= iseq.Length())
- B.Add( NewComp, Eseq(ind/2+1) );
- }
- }
- }
-
- //Recompute the axe of plane
- if (Pseq.Length() > slen)
- {
- TColgp_Array1OfPnt Parray2( 1, Pseq.Length() );
- for (i = 1; i <= Parray2.Length(); i++)
- Parray2(i) = Pseq(i);
- GeomLib::AxeOfInertia( Parray2, TheAxe, issing );
- resPlane = gp_Pln( TheAxe );
- }
-
- //Temporary
- return Standard_True;
-}
}
}
-//=======================================================================
-//function : GetIntervalNbr
-//purpose :
-//=======================================================================
-
-static Standard_Integer GetIntervalNbr
- (const Standard_Real theParam,
- const Handle(TColStd_HArray1OfReal) &theSurfKnots,
- const Standard_Integer theIndStart,
- const Standard_Integer theIndEnd)
-{
- Standard_Integer i;
- Standard_Real aTol = Precision::Confusion();
-
- for (i = theIndStart + 1; i < theIndEnd; i++) {
- if (theSurfKnots->Value(i) > theParam + aTol)
- return i - 1;
- }
-
- return Min(theIndStart, theIndEnd - 1);
-}
-
-//=======================================================================
-//function : GetRealCurveKnots
-//purpose :
-//=======================================================================
-
-static void GetRealCurveKnots
- (const Handle(TColStd_HArray1OfReal) &theCurveKnots,
- const Handle(TColStd_HArray1OfReal) &theSurfKnots,
- const Geom2dAdaptor_Curve &theCurve,
- Handle(TColStd_HArray1OfReal) &theTKnots)
-{
- Standard_Integer i = theCurveKnots->Lower();
- Standard_Integer iU = theCurveKnots->Upper();
- Standard_Integer aNbIntPnt = 23;
- TColStd_SequenceOfReal aSeqKnot;
- Standard_Real aTol = Precision::Confusion();
- Standard_Real aTParam;
-
- while (i < iU) {
- Standard_Real aT1 = theCurveKnots->Value(i++);
- Standard_Real aT2 = theCurveKnots->Value(i);
- Standard_Real aStep = (aT2 - aT1)/(aNbIntPnt + 1.);
- Standard_Integer j;
- gp_Pnt2d aValue;
- gp_Vec2d aDir;
- Standard_Integer aSurfLInd = theSurfKnots->Lower();
- Standard_Integer aSurfUInd = theSurfKnots->Upper();
- Standard_Integer anIntrvlInd;
- Standard_Real aTParamOld;
- Standard_Real aVParam;
- Standard_Real aVParamOld;
- Standard_Real aDiffOld;
- Standard_Real aDiff;
-
-
- // Append the first curve knot of each interval in the sequence of knots.
- aSeqKnot.Append(aT1);
-
- aTParamOld = aT1;
- theCurve.D0(aTParamOld, aValue);
- aVParamOld = aValue.Y();
- anIntrvlInd = GetIntervalNbr(aVParamOld, theSurfKnots,
- aSurfLInd, aSurfUInd);
- aDiffOld = Min(Abs(aVParamOld - theSurfKnots->Value(anIntrvlInd)),
- Abs(aVParamOld - theSurfKnots->Value(anIntrvlInd + 1)));
-
- for (j = 1; j <= aNbIntPnt; j++) {
- aTParam = aT1 + j*aStep;
- theCurve.D1(aTParam, aValue, aDir);
- aVParam = aValue.Y();
- aDiff = Min(Abs(aVParam - theSurfKnots->Value(anIntrvlInd)),
- Abs(aVParam - theSurfKnots->Value(anIntrvlInd + 1)));
-
- // Skip points if the curve goes along V isoline.
- if (Abs(aDir.Y()) > aTol) {
- Standard_Boolean isLower =
- (aVParam - aTol < theSurfKnots->Value(anIntrvlInd));
- Standard_Boolean isUpper =
- (aVParam + aTol > theSurfKnots->Value(anIntrvlInd + 1));
-
- if (isLower || isUpper) {
- if (isLower) {
- aSurfLInd = theSurfKnots->Lower();
- aSurfUInd = anIntrvlInd - 1;
- } else if (isUpper) {
- aSurfLInd = anIntrvlInd + 1;
- aSurfUInd = theSurfKnots->Upper();
- }
-
- // The V interval is changed. Find new interval.
- anIntrvlInd = GetIntervalNbr(aVParam, theSurfKnots,
- aSurfLInd, aSurfUInd);
-
- // Add the value that is closer to surface knots.
- // Check if the previous value is already added.
- if (aDiff < aDiffOld)
- aSeqKnot.Append(aTParam);
- else if (Abs(aSeqKnot.Last() - aTParamOld) > aTol)
- aSeqKnot.Append(aTParamOld);
- }
- }
-
- // Prepare data for the next iteration.
- aTParamOld = aTParam;
- aVParamOld = aVParam;
- aDiffOld = aDiff;
- }
- }
-
- // Add the last curve knot to the sequence.
- aSeqKnot.Append(theCurveKnots->Value(iU));
-
- // Fill the array of knots.
- Standard_Integer aKnotsLen = aSeqKnot.Length();
-
- theTKnots = new TColStd_HArray1OfReal(1, aKnotsLen);
-
- for (i = 1; i <= aKnotsLen; i++) {
- aTParam = aSeqKnot.Value(i);
- theTKnots->SetValue(i, aTParam);
- }
-}
-
//=======================================================================
//function : GetUKnots
//purpose :
#include <GeomLib.hxx>
#include <GeomAPI_Interpolate.hxx>
-static Standard_Boolean IsClosed(const TopoDS_Wire& aWire)
-{
- TopoDS_Vertex V1, V2;
- TopExp::Vertices(aWire, V1, V2);
- return (V1.IsSame(V2));
-}
-
static Standard_Boolean IsLinear(const TopoDS_Edge& anEdge,
gp_Lin& aLine)
{
static Standard_Integer nbb = 0;
*/
-#ifdef DEB
-static Standard_Boolean PointIsOnCurve(const Handle(Geom2d_Curve)& C,
- const gp_Pnt2d& P,
- Standard_Real& U);
-#endif
static Standard_Boolean IsMaxRC (const Handle(Geom2d_Curve)& C,
Standard_Real U,
Standard_Real& R);
return thebisector;
}
-//=============================================================================
-//function : PointIsOnCurve
-// purpose :
-//=============================================================================
-#ifdef DEB
-static Standard_Boolean PointIsOnCurve(const Handle(Geom2d_Curve)& C,
- const gp_Pnt2d& P,
- Standard_Real& U)
-{
- if (C->Value(C->FirstParameter()).IsEqual(P,Precision::Confusion())) {
- U = C->FirstParameter();
- return Standard_True;
- }
- if (C->Value(C->LastParameter()).IsEqual(P,Precision::Confusion())) {
- U = C->LastParameter();
- return Standard_True;
- }
- return Standard_False;
-}
-#endif
//=============================================================================
//function : ReplaceByLineIfIsToSmall
//purpose : If the size of an algorithmic bissectrice is negligeable it is
//purpose :
//=============================================================================
// Unused :
-#ifdef DEB
+#ifdef DEB_CUR
static Standard_Real Curvature (const Handle(Geom2d_Curve)& C,
Standard_Real U,
Standard_Real Tol)
else {
Standard_Real A = 0.5*SquareMagPPC/Prosca;
Standard_Real Dist = A*A*NorNor;
+#ifdef DEB_CUR
//----------------------------------------
// Test Curvature if the curve is concave.
//----------------------------------------
-// if (!isConvex){
-// Standard_Real K = Curvature(curve,UOnCurve,Precision::Confusion());
-// if (K != 0.) {
-// if (Dist > 1/(K*K)) { Dist = Precision::Infinite();}
-// }
-// }
+ if (!isConvex){
+ Standard_Real K = Curvature(curve,UOnCurve,Precision::Confusion());
+ if (K != 0.) {
+ if (Dist > 1/(K*K)) { Dist = Precision::Infinite();}
+ }
+ }
+#endif
return Dist;
}
}
#include <CDF.ixx>
#include <Standard_Failure.hxx>
-// Unused :
-#ifdef DEB
-static void CDF_CheckStatus(int LicenseStatus) {
-
- if (LicenseStatus != 0) {
-
- switch (LicenseStatus) {
-
- case 1: Standard_Failure::Raise("LICENSE_unauthorized"); break;
- case 2: Standard_Failure::Raise("LICENSE_wrong_data"); break;
- case 3: Standard_Failure::Raise("LICENSE_max_users"); break;
- case 4: Standard_Failure::Raise("LICENSE_unspecified"); break;
- case 5: Standard_Failure::Raise("LICENSE_pb_init"); break;
- case 6: Standard_Failure::Raise("LICENSE_unspecified"); break;
- case 7: Standard_Failure::Raise("LICENSE_cantopenfile"); break;
- case 8: Standard_Failure::Raise("LICENSE_connexion"); break;
- case 9: Standard_Failure::Raise("LICENSE_syntaxe"); break;
- default: Standard_Failure::Raise("LICENSE_unspecified"); break;
- }
- }
-}
-#endif
void static CDF_InitApplication () {
static Standard_Boolean FirstApplication = Standard_True;
((Adaptor3d_Curve*)C)->D1(U,P,V1);
}
-// Unused :
-#ifdef DEB
-static void D12d(const Standard_Address C, const Standard_Real U,
- gp_Pnt& PP, gp_Vec& VV1)
-{
- gp_Pnt2d P;
- gp_Vec2d V1;
- ((Adaptor2d_Curve2d*)C)->D1(U,P,V1);
- PP.SetCoord(P.X(),P.Y(),0.);
- VV1.SetCoord(V1.X(),V1.Y(),0.);
-}
-#endif
-
static inline void D23d(const Standard_Address C, const Standard_Real U,
gp_Pnt& P, gp_Vec& V1, gp_Vec& V2)
{
#include <ChFiKPart_ComputeData_Rotule.hxx>
#include <ChFiKPart_ComputeData_Sphere.hxx>
-//=======================================================================
-//function : ComputeAbscissa
-//purpose :
-//=======================================================================
-
-// Unused :
-#ifdef DEB
-static Standard_Real ComputeAbscissa(const BRepAdaptor_Curve& C,
- const Standard_Real UFirst)
-{
- Standard_Real fp = fp = C.FirstParameter();
- switch (C.GetType()) {
- case GeomAbs_Line:
- return UFirst - fp;
- case GeomAbs_Circle:
- return C.Circle().Radius()*(UFirst-fp);
- default:
- break;
- }
- Standard_NotImplemented::Raise("calcul abscisse not processed");
- return 0.;
-}
-#endif
-
//=======================================================================
//function : Compute
//purpose :
di << "DDataStd_PNT : Error : not done" << "\n";
return 1;
}
-
-
-
-//=======================================================================
-//function : DDataStd_DrawStdDriver
-//purpose : DrawStdDriver
-//=======================================================================
-// Unused :
-#ifdef DEB
-static Standard_Integer DDataStd_DrawStdDriver (Draw_Interpretor& /*di*/,
- Standard_Integer /*nb*/,
- const char** /*arg*/)
-{
- DDataStd_DrawDriver::Set(new DDataStd_DrawDriver());
- return 0;
-}
-#endif
//=======================================================================
//function : DDataStd_Rmdraw
// necessary for WNT in C21 only
static FDraw_InitAppli theDraw_InitAppli; //pointer to the Draw_InitAppli
-static void Draw_InitAppli(Draw_Interpretor& theCommands)
-{
- theDraw_InitAppli (theCommands);
-}
#endif
#ifdef WNT
return Dr;
}
-#ifdef DEB
-//=======================================================================
-//function : GetCurve
-//purpose :
-//=======================================================================
-static Handle(DrawTrSurf_Curve) GetCurve(Standard_CString& Name)
-{
- Handle(Draw_Drawable3D) D = Draw::Get(Name);
- Handle(DrawTrSurf_Curve) Dr;
- if (!D.IsNull())
- Dr = Handle(DrawTrSurf_Curve)::DownCast(D);
- return Dr;
-}
-#endif
-
//=======================================================================
//function : GetBezierCurve
//purpose :
- update table TbSel.
-----------------------------------------------------------------------------*/
-static Standard_Boolean IsoIsDeg (const Adaptor3d_Surface& S,
- const Standard_Real Param,
- const GeomAbs_IsoType IT,
- const Standard_Real TolMin,
- const Standard_Real TolMax)
-{
- Standard_Real U1=0.,U2=0.,V1=0.,V2=0.,T;
- Standard_Boolean Along = Standard_True;
- U1 = S.FirstUParameter();
- U2 = S.LastUParameter();
- V1 = S.FirstVParameter();
- V2 = S.LastVParameter();
- gp_Vec D1U,D1V;
- gp_Pnt P;
- Standard_Real Step,D1NormMax;
- if (IT == GeomAbs_IsoV)
- {
- Step = (U2 - U1)/10;
- D1NormMax=0.;
- for (T=U1;T<=U2;T=T+Step)
- {
- S.D1(T,Param,P,D1U,D1V);
- D1NormMax=Max(D1NormMax,D1U.Magnitude());
- }
-
- if (D1NormMax >TolMax || D1NormMax < TolMin )
- Along = Standard_False;
- }
- else
- {
- Step = (V2 - V1)/10;
- D1NormMax=0.;
- for (T=V1;T<=V2;T=T+Step)
- {
- S.D1(Param,T,P,D1U,D1V);
- D1NormMax=Max(D1NormMax,D1V.Magnitude());
- }
-
- if (D1NormMax >TolMax || D1NormMax < TolMin )
- Along = Standard_False;
-
-
- }
- return Along;
-}
-//----------------------------------------------------------
Extrema_GenExtPS::Extrema_GenExtPS()
{
myDone = Standard_False;
// Function : ... (OCC78)
// Purpose : This family of functions produce conversion of angle utility
//===============================================================
-static Standard_Real corrPI_2PI(Standard_Real Ang){
- return Ang = (Ang >= 0.0? Ang: 2*M_PI+Ang);
-};
static Standard_Real corr2PI_PI(Standard_Real Ang){
return Ang = (Ang < M_PI? Ang: Ang-2*M_PI);
};
}
}
};
-
-
-
+
//-- ================================================================================
-//=======================================================================
-//function : FindInList
-//purpose :
-//=======================================================================
-// Unused :
-#ifdef DEB
-static Standard_Boolean FindInList (const TColStd_ListOfInteger& L,
- const Standard_Integer V)
-{
- for (TColStd_ListIteratorOfListOfInteger ILV(L);
- ILV.More();
- ILV.Next()) {
- if (V == ILV.Value())
- return Standard_True;
- }
- return Standard_False;
-}
-#endif
-
//=======================================================================
//function : AdjustParameter
//purpose :
//function : ProcessComplex
//purpose :
//=======================================================================
+#ifdef DEB_SI
static Standard_Boolean SimilarInterference(const HLRAlgo_Interference& I1,
const HLRAlgo_Interference& I2)
{
return IsSimilar;
}
+#endif
void HLRBRep_EdgeIList::
ProcessComplex(HLRAlgo_InterferenceList& IL,
const HLRBRep_EdgeInterferenceTool& T)
HLRAlgo_ListIteratorOfInterferenceList It2(It1);
It2.Next();
if (It2.More()) {
- if (T.SameInterferences(It1.Value(),It2.Value())/* ||
- SimilarInterference(It1.Value(),It2.Value())*/) {
-
+ if (T.SameInterferences(It1.Value(),It2.Value())
+#ifdef DEB_SI
+ || SimilarInterference(It1.Value(),It2.Value())
+#endif
+ )
+{
T.EdgeGeometry(T.ParameterOfInterference(It1.Value()),
TgtE, NormE, CurvE);
transTool.Reset(TgtE,NormE,CurvE);
It1.Value().BoundaryTransition());
while (It2.More()) {
- if (!(T.SameInterferences(It1.Value(),It2.Value())/* ||
- SimilarInterference(It1.Value(),It2.Value())*/)) break;
+ if (!(T.SameInterferences(It1.Value(),It2.Value())
+#ifdef DEB_SI
+ || SimilarInterference(It1.Value(),It2.Value())
+#endif
+ )) break;
T.InterferenceBoundaryGeometry(It2.Value(),TgtI,NormI,CurvI);
transTool.AddInterference(TolAng,
Standard_Real& u,
Standard_Real& v);
-static
- Standard_Boolean DoTrim(const TheCurve& curve,
- const TheSurface& surface);
-static
- void DoCurve(const TheCurve& curve,
- Bnd_Box& boxCurve);
-
-static
- void DoCommon(TColStd_Array1OfReal& Coords,
- Standard_Real& Cmin,
- Standard_Real& Cmax);
-
-static
- void DoCommonBox(const Bnd_Box& boxSurface,
- const Bnd_Box& boxCurve,
- TColStd_Array1OfReal& X,
- TColStd_Array1OfReal& Y,
- TColStd_Array1OfReal& Z);
-
static
void ProjectIntersectAndEstLim(const gp_Lin& theLine,
const gp_Pln& thePln,
gap = Max(Ures,Vres);
}
-//=======================================================================
-//function : DoCurve
-//purpose :
-//=======================================================================
-void DoCurve(const TheCurve& curve,
- Bnd_Box& boxCurve)
-{
- Standard_Real CF = TheCurveTool::FirstParameter(curve);
- Standard_Real CL = TheCurveTool::LastParameter(curve);
- Standard_Real C = 0., dC = fabs(CL-CF)/50.;
- Standard_Integer iC = 0;
- gp_Pnt aPnt;
-
- for(iC = 0; iC < 50; iC++) {
- if(iC == 0)
- C = CF;
- else if(iC == 49)
- C = CL;
- else
- C = CF + dC *((Standard_Real)iC);
-
- TheCurveTool::D0(curve,C,aPnt);
- boxCurve.Add(aPnt);
- }
-}
-
-//=======================================================================
-//function : DoCommon
-//purpose :
-//=======================================================================
-void DoCommon(TColStd_Array1OfReal& Coords,
- Standard_Real& Cmin,
- Standard_Real& Cmax)
-{
- Standard_Integer i = 0, j = 0;
- for(i = 1; i <= 4; i++) {
- for(j = i+1; j <= 4; j++) {
- if(Coords(j) > Coords(i)) {
- Standard_Real c = Coords(i);
- Coords.SetValue(i,Coords(j));
- Coords.SetValue(j,c);
- }
- }
- }
- Cmax = Coords(2);
- Cmin = Coords(3);
-}
-
-//=======================================================================
-//function : DoCommonBox
-//purpose :
-//=======================================================================
-static void DoCommonBox(const Bnd_Box& boxSurface,
- const Bnd_Box& boxCurve,
- TColStd_Array1OfReal& X,
- TColStd_Array1OfReal& Y,
- TColStd_Array1OfReal& Z)
-{
- Standard_Real SBXmin = 0., SBYmin = 0., SBZmin = 0.;
- Standard_Real SBXmax = 0., SBYmax = 0., SBZmax = 0.;
- boxSurface.Get(SBXmin,SBYmin,SBZmin,SBXmax,SBYmax,SBZmax);
-
- Standard_Real CBXmin = 0., CBYmin = 0., CBZmin = 0.;
- Standard_Real CBXmax = 0., CBYmax = 0., CBZmax = 0.;
- boxCurve.Get(CBXmin,CBYmin,CBZmin,CBXmax,CBYmax,CBZmax);
-
- TColStd_Array1OfReal Coord(1,4);
-
- Coord(1) = SBXmin; Coord(2) = SBXmax; Coord(3) = CBXmin; Coord(4) = CBXmax;
- Standard_Real CXmin = SBXmin, CXmax = SBXmax;
- DoCommon(Coord,CXmin,CXmax);
-
- Coord(1) = SBYmin; Coord(2) = SBYmax; Coord(3) = CBYmin; Coord(4) = CBYmax;
- Standard_Real CYmin = SBYmin, CYmax = SBYmax;
- DoCommon(Coord,CYmin,CYmax);
-
- Coord(1) = SBZmin; Coord(2) = SBZmax; Coord(3) = CBZmin; Coord(4) = CBZmax;
- Standard_Real CZmin = SBZmin, CZmax = SBZmax;
- DoCommon(Coord,CZmin,CZmax);
-
- X.SetValue(1,CXmin); X.SetValue(2,CXmax);
- Y.SetValue(1,CYmin); Y.SetValue(2,CYmax);
- Z.SetValue(1,CZmin); Z.SetValue(2,CZmax);
-}
-
//=======================================================================
//function : DoNewBounds
//purpose :
V1new = Max(V1new, -1.e10);
V2new = Min(V2new, 1.e10);
}
-//=======================================================================
-//function : DoTrim
-//purpose :
-//=======================================================================
-Standard_Boolean DoTrim(const TheCurve& curve,
- const TheSurface& surface)
-{
- Standard_Boolean isAnaCurve, isAnaSurface, result;
- GeomAbs_CurveType aCT;
- GeomAbs_SurfaceType aST;
-
- isAnaCurve = Standard_False;
- isAnaSurface = Standard_False;
- //
- aCT=TheCurveTool::GetType(curve);
- //
- isAnaCurve= (aCT==GeomAbs_Line ||
- aCT==GeomAbs_Circle ||
- aCT==GeomAbs_Ellipse ||
- aCT==GeomAbs_Hyperbola ||
- aCT==GeomAbs_Parabola);
- //
- aST=TheSurfaceTool::GetType(surface);
- isAnaSurface=(aST==GeomAbs_Plane ||
- aST==GeomAbs_Cylinder ||
- aST==GeomAbs_Cone ||
- aST==GeomAbs_Sphere ||
- aST==GeomAbs_Torus);
- //
- result = !(isAnaCurve && isAnaSurface);
- //
- if(result) {
- Standard_Boolean isUClosed, isVClosed;
-
- isUClosed=(TheSurfaceTool::IsUClosed(surface) ||
- TheSurfaceTool::IsUPeriodic(surface));
- isVClosed=(TheSurfaceTool::IsVClosed(surface)
- || TheSurfaceTool::IsVPeriodic(surface));
- if(isUClosed && isVClosed) {
- result =!result;
- }
- }
- //modified by NIZNHY-PKV Wed Apr 04 12:11:01 2012f
- if (result) {
- Standard_Real aU0,aU1,aV0,aV1, dU, dV, dA, dB, aR, aTresh;
- //
- aTresh=100.;
- aV0 = TheSurfaceTool::FirstVParameter(surface);
- aV1 = TheSurfaceTool::LastVParameter(surface);
- aU0 = TheSurfaceTool::FirstUParameter(surface);
- aU1 = TheSurfaceTool::LastUParameter(surface);
- dU=aU1-aU0;
- dV=aV1-aV0;
- //
- dA=dU;
- dB=dV;
- if (dV>dU) {
- dA=dV;
- dB=dU;
- }
- //
- aR=dA/dB;
- if (dB<Precision::PConfusion()) {
- result=!result;
- return result;
- }
- if (aR>aTresh) {
- result=!result;
- }
-
- }
- //modified by NIZNHY-PKV Wed Apr 04 12:11:03 2012t
- return result;
-}
return u;
}
-// adjust U parameters on Quadric
-static Standard_Real AdjustUNext(Standard_Real Un,Standard_Real Up)
-{
- Standard_Real u = Un;
- if( Un < 0. )
- while(u < 0.)
- u += (2.*M_PI);
- else if( Un > (2.*M_PI) )
- while( u > (2.*M_PI) )
- u -= (2.*M_PI);
- else if(Un == 0. || fabs(Un) <= 1.e-9)
- u = (fabs(Up) < fabs(2.*M_PI-Up)) ? 0. : (2.*M_PI);
- else if(Un == (2.*M_PI) || fabs(Un-(2.*M_PI)) <= 1.e-9)
- u = (fabs(Up) < fabs(2.*M_PI-Up)) ? 0. : (2.*M_PI);
- else //( Un > 0. && Un < (2.*M_PI) )
- return u;
- return u;
-}
-
// collect vertices, reject equals
static Handle(IntSurf_LineOn2S) GetVertices(const Handle(IntPatch_WLine)& WLine,
const Standard_Boolean ,//IsReversed,
}
}
}
-
-#ifdef DEB
-#include <TopoDS_Shape.hxx>
-#include <Poly_Triangulation.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <Poly_Array1OfTriangle.hxx>
-#include <BRep_TFace.hxx>
-#include <TopoDS_Face.hxx>
-
-//=======================================================================
-//function : TriangleShape
-//purpose : shape with triangulation containing triangles
-//=======================================================================
-static TopoDS_Shape TriangleShape(const IntPolyh_ArrayOfTriangles & TTriangles,
- const IntPolyh_ArrayOfPoints & TPoints)
-{
- TopoDS_Face aFace;
- if (TPoints.NbItems() < 1 || TTriangles.NbItems() < 1) return aFace;
-
- Handle(Poly_Triangulation) aPTriangulation =
- new Poly_Triangulation(TPoints.NbItems(),TTriangles.NbItems(),Standard_False);
- TColgp_Array1OfPnt & aPNodes = aPTriangulation->ChangeNodes();
- Poly_Array1OfTriangle & aPTrialgles = aPTriangulation->ChangeTriangles();
-
- Standard_Integer i;
- for (i=0; i<TPoints.NbItems(); i++) {
- const IntPolyh_Point& P = TPoints[i];
- aPNodes(i+1).SetCoord(P.X(), P.Y(), P.Z());
- }
- for (i=0; i<TTriangles.NbItems(); i++) {
- const IntPolyh_Triangle& T = TTriangles[i];
- aPTrialgles(i+1).Set(T.FirstPoint()+1, T.SecondPoint()+1, T.ThirdPoint()+1);
- }
-
- Handle(BRep_TFace) aTFace = new BRep_TFace;
- aTFace->Triangulation(aPTriangulation);
- aFace.TShape(aTFace);
- return aFace;
-}
-#endif
-
-//#define MyTolerance 10.0e-7
-//#define MyConfusionPrecision 10.0e-12
-//#define SquareMyConfusionPrecision 10.0e-24
const Standard_Integer NumTri,
const Standard_Integer NewTriNum,
IntPolyh_ArrayOfEdges & TEdges) ;
-static
- void TestOldEdgeB(const Standard_Integer NumTA,
- const Standard_Integer numPtT1,
- const Standard_Integer numPtT2,
- const Standard_Integer T1,
- const Standard_Integer T2,
- const IntPolyh_ArrayOfTriangles & TTriangles,
- const Standard_Integer Edge1,
- const Standard_Integer Edge3,
- IntPolyh_ArrayOfEdges & TEdges );
//=======================================================================
//function : IntPolyh_Triangle
}
}
-//=======================================================================
-//function : TestOldEdgeB
-//purpose :
-//=======================================================================
-void TestOldEdgeB(const Standard_Integer NumTA,
- const Standard_Integer numPtT1,
- const Standard_Integer /*numPtT2*/,
- const Standard_Integer T1,
- const Standard_Integer T2,
- const IntPolyh_ArrayOfTriangles & /*TTriangles*/,
- const Standard_Integer Edge1,
- const Standard_Integer Edge3,
- IntPolyh_ArrayOfEdges & TEdges )
-{
-
- if( (TEdges[Edge1].FirstPoint() == numPtT1)
- ||(TEdges[Edge1].SecondPoint()== numPtT1) ) {
- /// L'edge1 est commun aux triangles NumTA et T1
- if(TEdges[Edge1].FirstTriangle()==NumTA)
- TEdges[Edge1].SetFirstTriangle(T1);
- else TEdges[Edge1].SetSecondTriangle(T1);
-
- if(TEdges[Edge3].FirstTriangle()==NumTA)
- TEdges[Edge3].SetFirstTriangle(T2);
- else TEdges[Edge3].SetSecondTriangle(T2);
- }
- else {
- /// L'edge3 est commun aux triangles NumTA et T1
- if(TEdges[Edge3].FirstTriangle()==NumTA)
- TEdges[Edge3].SetFirstTriangle(T1);
- else TEdges[Edge3].SetSecondTriangle(T1);
- if(TEdges[Edge1].FirstTriangle()==NumTA)
- TEdges[Edge1].SetFirstTriangle(T2);
- else TEdges[Edge1].SetSecondTriangle(T2);
- }
-}
//=======================================================================
//function : MiddleRefinement
//purpose :
static
void RefineVector(gp_Vec2d& aV2D);
-
+#ifdef DEB_DUMPWLINE
static
void DumpWLine(const Handle(IntPatch_WLine)& aWLine);
+#endif
//
static
void TolR3d(const TopoDS_Face& ,
//
const Handle(IntPatch_WLine)& aWLine=
Handle(IntPatch_WLine)::DownCast(L);
- //DEBf
- //DumpWLine(aWLine);
- //DEBt
+#ifdef DEB_DUMPWLINE
+ DumpWLine(aWLine);
+#endif
anewL = ComputePurgedWLine(aWLine);
if(anewL.IsNull()) {
return;
}
L = anewL;
- //DEBf
- /*
- { const Handle(IntPatch_WLine)& aWLineX=
- Handle(IntPatch_WLine)::DownCast(L);
+#ifdef DEB_DUMPWLINE
+ const Handle(IntPatch_WLine)& aWLineX = Handle(IntPatch_WLine)::DownCast(L);
DumpWLine(aWLineX);
- }
- */
- //DEBt
+#endif
//
if(!myListOfPnts.IsEmpty()) {
bAvoidLineConstructor = Standard_True;
}
return aIndex;
}
+#ifdef DEB_DUMPWLINE
//=======================================================================
//function : DumpWLine
//purpose :
// i, aX, aY, aZ, aU1, aV1, aU2, aV2);
}
}
+#endif
//=======================================================================
//function : RefineVector
//purpose :
return RetVal;
}
-
-//=======================================================================
-//function : LocBefore
-//purpose :
-//=======================================================================
-
-#ifdef DEB
-static Standard_Boolean LocBefore (const LocOpe_SequenceOfPntFace& Spt,
- const Standard_Integer FromInd,
- const Standard_Real Tol,
- TopAbs_Orientation& Or,
- Standard_Integer& IndFrom,
- Standard_Integer& IndTo)
-{
- Standard_Integer nbpoints = Spt.Length();
- if (FromInd <= 1) {
- return Standard_False;
- }
-
- Standard_Real param,FPEPS;
- Standard_Integer i,ifirst;
- if (FromInd <= nbpoints) {
- FPEPS = Spt(FromInd).Parameter() + Tol;
- for (ifirst=FromInd-1; ifirst>=1; ifirst--) {
- if (Spt(ifirst).Parameter() <= FPEPS) {
- break;
- }
- }
- }
- else {
- ifirst = nbpoints;
- }
-
- Standard_Boolean RetVal = Standard_False;
- if (ifirst >= 1) {
- i = ifirst;
- IndTo = ifirst;
- Standard_Boolean found = Standard_False;
- while (!found) {
- Or = Spt(i).Orientation();
- param = Spt(i).Parameter();
- i = i-1;
- while (i>=1) {
- if (param - Spt(i).Parameter() <= Tol) {
- if (Or != TopAbs_EXTERNAL && Or != Spt(i).Orientation()) {
- Or = TopAbs_EXTERNAL;
- }
- i--;
- }
- else {
- break;
- }
- }
- if (Or == TopAbs_EXTERNAL) {
- found = (i < 1);
- IndTo = i;
- }
- else { // on a une intersection franche
- IndFrom = i+1;
- found = Standard_True;
- RetVal = Standard_True;
- }
- }
- }
- return RetVal;
-}
-#endif
-
-
//=======================================================================
//function : AddPoints
//purpose :
const TopoDS_Edge&,
const TopoDS_Vertex&);
-#ifdef DEB
-static Standard_Boolean Contains(const TopTools_ListOfShape&,
- const TopoDS_Shape&);
-#endif
-
-
-
//=======================================================================
//function : Perform
}
return 0;
}
-
-
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-
-// Unused :
-#ifdef DEB
-Standard_Boolean Contains(const TopTools_ListOfShape& L,
- const TopoDS_Shape& S)
-{
- TopTools_ListIteratorOfListOfShape itl;
- for (itl.Initialize(L); itl.More(); itl.Next()) {
-// for (TopTools_ListIteratorOfListOfShape itl(L); itl.More(); itl.Next()) {
- if (itl.Value().IsSame(S)) {
- return Standard_True;
- }
- }
- return Standard_False;
-}
-#endif
-
#include <TopExp.hxx>
#include <Precision.hxx>
-
-#ifdef DEB
-static Standard_Boolean FindCircle(const gp_Ax1&,
- const gp_Pnt&,
- gp_Circ&);
-#endif
-
//=======================================================================
//function : LocOpe_Revol
//purpose :
{
return myMap(S);
}
-
-//=======================================================================
-//function : FincCircle
-//purpose :
-//=======================================================================
-
-#ifdef DEB
-static Standard_Boolean FindCircle(const gp_Ax1& Ax,
- const gp_Pnt& Pt,
- gp_Circ& Ci)
-{
-
- const gp_Dir& Dax = Ax.Direction();
- gp_Vec OP(Ax.Location(),Pt);
-
- Standard_Real prm = OP.Dot(Dax);
-
- gp_Pnt prj(Ax.Location().XYZ().Added(prm*Dax.XYZ()));
- gp_Vec axx(prj,Pt);
- Standard_Real Radius = axx.Magnitude();
- if (Radius < Precision::Confusion()) {
- return Standard_False;
- }
- Ci.SetRadius(Radius);
- Ci.SetPosition(gp_Ax2(prj,Dax,axx));
- return Standard_True;
-}
-#endif
return 0;
}
-
-//=======================================================================
-//function : printdegree
-//purpose :
-//=======================================================================
-
-static void printdegree(BRepMesh_DegreeOfFreedom dof, Draw_Interpretor& di)
-{
- switch (dof) {
-case BRepMesh_InVolume :
- di << "InVolume";
- break;
-case BRepMesh_OnSurface :
- di << "OnSurface";
- break;
-case BRepMesh_OnCurve :
- di << "OnCurve";
- break;
-case BRepMesh_Fixed :
- di << "Fixed";
- break;
-case BRepMesh_Frontier :
- di << "Frontier";
- break;
-case BRepMesh_Deleted :
- di << "Deleted";
- break;
-case BRepMesh_Free :
- di << "Free";
- break;
- }
-}
-
//=======================================================================
//function : dumpvertex
//purpose :
//purpose :
//=======================================================================
-static void printdegree(BRepMesh_DegreeOfFreedom dof)
-{
- switch (dof) {
- case BRepMesh_InVolume :
- cout << "InVolume";
- break;
- case BRepMesh_OnSurface :
- cout << "OnSurface";
- break;
- case BRepMesh_OnCurve :
- cout << "OnCurve";
- break;
- case BRepMesh_Fixed :
- cout << "Fixed";
- break;
- case BRepMesh_Frontier :
- cout << "Frontier";
- break;
- case BRepMesh_Deleted :
- cout << "Deleted";
- break;
- case BRepMesh_Free :
- cout << "Free";
- break;
- }
-}
-
void MeshTest_DrawableMesh::Dump(Standard_OStream&) const
{
// Should be reimplemented
return PArray;
}
-//=======================================================================
-//function : ArrayCopy
-//purpose : Copy the gp_Pnt2d
-// from an Array2 from TColgp (TCollection)
-// to an HArray2 from PColgp (PCollection)
-//=======================================================================
-#ifdef DEB
-static Handle(PColgp_HArray2OfPnt2d) ArrayCopy
- (const TColgp_Array2OfPnt2d& TArray)
-{
- Standard_Integer LowerRow = TArray.LowerRow();
- Standard_Integer UpperRow = TArray.UpperRow();
- Standard_Integer LowerCol = TArray.LowerCol();
- Standard_Integer UpperCol = TArray.UpperCol();
- Standard_Integer IndexRow, IndexCol;
- Handle(PColgp_HArray2OfPnt2d) PArray =
- new PColgp_HArray2OfPnt2d(LowerRow, UpperRow, LowerCol, UpperCol);
- for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
- for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
- PArray->SetValue(IndexRow, IndexCol, TArray(IndexRow, IndexCol));
- }
- }
- return PArray;
-}
-#endif
//=======================================================================
//function : ArrayCopy
//purpose : Copy the Standard_Real
return PArray;
}
-//=======================================================================
-//function : ArrayCopy
-//purpose : Copy the Standard_Real
-// from an Array2 from TColStd (TCollection)
-// to an DoubleArray from PCollection
-//=======================================================================
-#ifdef DEB
-static Handle(PColStd_HArray2OfReal) ArrayCopy
- (const TColStd_Array2OfReal& TArray)
-{
- Standard_Integer LowerRow = TArray.LowerRow();
- Standard_Integer UpperRow = TArray.UpperRow();
- Standard_Integer LowerCol = TArray.LowerCol();
- Standard_Integer UpperCol = TArray.UpperCol();
- Standard_Integer IndexRow, IndexCol;
- Handle(PColStd_HArray2OfReal) PArray =
- new PColStd_HArray2OfReal(LowerRow, UpperRow, LowerCol, UpperCol);
- for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
- for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
- PArray->SetValue(IndexRow, IndexCol, TArray(IndexRow, IndexCol));
- }
- }
- return PArray;
-}
-#endif
//=======================================================================
//function : ArrayCopy
//purpose : Copy the Standard_Integer
}
}
-//=======================================================================
-//function : ArrayCopy
-//purpose : Copy the gp_Pnt2d
-// from an HArray2 from PColgp (PCollection)
-// to an Array2 from TColgp (TCollection)
-//=======================================================================
-
-// Unused :
-#ifdef DEB
-static void ArrayCopy
- (const Handle(PColgp_HArray2OfPnt2d)& PArray,
- TColgp_Array2OfPnt2d& TArray)
-{
- Standard_Integer LowerRow = TArray.LowerRow();
- Standard_Integer UpperRow = TArray.UpperRow();
- Standard_Integer LowerCol = TArray.LowerCol();
- Standard_Integer UpperCol = TArray.UpperCol();
- Standard_Integer IndexRow, IndexCol;
- for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
- for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
- TArray(IndexRow, IndexCol) = PArray->Value(IndexRow, IndexCol);
- }
- }
-}
-#endif
-
//=======================================================================
//function : ArrayCopy
//purpose : Copy the Standard_Real
}
}
-//=======================================================================
-//function : ArrayCopy
-//purpose : Copy the Standard_Real
-// from an DoubleArray from PCollection
-// to an Array2 from TColStd (TCollection)
-//=======================================================================
-
-// Unused :
-#ifdef DEB
-static void ArrayCopy
- (const Handle(PColStd_HArray2OfReal)& PArray,
- TColStd_Array2OfReal& TArray)
-{
- Standard_Integer LowerRow = TArray.LowerRow();
- Standard_Integer UpperRow = TArray.UpperRow();
- Standard_Integer LowerCol = TArray.LowerCol();
- Standard_Integer UpperCol = TArray.UpperCol();
- Standard_Integer IndexRow, IndexCol;
- for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
- for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
- TArray(IndexRow, IndexCol) = PArray->Value(IndexRow, IndexCol);
- }
- }
-}
-#endif
-
//=======================================================================
//function : ArrayCopy
//purpose : Copy the Standard_Integer
isDone = Standard_False;
}
-
-//=======================================================================
-//function : EvalPnt2d / EvalDir2d
-//purpose : returns the Projected Pnt / Dir in the parametrization range
-// of myPlane.
-//=======================================================================
-
-#ifdef DEB
-static gp_Pnt2d EvalPnt2d( const gp_Pnt& P, const gp_Cone& C)
-{
- gp_Vec OP( C.Location(),P);
- Standard_Real X = OP.Dot(gp_Vec(C.Position().XDirection()));
- Standard_Real Y = OP.Dot(gp_Vec(C.Position().YDirection()));
- Standard_Real Z = OP.Dot(gp_Vec(C.Position().Direction()));
- Standard_Real U,V;
-
- if ( Abs(X) > Precision::PConfusion() ||
- Abs(Y) > Precision::PConfusion() ) {
- U = ATan2(Y,X);
- }
- else {
- U = 0.;
- }
-
- V = Z / Cos(C.SemiAngle());
-
- return gp_Pnt2d( U, Z);
-}
-#endif
-
//=======================================================================
//function : Project
//purpose :
return Along;
}
-//=======================================================================
-//function : Interpolate
-//purpose :
-//=======================================================================
-
-static Handle(Geom2d_BSplineCurve) Interpolate(const Handle(TColgp_HArray1OfPnt2d)& myPoints,
- const Handle(TColStd_HArray1OfReal)& myParameters,
- const gp_Vec2d& InitialTangent,
- const gp_Vec2d& FinalTangent)
-{
- Handle(Geom2d_BSplineCurve) myCurve = NULL;
-
-// This code is extraction from Geom2dAPI_Interpolate with small correction
-// This is done to avoid of cyclic dependency if Geom2dAPI is used in ProjLib
-
- Standard_Integer degree,
- ii,
- jj,
- index,
- index1,
- index2,
- index3,
- mult_index,
- inversion_problem,
- num_points,
- num_distinct_knots,
- num_poles ;
-
- gp_Pnt2d a_point ;
-
- Standard_Boolean myTangentRequest = Standard_True;
-
- Handle(TColgp_HArray1OfVec2d) myTangents =
- new TColgp_HArray1OfVec2d(myPoints->Lower(),
- myPoints->Upper()) ;
- Handle(TColStd_HArray1OfBoolean) myTangentFlags =
- new TColStd_HArray1OfBoolean(myPoints->Lower(),
- myPoints->Upper()) ;
- myTangentFlags->Init(Standard_False);
-
- myTangentFlags->SetValue(1,Standard_True) ;
- myTangentFlags->SetValue(myPoints->Length(),Standard_True) ;
- myTangents->SetValue(1,InitialTangent) ;
- myTangents->SetValue(myPoints->Length(),FinalTangent);
-
- num_points =
- num_distinct_knots =
- num_poles = myPoints->Length() ;
- if (num_poles == 2 && !myTangentRequest) {
- degree = 1 ;
- }
- else if (num_poles == 3 && !myTangentRequest) {
- degree = 2 ;
- num_distinct_knots = 2 ;
- }
- else {
- degree = 3 ;
- num_poles += 2 ;
- //if (myTangentRequest)
- //for (ii = myTangentFlags->Lower() + 1 ;
- // ii < myTangentFlags->Upper() ; ii++) {
- //if (myTangentFlags->Value(ii)) {
- //num_poles += 1 ;
- //}
- //}
- }
-
-
- TColStd_Array1OfReal parameters(1,num_poles) ;
- TColStd_Array1OfReal flatknots(1,num_poles + degree + 1) ;
- TColStd_Array1OfInteger mults(1,num_distinct_knots) ;
- TColStd_Array1OfReal knots(1,num_distinct_knots) ;
- TColStd_Array1OfInteger contact_order_array(1, num_poles) ;
- TColgp_Array1OfPnt2d poles(1,num_poles) ;
-
- for (ii = 1 ; ii <= degree + 1 ; ii++) {
- flatknots.SetValue(ii,myParameters->Value(1)) ;
- flatknots.SetValue(ii + num_poles,
- myParameters->Value(num_points)) ;
- }
- for (ii = 1 ; ii <= num_poles ; ii++) {
- contact_order_array.SetValue(ii,0) ;
- }
- for (ii = 2 ; ii < num_distinct_knots ; ii++) {
- mults.SetValue(ii,1) ;
- }
- mults.SetValue(1,degree + 1) ;
- mults.SetValue(num_distinct_knots ,degree + 1) ;
-
- switch (degree) {
- case 1:
- for (ii = 1 ; ii <= num_poles ; ii++) {
- poles.SetValue(ii ,myPoints->Value(ii)) ;
- }
- myCurve =
- new Geom2d_BSplineCurve(poles,
- myParameters->Array1(),
- mults,
- degree) ;
- //myIsDone = Standard_True ;
- break ;
- case 2:
- knots.SetValue(1,myParameters->Value(1)) ;
- knots.SetValue(2,myParameters->Value(3)) ;
- for (ii = 1 ; ii <= num_poles ; ii++) {
- poles.SetValue(ii,myPoints->Value(ii)) ;
-
- }
- BSplCLib::Interpolate(degree,
- flatknots,
- myParameters->Array1(),
- contact_order_array,
- poles,
- inversion_problem) ;
- if (!inversion_problem) {
- myCurve =
- new Geom2d_BSplineCurve(poles,
- knots,
- mults,
- degree) ;
- //myIsDone = Standard_True ;
- }
- break ;
- case 3:
-//
-// check if the boundary conditions are set
-//
- //if (num_points >= 3) {
-//
-// cannot build the tangents with degree 3 with only 2 points
-// if those where not given in advance
-//
- //BuildTangents(myPoints->Array1(),
- //myTangents->ChangeArray1(),
- //myTangentFlags->ChangeArray1(),
- //myParameters->Array1()) ;
- //}
- contact_order_array.SetValue(2,1) ;
- parameters.SetValue(1,myParameters->Value(1)) ;
- parameters.SetValue(2,myParameters->Value(1)) ;
- poles.SetValue(1,myPoints->Value(1)) ;
- for (jj = 1 ; jj <= 2 ; jj++) {
- a_point.SetCoord(jj,myTangents->Value(1).Coord(jj)) ;
-
- }
- poles.SetValue(2,a_point) ;
- mult_index = 2 ;
- index = 3 ;
- index1 = 2 ;
- index2 = myPoints->Lower() + 1 ;
- index3 = degree + 2 ;
- if (myTangentRequest) {
- for (ii = myParameters->Lower() + 1 ;
- ii < myParameters->Upper() ; ii++) {
- parameters.SetValue(index,myParameters->Value(ii)) ;
- poles.SetValue(index,myPoints->Value(index2)) ;
- flatknots.SetValue(index3,myParameters->Value(ii)) ;
- index += 1 ;
- index3 += 1 ;
- if (myTangentFlags->Value(index1)) {
-//
-// set the multiplicities, the order of the contact, the
-// the flatknots,
-//
- mults.SetValue(mult_index,mults.Value(mult_index) + 1) ;
- contact_order_array(index) = 1 ;
- flatknots.SetValue(index3, myParameters->Value(ii)) ;
- parameters.SetValue(index,
- myParameters->Value(ii)) ;
- for (jj = 1 ; jj <= 2 ; jj++) {
- a_point.SetCoord(jj,myTangents->Value(ii).Coord(jj)) ;
- }
- poles.SetValue(index,a_point) ;
- index += 1 ;
- index3 += 1 ;
- }
- mult_index += 1 ;
- index1 += 1 ;
- index2 += 1 ;
-
- }
- }
- else {
- index1 = 2 ;
- for(ii = myParameters->Lower() ; ii <= myParameters->Upper() ; ii++) {
- parameters.SetValue(index1,
- myParameters->Value(ii)) ;
- index1 += 1 ;
- }
- index = 3 ;
- for (ii = myPoints->Lower() + 1 ; ii <= myPoints->Upper() - 1 ; ii++) {
- poles.SetValue(index,
- myPoints->Value(ii)) ;
- index += 1 ;
- }
-
-
- index = degree + 1 ;
- for(ii = myParameters->Lower() ; ii <= myParameters->Upper() ; ii++) {
- flatknots.SetValue(index,
- myParameters->Value(ii)) ;
- index += 1 ;
- }
- }
- for (jj = 1 ; jj <= 2 ; jj++) {
- a_point.SetCoord(jj,
- myTangents->Value(num_points).Coord(jj)) ;
- }
- poles.SetValue(num_poles-1 ,a_point) ;
-
- contact_order_array.SetValue(num_poles - 1,1) ;
- parameters.SetValue(num_poles,
- myParameters->Value(myParameters->Upper())) ;
- parameters.SetValue(num_poles -1,
- myParameters->Value(myParameters->Upper())) ;
-
- poles.SetValue(num_poles,
- myPoints->Value(num_points)) ;
-
- BSplCLib::Interpolate(degree,
- flatknots,
- parameters,
- contact_order_array,
- poles,
- inversion_problem) ;
- if (!inversion_problem) {
- myCurve =
- new Geom2d_BSplineCurve(poles,
- myParameters->Array1(),
- mults,
- degree) ;
- //myIsDone = Standard_True ;
- }
- break ;
-
- }
-
-
- return myCurve;
-}
-
//=======================================================================
//function : TrimC3d
//purpose :
aCompCurve.Add(aSegment, aTol);
aRes = aCompCurve.BSplineCurve();
-
- /*
- gp_Pnt2d P0;
- gp_Vec2d V01, V02;
- aRes->D2(t, P0, V01, V02);
-
- gp_XY XYP1 = P0.XY() + V01.XY()*dt + .5*V02.XY()*dt*dt;
-
- gp_Vec2d V11 = V01 + V02*dt;
-
- if(XYP1.X() < u1) XYP1.SetX(u1);
- if(XYP1.X() > u2) XYP1.SetX(u2);
- if(XYP1.Y() < v1) XYP1.SetY(v1);
- if(XYP1.Y() > v2) XYP1.SetY(v2);
-
- Handle(TColgp_HArray1OfPnt2d) aPnts = new TColgp_HArray1OfPnt2d(1, 2);
- Handle(TColStd_HArray1OfReal) aPars = new TColStd_HArray1OfReal(1, 2);
-
- if(dt < 0.) {
- aPnts->SetValue(1, gp_Pnt2d(XYP1));
- aPnts->SetValue(2, P0);
- aPars->SetValue(1, t + dt);
- aPars->SetValue(2, t);
- }
- else {
- aPnts->SetValue(2, gp_Pnt2d(XYP1));
- aPnts->SetValue(1, P0);
- aPars->SetValue(2, t + dt);
- aPars->SetValue(1, t);
- }
-
- Handle(Geom2d_BSplineCurve) aC;
-
- if(dt < 0.) {
- aC = Interpolate(aPnts, aPars, V11, V01);
- }
- else {
- aC = Interpolate(aPnts, aPars, V01, V11);
- }
-
-
- Geom2dConvert_CompCurveToBSplineCurve aConcat(aRes);
- aConcat.Add(aC, Precision::PConfusion());
-
- aRes = aConcat.BSplineCurve();
- */
-}
+}
//=======================================================================
//function : Project
#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
-static Quantity_NameOfColor GetColorFromName( const char *name, Standard_Boolean& Found)
-{
- Quantity_NameOfColor ret = DEFAULT_COLOR;
-
- Found = Standard_False;
- Standard_CString colstring;
- for(Standard_Integer i=0;i<=514 && !Found;i++)
- {
- colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
- if (!strcasecmp(name,colstring)) {
- ret = (Quantity_NameOfColor)i;
- Found = Standard_True;
- break;
- }
- }
-
- return ret;
-}
-
static Standard_Integer BUC60851 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
{
Handle(AIS_InteractiveContext) context= ViewerTest_Tool::MakeContext ("buc60851");
save.close();
}
-static void ModDbgTools_WriteCurrentShape(const Handle(TNaming_NamedShape) & NS)
-{
- TCollection_AsciiString entry;
- TDF_Tool::Entry(NS->Label(), entry);
- if (!NS.IsNull())
- {
- TopoDS_Shape Sh = TNaming_Tool::CurrentShape (NS);
- if(!Sh.IsNull()) {
- TCollection_AsciiString Entry = entry.Cat("_Cur.brep");
- ModDbgTools_Write(Sh, Entry.ToCString());
- }
- else
- cout << "ModDbgTools::Write>>> TopoDS_Shape IS NULL on Entry = "<< entry << endl;
- }
- else
- cout << "ModDbgTools::Write>>> CurrentShape of TNaming_NamedShape IS NULL on Entry = "<< entry << endl;
-}
#endif
//=======================================================================
#include <BOPDS_CommonBlock.hxx>
#include <BOPTools_AlgoTools3D.hxx>
-static Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
- const TopoDS_Face& theFace2);
-
static Standard_Boolean AddShapeToHistoryMap(const TopoDS_Shape& theOldShape,
const TopoDS_Shape& theNewShape,
TopTools_IndexedDataMapOfShapeListOfShape& theHistoryMap);
return Standard_True;
}
-// -----------------------------------------------------------------
-// static function: CheckSameDomainFaceInside
-// purpose: Check if distance between several points of theFace1 and
-// theFace2 is not more than sum of maximum of tolerances of
-// theFace1's edges and tolerance of theFace2
-// -----------------------------------------------------------------
-Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
- const TopoDS_Face& theFace2) {
-
- Standard_Real umin = 0., umax = 0., vmin = 0., vmax = 0.;
- BRepTools::UVBounds(theFace1, umin, umax, vmin, vmax);
- Handle(BOPInt_Context) aContext;
- Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace1);
- Standard_Real aTolerance = BRep_Tool::Tolerance(theFace1);
-
- aContext = new BOPInt_Context;
- TopExp_Explorer anExpE(theFace1, TopAbs_EDGE);
-
- for(; anExpE.More(); anExpE.Next()) {
- const TopoDS_Edge& anEdge = TopoDS::Edge(anExpE.Current());
- Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
- aTolerance = (aTolerance < anEdgeTol) ? anEdgeTol : aTolerance;
- }
- aTolerance += BRep_Tool::Tolerance(theFace2);
-
- Standard_Integer nbpoints = 5;
- Standard_Real adeltau = (umax - umin) / (nbpoints + 1);
- Standard_Real adeltav = (vmax - vmin) / (nbpoints + 1);
- Standard_Real U = umin + adeltau;
- GeomAPI_ProjectPointOnSurf& aProjector = aContext->ProjPS(theFace2);
-
- for(Standard_Integer i = 1; i <= nbpoints; i++, U+=adeltau) {
- Standard_Real V = vmin + adeltav;
-
- for(Standard_Integer j = 1; j <= nbpoints; j++, V+=adeltav) {
- gp_Pnt2d aPoint(U,V);
-
- if(aContext->IsPointInFace(theFace1, aPoint)) {
- gp_Pnt aP3d = aSurface->Value(U, V);
- aProjector.Perform(aP3d);
-
- if(aProjector.IsDone()) {
-
- if(aProjector.LowerDistance() > aTolerance)
- return Standard_False;
- }
- }
- }
- }
-
- return Standard_True;
-}
-
// --------------------------------------------------------------------------------------------
// static function: AddShapeToHistoryMap
// purpose:
}
-// Unused :
-#ifdef DEB
-static Standard_Boolean SMListContains(const TColStd_ListOfInteger& LL,
- const Standard_Integer aMode)
-{
- TColStd_ListIteratorOfListOfInteger LIt;
- for (LIt.Initialize(LL);LIt.More();LIt.Next())
- {if(LIt.Value()==aMode) return Standard_True;}
- return Standard_False;
-}
-
-#endif
-
//==================================================
// Function: Create
// Purpose :
return isDone;
}
-
-//=======================================================================
-//function : GetPointOnEdge
-//purpose : auxiliary
-//:h0 abv 29 May 98: PRO10105 1949: like in BRepCheck, point is to be taken
-// from 3d curve (but only if edge is SameParameter)
-//=======================================================================
-static gp_Pnt GetPointOnEdge ( const TopoDS_Edge &edge,
- const Handle(ShapeAnalysis_Surface) &surf,
- const Handle(Geom2d_Curve) &Crv2d,
- const Standard_Real param )
-{
- if ( BRep_Tool::SameParameter ( edge ) ) {
- Standard_Real f,l;
- TopLoc_Location L;
- const Handle(Geom_Curve) ConS = BRep_Tool::Curve ( edge, L, f, l );
- if ( ! ConS.IsNull() )
- return ConS->Value ( param ).Transformed ( L.Transformation() );
- }
- return surf->Value ( Crv2d->Value ( param ) );
-}
-
-
//=======================================================================
//function : SplitEdge
//purpose :
// B.Add(mySolid,TopoDS::Shell(iter.Value()));
myShape = solid;
}
+#ifdef DEB_GET_MIDDLE_POINT
//=======================================================================
-//function : CollectSolids
+//function : GetMiddlePoint
//purpose :
//=======================================================================
static void GetMiddlePoint(const TopoDS_Shape& aShape, gp_Pnt& pmid)
center /= numpoints;
pmid.SetXYZ(center);
}
+#endif
+//=======================================================================
+//function : CollectSolids
+//purpose :
+//=======================================================================
static void CollectSolids(const TopTools_SequenceOfShape& aSeqShells ,
TopTools_DataMapOfShapeListOfShape& aMapShellHoles,
TopTools_DataMapOfShapeInteger& theMapStatus)
}
if(numon == 3 && pointstatus ==TopAbs_ON) {
- //gp_Pnt pmid;
- //GetMiddlePoint(aShell2,pmid);
- //bsc3d.Perform(pmid,Precision::Confusion());
+#ifdef DEB_GET_MIDDLE_POINT
+ gp_Pnt pmid;
+ GetMiddlePoint(aShell2,pmid);
+ bsc3d.Perform(pmid,Precision::Confusion());
+#endif
pointstatus = /*(bsc3d.State() == TopAbs_IN ? TopAbs_IN :*/TopAbs_OUT;
}
if(pointstatus != infinstatus) {
#define BUC60925
#define OCC352
+#ifdef DEB_DBGTOOLS_WRITE
//#define OCC355
-//#define MDTV_DEB
-//#define MDTV_DEB_OR
-//#define MDTV_DEB_UNN
-//#define MDTV_DEB_INT
-//#define MDTV_DEB_GEN
-//#define MDTV_DEB_MODUN
-//#define MDTV_DEB_FNB
-//#define MDTV_DEB_WIN
-//#define MDTV_DEB_ARG
-//#define MDTV_DEB_SHELL
+#define MDTV_DEB
+#define MDTV_DEB_OR
+#define MDTV_DEB_UNN
+#define MDTV_DEB_INT
+#define MDTV_DEB_GEN
+#define MDTV_DEB_MODUN
+#define MDTV_DEB_FNB
+#define MDTV_DEB_WIN
+#define MDTV_DEB_ARG
+#define MDTV_DEB_SHELL
+#endif
#ifdef MDTV_DEB
#include <TCollection_AsciiString.hxx>
#include <TDF_Tool.hxx>
#include <BRepTools.hxx>
-#include <DbgTools.hxx>
#endif
#ifdef DEB
#include <TCollection_AsciiString.hxx>
cout << "LabelEntry = "<< entry << endl;
}
}
-
+#ifdef DEB_DBGTOOLS_WRITE
//=======================================================================
static void DbgTools_Write(const TopoDS_Shape& shape,
const Standard_CString filename)
}
}
#endif
-
-//=======================================================================
+#endif
//
//====================================================================
static Standard_Boolean ValidArgs(const TNaming_ListOfNamedShape& Args)
return Standard_True;
}
-//=======================================================================
-// function: FindShape
-//
-//=======================================================================
-static TopoDS_Shape FindShape(const TopTools_ListOfShape& theList)
-{
- Standard_Integer anUp = theList.Extent();
- TopoDS_Shape aShape;
- if(anUp < 1) return aShape;
- if(anUp == 1) return theList.First();
- Standard_Integer aLow = 1;
- TColStd_Array1OfInteger Ar1(aLow, anUp);
- TopTools_Array1OfShape Ars(aLow, anUp);
- TopTools_ListIteratorOfListOfShape it(theList);
- Standard_Integer i=0;
- for(i=aLow;it.More();it.Next(), i++) {
- Ars.SetValue(i, it.Value());
- Ar1.SetValue(i, 0);
- }
-// for(i = aLow;i<= anUp;i++) {
-// const TopoDS_Shape& aS = Ars.Value(i);
-// for(Standard_Integer j=i;j<=anUp;j++)
-// if(aS.IsSame(Ars.Value(j)))
-// Ar1.SetValue(i, Ar1.Value(i)+1);
-// }
- for(i = aLow;i<= anUp;i++) {
- const TopoDS_Shape& aS = Ars.Value(i);
- for(Standard_Integer j=i+1;j<=anUp;j++)
- if(aS.IsSame(Ars.Value(j)))
- return aS;
- }
-// Standard_Integer aNum = Ar1.Value(1);
-// Standard_Integer indx = -1;
-// for(i = aLow;i<= anUp;i++) {
-// if(aNum < Ar1.Value(i)) {
-// aNum = Ar1.Value(i);
-// indx = i;
-// }
-// }
-// if(indx == -1) return aShape;
-// return Ars.Value(indx);
- return aShape;
-}
-//=======================================================================
-/*
-static TopoDS_Shape FindShape(const TopTools_DataMapOfShapeListOfShape& DM)
-{
- TopoDS_Shape aResult;
- Standard_Integer aNum = DM.Extent();
- if(aNum < 1) return aResult;
- // cout <<" DM Keys Nb = " << aNum <<endl;
- TopTools_ListOfShape List;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it(DM);
- for (;it.More();it.Next()) {
- const TopoDS_Shape& aKey1 = it.Key();
- const TopTools_ListOfShape& aList = it.Value();
- TopTools_ListIteratorOfListOfShape itl(aList);
- for (;itl.More();itl.Next()) {
- const TopoDS_Shape& aS = itl.Value();
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it2(DM);
- for (;it2.More();it2.Next()) {
- const TopoDS_Shape& aKey2 = it2.Key();
- if(aKey2 == aKey1) continue;
- else {
- const TopTools_ListOfShape& aList2 = it2.Value();
- TopTools_ListIteratorOfListOfShape itl2(aList2);
- for(;itl2.More();itl2.Next()) {
- if(aS.IsSame(itl2.Value()))
- List.Append(itl2.Value());
- }
- }
- }
- }
- break;
- }
-
- if(List.IsEmpty()) return aResult;
- if(List.Extent() == 1) return List.First();
- TopTools_ListIteratorOfListOfShape itl (List);
- TopoDS_Compound Compound;
- BRep_Builder B;
- B.MakeCompound(Compound);
- for (; itl.More(); itl.Next()){
- B.Add(Compound,itl.Value());
- }
- return Compound;
-}
-*/
-
//=======================================================================
static TopoDS_Shape FindShape(const TNaming_DataMapOfShapeMapOfShape& DM)
{
if(!aList2.Extent()) return Standard_False; // Empty
Standard_Boolean found = Standard_False;
- //TopoDS_Shape aShape = FindShape(aList2);
TopoDS_Shape aShape = FindShape(aDM);
#ifdef MDTV_DEB_GEN
if(!aShape.IsNull())
else
cout << "WriteNSOnLabel >>> NamedShape IS NULL" << endl;
}
-//=======================================================================
-static void Write(const TopTools_MapOfShape& MS, const Standard_CString filename)
-{
- if (!MS.IsEmpty ()) {
- TCollection_AsciiString aNam (filename);
- Standard_Integer i(0);
- TopTools_MapIteratorOfMapOfShape it(MS);
- for(;it.More();it.Next(),i++) {
- TCollection_AsciiString aName = aNam + "_" + i + ".brep";
- Write ( it.Key(), aName.ToCString());
- }
- }
-}
#endif
//==========================================================================================
#define oneINtwo ( 1)
#define twoINone ( 2)
-#ifdef DEB
-static void FUN_coutsta(const Standard_Integer& sta, const Standard_Integer& i1, const Standard_Integer& i2, Draw_Interpretor& di)
-{
- switch (sta) {
- case SAME:
- di<<i1<<" gives SAME bnd with "<<i2<<"\n"; break;
- case DIFF:
- di<<i1<<" gives OUT bnd with "<<i2<<"\n"; break;
- case oneINtwo:
- di<<i1<<" is IN "<<i2<<"\n"; break;
- case twoINone:
- di<<i2<<" is IN "<<i1<<"\n"; break;
- }
-}
-#endif
-
static void FUN_test_draw(TCollection_AsciiString aa,
const TopoDS_Edge& E, const TopoDS_Face& F,
const Standard_Integer ie,
return S;
}
-#ifdef DEB
-static const TopoDS_Shape& GetShapeSameDomain
-(const Standard_Integer IS,const TopAbs_ShapeEnum TS,const TCollection_AsciiString& pre = "");
-
-//-----------------------------------------------------------------------
-// GetShapeSameDomain IS = shape index,TS = shape kind
-//-----------------------------------------------------------------------
-static const TopoDS_Shape& GetShapeSameDomain(const Standard_Integer IS,const TopAbs_ShapeEnum TS,const TCollection_AsciiString& pre)
-{
- Standard_Boolean TypeControl = Standard_True;
- if ( !PHDSD ) return bidbid;
-
- static TopoDS_Shape ShapeNull;
- const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
- const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
-
- // check on shape index and on shape kind if kind differs from TopAbs_SHAPE
- Standard_Integer ns = BDS.NbShapes();
- if ( IS < 1 || IS > ns) {
- TopAbs::Print(TS,cout);cout<<" "<<IS<<" does not exist in DS"<<endl;
- return ShapeNull;
- }
- else if ( !PHDSD->ShapeKind(IS,TS) ) {
- if ( TypeControl ) {
- cout<<"Shape "<<IS<<" is not a ";TopAbs::Print(TS,cout);
- cout<<" but a ";TopAbs::Print(BDS.Shape(IS,SFindKeep).ShapeType(),cout);
- cout<<endl;
- }
- return ShapeNull;
- }
- else if ( !HDS->HasSameDomain(HDS->Shape(IS,SFindKeep)) ) {
- if ( TypeControl ) cout<<"Shape "<<IS<<" is not HasSameDomain"<<endl;
- return ShapeNull;
- }
-
- // shape index <IS> ok : get shape <S> of index <IS>
- const TopoDS_Shape& S = BDS.Shape(IS,SFindKeep);
- TopOpeBRepDS_Dumper Dumper(HDS);
- TCollection_AsciiString sse = Dumper.SPrintShape(S);
- TCollection_AsciiString sor = TopOpeBRepDS::SPrint(S.Orientation());
- TCollection_AsciiString str;str=str+pre+sse+" is "+sor+"\n";
- cout<<str;cout.flush();
-
- return S;
-}
-#endif
-
//-----------------------------------------------------------------------
// SeeSectionEdge
//-----------------------------------------------------------------------
return 0;
}
-//-----------------------------------------------------------------------
-// SeeGeometry
-//-----------------------------------------------------------------------
-// Unused :
-#ifdef DEB
-static Standard_Integer SeeGeometry(const tsee_entity& E)
-{
- if (!E.myEOK) return 0;
- return SeeGeometry(E.myEindex,E.myETK);
-}
-#endif
-
//-----------------------------------------------------------------------
// SeeGeometry
//-----------------------------------------------------------------------
return res;
}
-//-----------------------------------------------------------------------
-// decalargs : shift a[*] from <-d>,modify na = na - deca
-//-----------------------------------------------------------------------
-// Unused :
-#ifdef DEB
-static void decalargs(Standard_Integer& na,const char** a,const Standard_Integer d)
-{for(Standard_Integer i=1;i<na;i++)a[i]=a[i+d];na-=d;}
-#endif
-
//-----------------------------------------------------------------------
// suppressarg : remove a[d],modify na--
//-----------------------------------------------------------------------
na -= l-f+1;
}
-//-----------------------------------------------------------------------
-// SetTolFlag
-//-----------------------------------------------------------------------
-// Unused :
-#ifdef DEB
-static Standard_Boolean SetTolFlag(Standard_Integer& na,const char** a) { decalargs(na,a,1); return Standard_True; }
-#endif
-
//-----------------------------------------------------------------------
// tsee_flags
//-----------------------------------------------------------------------
return NbMES;
}
-// Unused :
-#ifdef DEB
-//-----------------------------------------------
-static void SeemMesure(const Handle(TestTopOpeDraw_DrawableMesure) DM,const Standard_Integer CMES)
-//-----------------------------------------------
-{
- char *pname = (char *)(*PNAME).Value(CMES).ToCString();
- Draw::Set(pname,DM);
-}
-#endif
-
static void Mes_help(Draw_Interpretor& di)
{
di<<"\n";
return temp;
}
-#ifdef DEB
-static Handle(Geom_Curve) DrawAxe1(const TColgp_Array1OfPnt& T)
-{
- Standard_Integer up = T.Upper();
- TColgp_Array1OfPnt *AOP = new TColgp_Array1OfPnt(1, up);
- for(Standard_Integer i= 1; i <= up; i++) {
- gp_Pnt pnt(T.Value(i).Coord(1), 0, 0);
- (*AOP).SetValue(i, pnt);
- }
- Handle(Geom_Curve) C;
- C = TopOpeBRepTool_CurveTool::MakeBSpline1fromPnt(*AOP);
- return C;
-}
-#endif
-
-#ifdef DEB
-static Handle(Geom_Curve) DrawAxe2(const TColgp_Array1OfPnt& T)
-{
- Standard_Integer up = T.Upper();
- TColgp_Array1OfPnt *AOP = new TColgp_Array1OfPnt(1, up);
- for(Standard_Integer i= 1; i <= up; i++) {
- gp_Pnt pnt(0, T.Value(i).Coord(2), 0);
- (*AOP).SetValue(i, pnt);
- }
- Handle(Geom_Curve) C;
- C = TopOpeBRepTool_CurveTool::MakeBSpline1fromPnt(*AOP);
- return C;
-}
-#endif
-
static Handle(Geom_Curve) DrawAxe1(const TColgp_Array1OfPnt& T,
const Standard_Real ScaleX)
{
}
}
-// 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 :
extern void debvprmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il,Standard_Integer vp,Standard_Integer si);
extern Standard_Boolean TopOpeBRep_GetcontextNOPUNK();
-static void SSAVFF(const TopoDS_Shape& F1, const TopoDS_Shape& F2)
-{
- TCollection_AsciiString aname_1("ffbug_1"), aname_2("ffbug_2");
- Standard_CString name_1=aname_1.ToCString(),name_2=aname_2.ToCString();
- cout<<"FacesFiller : "<<name_1<<","<<name_2<<endl;
- BRepTools::Write(F1,name_1); BRepTools::Write(F2,name_2);
-}
#ifdef DRAW
static void FUN_traceRLine(const TopOpeBRep_LineInter& L)
{
return ONfirstP;
}
-#ifdef DEB
-static void FUN_remove(TopOpeBRepDS_ListOfInterference& lI, const Handle(TopOpeBRepDS_Interference)& I)
-{
- TopOpeBRepDS_ListIteratorOfListOfInterference itI(lI);
- while (itI.More()) {
- const Handle(TopOpeBRepDS_Interference)& Icur = itI.Value();
- if (Icur == I) lI.Remove(itI);
- else itI.Next();
- }
-}
-#endif
-
//=======================================================================
//function : ProcessRLine
//purpose :
{cout<<"f1,f2,il,vp,si : "<<f1<<","<<f2<<","<<il<<","<<vp<<","<<si<<endl;cout.flush();debvpr();}
void debpoint(Standard_Integer i) {cout<<"+ debpoint"<<i<<endl;}
void debvertex(Standard_Integer i){cout<<"+ debvertex"<<i<<endl;}
-static void FUN_Raise() {cout <<"FAILURE IN TopOpeBRep_FacesFiller::ProcessVPonR"<<endl;}
Standard_EXPORT void debarc(const Standard_Integer i) {cout<<"+ debarc "<<i<<endl;}
Standard_EXPORT void debooarc(const Standard_Integer i) {cout<<"+ debooarc "<<i<<endl;}
// modified by NIZHNY-MKK Tue Nov 21 17:30:27 2000.END
#ifdef DEB
-void static FUN_debdegeneR() {}
-void static FUN_debdegeneF() {}
extern Standard_Boolean TopOpeBRepDS_GettraceDEGEN();
extern Standard_Boolean TopOpeBRepDS_GettraceDSF();
Standard_EXPORT Standard_Boolean FUN_debnull(const TopoDS_Shape& s);
if (FUN_debnull(Ed)) cout<<"Ed is null"<<endl;
if (trace) {
TopAbs_Orientation Edori = Ed.Orientation();
- if (Edori == TopAbs_FORWARD) FUN_debdegeneF();
- if (Edori == TopAbs_REVERSED) FUN_debdegeneR();
}
Standard_Boolean trace3d = Standard_False;
#ifdef DRAW
return x;
}
-/*static void FUN_getinfsupx(const TopoDS_Edge& E, const TopOpeBRepTool_C2DF& c2df,
- const Standard_Boolean uiso,
- Standard_Real& xf, Standard_Real& xl)
-{ // prequesitory : E is uviso
- // 2drep(E) describes [xf,xl]*[yf,yl];
- // if (uiso) x = upar
- // if (viso) x = vpar
- Standard_Real f,l; FUN_tool_bounds(E, f,l);
- Standard_Real parf = FUN_getx(E,c2df,uiso, f);
- Standard_Real parl = FUN_getx(E,c2df,uiso, l);
- if (parf < parl) {xf = parf; xl = parl;}
- else {xf = parl; xl = parf;}
-}*/
-
-#ifdef DEB
-static Standard_Boolean FUN_isonOcE(const TopOpeBRepTool_CORRISO CO, const TopoDS_Edge& cE)
-{
- TopTools_Array1OfShape vcE(1,2); TopOpeBRepTool_TOOL::Vertices(cE,vcE);
- TopAbs_Orientation ocE = cE.Orientation();
-
- Standard_Real tttolcE = BRep_Tool::Tolerance(cE);
- Standard_Real tttuvcE = Max(CO.Tol(1,tttolcE),CO.Tol(2,tttolcE));
- TopOpeBRepTool_C2DF cE2d; Standard_Boolean isb = CO.UVRep(cE,cE2d);
- if (!isb) return Standard_False; // NYIRAISE
-
- // isonOcE2d :
- Standard_Boolean isonOcE2d = Standard_False;
- {
- // OcE (closing edge with complemented orientation):
- TopAbs_Orientation oOcE = TopAbs::Complement(ocE);
- TopoDS_Shape aLocalShape = cE.Oriented(oOcE);
- TopoDS_Edge OcE = TopoDS::Edge(aLocalShape);
-// TopoDS_Edge OcE = TopoDS::Edge(cE.Oriented(oOcE));
- TopTools_Array1OfShape vOcE(1,2); TopOpeBRepTool_TOOL::Vertices(OcE,vOcE);
- Standard_Real tttolOcE = BRep_Tool::Tolerance(OcE);
- Standard_Real tttuvOcE = Max(CO.Tol(1,tttolOcE),CO.Tol(2,tttolOcE));
- TopOpeBRepTool_C2DF OcE2d; Standard_Boolean isOb = CO.UVRep(OcE,OcE2d);
- if (!isOb) return Standard_False; // NYIRAISE
-
- Standard_Real parvce1 = TopOpeBRepTool_TOOL::ParE(1,cE); gp_Pnt2d UVvce1 = TopOpeBRepTool_TOOL::UVF(parvce1,cE2d);
-
- Standard_Real parvOcE2 = TopOpeBRepTool_TOOL::ParE(2,OcE); gp_Pnt2d UVvOcE2 = TopOpeBRepTool_TOOL::UVF(parvOcE2,OcE2d);
- Standard_Real tol = Max(tttuvcE,tttuvOcE);
- isonOcE2d = (UVvce1.Distance(UVvOcE2) < tol);
- }
- return isonOcE2d;
-}
-#endif
-
//=======================================================================
//function : PurgeFyClosingE
//purpose :
#endif
// DEB
-// Unused :
-#ifdef DEB
-static void FUN_RaiseError()
-{
-#ifdef DEB
- Standard_Boolean trc = TopOpeBRepTool_GettracePURGE();
- // Standard_Failure::Raise("TopOpeBRepTool::PurgeClosingEdges");
- FUN_REINIT();
- if (trc) cout <<"*********failure in TopOpeBRepTool::PurgeClosingEdges***********\n";
-#endif
-}
-static void FUN_Raise()
-{
-#ifdef DEB
- // cout <<"*********failure in TopOpeBRepTool::CorrectONUVISO***********\n";
- // Standard_Failure::Raise("TopOpeBRepTool::CorrectONUVISO");
-#endif
-}
-#endif
-
#define SPLITEDGE (0)
#define INCREASE (1)
#define DECREASE (-1)
Standard_Boolean ok = ::FUN_correctClosingE(fyisoe,Fsp);
if (!ok) {
- FUN_Raise();
continue;
}
}
Standard_Boolean ok = ::FUN_correctDegeneratedE(mve,fydege,Fsp);
if (!ok) {
- FUN_Raise();
continue;
}
} // itdeg
#define EXTERNAL (4)
#define CLOSING (5)
-// Unused :
-#ifdef DEB
-static Standard_Real FUN_nullcurv(const Standard_Real curv)
-{
- Standard_Real tol = Precision::Confusion()*1.e+2; // NYI
- return (curv < tol);
-}
-#endif
static Standard_Boolean FUN_nullprodv(const Standard_Real prodv)
{
// Standard_Real tola = Precision::Angular()*1.e+1; // NYI
extern TopTools_IndexedMapOfOrientedShape STATIC_PURGE_mapeds;
extern Standard_Boolean TopOpeBRepTool_GettracePURGE();
Standard_EXPORT void FUN_REINIT()
-{STATIC_PURGE_mapv.Clear(); STATIC_PURGE_mapeds.Clear();}
-static void FUN_RaiseError()
{
-#ifdef DEB
- Standard_Boolean trc = TopOpeBRepTool_GettracePURGE();
- // Standard_Failure::Raise("TopOpeBRepTool::PurgeClosingEdges");
- FUN_REINIT();
- if (trc) cout <<"*********failure in TopOpeBRepTool::PurgeClosingEdges***********\n";
-#endif
+ STATIC_PURGE_mapv.Clear(); STATIC_PURGE_mapeds.Clear();
}
-Standard_EXPORT Standard_Integer FUN_addepc(const TopoDS_Shape& ed,const TopoDS_Shape& /*f*/){
+Standard_EXPORT Standard_Integer FUN_addepc(const TopoDS_Shape& ed,const TopoDS_Shape&)
+{
Standard_Integer ie = STATIC_PURGE_mapeds.Add(ed);
#ifdef DRAW
// TCollection_AsciiString aa = TCollection_AsciiString("pc_"); FUN_tool_draw(aa,TopoDS::Edge(ed),TopoDS::Face(f),ie);
#endif
return ie;
}
+
Standard_EXPORT Standard_Integer FUN_addcheckepc(const TopoDS_Shape& ed,const TopoDS_Shape& f) {
Standard_Integer ie = 0;
ie = STATIC_PURGE_mapeds.FindIndex(ed);
if (ie == 0) ie = FUN_addepc(ed,f);
return ie;
}
-/*Standard_EXPORT Standard_Integer FUN_adds(const TopoDS_Shape& s) {
- TopAbs_ShapeEnum typ = s.ShapeType();
- TCollection_AsciiString aa; Standard_Integer is;
- if (typ == TopAbs_VERTEX) {aa = TCollection_AsciiString("v_"); is = STATIC_PURGE_mapv.Add(s);}
-#ifdef DRAW
- Standard_Boolean trc = TopOpeBRepTool_GettracePURGE();
- if (trc) FUN_tool_draw(aa,s,is);
-#endif
- return is;
-}*/
Standard_IMPORT Standard_Integer FUN_adds(const TopoDS_Shape& s);
+
Standard_EXPORT void FUN_tool_tori(const TopAbs_Orientation Or)
{
switch (Or) {
#endif
Standard_EXPORT void FUN_tool_trace(const Standard_Integer Index)
-{if (Index == 1) cout <<"FORWARD ";
- if (Index == 2) cout <<"REVERSED ";}
-Standard_EXPORT void FUN_tool_trace(const gp_Pnt2d p2d)
-{cout<<" = ("<<p2d.X()<<" "<<p2d.Y()<<")"<<endl;}
-
-/*Standard_IMPORT Standard_Real FUN_tool_parOnE(const Standard_Integer Index,const TopoDS_Edge& E,const TopoDS_Face& F);
-Standard_IMPORT void FUN_tool_addTomap
-(const TopoDS_Shape& key,const TopoDS_Shape& elementOfitem,TopTools_DataMapOfShapeListOfShape& map,const Standard_Integer check);
-Standard_IMPORT void FUN_tool_addTomap(const TopoDS_Shape& key,const TopoDS_Shape& elementOfitem,
- TopTools_IndexedDataMapOfShapeListOfShape& map,const Standard_Integer check);
-
-// ----------------------------------------------------------------------
-Standard_EXPORT gp_Pnt2d FUN_GetVParonF(const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Integer Index)
-// ----------------------------------------------------------------------
-{
- Standard_Real par = FUN_tool_parOnE(Index, E, F);
- Standard_Real pf,pl,tol; Handle(Geom2d_Curve) PC = FUNTOOLC2D_CurveOnSurface(E,F,pf,pl,tol);
- if (PC.IsNull()) Standard_Failure::Raise(" FUN_GetVParonF : no 2d curve");
- gp_Pnt2d p2d; PC->D0(par,p2d);
- return p2d;
-}
-
-// ----------------------------------------------------------------------
-Standard_EXPORT Standard_Real FUN_toluv(const GeomAdaptor_Surface& GAS, const Standard_Real& tol3d)
-// ----------------------------------------------------------------------
{
- Standard_Real tolu = GAS.UResolution(tol3d);
- Standard_Real tolv = GAS.VResolution(tol3d);
- Standard_Real toluv = Max(tolu,tolv);
- return toluv;
+ if (Index == 1) cout <<"FORWARD ";
+ if (Index == 2) cout <<"REVERSED ";
}
-
-// ----------------------------------------------------------------------
-Standard_EXPORT void FUN_tool_Vertices(const TopoDS_Edge& E, TopTools_Array1OfShape& vertices)
-// ----------------------------------------------------------------------
-{
- // Returns vertices (F,R) if E is FORWARD
- // (R,V) if E is REVERSED
- TopAbs_Orientation oriE = E.Orientation();
- TopoDS_Vertex vF, vR; TopExp::Vertices(E,vF,vR);
- Standard_Integer iF, iR;
- if (oriE == TopAbs_FORWARD) {iF = 1; iR = 2;}
- else {iF = 2; iR = 1;}
- vertices.ChangeValue(iF) = vF;
- vertices.ChangeValue(iR) = vR;
-}
-// ----------------------------------------------------------------------
-Standard_EXPORT void FUN_mapVloe(const TopoDS_Shape& F, TopTools_IndexedDataMapOfShapeListOfShape& mapVloe)
-// ----------------------------------------------------------------------
-{
- mapVloe.Clear();
-// TopExp::MapShapesAndAncestors(F,TopAbs_VERTEX,TopAbs_EDGE,mapVloe);
- TopExp_Explorer exe(F, TopAbs_EDGE);
- for (; exe.More(); exe.Next()){
- const TopoDS_Shape e = exe.Current();
- TopExp_Explorer exv(e, TopAbs_VERTEX);
- for (; exv.More(); exv.Next()){
- const TopoDS_Shape& v = exv.Current();
- FUN_tool_addTomap(v, e, mapVloe, 0);
- }
- }
-}*/
-
-//======================================================================
-
-/*Standard_EXPORT Standard_Boolean FUN_DetectEdgeswithfaultyUV
-(const TopoDS_Face& Fin, const TopoDS_Shape& fF, const TopTools_ListOfShape& ISOEds,
- const Standard_Boolean has2fybounds, TopTools_ListOfShape& lfyE, Standard_Integer& Ivfaulty,
- const Standard_Boolean& stopatfirst=Standard_False)
-// purpose : finding out edges <lfyE> / its UV rep. on <Fin>
-// is unconnected to the other pcurves.
-// if (has2fybounds), the 2 bounds of the pcurve are faulty.
-// else : Ivfaulty is index of faulty vertex.
-// return True if at least one edge is faulty
-{
- // <ISOEds> : list of pcurves to check among <fF>'s 2d rep. edges.
- // <ISOEds> are edges of <fF>
-
- lfyE.Clear();
- Ivfaulty = 0; // dummy if has2faultybounds
- TopTools_ListOfShape Eds;
- TopExp_Explorer exe(fF, TopAbs_EDGE);
- for (; exe.More(); exe.Next()) Eds.Append(exe.Current());
-
- // <mapVloe> :
- // ----------
- // key = a vertex boundary of a closing edge,
- // item = the list of edges connexed to the vertex.
- TopTools_IndexedDataMapOfShapeListOfShape mapVloe; ::FUN_mapVloe(fF,mapVloe);
-
- const Handle(Geom_Surface)& SU = BRep_Tool::Surface(Fin);
- GeomAdaptor_Surface GAS(SU);
- Standard_Real tttol = 1.e-8;
- Standard_Real tttolF = BRep_Tool::Tolerance(Fin);
- Standard_Real tttuvF = FUN_toluv(GAS,tttolF);
-
- // fF's checking :
- // -----------------
- // An edge is valid if the first and last vertices are valid:
- // vertex <vISOe> is valid if there is an edge with bound <ve> such that :
- // <vISOe> and <ve> share same UV geometry
- // <vISOe> and <ve> are of opposite orientation.
- TopTools_ListIteratorOfListOfShape itISOEd(ISOEds);
- for (; itISOEd.More(); itISOEd.Next()) {
- const TopoDS_Edge& ISOe = TopoDS::Edge(itISOEd.Value());
- TopAbs_Orientation oriISO = ISOe.Orientation();
- if (M_INTERNAL(oriISO) || M_EXTERNAL(oriISO)) continue;
-
- Standard_Real tttolISOe = BRep_Tool::Tolerance(ISOe);
- Standard_Real tttuvISOe = FUN_toluv(GAS,tttolISOe);
-
- TopTools_Array1OfShape vISOE(1,2); FUN_tool_Vertices(ISOe, vISOE);
-
- Standard_Boolean closed = vISOE(1).IsSame(vISOE(2));
- if (closed) continue; // closed edge is ass
-
- Standard_Integer nfyv = 0;
- for (Standard_Integer ivISOe = 1; ivISOe <=2; ivISOe++) {
-
- // <vISOe> (boundary of <ISOe>):
- const TopoDS_Vertex& vISOe = TopoDS::Vertex(vISOE(ivISOe));
- gp_Pnt2d UVvISOe = FUN_GetVParonF(ISOe, Fin, ivISOe);
-
- Standard_Real tttolvISOe = BRep_Tool::Tolerance(vISOe);
- Standard_Real tttuvvISOe = FUN_toluv(GAS,tttolvISOe);
-
- Standard_Boolean isbound = mapVloe.Contains(vISOe);
- if (!isbound) {FUN_RaiseError(); return Standard_False;}
-
- // <vISOeok> :
- Standard_Boolean vISOeok = Standard_False;
- const TopTools_ListOfShape& loe = mapVloe.FindFromKey(vISOe);
- Standard_Integer nloe = loe.Extent();
- for (TopTools_ListIteratorOfListOfShape ite(loe); ite.More(); ite.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(ite.Value());
- if (E.IsSame(ISOe)) continue;
- Standard_Real tttolE = BRep_Tool::Tolerance(E);
- Standard_Real tttuvE = FUN_toluv(GAS,tttolE);
-
- TopTools_Array1OfShape vE(1,2); FUN_tool_Vertices(E,vE);
- for (Standard_Integer ive = 1; ive <=2; ive++) {
- const TopoDS_Vertex& ve = TopoDS::Vertex(vE(ive));
- Standard_Boolean samev = ve.IsSame(vISOe);
- if (!samev) continue;
-
- if (ive == ivISOe) continue;
- gp_Pnt2d UVve = FUN_GetVParonF(E, Fin, ive);
-
- Standard_Real tttolve = BRep_Tool::Tolerance(ve);
- Standard_Real tttuvve = FUN_toluv(GAS,tttolve);
-
- tttol = Max(tttol,Max(tttuvF,Max(tttuvE,Max(tttuvISOe,Max(tttuvve,tttuvvISOe)))));
- Standard_Boolean isequal = UVvISOe.IsEqual(UVve,tttol);
- if (isequal) {vISOeok = Standard_True; break;}
- } // ive
- if (vISOeok) break;
- } // ite(loe)
-
- if (!vISOeok) nfyv++;
-
- Standard_Boolean stop = (!has2fybounds && (nfyv > 0));
- if (stop) {
- if (Ivfaulty == 0) Ivfaulty = ivISOe;//xpu121098 (cto900J4,f4ou) : first faulty edge
- break;
- }
- } // ivISOe = 1..2
-
- Standard_Boolean found = has2fybounds && (nfyv == 2);
- found = found || (!has2fybounds && (nfyv == 1));
- if (found) {
- lfyE.Append(ISOe);
- }
- }
-
- Standard_Integer n = lfyE.Extent();
- Standard_Boolean det = (n != 0);
- return det;
-} // FUN_DetectEdgeswithfaultyUV
-
-Standard_EXPORT Standard_Boolean FUN_DetectEdgewithfaultyUV
-(const TopoDS_Face& Fin, const TopoDS_Shape& fF, const TopTools_ListOfShape& ISOEds,
- const Standard_Boolean has2fybounds, TopoDS_Shape& fyE, Standard_Integer& Ivfaulty)
-// purpose : finding out first edge <fyE> / its UV rep. on <Fin>
-// is unconnected to the other pcurves.
-// if (has2fybounds), the 2 bounds of the pcurve are faulty.
-// else : Ivfaulty is index of faulty vertex.
-// return True if at least one edge is faulty
+Standard_EXPORT void FUN_tool_trace(const gp_Pnt2d p2d)
{
- // <ISOEds> : list of pcurves to check among <fF>'s 2d rep. edges.
- // <ISOEds> are edges of <fF>
- TopTools_ListOfShape lfyE;
- Standard_Boolean det = FUN_DetectEdgeswithfaultyUV(Fin,fF,ISOEds,has2fybounds,lfyE,Ivfaulty);
- if (det) fyE = lfyE.First();
- return det;
+ cout<<" = ("<<p2d.X()<<" "<<p2d.Y()<<")"<<endl;
}
-
-// ----------------------------------------------------------------------
-Standard_EXPORT Standard_Boolean FUN_DetectFaultyClosingEdge
-(const TopoDS_Face& Fin,const TopTools_ListOfShape& Eds,const TopTools_ListOfShape& cEds,TopTools_ListOfShape& fyE)
-// ----------------------------------------------------------------------
-{
-#ifdef DEB
- Standard_Boolean trc = TopOpeBRepTool_GettracePURGE();
- for (TopTools_ListIteratorOfListOfShape it(Eds); it.More(); it.Next()){
- const TopoDS_Shape& ed = it.Value();
- TopExp_Explorer ex;
- for (ex.Init(ed, TopAbs_VERTEX); ex.More(); ex.Next())
-// for (TopExp_Explorer ex(ed, TopAbs_VERTEX); ex.More(); ex.Next())
- FUN_adds(ex.Current());}
-#endif
-
- // <cEds> and <Eds> are the lists of closed and non-"closing" edges
- // describing a wire boundary on face <Fin>.
- // ("closing" edge = edge built on the geometry of a closing edge of <Fin> )
-
- // If <W> has UV non-connexed edges, returns <True> if <fyE> is the list of faulty cEds
- // fyE = {e / e has its 2 bounds non-UVconnexed}
- // Returns <False> elsewhere.
- // prequesitory : wire <W> is 3d-connexed, so a faulty edge must be a
- // closing edge.
-
- // <mapVloe> :
- // ----------
- // key = a vertex boundary of a closing edge,
- // item = the list of edges connexed to the vertex.
- TopTools_DataMapOfShapeListOfShape mapVloe;
- for (TopTools_ListIteratorOfListOfShape itEd(Eds); itEd.More(); itEd.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(itEd.Value());
- 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_Shape& v = ex.Current();
- FUN_tool_addTomap(v, E, mapVloe, 0);
- }
- }
- const Handle(Geom_Surface)& SU = BRep_Tool::Surface(TopoDS::Face(Fin));
- GeomAdaptor_Surface GAS(SU);
- Standard_Real tttol = 1.e-8;
- Standard_Real tttolF = BRep_Tool::Tolerance(TopoDS::Face(Fin));
- Standard_Real tttuvF = FUN_toluv(GAS,tttolF);
-
- Standard_Boolean uclosed,vclosed; Standard_Real uperiod,vperiod;
- Standard_Boolean uvclosed = FUN_tool_closedS(Fin,uclosed,uperiod,vclosed,vperiod);
-
- // wire's checking :
- // -----------------
- // An edge is valid if the first and last vertices are valid:
- // vertex <vce> is valid if there is an edge with bound <ve> verifying :
- // <vce> and <ve> share same UV geometry
- // <vce> and <ve> are of opposite orientation.
- TopTools_ListIteratorOfListOfShape itCEd(cEds);
- for (; itCEd.More(); itCEd.Next()) {
- const TopoDS_Edge& cE = TopoDS::Edge(itCEd.Value());
- Standard_Boolean isou,isov; gp_Pnt2d o2d; gp_Dir2d d2d;
- Standard_Real f,l,tol; Handle(Geom2d_Curve) PC = FUNTOOLC2D_CurveOnSurface(cE,Fin,f,l,tol);
- Standard_Boolean isouv = FUN_tool_IsUViso(PC,isou,isov,d2d,o2d);
-
-#ifdef DEB
- Standard_Integer icE = FUN_addcheckepc(cE,Fin);
- if (trc) {cout<<"closing edge "<<icE<<" "; TopAbs::Print(cE.Orientation(),cout);
- cout<<" : \n";}
-#endif
-
- Standard_Real tttolcE = BRep_Tool::Tolerance(cE);
- Standard_Real tttuvcE = FUN_toluv(GAS,tttolcE);
-
- Standard_Boolean cEKO = Standard_True;
- TopTools_Array1OfShape vcE(1,2); FUN_tool_Vertices(cE, vcE);
- for (Standard_Integer ivce = 1; ivce <=2; ivce++) {
- // <vce> (boundary of <cE>):
- const TopoDS_Vertex& vce = TopoDS::Vertex(vcE(ivce));
- gp_Pnt2d UVvce = FUN_GetVParonF(cE, Fin, ivce);
-#ifdef DEB
- // recall in one wire, there are 2 vertices for one non-degenerated closing edge
- Standard_Integer ivmapv = STATIC_PURGE_mapv.Add(vce);
- if (trc) {
- cout<<"v"<<ivmapv<<" ";FUN_tool_trace(ivce);cout<<" in closing edge "<<icE;
- FUN_tool_trace(UVvce);
-#ifdef DRAW
- TCollection_AsciiString bb("uv_");bb += TCollection_AsciiString(ivmapv);FUN_tool_draw(bb,UVvce);
-#endif
- }
-#endif
-
- Standard_Real tttolvce = BRep_Tool::Tolerance(vce);
- Standard_Real tttuvvce = FUN_toluv(GAS,tttolvce);
-
- Standard_Boolean isbound = mapVloe.IsBound(vce);
- if (!isbound) continue; //xpu201198 cto016E2 (e3on)
-
- // <vceok> :
- Standard_Boolean vceok = Standard_False;
- const TopTools_ListOfShape& loe = mapVloe.Find(vce);
- Standard_Integer nloe = loe.Extent();
-#ifdef DRAW
- Standard_Boolean tdr = Standard_False;
- if (tdr) {
- Standard_Integer inde = 1;
- for (TopTools_ListIteratorOfListOfShape ite(loe); ite.More(); ite.Next()) {
- const TopoDS_Shape& eee = ite.Value(); FUN_drawe(eee,inde); inde++;
- }
- }
-#endif
- for (TopTools_ListIteratorOfListOfShape ite(loe); ite.More(); ite.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(ite.Value());
-// if (E.IsSame(cE)) continue; // closing FORWARD and REVERSED EDGES are UV disjoint
-#ifdef DEB
- Standard_Integer iE = FUN_addcheckepc(E,Fin);
-#endif
-
- Standard_Real tttolE = BRep_Tool::Tolerance(E);
- Standard_Real tttuvE = FUN_toluv(GAS,tttolE);
-
- TopTools_Array1OfShape vE(1,2); FUN_tool_Vertices(E,vE);
- for (Standard_Integer ive = 1; ive <=2; ive++) {
- const TopoDS_Vertex& ve = TopoDS::Vertex(vE(ive));
- Standard_Boolean samev = ve.IsSame(vce);
- if (!samev) continue;
-
- if (ive == ivce) continue;
- gp_Pnt2d UVve = FUN_GetVParonF(E, Fin, ive);
-
- Standard_Real tttolve = BRep_Tool::Tolerance(ve);
- Standard_Real tttuvve = FUN_toluv(GAS,tttolve);
-
- tttol = Max(tttol,Max(tttuvF,Max(tttuvE,Max(tttuvcE,Max(tttuvve,tttuvvce)))));
-// Standard_Boolean isequal = UVvce.IsEqual(UVve,tttol);
- Standard_Real dd=0., xperiod=0.;
- if (uclosed && isou) {dd = UVve.X()-UVvce.X(); xperiod = uperiod;}
- if (vclosed && isov) {dd = UVve.Y()-UVvce.Y(); xperiod = vperiod;}
- Standard_Boolean xok = (Abs(dd)<tttol) || (Abs(Abs(dd)-xperiod)<tttol);
- Standard_Boolean isequal = xok;
-
- if (isequal) {
- vceok = Standard_True;
-#ifdef DEB
- if (trc)
- {cout<<"vertex ";FUN_tool_trace(ivce);cout<<" of closing edge "<<icE;
- cout<<" is connexed to vertex ";FUN_tool_trace(ive);cout<<" of edge "<<iE<<endl;}
-#endif
- }
- break;
- } // ive
- if (vceok) break;
- } // ite(loe)
-#ifdef DEB
- if (trc && !vceok) {cout<<" vertex ";FUN_tool_trace(ivce);
- cout<<"of closing edge "<<icE<<" is faulty"<<endl;}
-#endif
- cEKO = cEKO && (!vceok);
- } // ivce
-
-#ifdef DEB
- if (trc) {if (!cEKO) cout<<"-> valid edge"<<endl;
- else cout<<"-> faulty edge"<<endl;}
-#endif
- if (cEKO) {fyE.Append(cE);}
- }
- return (!fyE.IsEmpty());
-}
-
-Standard_EXPORT Standard_Boolean FUN_isUVClosed(const TopoDS_Face& Fin, const TopoDS_Face& fF)
-// purpose : returns true is fF is UV connexed
-{
- TopTools_ListOfShape efF;
- TopExp_Explorer ex(fF, TopAbs_EDGE);
- for (; ex.More(); ex.Next()) efF.Append(ex.Current());
- Standard_Integer Ivfaulty; TopTools_ListOfShape lfyE; Standard_Boolean stopatfirst = Standard_True;
- Standard_Boolean foundfaulty = FUN_DetectEdgeswithfaultyUV(Fin,fF,efF,Standard_False,lfyE,Ivfaulty,stopatfirst);
- return !foundfaulty;
-}*/
#include <BRepOffsetAPI_MakeThickSolid.hxx>
#include <BRepOffset.hxx>
-
-//==============================================================================
-//function : GetTypeNameFromShape
-//purpose : get the shape type as a string from a shape
-//==============================================================================
-
-static const char* GetTypeNameFromShape( const TopoDS_Shape& aShape )
-{ const char *ret = "????";
-
- if ( aShape.IsNull() ) ret = "Null Shape";
-
- switch ( aShape.ShapeType() ) {
- case TopAbs_COMPOUND : ret = "COMPOUND" ; break;
- case TopAbs_COMPSOLID : ret = "COMPSOLID" ; break;
- case TopAbs_SOLID : ret = "SOLID" ; break;
- case TopAbs_SHELL : ret = "SHELL" ; break;
- case TopAbs_FACE : ret = "FACE" ; break;
- case TopAbs_WIRE : ret = "WIRE" ; break;
- case TopAbs_EDGE : ret = "EDGE" ; break;
- case TopAbs_VERTEX : ret = "VERTEX" ; break;
- case TopAbs_SHAPE : ret = "SHAPE" ; break;
- }
- return ret;
-}
//==============================================================================
// VIEWER OBJECT MANAGEMENT GLOBAL VARIABLES
//==============================================================================
return S;
}
-//==============================================================================
-//function : GetShapeFromName
-//purpose : Compute an Shape from a draw variable or a file name
-//==============================================================================
-// Unused :
-#ifdef DEB
-static TopoDS_Shape GetShapeFromAIS(const AIS_InteractiveObject & TheAisIO )
-{
- TopoDS_Shape TheShape=((*(Handle(AIS_Shape)*)&TheAisIO))->Shape();
- return TheShape;
-}
-#endif
+
//==============================================================================
//function : GetAISShapeFromName
//purpose : Compute an AIS_Shape from a draw variable or a file name
return 0;
}
-//==============================================================================
-//function : VMoveA
-//purpose : Test the annimation of an object along a
-// predifined trajectory
-//Draw arg : vmove ShapeName
-//==============================================================================
-
-#ifdef DEB
-static int VMoveA (Draw_Interpretor& di, Standard_Integer argc, const char** argv) {
-
- OSD_Timer myTimer;
- myTimer.Start();
-
- if (TheAISContext()->HasOpenedContext())
- TheAISContext()->CloseLocalContext();
-
- Standard_Real Step=2*M_PI/180;
- Standard_Real Angle=0;
- // R est le rayon de l'hellicoide
- Standard_Real R=50;
- // D est la distance parcourue en translation en 1 tour
- Standard_Real D=50;
-
- Handle(AIS_InteractiveObject) aIO;
-
- if (GetMapOfAIS().IsBound2(argv[1]))
- aIO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[1]));
-
- if (aIO.IsNull()) {
- di<<" Syntaxe error: "<<argv[1]<<" doesn't exist"<<"\n";
- return 1;
- }
- TheAISContext()->Deactivate(aIO);
-
- // boucle generant le mouvement
- if(argc==3) {
- di<<" Transformations"<<"\n";
- for (Standard_Real myAngle=0;Angle<5*2*M_PI; myAngle++) {
-
- Angle=Step*myAngle;
- gp_Ax3 newBase(gp_Pnt(R*cos(Angle), R*sin(Angle), D*Angle/(2*M_PI) ), gp_Vec(0,0,1), gp_Vec(1,0,0) );
- gp_Trsf myTransfo;
- myTransfo.SetTransformation(newBase.Rotated(gp_Ax1(gp_Pnt(R*cos(Angle),R*sin(Angle),0), gp_Dir(0,0,1) ),Angle ) );
- TheAISContext()->SetLocation(aIO,myTransfo);
-
- TheAISContext() ->UpdateCurrentViewer();
-
- }
- }
- else {
- di<<" Locations"<<"\n";
- gp_Trsf myAngleTrsf;
- myAngleTrsf.SetRotation(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1) ), Step );
- TopLoc_Location myDeltaAngle (myAngleTrsf);
- gp_Trsf myDistTrsf;
- myDistTrsf.SetTranslation(gp_Dir(0,0,1) );
- TopLoc_Location myDeltaDist (myDistTrsf);
- TopLoc_Location myTrueLoc;
-
- for (Standard_Real myAngle=0;Angle<5*2*M_PI; myAngle++) {
-
- Angle=Step*myAngle;
- myTrueLoc=myTrueLoc*myDeltaAngle*myDeltaDist;
- TheAISContext()->SetLocation(aIO,myTrueLoc );
- TheAISContext() ->UpdateCurrentViewer();
- }
- }
-
-
- TopoDS_Shape ShapeBis=((*(Handle(AIS_Shape)*)&aIO)->Shape()).Located( aIO->Location() );
-
- //TopLoc_Location Tempo=aIO->Location();
- //TopoDS_Shape ShapeBis=((*(Handle(AIS_Shape)*)&aIO)->Shape());
- //ShapeBis.Located(Tempo);
-
-
- // On reset la location (origine) contenue dans l'AISInteractiveObject
- TheAISContext() ->ResetLocation(aIO);
-
- // On force aShape a devenir l'AIS IO propre a ShapeBis
-
- // Pour cela on force aShape(AIS IO) a devenir une AISShape
- // ->Set() est une methode de AIS_Shape
- (*(Handle(AIS_Shape)*)& aIO)->Set(ShapeBis);
-
- // On donne a ShapeBis le nom de l'AIS IO
- //Rep::Set(argv[1],ShapeBis);
-
-
- TheAISContext()->Redisplay(aIO,Standard_False);
-
- // On reactive la selection des primitives sensibles
- TheAISContext()->Activate(aIO,0);
-
- TheAISContext() ->UpdateCurrentViewer();
- a3DView() -> Redraw();
-
- myTimer.Stop();
- di<<" Temps ecoule "<<"\n";
- myTimer.Show();
-
- return 0;
-}
-#endif
-
-
//==============================================================================
//function : VPerf
//purpose : Test the annimation of an object along a
}
}
return 0;
-
}
-
-//=======================================================================
-//function : VPickObject
-//purpose : filters can be set (type of Object to pick....
-//
-//=======================================================================
-// Unused :
-#ifdef DEB
-static int VPickObject( Draw_Interpretor& , Standard_Integer /*argc*/, const char** /*argv*/)
-{
- // preparation de la nomination automatique
- static TCollection_AsciiString ObjType[] ={"None","Datum","Shape","Object","Relation"};
-// static char* DatumSig [8] ={"Point","Axis","Trih","PlTri","Line","Circle","Plane","UnK"};
-
-/* TCollection_AsciiString name;
-
- Standard_Integer NbToPick = argc>2 ? argc-2 : 1;
- if(NbToPick==1){
- PickSh = ViewerTest::PickObject(theType);
-
- if(PickSh.IsNull())
- return 1;
- if(argc>2){
- name += argv[2];
- }
- else{
-
- if(!PickSh.IsNull()){
- nbOfSub[Standard_Integer(theType)]++;
- name += "Picked_";
- name += nameType[Standard_Integer(theType)];
- TCollection_AsciiString indxstring(nbOfSub[Standard_Integer(theType)]);
- name +="_";
- name+=indxstring;
- }
- }
- // si on avait une petite methode pour voir si la shape
- // est deja dans la Double map, ca eviterait de creer....
- DBRep::Set(name.ToCString(),PickSh);
-
- Handle(AIS_Shape) newsh = new AIS_Shape(PickSh);
- GetMapOfAIS().Bind(newsh, name);
- TheAISContext()->Display(newsh);
- cout<<"Nom de la shape pickee : "<<name<<endl;
- }
-
- // Plusieurs objets a picker, vite vite vite....
- //
- else{
- Standard_Boolean autonaming = !strcasecmp(argv[2],".");
- Handle(TopTools_HArray1OfShape) arr = new TopTools_HArray1OfShape(1,NbToPick);
- if(ViewerTest::PickShapes(theType,arr)){
- for(Standard_Integer i=1;i<=NbToPick;i++){
- PickSh = arr->Value(i);
- if(!PickSh.IsNull()){
- if(autonaming){
- nbOfSub[Standard_Integer(theType)]++;
- name.Clear();
- name += "Picked_";
- name += nameType[Standard_Integer(theType)];
- TCollection_AsciiString indxstring(nbOfSub[Standard_Integer(theType)]);
- name +="_";
- name+=indxstring;
- }
- }
- else
- name = argv[1+i];
-
- DBRep::Set(name.ToCString(),PickSh);
- Handle(AIS_Shape) newsh = new AIS_Shape(PickSh);
- GetMapOfAIS().Bind(newsh, name);
- cout<<"display of picke shape #"<<i<<" - nom : "<<name<<endl;
- TheAISContext()->Display(newsh);
-
- }
- }
- }
- */
- return 0;
-}
-#endif
-
//=======================================================================
//function : list of known objects
//purpose :
di<<"tolblend "<<ta<<" "<<t3d<<" "<<t2d<<" "<<fl<<"\n";
}
-// Unused :
-#ifdef DEB
-static Standard_Integer tolblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
-{
- if(narg == 1){
- printtolblend(di);
- return 0;
- }
- else if(narg == 5){
- ta = Draw::Atof(a[1]);
- t3d = Draw::Atof(a[2]);
- t2d = Draw::Atof(a[3]);
- fl = Draw::Atof(a[4]);
- return 0;
- }
- return 1;
-}
-#endif
-
static Standard_Integer VBLEND(Draw_Interpretor& di, Standard_Integer narg, const char** a)
{
if(Rakk != 0) {delete Rakk; Rakk = 0;}