1
0
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:
azv
2015-05-28 13:36:57 +03:00
committed by bugmaster
parent 9176540c64
commit 94f71cad33
137 changed files with 4104 additions and 2503 deletions

View File

@@ -122,10 +122,11 @@ Standard_Real ShapeAnalysis_Curve::Project(const Handle(Geom_Curve)& C3D,
Standard_Real uMin = (cf < cl ? cf : cl);
Standard_Real uMax = (cf < cl ? cl : cf);
GeomAdaptor_Curve GAC(C3D, uMin, uMax);
if (C3D->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) {
Standard_Real prec = ( AdjustToEnds ? preci : Precision::Confusion() ); //:j8 abv 10 Dec 98: tr10_r0501_db.stp #9423: protection against densing of points near one end
gp_Pnt LowBound = C3D->Value(uMin);
gp_Pnt HigBound = C3D->Value(uMax);
gp_Pnt LowBound = GAC.Value(uMin);
gp_Pnt HigBound = GAC.Value(uMax);
distmin = LowBound.Distance(P3D);
if (distmin <= prec) {
param = uMin;
@@ -140,7 +141,6 @@ Standard_Real ShapeAnalysis_Curve::Project(const Handle(Geom_Curve)& C3D,
}
}
GeomAdaptor_Curve GAC(C3D, uMin, uMax);
if (!C3D->IsClosed()) {
//modified by rln on 16/12/97 after CSR# PRO11641 entity 20767
//the VIso was not closed (according to C3D->IsClosed()) while it "almost"
@@ -403,10 +403,11 @@ Standard_Real ShapeAnalysis_Curve::NextProject(const Standard_Real paramPrev,
Standard_Real uMin = (cf < cl ? cf : cl);
Standard_Real uMax = (cf < cl ? cl : cf);
Standard_Real distmin = Precision::Infinite();
GeomAdaptor_Curve GAC(C3D, uMin, uMax);
if (C3D->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) {
Standard_Real prec = ( AdjustToEnds ? preci : Precision::Confusion() ); //:j8 abv 10 Dec 98: tr10_r0501_db.stp #9423: protection against densing of points near one end
gp_Pnt LowBound = C3D->Value(uMin);
gp_Pnt HigBound = C3D->Value(uMax);
gp_Pnt LowBound = GAC.Value(uMin);
gp_Pnt HigBound = GAC.Value(uMax);
distmin = LowBound.Distance(P3D);
if (distmin <= prec) {
param = uMin;
@@ -421,7 +422,6 @@ Standard_Real ShapeAnalysis_Curve::NextProject(const Standard_Real paramPrev,
}
}
GeomAdaptor_Curve GAC(C3D, uMin, uMax);
if (!C3D->IsClosed()) {
//modified by rln on 16/12/97 after CSR# PRO11641 entity 20767
//the VIso was not closed (according to C3D->IsClosed()) while it "almost"
@@ -1017,11 +1017,13 @@ Standard_Boolean ShapeAnalysis_Curve::GetSamplePoints (const Handle(Geom_Curve)&
Handle(Geom_TrimmedCurve) aC = Handle(Geom_TrimmedCurve)::DownCast(curve);
return GetSamplePoints(aC->BasisCurve(),first,last,seq);
}
GeomAdaptor_Curve GAC(curve);
Standard_Real step = ( last - first ) / (Standard_Real)( nbp - 1 );
Standard_Real par = first, stop = last - 0.5 * step;
for ( ; par < stop; par += step )
seq.Append(curve->Value(par));
seq.Append(curve->Value(last));
seq.Append(GAC.Value(par));
seq.Append(GAC.Value(last));
return Standard_True;
}
//=======================================================================
@@ -1043,8 +1045,8 @@ Standard_Boolean ShapeAnalysis_Curve::GetSamplePoints (const Handle(Geom2d_Curve
Standard_Real step = ( last - first ) / (Standard_Real)( nbs - 1 );
Standard_Real par = first, stop = last - 0.5 * step;
for ( ; par < stop; par += step )
seq.Append(curve->Value(par));
seq.Append(curve->Value(last));
seq.Append(C.Value(par));
seq.Append(C.Value(last));
return Standard_True;
/*
Standard_Integer i;

View File

@@ -1068,7 +1068,7 @@ Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer nu
// 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 Geom2dAdaptor_Curve &Crv2d,
const Standard_Real param )
{
if ( BRep_Tool::SameParameter ( edge ) ) {
@@ -1078,7 +1078,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());
}
//=======================================================================
@@ -1132,7 +1133,7 @@ Standard_Boolean ShapeAnalysis_Wire::CheckSelfIntersectingEdge (const Standard_I
const IntRes2d_Transition &Tr2 = IP.TransitionOfSecond();
if ( Tr1.PositionOnCurve() != IntRes2d_Middle &&
Tr2.PositionOnCurve() != IntRes2d_Middle ) continue;
gp_Pnt pint = GetPointOnEdge ( edge, mySurf, Crv, IP.ParamOnFirst() );
gp_Pnt pint = GetPointOnEdge ( edge, mySurf, AC, IP.ParamOnFirst() );
Standard_Real dist21 = pnt1.SquareDistance ( pint );
Standard_Real dist22 = pnt2.SquareDistance ( pint );
if ( dist21 > tol1 * tol1 && dist22 > tol2 * tol2 ) {
@@ -1222,11 +1223,11 @@ Standard_Boolean ShapeAnalysis_Wire::CheckIntersectingEdges (const Standard_Inte
Standard_Real tolint = 1.0e-10;
//szv#4:S4163:12Mar99 warning
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 );
//:64 abv 25 Dec 97: Attention!
// Since Intersection algorithm is not symmetrical, for consistency with BRepCheck
@@ -1282,8 +1283,8 @@ Standard_Boolean ShapeAnalysis_Wire::CheckIntersectingEdges (const Standard_Inte
param2-b2 > ::Precision::PConfusion() ) continue;
//:82 abv 21 Jan 98: point of intersection on Crv1 and Crv2 is different
gp_Pnt pi1 = GetPointOnEdge ( edge1, mySurf, Crv1, param1 ); //:h0: thesurf.Value ( Crv1->Value ( param1 ) );
gp_Pnt pi2 = GetPointOnEdge ( edge2, mySurf, Crv2, param2 ); //:h0: thesurf.Value ( Crv2->Value ( param2 ) );
gp_Pnt pi1 = GetPointOnEdge ( edge1, mySurf, C1, param1 ); //:h0: thesurf.Value ( Crv1->Value ( param1 ) );
gp_Pnt pi2 = GetPointOnEdge ( edge2, mySurf, C2, param2 ); //:h0: thesurf.Value ( Crv2->Value ( param2 ) );
gp_Pnt pint = 0.5 * ( pi1.XYZ() + pi2.XYZ() );
Standard_Real di1 = pi1.SquareDistance ( pnt );
Standard_Real di2 = pi2.SquareDistance ( pnt );
@@ -1413,8 +1414,8 @@ Standard_Boolean ShapeAnalysis_Wire::CheckIntersectingEdges(const Standard_Integ
Tr2.PositionOnCurve() != IntRes2d_Middle ) continue;
Standard_Real param1 = IP.ParamOnFirst();
Standard_Real param2 = IP.ParamOnSecond();
gp_Pnt pi1 = GetPointOnEdge ( edge1, mySurf, Crv1, param1 ); //:h0: thesurf.Value ( Crv1->Value ( param1 ) );
gp_Pnt pi2 = GetPointOnEdge ( edge2, mySurf, Crv2, param2 );
gp_Pnt pi1 = GetPointOnEdge ( edge1, mySurf, C1, param1 ); //:h0: thesurf.Value ( Crv1->Value ( param1 ) );
gp_Pnt pi2 = GetPointOnEdge ( edge2, mySurf, C2, param2 );
Standard_Boolean OK1 = Standard_False;
Standard_Boolean OK2 = Standard_False;
@@ -1494,13 +1495,15 @@ Standard_Boolean ShapeAnalysis_Wire::CheckLacking (const Standard_Integer num,
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL3);
return Standard_False;
}
c2d->D1 ( b, p2d1, v1 );
Geom2dAdaptor_Curve anAdapt(c2d);
anAdapt.D1(b, p2d1, v1);
if ( E1.Orientation() == TopAbs_REVERSED ) v1.Reverse();
if ( ! sae.PCurve ( E2, myFace, c2d, a, b, Standard_True ) ) {
myStatus |= ShapeExtend::EncodeStatus (ShapeExtend_FAIL3);
return Standard_False;
}
c2d->D1 ( a, p2d2, v2 );
anAdapt.Load(c2d);
anAdapt.D1(a, p2d2, v2);
if ( E2.Orientation() == TopAbs_REVERSED ) v2.Reverse();
v12 = p2d2.XY() - p2d1.XY();
myMax2d = v12.SquareMagnitude();