[PATCH 4/7] BRepFill_Filling: Curve constraints confused by implicit cast from GeomAb...
authorblobfish <blobfish@gmx.com>
Tue, 23 May 2023 07:45:56 +0000 (08:45 +0100)
committerTobias Frost <tobi@debian.org>
Tue, 23 May 2023 07:45:56 +0000 (08:45 +0100)
Gbp-Pq: Name 0004-BRepFill_Filling-Curve-constraints-confused-by-impli.patch

src/BRepFill/BRepFill_Filling.cxx

index 9342a9ddea550e47fc4b97350b4ea1ab33491398..8c1b773335ad3a06d1569fce10c5865aba4270c5 100644 (file)
@@ -332,13 +332,22 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
       CurFace = SeqOfConstraints(i).myFace;
       CurOrder = SeqOfConstraints(i).myOrder;
       
+      // this silently defaults to C0 with an invalid value,
+      // where before an exception would be
+      // thrown out of curve constraints. Good, Bad?
+      Standard_Integer orderAdapt = 0;
+      if (CurOrder == GeomAbs_G1)
+        orderAdapt = 1;
+      else if (CurOrder == GeomAbs_G2)
+        orderAdapt = 2;
+
       if (CurFace.IsNull()) {
        if (CurOrder == GeomAbs_C0) {
          Handle( BRepAdaptor_Curve ) HCurve = new BRepAdaptor_Curve();
          HCurve->Initialize( CurEdge );
          const Handle(Adaptor3d_Curve)& aHCurve = HCurve; // to avoid ambiguity
          Constr = new BRepFill_CurveConstraint(aHCurve,
-                                               CurOrder,
+                                               orderAdapt,
                                                myNbPtsOnCur,
                                                myTol3d );
        }
@@ -362,7 +371,7 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
          Handle (Adaptor3d_CurveOnSurface) HCurvOnSurf = new Adaptor3d_CurveOnSurface( CurvOnSurf );
          
          Constr = new GeomPlate_CurveConstraint(HCurvOnSurf,
-                                                CurOrder,
+                                                orderAdapt,
                                                 myNbPtsOnCur,
                                                 myTol3d,
                                                 myTolAng,
@@ -382,7 +391,7 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
          Handle (Adaptor3d_CurveOnSurface) HCurvOnSurf = new Adaptor3d_CurveOnSurface( CurvOnSurf );
 
          Constr = new BRepFill_CurveConstraint( HCurvOnSurf,
-                                                CurOrder,
+                                                orderAdapt,
                                                 myNbPtsOnCur,
                                                 myTol3d,
                                                 myTolAng,