has been
+ -- modified. In this case, is the new geometric
+ -- support of the vertex, the new tolerance.
+ -- Otherwise, returns Standard_False, and ,
+ -- are not significant.
+
+ NewCurve2d(me: mutable; E : Edge from TopoDS;
+ F : Face from TopoDS;
+ NewE : Edge from TopoDS;
+ NewF : Face from TopoDS;
+ C : out Curve from Geom2d;
+ Tol : out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the edge has a new
+ -- curve on surface on the face .In this case,
+ -- is the new geometric support of the edge, the
+ -- new location, the new tolerance.
+ --
+ -- Otherwise, returns Standard_False, and , ,
+ -- are not significant.
+ --
+ -- is the new edge created from .
+ -- is the new face created from . They may be usefull.
+
+ NewParameter(me: mutable; V : Vertex from TopoDS;
+ E : Edge from TopoDS;
+ P : out Real from Standard;
+ Tol: out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the Vertex has a new
+ -- parameter on the edge . In this case, is
+ -- the parameter, the new tolerance.
+ -- Otherwise, returns Standard_False, and ,
+ -- are not significant.
+
+ Continuity(me: mutable; E : Edge from TopoDS;
+ F1,F2 : Face from TopoDS;
+ NewE : Edge from TopoDS;
+ NewF1,NewF2: Face from TopoDS)
+ returns Shape from GeomAbs;
+ ---Purpose: Returns the continuity of between
+ -- and .
+ --
+ -- is the new edge created from .
+ -- (resp. ) is the new face created from
+ -- (resp. ).
+
+
+fields
+
+ myTolerance : Real;
+ myMapOfFaces : DataMapOfShapeInteger from TopTools;
+ myMapOfSurfaces: IndexedMapOfTransient from TColStd;
+
+end PeriodicSurfaceModifier;
diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx
new file mode 100644
index 000000000..9ca792fed
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx
@@ -0,0 +1,230 @@
+// File: BlockFix_PeriodicSurfaceModifier.cxx
+// Created: 15.12.04 10:08:50
+// Author: Sergey KUUL
+// Copyright: Open CASCADE SA 2004
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+//=======================================================================
+//function : BlockFix_PeriodicSurfaceModifier()
+//purpose : Constructor
+//=======================================================================
+
+BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier ( )
+{
+ myMapOfFaces.Clear();
+ myMapOfSurfaces.Clear();
+}
+
+
+//=======================================================================
+//function : SetTolerance
+//purpose :
+//=======================================================================
+
+void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol)
+{
+ myTolerance = Tol;
+}
+
+
+//=======================================================================
+//function : ModifySurface
+//purpose : auxilary
+//=======================================================================
+
+static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
+ const Handle(Geom_Surface)& aSurface,
+ Handle(Geom_Surface)& aNewSurface)
+{
+ Handle(Geom_Surface) S = aSurface;
+
+ if(S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
+ Handle(Geom_CylindricalSurface) aCyl =
+ Handle(Geom_CylindricalSurface)::DownCast(S);
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
+ if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) {
+ gp_Ax3 ax3 = aCyl->Position();
+ gp_Ax1 NDir = ax3.Axis();
+ gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
+ Handle(Geom_CylindricalSurface) aNewCyl =
+ new Geom_CylindricalSurface(newax3,aCyl->Radius());
+ aNewSurface = aNewCyl;
+ return Standard_True;
+ }
+ }
+
+ if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
+ Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
+ if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) {
+ gp_Ax3 ax3 = aSphere->Position();
+ gp_Ax1 NDir = ax3.Axis();
+ gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
+ Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(newax3,aSphere->Radius());
+ aNewSurface = aNewSphere;
+ return Standard_True;
+ }
+ }
+
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : NewSurface
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F,
+ Handle(Geom_Surface)& S,
+ TopLoc_Location& L,Standard_Real& Tol,
+ Standard_Boolean& RevWires,
+ Standard_Boolean& RevFace)
+{
+ TopLoc_Location LS;
+ Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
+
+ if(ModifySurface(F, SIni, S)) {
+
+ RevWires = Standard_False;
+ RevFace = Standard_False;
+
+ L = LS;
+ Tol = BRep_Tool::Tolerance(F);
+
+ Standard_Integer anIndex = myMapOfSurfaces.Add(S);
+ myMapOfFaces.Bind(F,anIndex);
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : NewCurve
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/,
+ Handle(Geom_Curve)& /*C*/,
+ TopLoc_Location& /*L*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : NewPoint
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
+ gp_Pnt& /*P*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : NewCurve2d
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E,
+ const TopoDS_Face& F,
+ const TopoDS_Edge& /*NewE*/,
+ const TopoDS_Face& /*NewF*/,
+ Handle(Geom2d_Curve)& C,
+ Standard_Real& Tol)
+{
+ //check if undelying surface of the face was modified
+ if(myMapOfFaces.IsBound(F)) {
+ Standard_Integer anIndex = myMapOfFaces.Find(F);
+
+ Handle(Geom_Surface) aNewSurf = Handle(Geom_Surface)::DownCast(myMapOfSurfaces.FindKey(anIndex));
+
+ Standard_Real f,l;
+ TopLoc_Location LC, LS;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
+
+ //taking into accound the orientation of the seam
+ C = BRep_Tool::CurveOnSurface(E,F,f,l);
+ Tol = BRep_Tool::Tolerance(E);
+
+ BRep_Builder B;
+ TopoDS_Edge TempE;
+ B.MakeEdge(TempE);
+ B.Add(TempE, TopExp::FirstVertex(E));
+ B.Add(TempE, TopExp::LastVertex(E));
+
+ if(!C3d.IsNull())
+ B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
+ B.Range(TempE, f, l);
+
+ Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
+ Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(LS.Transformation()));
+ TopLoc_Location LTemp;
+ LTemp.Identity();
+
+ Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
+ Standard_Real aWorkTol = 2*myTolerance+Tol;
+ sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
+ sfe->FixSameParameter(TempE);
+
+ //keep the orientation of original edge
+ TempE.Orientation(E.Orientation());
+ C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
+
+ //surface was modified
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : NewParameter
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,
+ const TopoDS_Edge& /*E*/,
+ Standard_Real& /*P*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : Continuity
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E,
+ const TopoDS_Face& F1,
+ const TopoDS_Face& F2,
+ const TopoDS_Edge& /*NewE*/,
+ const TopoDS_Face& /*NewF1*/,
+ const TopoDS_Face& /*NewF2*/)
+{
+ return BRep_Tool::Continuity(E,F1,F2);
+}
+
diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx
new file mode 100644
index 000000000..b55096ce9
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx
@@ -0,0 +1,140 @@
+// File generated by CPPExt (Transient)
+//
+//
+// Copyright (C) 1991 - 2000 by
+// Matra Datavision SA. All rights reserved.
+//
+// Copyright (C) 2001 - 2004 by
+// Open CASCADE SA. All rights reserved.
+//
+// This file is part of the Open CASCADE Technology software.
+//
+// This software may be distributed and/or modified under the terms and
+// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
+// and appearing in the file LICENSE included in the packaging of this file.
+//
+// This software is distributed on an "AS IS" basis, without warranty of any
+// kind, and Open CASCADE SA hereby disclaims all such warranties,
+// including without limitation, any warranties of merchantability, fitness
+// for a particular purpose or non-infringement. Please see the License for
+// the specific terms and conditions governing rights and limitations under the
+// License.
+
+#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
+#define _BlockFix_PeriodicSurfaceModifier_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include
+#endif
+#ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
+#include
+#endif
+
+#ifndef _Standard_Real_HeaderFile
+#include
+#endif
+#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
+#include
+#endif
+#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
+#include
+#endif
+#ifndef _BRepTools_Modification_HeaderFile
+#include
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include
+#endif
+#ifndef _Handle_Geom_Surface_HeaderFile
+#include
+#endif
+#ifndef _Handle_Geom_Curve_HeaderFile
+#include
+#endif
+#ifndef _Handle_Geom2d_Curve_HeaderFile
+#include
+#endif
+#ifndef _GeomAbs_Shape_HeaderFile
+#include
+#endif
+class TopoDS_Face;
+class Geom_Surface;
+class TopLoc_Location;
+class TopoDS_Edge;
+class Geom_Curve;
+class TopoDS_Vertex;
+class gp_Pnt;
+class Geom2d_Curve;
+
+
+class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification {
+
+public:
+
+ void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+ // Methods PUBLIC
+ //
+Standard_EXPORT BlockFix_PeriodicSurfaceModifier();
+Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
+Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
+Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
+Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
+Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
+Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
+Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
+Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ //
+
+
+ // Fields PROTECTED
+ //
+
+
+private:
+
+ // Methods PRIVATE
+ //
+
+
+ // Fields PRIVATE
+ //
+Standard_Real myTolerance;
+TopTools_DataMapOfShapeInteger myMapOfFaces;
+TColStd_IndexedMapOfTransient myMapOfSurfaces;
+
+
+};
+
+
+
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx
new file mode 100644
index 000000000..7bdcfb449
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx
@@ -0,0 +1,78 @@
+// File generated by CPPExt (Transient)
+//
+// Copyright (C) 1991 - 2000 by
+// Matra Datavision SA. All rights reserved.
+//
+// Copyright (C) 2001 - 2004 by
+// Open CASCADE SA. All rights reserved.
+//
+// This file is part of the Open CASCADE Technology software.
+//
+// This software may be distributed and/or modified under the terms and
+// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
+// and appearing in the file LICENSE included in the packaging of this file.
+//
+// This software is distributed on an "AS IS" basis, without warranty of any
+// kind, and Open CASCADE SA hereby disclaims all such warranties,
+// including without limitation, any warranties of merchantability, fitness
+// for a particular purpose or non-infringement. Please see the License for
+// the specific terms and conditions governing rights and limitations under the
+// License.
+
+#include
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include
+#endif
+
+BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() {}
+
+
+
+Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_()
+{
+
+ static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
+ if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
+ static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+ if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+ static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+ if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+
+ static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+ static Handle_Standard_Type _aType = new Standard_Type("BlockFix_PeriodicSurfaceModifier",
+ sizeof(BlockFix_PeriodicSurfaceModifier),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
+
+ return _aType;
+}
+
+
+// DownCast method
+// allow safe downcasting
+//
+const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
+{
+ Handle(BlockFix_PeriodicSurfaceModifier) _anOtherObject;
+
+ if (!AnObject.IsNull()) {
+ if (AnObject->IsKind(STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier))) {
+ _anOtherObject = Handle(BlockFix_PeriodicSurfaceModifier)((Handle(BlockFix_PeriodicSurfaceModifier)&)AnObject);
+ }
+ }
+
+ return _anOtherObject ;
+}
+const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const
+{
+ return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ;
+}
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const
+{
+ return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType));
+}
+Handle_BlockFix_PeriodicSurfaceModifier::~Handle_BlockFix_PeriodicSurfaceModifier() {}
+
diff --git a/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx
new file mode 100644
index 000000000..0a556d598
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx
@@ -0,0 +1,27 @@
+#ifndef _TopoDS_Face_HeaderFile
+#include
+#endif
+#ifndef _Geom_Surface_HeaderFile
+#include
+#endif
+#ifndef _TopLoc_Location_HeaderFile
+#include
+#endif
+#ifndef _TopoDS_Edge_HeaderFile
+#include
+#endif
+#ifndef _Geom_Curve_HeaderFile
+#include
+#endif
+#ifndef _TopoDS_Vertex_HeaderFile
+#include
+#endif
+#ifndef _gp_Pnt_HeaderFile
+#include
+#endif
+#ifndef _Geom2d_Curve_HeaderFile
+#include
+#endif
+#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
+#include
+#endif
diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl
new file mode 100644
index 000000000..eae4b8a7a
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl
@@ -0,0 +1,120 @@
+-- File: BlockFix_SphereSpaceModifier.cdl
+-- Created: Tue Dec 7 12:01:49 2004
+-- Author: Pavel Durandin
+--
+---Copyright: Open CASCADE SA 2004
+
+
+class SphereSpaceModifier from BlockFix inherits Modification from BRepTools
+
+ ---Purpose: Rotation of the parametric space of the sphere in order
+ -- to avoid the seam and degenerared edge within it
+
+uses
+ Vertex from TopoDS,
+ Edge from TopoDS,
+ Face from TopoDS,
+ Location from TopLoc,
+ Shape from GeomAbs,
+ Pnt from gp,
+ Curve from Geom,
+ Curve from Geom2d,
+ Surface from Geom,
+ IndexedMapOfTransient from TColStd,
+ DataMapOfShapeInteger from TopTools
+
+is
+
+ Create returns mutable SphereSpaceModifier from BlockFix;
+
+ SetTolerance(me: mutable; Toler: Real);
+ ---Purpose: Sets the tolerance for recognition of geometry
+
+ NewSurface(me: mutable; F : Face from TopoDS;
+ S : out Surface from Geom;
+ L : out Location from TopLoc;
+ Tol: out Real from Standard;
+ RevWires : out Boolean from Standard;
+ RevFace : out Boolean from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the face has been
+ -- modified. In this case, is the new geometric
+ -- support of the face, the new location,
+ -- the new tolerance. Otherwise, returns
+ -- Standard_False, and , , are not
+ -- significant.
+
+ NewCurve(me: mutable; E : Edge from TopoDS;
+ C : out Curve from Geom;
+ L : out Location from TopLoc;
+ Tol: out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the edge has been
+ -- modified. In this case, is the new geometric
+ -- support of the edge, the new location,
+ -- the new tolerance. Otherwise, returns
+ -- Standard_False, and , , are not
+ -- significant.
+
+ NewPoint(me: mutable; V : Vertex from TopoDS;
+ P : out Pnt from gp;
+ Tol: out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the vertex has been
+ -- modified. In this case, is the new geometric
+ -- support of the vertex, the new tolerance.
+ -- Otherwise, returns Standard_False, and ,
+ -- are not significant.
+
+ NewCurve2d(me: mutable; E : Edge from TopoDS;
+ F : Face from TopoDS;
+ NewE : Edge from TopoDS;
+ NewF : Face from TopoDS;
+ C : out Curve from Geom2d;
+ Tol : out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the edge has a new
+ -- curve on surface on the face .In this case,
+ -- is the new geometric support of the edge, the
+ -- new location, the new tolerance.
+ --
+ -- Otherwise, returns Standard_False, and , ,
+ -- are not significant.
+ --
+ -- is the new edge created from .
+ -- is the new face created from . They may be usefull.
+
+ NewParameter(me: mutable; V : Vertex from TopoDS;
+ E : Edge from TopoDS;
+ P : out Real from Standard;
+ Tol: out Real from Standard)
+ returns Boolean from Standard;
+ ---Purpose: Returns Standard_True if the Vertex has a new
+ -- parameter on the edge . In this case, is
+ -- the parameter, the new tolerance.
+ -- Otherwise, returns Standard_False, and ,
+ -- are not significant.
+
+ Continuity(me: mutable; E : Edge from TopoDS;
+ F1,F2 : Face from TopoDS;
+ NewE : Edge from TopoDS;
+ NewF1,NewF2: Face from TopoDS)
+ returns Shape from GeomAbs;
+ ---Purpose: Returns the continuity of between
+ -- and .
+ --
+ -- is the new edge created from .
+ -- (resp. ) is the new face created from
+ -- (resp. ).
+
+ ForRotation(me: mutable; F: Face from TopoDS) returns Boolean;
+
+fields
+
+ myTolerance : Real;
+ myMapOfFaces : DataMapOfShapeInteger from TopTools;
+ myMapOfSpheres: IndexedMapOfTransient from TColStd;
+ --myMapOfGeom: MapOfShapeTransient from TColStd;
+
+end SphereSpaceModifier;
+
diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx
new file mode 100644
index 000000000..c5f774d82
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx
@@ -0,0 +1,224 @@
+// File: BlockFix.cxx
+// Created: Tue Dec 7 11:59:05 2004
+// Author: Pavel DURANDIN
+// Copyright: Open CASCADE SA 2004
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+//=======================================================================
+//function : BlockFix_SphereSpaceModifier
+//purpose :
+//=======================================================================
+
+BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier()
+{
+ myMapOfFaces.Clear();
+ myMapOfSpheres.Clear();
+}
+
+//=======================================================================
+//function : SetTolerance
+//purpose :
+//=======================================================================
+
+void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol)
+{
+ myTolerance = Tol;
+}
+
+
+//=======================================================================
+//function : NewSurface
+//purpose :
+//=======================================================================
+
+
+static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
+ const Handle(Geom_Surface)& aSurface,
+ Handle(Geom_Surface)& aNewSurface)
+{
+ Handle(Geom_Surface) S = aSurface;
+ if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
+ Handle(Geom_RectangularTrimmedSurface) RTS =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
+ S = RTS->BasisSurface();
+ }
+
+ if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
+ Standard_Real PI2 = PI/2.;
+ if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
+ if(Abs(Vmax-Vmin) < PI2) {
+ Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
+ gp_Sphere sp = aSphere->Sphere();
+ gp_Ax3 ax3 = sp.Position();
+ gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
+ sp.SetPosition(axnew3);
+ Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
+ aNewSurface = aNewSphere;
+ return Standard_True;
+ }
+ }
+ }
+ return Standard_False;
+}
+
+
+Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F,
+ Handle(Geom_Surface)& S,
+ TopLoc_Location& L,Standard_Real& Tol,
+ Standard_Boolean& RevWires,
+ Standard_Boolean& RevFace)
+{
+ TopLoc_Location LS;
+ Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
+
+ //check if pole of the sphere in the parametric space
+ if(ModifySurface(F, SIni, S)) {
+
+ RevWires = Standard_False;
+ RevFace = Standard_False;
+
+ L = LS;
+ Tol = BRep_Tool::Tolerance(F);
+
+ Standard_Integer anIndex = myMapOfSpheres.Add(S);
+ myMapOfFaces.Bind(F,anIndex);
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewCurve
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/,
+ TopLoc_Location& /*L*/,Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewPoint
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
+ gp_Pnt& /*P*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewCurve2d
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,
+ const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/,
+ Handle(Geom2d_Curve)& C,Standard_Real& Tol)
+{
+ //check if undelying surface of the face was modified
+ if(myMapOfFaces.IsBound(F)) {
+ Standard_Integer anIndex = myMapOfFaces.Find(F);
+
+ Handle(Geom_Surface) aNewSphere = Handle(Geom_Surface)::DownCast(myMapOfSpheres.FindKey(anIndex));
+
+ Standard_Real f,l;
+ TopLoc_Location LC, LS;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
+
+ //taking into accound the orientation of the seam
+ C = BRep_Tool::CurveOnSurface(E,F,f,l);
+ Tol = BRep_Tool::Tolerance(E);
+
+ BRep_Builder B;
+ TopoDS_Edge TempE;
+ B.MakeEdge(TempE);
+ B.Add(TempE, TopExp::FirstVertex(E));
+ B.Add(TempE, TopExp::LastVertex(E));
+
+ if(!C3d.IsNull())
+ B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
+ B.Range(TempE, f, l);
+
+ Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
+ Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSphere->Transformed(LS.Transformation()));
+ TopLoc_Location LTemp;
+ LTemp.Identity();
+
+ Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
+ Standard_Real aWorkTol = 2*myTolerance+Tol;
+ sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
+ sfe->FixSameParameter(TempE);
+
+ //keep the orientation of original edge
+ TempE.Orientation(E.Orientation());
+ C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
+
+ // shifting seam of sphere
+ if(isClosed && !C.IsNull()) {
+ Standard_Real f2,l2;
+ Handle(Geom2d_Curve) c22 =
+ BRep_Tool::CurveOnSurface(TopoDS::Edge(TempE.Reversed()),STemp, LTemp,f2,l2);
+ Standard_Real dPreci = Precision::PConfusion()*Precision::PConfusion();
+ if((C->Value(f).SquareDistance(c22->Value(f2)) < dPreci)
+ ||(C->Value(l).SquareDistance(c22->Value(l2)) < dPreci)) {
+ gp_Vec2d shift(S->UPeriod(),0.);
+ C->Translate(shift);
+ }
+ }
+ //sphere was modified
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : NewParameter
+//purpose :
+//=======================================================================
+
+Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/,
+ Standard_Real& /*P*/,Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : Continuity
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,
+ const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/,
+ const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/)
+{
+ return BRep_Tool::Continuity(E,F1,F2);
+}
+
diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx
new file mode 100644
index 000000000..463277a46
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx
@@ -0,0 +1,141 @@
+// File generated by CPPExt (Transient)
+//
+//
+// Copyright (C) 1991 - 2000 by
+// Matra Datavision SA. All rights reserved.
+//
+// Copyright (C) 2001 - 2004 by
+// Open CASCADE SA. All rights reserved.
+//
+// This file is part of the Open CASCADE Technology software.
+//
+// This software may be distributed and/or modified under the terms and
+// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
+// and appearing in the file LICENSE included in the packaging of this file.
+//
+// This software is distributed on an "AS IS" basis, without warranty of any
+// kind, and Open CASCADE SA hereby disclaims all such warranties,
+// including without limitation, any warranties of merchantability, fitness
+// for a particular purpose or non-infringement. Please see the License for
+// the specific terms and conditions governing rights and limitations under the
+// License.
+
+#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
+#define _BlockFix_SphereSpaceModifier_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include
+#endif
+#ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile
+#include
+#endif
+
+#ifndef _Standard_Real_HeaderFile
+#include
+#endif
+#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
+#include
+#endif
+#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
+#include
+#endif
+#ifndef _BRepTools_Modification_HeaderFile
+#include
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include
+#endif
+#ifndef _Handle_Geom_Surface_HeaderFile
+#include
+#endif
+#ifndef _Handle_Geom_Curve_HeaderFile
+#include
+#endif
+#ifndef _Handle_Geom2d_Curve_HeaderFile
+#include
+#endif
+#ifndef _GeomAbs_Shape_HeaderFile
+#include
+#endif
+class TopoDS_Face;
+class Geom_Surface;
+class TopLoc_Location;
+class TopoDS_Edge;
+class Geom_Curve;
+class TopoDS_Vertex;
+class gp_Pnt;
+class Geom2d_Curve;
+
+
+class BlockFix_SphereSpaceModifier : public BRepTools_Modification {
+
+public:
+
+ void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+ // Methods PUBLIC
+ //
+Standard_EXPORT BlockFix_SphereSpaceModifier();
+Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
+Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
+Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
+Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
+Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
+Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
+Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
+Standard_EXPORT Standard_Boolean ForRotation(const TopoDS_Face& F) ;
+Standard_EXPORT ~BlockFix_SphereSpaceModifier();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ //
+
+
+ // Fields PROTECTED
+ //
+
+
+private:
+
+ // Methods PRIVATE
+ //
+
+
+ // Fields PRIVATE
+ //
+Standard_Real myTolerance;
+TopTools_DataMapOfShapeInteger myMapOfFaces;
+TColStd_IndexedMapOfTransient myMapOfSpheres;
+
+
+};
+
+
+
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx
new file mode 100644
index 000000000..55b027172
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx
@@ -0,0 +1,78 @@
+// File generated by CPPExt (Transient)
+//
+// Copyright (C) 1991 - 2000 by
+// Matra Datavision SA. All rights reserved.
+//
+// Copyright (C) 2001 - 2004 by
+// Open CASCADE SA. All rights reserved.
+//
+// This file is part of the Open CASCADE Technology software.
+//
+// This software may be distributed and/or modified under the terms and
+// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
+// and appearing in the file LICENSE included in the packaging of this file.
+//
+// This software is distributed on an "AS IS" basis, without warranty of any
+// kind, and Open CASCADE SA hereby disclaims all such warranties,
+// including without limitation, any warranties of merchantability, fitness
+// for a particular purpose or non-infringement. Please see the License for
+// the specific terms and conditions governing rights and limitations under the
+// License.
+
+#include
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include
+#endif
+
+BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {}
+
+
+
+Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_()
+{
+
+ static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
+ if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
+ static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+ if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+ static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+ if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+
+ static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+ static Handle_Standard_Type _aType = new Standard_Type("BlockFix_SphereSpaceModifier",
+ sizeof(BlockFix_SphereSpaceModifier),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
+
+ return _aType;
+}
+
+
+// DownCast method
+// allow safe downcasting
+//
+const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
+{
+ Handle(BlockFix_SphereSpaceModifier) _anOtherObject;
+
+ if (!AnObject.IsNull()) {
+ if (AnObject->IsKind(STANDARD_TYPE(BlockFix_SphereSpaceModifier))) {
+ _anOtherObject = Handle(BlockFix_SphereSpaceModifier)((Handle(BlockFix_SphereSpaceModifier)&)AnObject);
+ }
+ }
+
+ return _anOtherObject ;
+}
+const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const
+{
+ return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ;
+}
+Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const
+{
+ return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType));
+}
+Handle_BlockFix_SphereSpaceModifier::~Handle_BlockFix_SphereSpaceModifier() {}
+
diff --git a/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx
new file mode 100644
index 000000000..a2a6afec0
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx
@@ -0,0 +1,27 @@
+#ifndef _TopoDS_Face_HeaderFile
+#include
+#endif
+#ifndef _Geom_Surface_HeaderFile
+#include
+#endif
+#ifndef _TopLoc_Location_HeaderFile
+#include
+#endif
+#ifndef _TopoDS_Edge_HeaderFile
+#include
+#endif
+#ifndef _Geom_Curve_HeaderFile
+#include
+#endif
+#ifndef _TopoDS_Vertex_HeaderFile
+#include
+#endif
+#ifndef _gp_Pnt_HeaderFile
+#include
+#endif
+#ifndef _Geom2d_Curve_HeaderFile
+#include
+#endif
+#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
+#include
+#endif
diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.cdl b/src/GEOMAlgo/BlockFix_UnionEdges.cdl
new file mode 100644
index 000000000..8a6a4b905
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_UnionEdges.cdl
@@ -0,0 +1,28 @@
+-- File: BlockFix_UnionEdges.cdl
+-- Created: Tue Dec 7 15:24:51 2004
+-- Author: Sergey KUUL
+--
+
+class UnionEdges from BlockFix
+
+ ---Purpose:
+
+uses
+
+ Shape from TopoDS,
+ ReShape from ShapeBuild
+
+is
+
+ Create returns UnionEdges from BlockFix;
+
+ Perform(me: in out; Shape: Shape from TopoDS;
+ Tol : Real)
+ returns Shape from TopoDS;
+
+fields
+
+ myTolerance : Real;
+ myContext : ReShape from ShapeBuild;
+
+end UnionEdges;
diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.cxx b/src/GEOMAlgo/BlockFix_UnionEdges.cxx
new file mode 100644
index 000000000..f36e8c7e1
--- /dev/null
+++ b/src/GEOMAlgo/BlockFix_UnionEdges.cxx
@@ -0,0 +1,325 @@
+// File: BlockFix_UnionEdges.cxx
+// Created: 07.12.04 15:27:30
+// Author: Sergey KUUL
+
+
+#include
+
+#include
+#include