model.testNbSubShapes(Filling_2, GeomAPI_Shape.FACE, [1])
model.testNbSubShapes(Filling_2, GeomAPI_Shape.EDGE, [4])
model.testNbSubShapes(Filling_2, GeomAPI_Shape.VERTEX, [8])
-model.testResultsAreas(Filling_2, [29.198793093])
+model.testResultsAreas(Filling_2, [29.10364506])
model.testNbResults(Filling_3, 1)
model.testNbSubResults(Filling_3, [0])
model.testNbSubShapes(Filling_3, GeomAPI_Shape.FACE, [1])
model.testNbSubShapes(Filling_3, GeomAPI_Shape.EDGE, [4])
model.testNbSubShapes(Filling_3, GeomAPI_Shape.VERTEX, [8])
-model.testResultsAreas(Filling_3, [30.74501422428])
+model.testResultsAreas(Filling_3, [30.744277238])
assert(model.checkPythonDump())
# check fillings
REF_DATA = [(Filling_1, 719.149788883378505488508380949),
- (Filling_2, 910.894530912501409147807862610),
+ (Filling_2, 911.056740330659408755309414119),
(Filling_3, 719.149788883378505488508380949),
- (Filling_4, 910.894530912501409147807862610)]
+ (Filling_4, 911.056740330659408755309414119)]
for ref in REF_DATA:
model.testNbResults(ref[0], 1)
model.testNbSubResults(ref[0], [0])
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Wire.h>
+#include <Approx_CurvilinearParameter.hxx>
+
#include <Bnd_Box.hxx>
#include <BRep_Tool.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Curve.hxx>
+#include <Geom_BSplineCurve.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
+#include <GeomAdaptor_HCurve.hxx>
+
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ShapeIterator.h>
aWire = fixParametricGaps(aWire);
aWire = BRepAlgo::ConcatenateWire(aWire, GeomAbs_G1); // join smooth parts of wire
aNewEdge = BRepAlgo::ConcatenateWireC0(aWire); // join C0 parts of wire
+
+ // Reapproximate the result edge to have the parameter equal to curvilinear abscissa.
+ static const int THE_MAX_DEGREE = 14;
+ static const int THE_MAX_INTERVALS = 32;
+ double aFirst, aLast;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aNewEdge, aFirst, aLast);
+ Handle(GeomAdaptor_HCurve) aHCurve = new GeomAdaptor_HCurve(aCurve);
+ Approx_CurvilinearParameter anApprox(aHCurve, Precision::Confusion(), aCurve->Continuity(),
+ THE_MAX_DEGREE, THE_MAX_INTERVALS);
+ if (anApprox.HasResult()) {
+ Handle(Geom_BSplineCurve) aNewCurve = anApprox.Curve3d();
+ TColStd_Array1OfReal aKnots = aNewCurve->Knots();
+ BSplCLib::Reparametrize(aFirst, aLast, aKnots);
+ aNewCurve->SetKnots(aKnots);
+ BRep_Builder().UpdateEdge(aNewEdge, aNewCurve, BRep_Tool::Tolerance(aNewEdge));
+ }
}
anEdge = GeomEdgePtr(new GeomAPI_Edge);
anEdge->setImpl(new TopoDS_Edge(aNewEdge));