mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024682: Move out B-spline cache from curves and surfaces to dedicated classes BSplCLib_Cache and BSplSLib_Cache
1. B-spline cache was moved into separated classes: BSplCLib_Cache for 2D and 3D curves and BSplSLib_Cache for surfaces. 2. The cache is used now in corresponding adaptor classes (Geom2dAdaptor_Curve, GeomAdaptor_Curve and GeomAdaptor_Surface) when the curve or surface is a B-spline. 3. Algorithms were changed to use adaptors for B-spline calculations instead of curves or surfaces. 4. Precised calculation of derivatives of surface of revolution is implemented for the points of surface placed on the axis of revolution (Geom_SurfaceOfRevolution.cxx) 5. Small modifications are made to adjust algorithms to new behavior of B-spline calculation. 6. Test cases were modified according to the modern behavior. 7. Changes in BOPAlgo_WireSplitter, BOPTools_AlgoTools, BRepLib_CheckCurveOnSurface and ShapeAnalysis_Wire to use adaptors instead of geometric entities 8. Allow Geom2dAdaptor and GeomAdaptor in case of offset curve to use corresponding adaptor for basis curve Modification of test-cases according to the new behavior.
This commit is contained in:
@@ -426,7 +426,7 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci)
|
||||
Standard_Real wmid;
|
||||
sac.Project(COnS,mid,preci,pnt,wmid,Standard_False);
|
||||
wmid+=ShapeAnalysis::AdjustToPeriod(wmid,0,period);
|
||||
if(w1>w2) {
|
||||
if(w1>=w2) {
|
||||
if(w2 > wmid) myFirstParam -= period;
|
||||
else if (w1 > wmid)
|
||||
UpdateParam2d(theCurve2d);
|
||||
|
@@ -1281,6 +1281,16 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
|
||||
found = (staout != clas.Perform (unp1,Standard_False));
|
||||
}
|
||||
}
|
||||
// Additional check of diagonal steps for toroidal surfaces
|
||||
if (!found && uclosed && vclosed)
|
||||
{
|
||||
for (Standard_Real dX = -1.0; dX <= 1.0 && !found; dX += 2.0)
|
||||
for (Standard_Real dY = -1.0; dY <= 1.0 && !found; dY += 2.0)
|
||||
{
|
||||
unp1.SetCoord(unp.X() + uRange * dX, unp.Y() + vRange * dY);
|
||||
found = (staout != clas.Perform(unp1, Standard_False));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found) {
|
||||
if(stb==TopAbs_IN) stb = TopAbs_OUT;
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <BRepTools.hxx>
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#include <BndLib_Add2dCurve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
@@ -68,7 +70,7 @@ ShapeFix_IntersectionTool::ShapeFix_IntersectionTool(const Handle(ShapeBuild_ReS
|
||||
//=======================================================================
|
||||
static gp_Pnt GetPointOnEdge(const TopoDS_Edge &edge,
|
||||
const Handle(ShapeAnalysis_Surface) &surf,
|
||||
const Handle(Geom2d_Curve) &Crv2d,
|
||||
const Geom2dAdaptor_Curve &Crv2d,
|
||||
const Standard_Real param )
|
||||
{
|
||||
if( BRep_Tool::SameParameter(edge) ) {
|
||||
@@ -78,7 +80,8 @@ static gp_Pnt GetPointOnEdge(const TopoDS_Edge &edge,
|
||||
if( !ConS.IsNull() )
|
||||
return ConS->Value(param).Transformed(L.Transformation());
|
||||
}
|
||||
return surf->Value(Crv2d->Value(param));
|
||||
gp_Pnt2d aP2d = Crv2d.Value(param);
|
||||
return surf->Adaptor3d()->Value(aP2d.X(), aP2d.Y());
|
||||
}
|
||||
|
||||
|
||||
@@ -868,9 +871,9 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
if( !sae.PCurve(edge1, face, Crv1, a1, b1, Standard_False) ) return Standard_False;
|
||||
if( !sae.PCurve(edge2, face, Crv2, a2, b2, Standard_False) ) return Standard_False;
|
||||
Standard_Real tolint = 1.0e-10;
|
||||
IntRes2d_Domain d1(Crv1->Value(a1),a1,tolint,Crv1->Value(b1),b1,tolint);
|
||||
IntRes2d_Domain d2(Crv2->Value(a2),a2,tolint,Crv2->Value(b2),b2,tolint);
|
||||
Geom2dAdaptor_Curve C1(Crv1), C2(Crv2);
|
||||
IntRes2d_Domain d1(C1.Value(a1),a1,tolint,C1.Value(b1),b1,tolint);
|
||||
IntRes2d_Domain d2(C2.Value(a2),a2,tolint,C2.Value(b2),b2,tolint);
|
||||
Geom2dInt_GInter Inter;
|
||||
Inter.Perform( C1, d1, C2, d2, tolint, tolint );
|
||||
if(!Inter.IsDone()) continue;
|
||||
@@ -883,8 +886,8 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
Tr2.PositionOnCurve() == IntRes2d_Middle ) {
|
||||
Standard_Real param1 = IP.ParamOnFirst();
|
||||
Standard_Real param2 = IP.ParamOnSecond();
|
||||
gp_Pnt pi1 = GetPointOnEdge(edge1,sas,Crv1,param1);
|
||||
gp_Pnt pi2 = GetPointOnEdge(edge2,sas,Crv2,param2);
|
||||
gp_Pnt pi1 = GetPointOnEdge(edge1,sas,C1,param1);
|
||||
gp_Pnt pi2 = GetPointOnEdge(edge2,sas,C2,param2);
|
||||
BRep_Builder B;
|
||||
TopoDS_Vertex V;
|
||||
Standard_Real tolV=0;
|
||||
@@ -1023,10 +1026,10 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
IntRes2d_IntersectionPoint IPL = IS.LastPoint();
|
||||
Standard_Real p12 = IPL.ParamOnFirst();
|
||||
Standard_Real p22 = IPL.ParamOnSecond();
|
||||
gp_Pnt Pnt11 = GetPointOnEdge(edge1,sas,Crv1,p11);
|
||||
gp_Pnt Pnt12 = GetPointOnEdge(edge1,sas,Crv1,p12);
|
||||
gp_Pnt Pnt21 = GetPointOnEdge(edge2,sas,Crv2,p21);
|
||||
gp_Pnt Pnt22 = GetPointOnEdge(edge2,sas,Crv2,p22);
|
||||
gp_Pnt Pnt11 = GetPointOnEdge(edge1,sas,C1,p11);
|
||||
gp_Pnt Pnt12 = GetPointOnEdge(edge1,sas,C1,p12);
|
||||
gp_Pnt Pnt21 = GetPointOnEdge(edge2,sas,C2,p21);
|
||||
gp_Pnt Pnt22 = GetPointOnEdge(edge2,sas,C2,p22);
|
||||
// next string commented by skl 29.12.2004 for OCC7624
|
||||
//if( Pnt11.Distance(Pnt21)>myPreci || Pnt12.Distance(Pnt22)>myPreci ) continue;
|
||||
if( Pnt11.Distance(Pnt21)>MaxTolVert || Pnt12.Distance(Pnt22)>MaxTolVert ) continue;
|
||||
@@ -1155,8 +1158,8 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
if( !IsModified1 && !IsModified2 ) {
|
||||
Standard_Real param1 = (p11+p12)/2;
|
||||
Standard_Real param2 = (p21+p22)/2;
|
||||
gp_Pnt Pnt10 = GetPointOnEdge(edge1,sas,Crv1,param1);
|
||||
gp_Pnt Pnt20 = GetPointOnEdge(edge2,sas,Crv2,param2);
|
||||
gp_Pnt Pnt10 = GetPointOnEdge(edge1,sas,C1,param1);
|
||||
gp_Pnt Pnt20 = GetPointOnEdge(edge2,sas,C2,param2);
|
||||
gp_Pnt P0( (Pnt10.X()+Pnt20.X())/2, (Pnt10.Y()+Pnt20.Y())/2,
|
||||
(Pnt10.Z()+Pnt20.Z())/2 );
|
||||
dist1 = Max(Pnt11.Distance(P0),Pnt12.Distance(P0));
|
||||
@@ -1516,9 +1519,9 @@ Standard_Boolean ShapeFix_IntersectionTool::FixIntersectingWires
|
||||
if( !sae.PCurve(edge2, face, Crv2, a2, b2, Standard_False) )
|
||||
continue; //return Standard_False;gka 06.09.04
|
||||
Standard_Real tolint = 1.0e-10;
|
||||
IntRes2d_Domain d1(Crv1->Value(a1),a1,tolint,Crv1->Value(b1),b1,tolint);
|
||||
IntRes2d_Domain d2(Crv2->Value(a2),a2,tolint,Crv2->Value(b2),b2,tolint);
|
||||
Geom2dAdaptor_Curve C1(Crv1), C2(Crv2);
|
||||
IntRes2d_Domain d1(C1.Value(a1),a1,tolint,C1.Value(b1),b1,tolint);
|
||||
IntRes2d_Domain d2(C2.Value(a2),a2,tolint,C2.Value(b2),b2,tolint);
|
||||
Geom2dInt_GInter Inter;
|
||||
Inter.Perform( C1, d1, C2, d2, tolint, tolint );
|
||||
if(!Inter.IsDone()) continue;
|
||||
@@ -1532,8 +1535,8 @@ Standard_Boolean ShapeFix_IntersectionTool::FixIntersectingWires
|
||||
// create new vertex and split both edges
|
||||
Standard_Real param1 = IP.ParamOnFirst();
|
||||
Standard_Real param2 = IP.ParamOnSecond();
|
||||
gp_Pnt pi1 = GetPointOnEdge(edge1,sas,Crv1,param1);
|
||||
gp_Pnt pi2 = GetPointOnEdge(edge2,sas,Crv2,param2);
|
||||
gp_Pnt pi1 = GetPointOnEdge(edge1,sas,C1,param1);
|
||||
gp_Pnt pi2 = GetPointOnEdge(edge2,sas,C2,param2);
|
||||
gp_Pnt P0( (pi1.X()+pi2.X())/2, (pi1.Y()+pi2.Y())/2, (pi1.Z()+pi2.Z())/2 );
|
||||
BRep_Builder B;
|
||||
TopoDS_Vertex V;
|
||||
@@ -1597,10 +1600,10 @@ Standard_Boolean ShapeFix_IntersectionTool::FixIntersectingWires
|
||||
IntRes2d_IntersectionPoint IPL = IS.LastPoint();
|
||||
Standard_Real p12 = IPL.ParamOnFirst();
|
||||
Standard_Real p22 = IPL.ParamOnSecond();
|
||||
gp_Pnt Pnt11 = GetPointOnEdge(edge1,sas,Crv1,p11);
|
||||
gp_Pnt Pnt12 = GetPointOnEdge(edge1,sas,Crv1,p12);
|
||||
gp_Pnt Pnt21 = GetPointOnEdge(edge2,sas,Crv2,p21);
|
||||
gp_Pnt Pnt22 = GetPointOnEdge(edge2,sas,Crv2,p22);
|
||||
gp_Pnt Pnt11 = GetPointOnEdge(edge1,sas,C1,p11);
|
||||
gp_Pnt Pnt12 = GetPointOnEdge(edge1,sas,C1,p12);
|
||||
gp_Pnt Pnt21 = GetPointOnEdge(edge2,sas,C2,p21);
|
||||
gp_Pnt Pnt22 = GetPointOnEdge(edge2,sas,C2,p22);
|
||||
|
||||
// analysis for edge1
|
||||
TopoDS_Vertex V1 = sae.FirstVertex(edge1);
|
||||
@@ -1888,8 +1891,8 @@ Standard_Boolean ShapeFix_IntersectionTool::FixIntersectingWires
|
||||
(Pnt11.Z()+Pnt12.Z())/2 );
|
||||
Standard_Real param1 = (p11+p12)/2;
|
||||
Standard_Real param2 = (p21+p22)/2;
|
||||
gp_Pnt Pnt10 = GetPointOnEdge(edge1,sas,Crv1,param1);
|
||||
gp_Pnt Pnt20 = GetPointOnEdge(edge2,sas,Crv2,param2);
|
||||
gp_Pnt Pnt10 = GetPointOnEdge(edge1,sas,C1,param1);
|
||||
gp_Pnt Pnt20 = GetPointOnEdge(edge2,sas,C2,param2);
|
||||
dist1 = Max(Pnt11.Distance(P0),Pnt12.Distance(Pnt10));
|
||||
dist2 = Max(Pnt21.Distance(P0),Pnt22.Distance(Pnt10));
|
||||
Standard_Real tolV = Max(dist1,dist2);
|
||||
|
@@ -3132,7 +3132,11 @@ Standard_Boolean ShapeFix_Wire::FixNotchedEdges()
|
||||
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE2 );
|
||||
}
|
||||
else
|
||||
FixDummySeam(n1);
|
||||
{
|
||||
FixDummySeam(n1);
|
||||
// The seam edge is removed from the list. So, need to step back to avoid missing of edge processing
|
||||
i--;
|
||||
}
|
||||
|
||||
i--;
|
||||
if(!Context().IsNull()) //skl 07.03.2002 for OCC180
|
||||
|
Reference in New Issue
Block a user