if ( aType == STANDARD_TYPE(Geom_OffsetSurface) || Offset > 0.01 ) { //offset surface
aOffsetSurf = new Geom_OffsetSurface (aSurf, Offset);
aSurf = aOffsetSurf->Surface();
- BRepBuilderAPI_MakeFace mkFace(aSurf);
+ BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion());
mkFace.Build();
if( !mkFace.IsDone() ) return;
tmpSurf.Initialize( mkFace.Face() );
if ( aType == STANDARD_TYPE(Geom_OffsetSurface) || Offset > 0.01 ) { //offset surface
aOffsetSurf = new Geom_OffsetSurface (aSurf, Offset);
aSurf = aOffsetSurf->Surface();
- BRepBuilderAPI_MakeFace mkFace(aSurf);
+ BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion());
mkFace.Build();
if( !mkFace.IsDone() ) return;
tmpSurf.Initialize( mkFace.Face() );
TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
{
GeomAbs_Shape c = S->Continuity();
- if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S);
+ if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S, Precision::Confusion());
else return BRepBuilderAPI_MakeShell(S);
}
static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
{
GeomAbs_Shape c = S->Continuity();
- if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S);
+ if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S, Precision::Confusion());
else return BRepBuilderAPI_MakeShell(S);
}
---Level: Public
returns MakeFace from BRepBuilderAPI;
- Create(S : Surface from Geom)
- ---Purpose: Make a face from a Surface.
- ---Level: Public
+ Create(S : Surface from Geom; TolDegen : Real)
+ ---Purpose: Make a face from a Surface. Accepts tolerance value (TolDegen)
+ -- for resolution of degenerated edges.
+ ---Level: Public
returns MakeFace from BRepBuilderAPI;
----------------------------------------------
---Level: Public
returns MakeFace from BRepBuilderAPI;
- Create(S : Surface from Geom; UMin, UMax, VMin, VMax : Real)
- ---Purpose: Make a face from a Surface.
- ---Level: Public
+ Create(S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real)
+ ---Purpose: Make a face from a Surface. Accepts tolerance value (TolDegen)
+ -- for resolution of degenerated edges.
+ ---Level: Public
returns MakeFace from BRepBuilderAPI;
----------------------------------------------
-- want to work on the geometries of the two faces independently.
is static;
- Init(me : in out; S : Surface from Geom; Bound : Boolean = Standard_True)
- ---Purpose: Initializes (or reinitializes) the construction of a face on
- -- the surface S. If Bound is true (the default value), a wire is
- -- automatically created from the natural bounds of the
- -- surface S and added to the face in order to bound it. If
- -- Bound is false, no wire is added. This option is used
- -- when real bounds are known. These will be added to
- -- the face after this initialization, using the function Add.
- is static;
-
- Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax : Real)
- ---Purpose: Initializes (or reinitializes) the construction of a face on
- -- the surface S, limited in the u parametric direction by
- -- the two parameter values UMin and UMax and in the
- -- v parametric direction by the two parameter values VMin and VMax.
- -- Warning
- -- Error returns:
- -- - BRepBuilderAPI_ParametersOutOfRange
- -- when the parameters given are outside the bounds of the
- -- surface or the basis surface of a trimmed surface.
+ Init(me : in out; S : Surface from Geom; Bound : Boolean; TolDegen : Real)
+ ---Purpose: Initializes (or reinitializes) the construction of a face on
+ -- the surface S. If Bound is true, a wire is
+ -- automatically created from the natural bounds of the
+ -- surface S and added to the face in order to bound it. If
+ -- Bound is false, no wire is added. This option is used
+ -- when real bounds are known. These will be added to
+ -- the face after this initialization, using the function Add.
+ -- TolDegen parameter is used for resolution of degenerated edges
+ -- if calculation of natural bounds is turned on.
+ is static;
+
+ Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real)
+ ---Purpose: Initializes (or reinitializes) the construction of a face on
+ -- the surface S, limited in the u parametric direction by
+ -- the two parameter values UMin and UMax and in the
+ -- v parametric direction by the two parameter values VMin and VMax.
+ -- Warning
+ -- Error returns:
+ -- - BRepBuilderAPI_ParametersOutOfRange
+ -- when the parameters given are outside the bounds of the
+ -- surface or the basis surface of a trimmed surface.
+ -- TolDegen parameter is used for resolution of degenerated edges.
is static;
Add(me : in out; W : Wire from TopoDS)
//purpose :
//=======================================================================
-BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S)
-: myMakeFace(S)
+BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S,
+ const Standard_Real TolDegen)
+: myMakeFace(S, TolDegen)
{
if ( myMakeFace.IsDone()) {
Done();
//purpose :
//=======================================================================
-BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
-: myMakeFace(S,UMin,UMax,VMin,VMax)
+BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace (const Handle(Geom_Surface)& S,
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax,
+ const Standard_Real TolDegen)
+: myMakeFace (S, UMin, UMax, VMin, VMax, TolDegen)
{
if ( myMakeFace.IsDone()) {
Done();
//=======================================================================
void BRepBuilderAPI_MakeFace::Init(const Handle(Geom_Surface)& S,
- const Standard_Boolean Bound)
+ const Standard_Boolean Bound,
+ const Standard_Real TolDegen)
{
- myMakeFace.Init(S,Bound);
+ myMakeFace.Init(S, Bound, TolDegen);
if ( myMakeFace.IsDone()) {
Done();
myShape = myMakeFace.Shape();
//purpose :
//=======================================================================
-void BRepBuilderAPI_MakeFace::Init(const Handle(Geom_Surface)& SS,
- const Standard_Real Um,
- const Standard_Real UM,
- const Standard_Real Vm,
- const Standard_Real VM)
+void BRepBuilderAPI_MakeFace::Init (const Handle(Geom_Surface)& SS,
+ const Standard_Real Um,
+ const Standard_Real UM,
+ const Standard_Real Vm,
+ const Standard_Real VM,
+ const Standard_Real TolDegen)
{
- myMakeFace.Init(SS,Um,UM,Vm,VM);
+ myMakeFace.Init (SS, Um, UM, Vm, VM, TolDegen);
if ( myMakeFace.IsDone()) {
Done();
myShape = myMakeFace.Shape();
}
Handle(Geom_Surface) result = new Geom_RectangularTrimmedSurface(pSurf, Umin, Umax, Vmin, Vmax);
- aResFace = BRepBuilderAPI_MakeFace(result);
+ aResFace = BRepBuilderAPI_MakeFace(result, Precision::Confusion());
bIsInfinit = Standard_True;
}
return;
}
- FUntil = BRepLib_MakeFace(str);
+ FUntil = BRepLib_MakeFace(str, Precision::Confusion());
}
S = Handle(Geom_RectangularTrimmedSurface)::
DownCast(S)->BasisSurface();
}
- BRepLib_MakeFace fac(S);
+ BRepLib_MakeFace fac(S, Precision::Confusion());
mySFrom = fac.Face();
Trf = TransformShapeFU(0);
// FFrom = TopoDS::Face(mySFrom);
S = Handle(Geom_RectangularTrimmedSurface)::
DownCast(S)->BasisSurface();
}
- BRepLib_MakeFace fac(S);
+ BRepLib_MakeFace fac(S, Precision::Confusion());
mySFrom = fac.Face();
Trf = TransformShapeFU(0);
FFrom = TopoDS::Face(mySFrom);
// En attendant une utilisation des traces & retriction dans BRepFill_Sweep
// On fait un Fuse.
BRepLib_MakeFace MkF;
- MkF.Init(Surf);
+ MkF.Init(Surf, Standard_True, Precision::Confusion());
Fuse(MkF.Face(), KeepOutSide);
}
}
---Level: Public
returns MakeFace from BRepLib;
- Create(S : Surface from Geom)
- ---Purpose: Make a face from a Surface.
- ---Level: Public
+ Create(S : Surface from Geom; TolDegen : Real)
+ ---Purpose: Make a face from a Surface. Accepts tolerance value (TolDegen)
+ -- for resolution of degenerated edges.
+ ---Level: Public
returns MakeFace from BRepLib;
----------------------------------------------
---Level: Public
returns MakeFace from BRepLib;
- Create(S : Surface from Geom; UMin, UMax, VMin, VMax : Real)
- ---Purpose: Make a face from a Surface.
- ---Level: Public
+ Create(S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real)
+ ---Purpose: Make a face from a Surface. Accepts min & max parameters
+ -- to construct the face's bounds. Also accepts tolerance value (TolDegen)
+ -- for resolution of degenerated edges.
+ ---Level: Public
returns MakeFace from BRepLib;
----------------------------------------------
---Level: Public
is static;
- Init(me : in out; S : Surface from Geom; Bound : Boolean = Standard_True)
- ---Purpose: Creates the face from the surface. If Bound is
- -- True a wire is made from the natural bounds.
- ---Level: Public
+ Init(me : in out; S : Surface from Geom; Bound : Boolean; TolDegen : Real)
+ ---Purpose: Creates the face from the surface. If Bound is
+ -- True a wire is made from the natural bounds.
+ -- Accepts tolerance value (TolDegen) for resolution
+ -- of degenerated edges.
+ ---Level: Public
is static;
- Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax : Real)
- ---Purpose: Creates the face from the surface and the min-max
- -- values.
- ---Level: Public
+ Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real)
+ ---Purpose: Creates the face from the surface and the min-max
+ -- values. Accepts tolerance value (TolDegen) for resolution
+ -- of degenerated edges.
+ ---Level: Public
is static;
Add(me : in out; W : Wire from TopoDS)
is static;
fields
- myError : FaceError from BRepLib;
-
+ myError : FaceError from BRepLib;
end MakeFace;
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P)
{
Handle(Geom_Plane) GP = new Geom_Plane(P);
- Init(GP);
+ Init(GP, Standard_True, Precision::Confusion());
}
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C)
{
Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C);
- Init(GC);
+ Init(GC, Standard_True, Precision::Confusion());
}
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C)
{
Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C);
- Init(GC);
+ Init(GC, Standard_True, Precision::Confusion());
}
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S)
{
Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S);
- Init(GS);
+ Init(GS, Standard_True, Precision::Confusion());
}
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T)
{
Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T);
- Init(GT);
+ Init(GT, Standard_True, Precision::Confusion());
}
//purpose :
//=======================================================================
-BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S)
+BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S,
+ const Standard_Real TolDegen)
{
- Init(S);
+ Init(S, Standard_True, TolDegen);
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax)
{
Handle(Geom_Plane) GP = new Geom_Plane(P);
- Init(GP,UMin,UMax,VMin,VMax);
+ Init(GP, UMin, UMax, VMin, VMax, Precision::Confusion());
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax)
{
Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C);
- Init(GC,UMin,UMax,VMin,VMax);
+ Init(GC, UMin, UMax, VMin, VMax, Precision::Confusion());
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax)
{
Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C);
- Init(GC,UMin,UMax,VMin,VMax);
+ Init(GC, UMin, UMax, VMin, VMax, Precision::Confusion());
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax)
{
Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S);
- Init(GS,UMin,UMax,VMin,VMax);
+ Init(GS, UMin, UMax, VMin, VMax, Precision::Confusion());
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax)
{
Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T);
- Init(GT,UMin,UMax,VMin,VMax);
+ Init(GT, UMin, UMax, VMin, VMax, Precision::Confusion());
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S,
- const Standard_Real UMin,
- const Standard_Real UMax,
- const Standard_Real VMin,
- const Standard_Real VMax)
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ const Standard_Real VMin,
+ const Standard_Real VMax,
+ const Standard_Real TolDegen)
{
- Init(S,UMin,UMax,VMin,VMax);
+ Init(S, UMin, UMax, VMin, VMax, TolDegen);
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
- const Standard_Boolean OnlyPlane)
+ const Standard_Boolean OnlyPlane)
{
// Find a surface through the wire
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P,
- const TopoDS_Wire& W,
- const Standard_Boolean Inside)
+ const TopoDS_Wire& W,
+ const Standard_Boolean Inside)
{
Handle(Geom_Plane) Pl = new Geom_Plane(P);
- Init(Pl,Standard_False);
+ Init(Pl, Standard_False, Precision::Confusion());
Add(W);
if (Inside) CheckInside();
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C,
- const TopoDS_Wire& W,
- const Standard_Boolean Inside)
+ const TopoDS_Wire& W,
+ const Standard_Boolean Inside)
{
Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C);
- Init(GC,Standard_False);
+ Init(GC, Standard_False, Precision::Confusion());
Add(W);
if (Inside) CheckInside();
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C,
- const TopoDS_Wire& W,
- const Standard_Boolean Inside)
+ const TopoDS_Wire& W,
+ const Standard_Boolean Inside)
{
Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C);
- Init(GC,Standard_False);
+ Init(GC, Standard_False, Precision::Confusion());
Add(W);
if (Inside) CheckInside();
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S,
- const TopoDS_Wire& W,
- const Standard_Boolean Inside)
+ const TopoDS_Wire& W,
+ const Standard_Boolean Inside)
{
Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S);
- Init(GS,Standard_False);
+ Init(GS, Standard_False, Precision::Confusion());
Add(W);
if (Inside) CheckInside();
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T,
- const TopoDS_Wire& W,
- const Standard_Boolean Inside)
+ const TopoDS_Wire& W,
+ const Standard_Boolean Inside)
{
Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T);
- Init(GT,Standard_False);
+ Init(GT, Standard_False, Precision::Confusion());
Add(W);
if (Inside) CheckInside();
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S,
- const TopoDS_Wire& W,
- const Standard_Boolean Inside)
+ const TopoDS_Wire& W,
+ const Standard_Boolean Inside)
{
- Init(S,Standard_False);
+ Init(S, Standard_False, Precision::Confusion());
Add(W);
if (Inside) CheckInside();
}
//=======================================================================
BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Face& F,
- const TopoDS_Wire& W)
+ const TopoDS_Wire& W)
{
Init(F);
Add(W);
//=======================================================================
void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& S,
- const Standard_Boolean Bound)
+ const Standard_Boolean Bound,
+ const Standard_Real TolDegen)
{
myError = BRepLib_FaceDone;
if (Bound) {
Standard_Real UMin,UMax,VMin,VMax;
S->Bounds(UMin,UMax,VMin,VMax);
- Init(S,UMin,UMax,VMin,VMax);
+ Init(S,UMin,UMax,VMin,VMax,TolDegen);
}
else {
BRep_Builder B;
//=======================================================================
//function : IsDegenerated
-//purpose : fonction statique qui verifie qu'une courbe n'est pas reduite
-// a un point, pour ainsi coder l'edge Degenere.
+//purpose : Checks whether the passed curve is degenerated with the
+// passed tolerance value
//=======================================================================
-static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& C,
- const Standard_Real tol)
+static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& theCurve,
+ const Standard_Real theMaxTol,
+ Standard_Real& theActTol)
{
- GeomAdaptor_Curve AC(C);
-
+ GeomAdaptor_Curve AC(theCurve);
+ Standard_Real aConfusion = Precision::Confusion();
+ theActTol = aConfusion;
GeomAbs_CurveType Type = AC.GetType();
+
if (Type == GeomAbs_Circle) {
gp_Circ Circ = AC.Circle();
- return (Circ.Radius() < tol);
+ if ( Circ.Radius() > theMaxTol )
+ return Standard_False;
+ theActTol = Max(Circ.Radius(), aConfusion);
+ return Standard_True;
}
else if (Type == GeomAbs_BSplineCurve) {
Handle(Geom_BSplineCurve) BS = AC.BSpline();
Standard_Integer NbPoles = BS->NbPoles();
- Standard_Real tol2 = tol*tol;
+ Standard_Real aMaxPoleDist2 = 0.0, aMaxTol2 = theMaxTol*theMaxTol;
gp_Pnt P1,P2;
P1 = BS->Pole(1);
for (Standard_Integer i = 2; i <= NbPoles; i++) {
P2 = BS->Pole(i);
- if (P1.SquareDistance(P2) > tol2) return Standard_False;
-// P1 = P2;
+ Standard_Real aPoleDist2 = P1.SquareDistance(P2);
+ if (aPoleDist2 > aMaxTol2)
+ return Standard_False;
+ if (aPoleDist2 > aMaxPoleDist2)
+ aMaxPoleDist2 = aPoleDist2;
}
+ theActTol = Max(1.000001*Sqrt(aMaxPoleDist2), aConfusion);
return Standard_True;
}
else if (Type == GeomAbs_BezierCurve) {
Handle(Geom_BezierCurve) BZ = AC.Bezier();
Standard_Integer NbPoles = BZ->NbPoles();
- Standard_Real tol2 = tol*tol;
+ Standard_Real aMaxPoleDist2 = 0.0, aMaxTol2 = theMaxTol*theMaxTol;;
gp_Pnt P1,P2;
P1 = BZ->Pole(1);
for (Standard_Integer i = 2; i <= NbPoles; i++) {
P2 = BZ->Pole(i);
- if (P1.SquareDistance(P2) > tol2) return Standard_False;
-// P1 = P2;
+ Standard_Real aPoleDist2 = P1.SquareDistance(P2);
+ if (aPoleDist2 > aMaxTol2)
+ return Standard_False;
+ if (aPoleDist2 > aMaxPoleDist2)
+ aMaxPoleDist2 = aPoleDist2;
}
+ theActTol = Max(1.000001*Sqrt(aMaxPoleDist2), aConfusion);
return Standard_True;
}
//=======================================================================
void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS,
- const Standard_Real Um,
- const Standard_Real UM,
- const Standard_Real Vm,
- const Standard_Real VM)
+ const Standard_Real Um,
+ const Standard_Real UM,
+ const Standard_Real Vm,
+ const Standard_Real VM,
+ const Standard_Real TolDegen)
{
myError = BRepLib_FaceDone;
// compute 3d curves and degenerate flag
- Standard_Real tol = Precision::Confusion();
+ Standard_Real maxTol = TolDegen;
Handle(Geom_Curve) Cumin,Cumax,Cvmin,Cvmax;
Standard_Boolean Dumin,Dumax,Dvmin,Dvmax;
Dumin = Dumax = Dvmin = Dvmax = Standard_False;
+ Standard_Real uminTol, umaxTol, vminTol, vmaxTol;
if (!umininf) {
Cumin = S->UIso(UMin);
- Dumin = IsDegenerated(Cumin,tol);
+ Dumin = IsDegenerated(Cumin, maxTol, uminTol);
}
if (!umaxinf) {
Cumax = S->UIso(UMax);
- Dumax = IsDegenerated(Cumax,tol);
+ Dumax = IsDegenerated(Cumax, maxTol, umaxTol);
}
if (!vmininf) {
Cvmin = S->VIso(VMin);
- Dvmin = IsDegenerated(Cvmin,tol);
+ Dvmin = IsDegenerated(Cvmin, maxTol, vminTol);
}
if (!vmaxinf) {
Cvmax = S->VIso(VMax);
- Dvmax = IsDegenerated(Cvmax,tol);
+ Dvmax = IsDegenerated(Cvmax, maxTol, vmaxTol);
}
// compute vertices
TopoDS_Vertex V00,V10,V11,V01;
if (!umininf) {
- if (!vmininf) B.MakeVertex(V00,S->Value(UMin,VMin),tol);
- if (!vmaxinf) B.MakeVertex(V01,S->Value(UMin,VMax),tol);
+ if (!vmininf) B.MakeVertex(V00,S->Value(UMin,VMin), Max(uminTol, vminTol));
+ if (!vmaxinf) B.MakeVertex(V01,S->Value(UMin,VMax), Max(uminTol, vmaxTol));
}
if (!umaxinf) {
- if (!vmininf) B.MakeVertex(V10,S->Value(UMax,VMin),tol);
- if (!vmaxinf) B.MakeVertex(V11,S->Value(UMax,VMax),tol);
+ if (!vmininf) B.MakeVertex(V10,S->Value(UMax,VMin), Max(umaxTol, vminTol));
+ if (!vmaxinf) B.MakeVertex(V11,S->Value(UMax,VMax), Max(umaxTol, vmaxTol));
}
if (uclosed) {
// make the face
TopoDS_Face& F = TopoDS::Face(myShape);
- B.MakeFace(F,S,tol);
+ B.MakeFace(F,S,Precision::Confusion());
// make the edges
TopoDS_Edge eumin,eumax,evmin,evmax;
if (!umininf) {
if (!Dumin)
- B.MakeEdge(eumin,Cumin,tol);
+ B.MakeEdge(eumin,Cumin,uminTol);
else
B.MakeEdge(eumin);
if (uclosed)
- B.UpdateEdge(eumin,Lumax,Lumin,F,tol);
+ B.UpdateEdge(eumin,Lumax,Lumin,F,Max(uminTol, umaxTol));
else
- B.UpdateEdge(eumin,Lumin,F,tol);
+ B.UpdateEdge(eumin,Lumin,F,uminTol);
B.Degenerated(eumin,Dumin);
if (!vmininf) {
V00.Orientation(TopAbs_FORWARD);
eumax = eumin;
else {
if (!Dumax)
- B.MakeEdge(eumax,Cumax,tol);
+ B.MakeEdge(eumax,Cumax,umaxTol);
else
B.MakeEdge(eumax);
- B.UpdateEdge(eumax,Lumax,F,tol);
+ B.UpdateEdge(eumax,Lumax,F,umaxTol);
B.Degenerated(eumax,Dumax);
if (!vmininf) {
V10.Orientation(TopAbs_FORWARD);
if (!vmininf) {
if (!Dvmin)
- B.MakeEdge(evmin,Cvmin,tol);
+ B.MakeEdge(evmin,Cvmin,vminTol);
else
B.MakeEdge(evmin);
if (vclosed)
- B.UpdateEdge(evmin,Lvmin,Lvmax,F,tol);
+ B.UpdateEdge(evmin,Lvmin,Lvmax,F,Max(vminTol, vmaxTol));
else
- B.UpdateEdge(evmin,Lvmin,F,tol);
+ B.UpdateEdge(evmin,Lvmin,F,vminTol);
B.Degenerated(evmin,Dvmin);
if (!umininf) {
V00.Orientation(TopAbs_FORWARD);
evmax = evmin;
else {
if (!Dvmax)
- B.MakeEdge(evmax,Cvmax,tol);
+ B.MakeEdge(evmax,Cvmax,vmaxTol);
else
B.MakeEdge(evmax);
- B.UpdateEdge(evmax,Lvmax,F,tol);
+ B.UpdateEdge(evmax,Lvmax,F,vmaxTol);
B.Degenerated(evmax,Dvmax);
if (!umininf) {
V01.Orientation(TopAbs_FORWARD);
// Les Isos sont Approximees a Precision::Approximation()
// et on code Precision::Confusion() dans l'arete.
// ==> Un petit passage dans SamePrameter pour regler les tolerances.
- BRepLib::SameParameter( F, tol, Standard_True);
+ BRepLib::SameParameter(F, Precision::Confusion(), Standard_True);
}
Done();
TopExp_Explorer Exp (F,TopAbs_WIRE);
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
- TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf);
+ TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf, Precision::Confusion());
while (Exp.More()) {
Add (TopoDS::Wire (Exp.Current()),F, aNewF);
{
Vfirst = -PI/2.; Vlast = p2d1.Y();
}
- TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast);
+ TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast, Precision::Confusion());
TopoDS_Edge OldEdge;
for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next())
{
GeomFill_Pipe Pipe(CP,myOffset);
Pipe.Perform();
- BRepLib_MakeFace MF(Pipe.Surface());
+ BRepLib_MakeFace MF(Pipe.Surface(), Precision::Confusion());
myFace = MF.Face();
if ( Offset < 0.) myFace.Reverse();
{
gp_Pnt fpoint = AC.Value( AC.FirstParameter() );
gp_Pnt lpoint = AC.Value( AC.LastParameter() );
- TopoDS_Face theFace = BRepLib_MakeFace( theSurf );
+ TopoDS_Face theFace = BRepLib_MakeFace( theSurf, Precision::Confusion() );
Standard_Real U1 = 0., U2 = 0., TolProj = 1.e-4; //1.e-5;
TopoDS_Edge theEdge;
TopExp_Explorer Explo;
S = BRepBuilderAPI_MakeFace(P,MW.Wire());
else {
BRepBuilderAPI_MakeFace MFace;
- MFace.Init(Surface,Standard_False);
+ MFace.Init(Surface,Standard_False,Precision::Confusion());
MFace.Add(MW.Wire());
S = MFace.Face();
}
S = BRepBuilderAPI_MakeFace(P,MW.Wire());
else {
BRepBuilderAPI_MakeFace MFace;
- MFace.Init(Surface,Standard_False);
+ MFace.Init(Surface,Standard_False,Precision::Confusion());
MFace.Add(MW.Wire());
S = MFace.Face();
}
Henri.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
- BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax);
+ BRepBuilderAPI_MakeFace MF(Surf, Umin, Umax, Vmin, Vmax, Precision::Confusion());
DBRep::Set(a[1],MF.Face());
return 0;
#include <Geom_Surface.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <TopTools_ListOfShape.hxx>
+#include <Precision.hxx>
#ifdef WNT
//#define strcasecmp strcmp Already defined
if (n == 3) {
if (mkface)
- res = BRepBuilderAPI_MakeFace(S);
+ res = BRepBuilderAPI_MakeFace(S, Precision::Confusion());
else
res = BRepBuilderAPI_MakeShell(S,Segment);
}
}
else {
if (mkface)
- res = BRepBuilderAPI_MakeFace(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]));
+ res = BRepBuilderAPI_MakeFace(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]),Precision::Confusion());
else
res = BRepBuilderAPI_MakeShell(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]),
Segment);
Handle(Geom_Surface) Sur=aPipe.Surface();
TopoDS_Face F;
if(!Sur.IsNull())
- F =BRepBuilderAPI_MakeFace(Sur);
+ F = BRepBuilderAPI_MakeFace(Sur, Precision::Confusion());
DBRep::Set(a[1],F);
return 0;
}
if (theProp.IsNormalDefined()) {
P = theProp.Value();
Handle(Geom_Plane) Pln = new Geom_Plane(P, theProp.Normal());
- TopoDS_Face NewF = BRepLib_MakeFace(Pln);
+ TopoDS_Face NewF = BRepLib_MakeFace(Pln, Precision::Confusion());
NewF.Orientation(F.Orientation());
pons.SetCoord(0.,0.);
HS->ChangeSurface().Initialize(NewF);
TopExp::MapShapes(OrtProj.Projection() , TopAbs_EDGE, MapE1);
if (MapE1.Extent()!=0){
if (MapE1.Extent()!=1) {
- BRepLib_MakeFace Bface (BRep_Tool::Surface(F));
+ BRepLib_MakeFace Bface (BRep_Tool::Surface(F), Precision::Confusion());
F=Bface.Face();
OrtProj.Init(F);
OrtProj.Build();
res = plane;
}
else {
- BRepLib_MakeFace makeFace(surf);
+ BRepLib_MakeFace makeFace(surf, Precision::Confusion());
res = makeFace.Face();
}
// PTV 29.08.2002 end of OCC663
}
if (!aResultSurf.IsNull()) {
- BRepBuilderAPI_MakeFace aMakeF(aResultSurf);
+ BRepBuilderAPI_MakeFace aMakeF(aResultSurf, Precision::Confusion());
if (aMakeF.IsDone()) res = aMakeF.Face();
}
}
aBasisCurve->FirstParameter(),
aBasisCurve->LastParameter(),
0., dir.Magnitude() );
- BRepBuilderAPI_MakeFace aMakeF(aResultSurf);
+ BRepBuilderAPI_MakeFace aMakeF(aResultSurf, Precision::Confusion());
if (aMakeF.IsDone()) res = aMakeF.Face();
}
}
basisSrf = new Geom_OffsetSurface(geomSupport, st->Distance()*GetUnitFactor());
}
- BRepLib_MakeFace MF(basisSrf);
+ BRepLib_MakeFace MF(basisSrf, Precision::Confusion());
if(!MF.IsDone()) {
Message_Msg msg1265("IGES_1265");
SendFail(st, msg1265); // OffsetSurface Construction Error.
array1.SetValue(3,2,gp_Pnt(200,300,0));
array1.SetValue(3,3,gp_Pnt(400,300,0));
BZ1 = new Geom_BezierSurface(array1);
- BRepBuilderAPI_MakeFace bzf1( BZ1 );
+ BRepBuilderAPI_MakeFace bzf1( BZ1, Precision::Confusion() );
TopoDS_Face F1= bzf1.Face();
ais1 = new AIS_Shape(F1);
DBRep::Set("F1",F1);
//step 2. offseting the surface.
Handle_Geom_OffsetSurface offsurf;
offsurf = new Geom_OffsetSurface(BZ1, -100);
- BRepBuilderAPI_MakeFace bzf2( offsurf );
+ BRepBuilderAPI_MakeFace bzf2( offsurf, Precision::Confusion() );
TopoDS_Face F2= bzf2.Face();
Handle_AIS_Shape ais22 = new AIS_Shape(F2);
aContext->Display(ais22);
P1(0,0,20), P2(0,0,45);
angle = 2*PI;
Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
- TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S).Shape();
+ TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
aContext->Display(ais1);
aContext->SetColor(ais1, Quantity_NOC_BLUE1);
Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2,R1, 0).Value();
- TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2).Shape();
+ TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
aContext->Display(ais2);
aContext->SetColor(ais2, Quantity_NOC_RED);
}
Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
- TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S).Shape();
+ TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
DBRep::Set("BUC60857_BLUE",myshape);
Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
aContext->Display(ais1);
aContext->SetColor(ais1, Quantity_NOC_BLUE1);
Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2, R1, 0).Value();
- TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2).Shape();
+ TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
DBRep::Set("BUC60857_RED",myshape2);
Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
aContext->Display(ais2);
aContext->SetColor(ais2, Quantity_NOC_RED);
Handle(Geom_RectangularTrimmedSurface) S3 = GC_MakeTrimmedCone (P1, P2, R2, R1).Value();
- TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3).Shape();
+ TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3, Precision::Confusion()).Shape();
DBRep::Set("BUC60857_GREEN",myshape3);
Handle(AIS_Shape) ais3 = new AIS_Shape(myshape3);
aContext->Display(ais3);
Handle(Geom_BezierSurface) BezSurf = new Geom_BezierSurface(poles);
Handle(Geom_BSplineSurface) BSpSurf = GeomConvert::SurfaceToBSplineSurface(BezSurf);
- BRepBuilderAPI_MakeFace faceMaker(BSpSurf);
+ BRepBuilderAPI_MakeFace faceMaker(BSpSurf, Precision::Confusion());
TopoDS_Face face = faceMaker.Face();
gp_Pnt pnt(0, size, 0);
// Make face for first opening
Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane);
- mkFace.Init(Plane1,Standard_False);
+ mkFace.Init(Plane1,Standard_False,Precision::Confusion());
// SUPPORT:
// - Use wires created by MakePipeShell
//mkFace.Add(TopoDS::Wire(outerWire1_));
// Make face for second opening
Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane);
- mkFace.Init(Plane2,Standard_False);
+ mkFace.Init(Plane2,Standard_False,Precision::Confusion());
// SUPPORT:
// - Use wires created by MakePipeShell
//mkFace.Add(TopoDS::Wire(outerWire2_));
// Make face for first opening
Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane);
- mkFace.Init(Plane1,Standard_False);
+ mkFace.Init(Plane1,Standard_False,Precision::Confusion());
mkFace.Add(TopoDS::Wire(outerWire1_));
mkFace.Add(TopoDS::Wire(Wire1_.Reversed()));
if (!mkFace.IsDone()) return TCL_ERROR;
// Make face for second opening
Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane);
- mkFace.Init(Plane2,Standard_False);
+ mkFace.Init(Plane2,Standard_False,Precision::Confusion());
mkFace.Add(TopoDS::Wire(outerWire2_));
mkFace.Add(TopoDS::Wire(Wire2_.Reversed()));
if (!mkFace.IsDone()) return TCL_ERROR;
Handle(Geom_BSplineSurface) result_surf1 = b_surface1.BSplineSurface();
if (!result_surf1.IsNull())
{
- BRepBuilderAPI_MakeFace b_face1(result_surf1);
+ BRepBuilderAPI_MakeFace b_face1(result_surf1, Precision::Confusion());
TopoDS_Face bsp_face1 = b_face1.Face();
DBRep::Set(a[1],bsp_face1);
}
// deal with case of empty face: just create a new one by standard tool
if ( ws.Length() <=0 ) {
- BRepBuilderAPI_MakeFace mf (mySurf->Surface());
+ BRepBuilderAPI_MakeFace mf (mySurf->Surface(), Precision::Confusion());
if ( ! Context().IsNull() ) Context()->Replace ( myFace, mf.Face() );
myFace = mf.Face();
/* variant 2 */
TopLoc_Location L;
Handle(Geom_Surface) surf = BRep_Tool::Surface ( myFace, L );
- BRepBuilderAPI_MakeFace mf (surf);
+ BRepBuilderAPI_MakeFace mf (surf, Precision::Confusion());
TopoDS_Face ftmp = mf.Face();
ftmp.Location ( L );
for (wi.Initialize (ftmp,Standard_False); wi.More(); wi.Next()) {
{
// if (ShapeUpgrade::Debug()) cout <<"ShapeUpgrade_WireDivide::Init with Wire, Surface "<<endl;
myWire = W;
- BRepLib_MakeFace mkf(S);
+ BRepLib_MakeFace mkf(S, Precision::Confusion());
myFace = mkf.Face();
myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );
}
void ShapeUpgrade_WireDivide::SetSurface(const Handle(Geom_Surface)& S)
{
- BRepLib_MakeFace mkf(S);
+ BRepLib_MakeFace mkf(S, Precision::Confusion());
myFace = mkf.Face();
}
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <gp_Trsf.hxx>
+#include <Precision.hxx>
//=============================================================================
// Creation d' une Surface de Geom a partir d' une Surface de Step
const Standard_Real anOffset = OS->Distance() * UnitsMethods::LengthFactor();
if (aBasisSurface->Continuity() == GeomAbs_C0)
{
- const BRepBuilderAPI_MakeFace aBFace(aBasisSurface);
+ const BRepBuilderAPI_MakeFace aBFace(aBasisSurface, Precision::Confusion());
if (aBFace.IsDone())
{
const TopoDS_Shape aResult = ShapeAlgo::AlgoContainer()->C0ShapeToC1Shape(aBFace.Face(), Abs(anOffset));
// ============================================================================
//:i6 abv 17 Sep 98: ProSTEP TR9 r0601-ct.stp: to be able read GS: GeometricCurveSet -> GeometricSet
-static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf)
+static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf,
+ const Standard_Real TolDegen)
{
TopoDS_Face res;
!theSurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) return res;
//gka 11.01.99 file PRO7755.stp entity #2018 surface #1895: error BRepLib_MakeFace func IsDegenerated
- BRepBuilderAPI_MakeFace myMkFace(theSurf);
+ BRepBuilderAPI_MakeFace myMkFace(theSurf, TolDegen);
return myMkFace.Face();
}
for ( Standard_Integer ii=1; ii <= nbi; ii++ )
for ( Standard_Integer j=1; j <= nbj; j++ ) {
Handle(StepGeom_SurfacePatch) patch = RCS->SegmentsValue ( ii, j );
- TopoDS_Face f = TranslateBoundedSurf ( patch->ParentSurface() );
+ TopoDS_Face f = TranslateBoundedSurf (patch->ParentSurface(), preci);
if ( ! f.IsNull() ) B.Add ( C, f );
}
res = C;
}
// try other surfs
- else res = TranslateBoundedSurf ( aSurf );
+ else res = TranslateBoundedSurf (aSurf, preci);
}
else TP->AddWarning (ent," Entity is not a Curve, Point or Surface");
if ( ! res.IsNull() ) {
// add natural bound if implicit
if ( CBS->ImplicitOuter() ) {
if ( Surf->IsKind(STANDARD_TYPE(Geom_BoundedSurface)) ) {
- BRepBuilderAPI_MakeFace mf (Surf);
+ BRepBuilderAPI_MakeFace mf (Surf, Precision::Confusion());
myFace = mf.Face();
}
else TP->AddWarning ( CBS, "Cannot make natural bounds on infinite surface" );
Handle(StepShape_VertexLoop) VL = Handle(StepShape_VertexLoop)::DownCast(Loop);
// abv 10.07.00 pr1sy.stp: vertex_loop can be wrong; so just make natural bounds
- if (GeomSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
- BRepBuilderAPI_MakeFace mf (GeomSurf);
- for (TopoDS_Iterator it(mf); it.More(); it.Next() )
- B.Add ( F, it.Value() );
- continue;
+ if (GeomSurf->IsKind (STANDARD_TYPE(Geom_SphericalSurface)) ||
+ GeomSurf->IsKind (STANDARD_TYPE(Geom_BSplineSurface)) )
+ {
+ BRepBuilderAPI_MakeFace mf (GeomSurf, Precision());
+ for (TopoDS_Iterator it(mf); it.More(); it.Next())
+ B.Add (F, it.Value());
+
+ continue;
}
if (//GeomSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ||
S = Handle(Geom_RectangularTrimmedSurface)::
DownCast(S)->BasisSurface();
}
- BRepLib_MakeFace MF(S);
+ BRepLib_MakeFace MF(S, Precision::Confusion());
for(it2.Initialize(myFaceLW); it2.More(); it2.Next()) {
const TopoDS_Wire& wir1 = TopoDS::Wire(it2.Value());