From: Ekaterina Sukhareva Date: Tue, 26 Mar 2024 18:22:07 +0000 (+0000) Subject: [EDF] (2023-T3) Creation of a non planar face from a list of edges and points X-Git-Tag: V9_13_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Ftlpr%2F18%2Fhead;p=modules%2Fgeom.git [EDF] (2023-T3) Creation of a non planar face from a list of edges and points --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 91c34047f..36be15fc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,7 @@ FIND_PACKAGE(SalomeOmniORB REQUIRED) FIND_PACKAGE(SalomeOmniORBPy REQUIRED) FIND_PACKAGE(SalomeLibXml2 REQUIRED) FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C) +FIND_PACKAGE(Eigen3 3.2.5 REQUIRED) # Other KERNEL optionals: IF(SALOME_BUILD_TESTS) diff --git a/doc/salome/examples/topological_geom_objs_ex03.py b/doc/salome/examples/topological_geom_objs_ex03.py index a99f52369..00062de9b 100644 --- a/doc/salome/examples/topological_geom_objs_ex03.py +++ b/doc/salome/examples/topological_geom_objs_ex03.py @@ -47,12 +47,37 @@ face5 = geompy.MakeFaceWithConstraints([geompy.GetSubShape(cut, [5]), geompy.Get geompy.GetSubShape(cut, [11]), geompy.GetSubShape(cut, [3]), geompy.GetSubShape(cut, [13]), geompy.GetSubShape(cut, [3])]) +# create circle from 3 points +pCirc1 = geompy.MakeVertex(17.274575, 63.776413, 50.610737) +pCirc2 = geompy.MakeVertex(37.5, 49.081782, 127.552826) +pCirc3 = geompy.MakeVertex(62.5, 78.471044, 50.610737) +Circle_1 = geompy.MakeCircleThreePnt(pCirc1, pCirc2, pCirc3) +listE = [] +listE.append(Circle_1) + +# create list of points +listV = [] +pV1 = geompy.MakeVertex(64.694631, 85.225425, 64.54915) +listV.append(pV1) +pV2 = geompy.MakeVertex(11.528956, 67.95085, 95.45085) +listV.append(pV2) +pV3 = geompy.MakeVertex(36.233192, 82.369878, 102.699525) +listV.append(pV3) +pV4 = geompy.MakeVertex(35.305369, 85.225425, 64.54915) +listV.append(pV4) +pV5 = geompy.MakeVertex(50, 75.355339, 115.355339) +listV.append(pV5) + +# create face from edges and points +face6 = geompy.MakeWrappedFace(listE, listV, 1e-5) + # add objects in the study id_face1 = geompy.addToStudy(face1,"Face1") id_face2 = geompy.addToStudy(face2,"Face2") id_face3 = geompy.addToStudy(face3,"Face3") id_face4 = geompy.addToStudy(face4,"Face4") id_face5 = geompy.addToStudy(face5,"Face5") +id_face6 = geompy.addToStudy(face5,"Face6") # display the faces gg.createAndDisplayGO(id_face1) @@ -70,3 +95,6 @@ gg.setTransparency(id_face4,0.2) gg.createAndDisplayGO(id_face5) gg.setDisplayMode(id_face5,1) gg.setTransparency(id_face5,0.2) +gg.createAndDisplayGO(id_face6) +gg.setDisplayMode(id_face6,1) +gg.setTransparency(id_face6,0.2) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index f81c92cee..9bf78ddb8 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2066,6 +2066,17 @@ module GEOM GEOM_Object MakeFaceFromSurface(in GEOM_Object theFace, in GEOM_Object theWire); + /** + * \brief Create non planar face with list of edges and list of vertices + * \param theEdges list of Edges(must be closed but not nesessarily belong to the same plane) . + * \param theVertices list of vertices through which the result face must pass. + * \param theTolerance tolerance. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeWrappedFace(in ListOfGO theEdges, + in ListOfGO theVertices, + in double theTolerance); + /*! * \brief Create a face from a set of edges with the given constraints. * \param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples): diff --git a/src/GEOMImpl/CMakeLists.txt b/src/GEOMImpl/CMakeLists.txt index a6615ea7d..64228aa7c 100644 --- a/src/GEOMImpl/CMakeLists.txt +++ b/src/GEOMImpl/CMakeLists.txt @@ -25,6 +25,7 @@ INCLUDE_DIRECTORIES( ${PTHREAD_INCLUDE_DIR} ${KERNEL_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} + ${EIGEN3_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/src/ShHealOper ${PROJECT_SOURCE_DIR}/src/GEOM ${PROJECT_SOURCE_DIR}/src/BlockFix @@ -187,6 +188,8 @@ SET(GEOMImpl_HEADERS GEOMImpl_Types.hxx GEOM_GEOMImpl.hxx GEOMImpl_ICanonicalRecognition.hxx + GEOMImpl_WrappingDriver.hxx + GEOMImpl_IWrap.hxx ) # --- sources --- @@ -266,6 +269,7 @@ SET(GEOMImpl_SOURCES GEOMImpl_ShapeProximityDriver.cxx GEOMImpl_FieldDriver.cxx GEOMImpl_ICanonicalRecognition.cxx + GEOMImpl_WrappingDriver.cxx ) # --- rules --- diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index 3f6ae71c4..7a26f1fb9 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -85,6 +85,7 @@ #include #include #include +#include //============================================================================= /*! @@ -171,6 +172,9 @@ GEOMImpl_Gen::GEOMImpl_Gen() // Field TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FieldDriver::GetID(), new GEOMImpl_FieldDriver()); + // Wrapping + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_WrappingDriver::GetID(), new GEOMImpl_WrappingDriver()); + /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ SetEngine(this); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index ce32259fb..c253bba98 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -35,6 +35,7 @@ #include "GEOMImpl_ShapeDriver.hxx" #include "GEOMImpl_GlueDriver.hxx" #include "GEOMImpl_FillingDriver.hxx" +#include "GEOMImpl_WrappingDriver.hxx" #include "GEOMImpl_IExtract.hxx" #include "GEOMImpl_IVector.hxx" @@ -42,6 +43,7 @@ #include "GEOMImpl_IShapeExtend.hxx" #include "GEOMImpl_IGlue.hxx" #include "GEOMImpl_IFilling.hxx" +#include "GEOMImpl_IWrap.hxx" #include "GEOMImpl_Block6Explorer.hxx" #include "GEOMImpl_IHealingOperations.hxx" @@ -648,6 +650,99 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceFromSurface return aShape; } +//============================================================================= +/*! + * MakeWrappedFace + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeWrappedFace + (std::list theEdges, + std::list theVertices, + const Standard_Real theTolerance) +{ + SetErrorCode(KO); + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GEOM_FACE); + + //Add a new function + Handle(GEOM_Function) aFunction = + aShape->AddFunction(GEOMImpl_WrappingDriver::GetID(), WRAPPING_FACE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_WrappingDriver::GetID()) return NULL; + + GEOMImpl_IWrap aCI (aFunction); + aCI.SetTolerance(theTolerance); + + // Edges + Handle(TColStd_HSequenceOfTransient) anEdgesSeq = new TColStd_HSequenceOfTransient; + std::list::iterator it = theEdges.begin(); + for (; it != theEdges.end(); it++) { + Handle(GEOM_Object) anEdge = (*it); + if ( anEdge.IsNull() || anEdge->GetValue().ShapeType() != TopAbs_EDGE ) { + SetErrorCode("NULL argument edge for the face construction"); + return NULL; + } + Handle(GEOM_Function) aRefSh = anEdge->GetLastFunction(); + anEdgesSeq->Append(aRefSh); + } + aCI.SetEdges(anEdgesSeq); + + // Vertices + Handle(TColStd_HSequenceOfTransient) aVerticesSeq = new TColStd_HSequenceOfTransient; + it = theVertices.begin(); + for (; it != theVertices.end(); it++) { + Handle(GEOM_Object) aVertex = (*it); + if ( aVertex.IsNull() || aVertex->GetValue().ShapeType() != TopAbs_VERTEX ) { + SetErrorCode("NULL argument vertex for the face construction"); + return NULL; + } + Handle(GEOM_Function) aRefSh = aVertex->GetLastFunction(); + aVerticesSeq->Append(aRefSh); + } + aCI.SetVertices(aVerticesSeq); + + //Compute the face + try { + OCC_CATCH_SIGNALS; + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Wrap driver failed"); + return NULL; + } + } + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aShape << " = geompy.MakeWrappedFace(["; + + // Edges + it = theEdges.begin(); + if (it != theEdges.end()) { + pd << (*it++); + while (it != theEdges.end()) { + pd << ", " << (*it++); + } + } + pd << "], ["; + // Vertices + it = theVertices.begin(); + if (it != theVertices.end()) { + pd << (*it++); + while (it != theVertices.end()) { + pd << ", " << (*it++); + } + } + pd << "], " << theTolerance << ")"; + SetErrorCode(OK); + + return aShape; +} + //============================================================================= /*! * MakeFaceWithConstraints diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 0cb04e069..cd20bea5f 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -104,6 +104,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT Handle(GEOM_Object) MakeFaceFromSurface (Handle(GEOM_Object) theFace, Handle(GEOM_Object) theWire); + + Standard_EXPORT Handle(GEOM_Object) MakeWrappedFace(std::list theEdges, + std::list theVertices, + const Standard_Real theTolerance); Standard_EXPORT Handle(GEOM_Object) MakeFaceWithConstraints (std::list theConstraints); diff --git a/src/GEOMImpl/GEOMImpl_IWrap.hxx b/src/GEOMImpl/GEOMImpl_IWrap.hxx new file mode 100644 index 000000000..24a230324 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IWrap.hxx @@ -0,0 +1,58 @@ +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//NOTE: This is an interface to a function for the Box creation. +// +#include "GEOM_Function.hxx" + +class GEOMImpl_IWrap +{ + public: + + enum { + WRAP_ARG_EDGES = 1, // list of edges + WRAP_ARG_VERTICES = 2, // list of vertices + WRAP_TOLER = 3, // tolerance + }; + + GEOMImpl_IWrap(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetEdges(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(WRAP_ARG_EDGES, theShapes); } + + Handle(TColStd_HSequenceOfTransient) GetEdges() + { return _func->GetReferenceList(WRAP_ARG_EDGES); } + + void SetVertices(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(WRAP_ARG_VERTICES, theShapes); } + + Handle(TColStd_HSequenceOfTransient) GetVertices() + { return _func->GetReferenceList(WRAP_ARG_VERTICES); } + + void SetTolerance(double theTol) { _func->SetReal(WRAP_TOLER, theTol); } + + double GetTolerance() { return _func->GetReal(WRAP_TOLER); } + + private: + + Handle(GEOM_Function) _func; +}; \ No newline at end of file diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 04bea6ac1..9a0c75e65 100644 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -327,6 +327,8 @@ #define SOLID_FACES 19 #define EXTRACTION 20 +#define WRAPPING_FACE 1 + #define ARCHIMEDE_TYPE 1 // Shape Healing operators diff --git a/src/GEOMImpl/GEOMImpl_WrappingDriver.cxx b/src/GEOMImpl/GEOMImpl_WrappingDriver.cxx new file mode 100644 index 000000000..3d3037fee --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_WrappingDriver.cxx @@ -0,0 +1,452 @@ +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#if OCC_VERSION_LARGE < 0x07070000 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +//======================================================================= +// function : GetID +// purpose : +//======================================================================= +const Standard_GUID &GEOMImpl_WrappingDriver::GetID() +{ + static Standard_GUID aWrapDriver("FF1BBB71-729D-4E83-8232-78E74FC5637C"); + return aWrapDriver; +} + +//======================================================================= +// function : GEOMImpl_WrappingDriver +// purpose : +//======================================================================= +GEOMImpl_WrappingDriver::GEOMImpl_WrappingDriver() +{ +} + +//======================================================================= +// function : createPointsOnEdges +// purpose : create points on edges +//======================================================================= +static void createPointsOnEdges(const Handle(TColStd_HSequenceOfTransient) & theEdgesFuncs, + std::vector &thePoints) +{ + for (int i = 1; i <= theEdgesFuncs->Length(); i++) + { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(theEdgesFuncs->Value(i)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) + { + Standard_NullObject::Raise("Edge for face construction is null"); + } + TopExp_Explorer exp(aShape_i, TopAbs_EDGE); + for (; exp.More(); exp.Next()) + { + Standard_Real aFP, aLP, aP; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(exp.Current()), aFP, aLP); + if (!aCurve.IsNull()) + { + for (int aPar = 1; aPar <= 9; aPar++) + { + aP = aFP + (aLP - aFP) * (aPar * 0.1); + gp_Pnt aPnt = aCurve->Value(aP); + thePoints.push_back(aPnt); + } + } + } + } +} + +//================================================================================ +// function : maxDistanceToFace +// purpose : finds max distanse between points and a face +//================================================================================ +static Standard_Real maxDistanceToFace(const std::vector& thePoints, + const TopoDS_Face& theFace, + const Standard_Real theTolerance) +{ + Standard_Real U, V; + Standard_Real aMaxDist = 0.; + for(auto& aPnt : thePoints) + { + gp_Pnt aProj = GEOMUtils::ProjectPointOnFace(aPnt, theFace,U,V,theTolerance); + Standard_Real aDist = aProj.Distance(aPnt); + if(aDist > aMaxDist) + { + aMaxDist = aDist; + } + } + return aMaxDist; +} + +//================================================================================ +// function : divideSphericalShape +// purpose : divide spherical shape into two piece +// and choose that part that has the points +//================================================================================ +static void divideSphericalShape(TopoDS_Shape &theShape, + const TopoDS_Wire &theWire, + const std::vector &thePoints, + const Standard_Real theTolerance) +{ + TopExp_Explorer anExp(theShape, TopAbs_FACE); + const TopoDS_Face& aFace = TopoDS::Face(anExp.Current()); + TopoDS_Face aToolFace; + GEOMImpl_Block6Explorer::MakeFace(theWire, false, aToolFace); + if(!aToolFace.IsNull()) + { + //split sphere and choose right part + GEOMAlgo_Splitter PS; + PS.AddArgument(aFace); + PS.AddTool(aToolFace); + PS.SetLimit(TopAbs_FACE); + PS.Perform(); + TopoDS_Shape aResultShape = PS.Shape(); + if(!aResultShape.IsNull()) + { + anExp.Init(aResultShape, TopAbs_FACE); + for (; anExp.More(); anExp.Next()) + { + Standard_Real aDist = maxDistanceToFace(thePoints, TopoDS::Face(anExp.Current()), theTolerance); + if(aDist < theTolerance) + { + theShape = TopoDS::Face(anExp.Current()); + break; + } + } + } + } +} + +//================================================================================ +// function : makeFaceFromPointsAndWire +// purpose : Create face from set of points with the same approach as for +// geompy.makeSmoothingSurface. Cut resulting surface with a wire +//================================================================================ +static TopoDS_Shape makeFaceFromPointsAndWire(const TopoDS_Wire &theWire, + const std::vector &theAllPoints) +{ + int nbPoints = theAllPoints.size(); + Handle(TColgp_HArray1OfPnt) anArrayofPnt = new TColgp_HArray1OfPnt(1, nbPoints); + for (int i = 0; i < nbPoints; i++) { + gp_Pnt aP = theAllPoints[i]; + anArrayofPnt->SetValue(i+1, aP); + } + + // Try to build smoothing surface + GeomPlate_BuildAveragePlane gpbap(anArrayofPnt,anArrayofPnt->Length(),Precision::Confusion(),1,1); + Handle(Geom_Plane) plane(gpbap.Plane()); + + Standard_Real Umin, Umax, Vmin, Vmax; + gpbap.MinMaxBox(Umin,Umax,Vmin,Vmax); + + TopoDS_Face aInitShape; + BRepBuilderAPI_MakeFace mf(plane,Umin,Umax,Vmin,Vmax,Precision::Confusion()); + aInitShape = mf.Face(); + + GeomPlate_BuildPlateSurface aBuilder(3,10); + // ** Initialization of surface +#if OCC_VERSION_LARGE < 0x07070000 + Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface(); + HSI->ChangeSurface().Initialize(aInitShape); + aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face())); +#else + Handle(BRepAdaptor_Surface) HSI = new BRepAdaptor_Surface(); + HSI->Initialize(aInitShape); + aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->Face()) ); +#endif + + Standard_Integer j, j1, j2; + j1 = anArrayofPnt->Lower(); + j2 = anArrayofPnt->Upper(); + for (j=j1; j<=j2 ; j++) + { + gp_Pnt aPnt = anArrayofPnt->Value(j); + Handle(GeomPlate_PointConstraint) PCont = new GeomPlate_PointConstraint(aPnt,0); + aBuilder.Add(PCont); + } + aBuilder.Perform(); + Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface(); + if(gpPlate.IsNull()) + { + Standard_ConstructionError::Raise("Not possible to build a face with given input, GeomPlate_Surface failed"); + } + + Standard_Real seuil = Max(0.0001,10*aBuilder.G0Error()); + GeomPlate_MakeApprox Mapp(gpPlate,0.0001,2,8,seuil); + Handle(Geom_Surface) aSurf(Mapp.Surface()); + + //cut surface with a face + TopoDS_Shape aShape; + BRepBuilderAPI_MakeFace aMkFace(aSurf, theWire); + if (aMkFace.IsDone()) + { + aShape = aMkFace.Shape(); + } + + TopoDS_Face aFace = TopoDS::Face(aShape); + Handle(ShapeFix_Face) aFix = new ShapeFix_Face(aFace); + aFix->Perform(); + aFix->FixOrientation(); + aFace = aFix->Face(); + + return aFace; +} + +//======================================================================= +// function : Execute +// purpose : +//======================================================================= +Standard_Integer GEOMImpl_WrappingDriver::Execute(Handle(TFunction_Logbook) & log) const +{ + if (Label().IsNull()) + return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IWrap aCI(aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == WRAPPING_FACE) + { + Handle(TColStd_HSequenceOfTransient) anEdges = aCI.GetEdges(); + Handle(TColStd_HSequenceOfTransient) aVertices = aCI.GetVertices(); + + int nbEdge = anEdges->Length(); + int nbVertices = aVertices->Length(); + + if (nbEdge < 1 || nbVertices < 1) + { + Standard_ConstructionError::Raise("No edges or vertices given"); + } + + Standard_Real aTolerance = aCI.GetTolerance(); + if (aTolerance < Precision::Confusion()) + aTolerance = Precision::Confusion(); + + std::vector anAllPoints, aPoints; + createPointsOnEdges(anEdges, anAllPoints); + for (int i = 1; i <= aVertices->Length(); i++) + { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aVertices->Value(i)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) + { + Standard_NullObject::Raise("Vertex for face construction is null"); + } + TopExp_Explorer exp (aShape_i, TopAbs_VERTEX); + for (; exp.More(); exp.Next()) + { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(exp.Current())); + anAllPoints.push_back(aP); + aPoints.push_back(aP); + } + } + + if(anAllPoints.size() == 0) + { + Standard_NullObject::Raise("Shape creation imposible, no valid objects were given"); + } + + //create wire from edges + TopoDS_Wire aWire = GEOMImpl_ShapeDriver::MakeWireFromEdges(anEdges, aTolerance); + if(aWire.IsNull()) + { + Standard_NullObject::Raise("Given edges does not create closed contour"); + } + + aShape = createWrappedFace(aWire, anAllPoints, aPoints, aTolerance); + } + + if (aShape.IsNull()) + return 0; + + aFunction->SetValue(aShape); + + log->SetTouched(Label()); + + return 1; +} + +//================================================================================ +/*! + * \brief Create wrapped face from vector of points and wire + */ +//================================================================================ +TopoDS_Shape GEOMImpl_WrappingDriver::createWrappedFace(const TopoDS_Wire &theWire, + const std::vector &theAllPoints, + const std::vector &thePoints, + const Standard_Real theTolerance) const +{ + TopoDS_Shape aShape; + + gp_Pnt aCenter(0,0,0); + Standard_Real aRadius = 100; + if(isSphere(theAllPoints, aCenter, aRadius, theTolerance)) + { + aShape = BRepPrimAPI_MakeSphere(aCenter, aRadius).Shape(); + divideSphericalShape(aShape, theWire, thePoints, theTolerance); + return aShape; + } + + aShape = makeFaceFromPointsAndWire(theWire, theAllPoints); + return aShape; +} + +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ +Standard_Boolean GEOMImpl_WrappingDriver::isSphere(const std::vector& thePoints, + gp_Pnt& theCenter, + Standard_Real& theRadius, + const Standard_Real theTolerance)const +{ + int aNumPoints = thePoints.size(); + if(aNumPoints == 0) + { + return false; + } + + // Create coefficient matrix A and right-hand side vector f + Eigen::MatrixXd A(aNumPoints, 4); + Eigen::VectorXd f(aNumPoints); + + Standard_Real X(.0); + Standard_Real Y(.0); + Standard_Real Z(.0); + + for (int i = 0; i < aNumPoints; ++i) + { + X = thePoints[i].X(); + Y = thePoints[i].Y(); + Z = thePoints[i].Z(); + A(i, 0) = X * 2; + A(i, 1) = Y * 2; + A(i, 2) = Z * 2; + A(i, 3) = 1.0; + f(i) = X * X + Y * Y + Z * Z; + } + + // Solve linear equations to get coefficients + Eigen::VectorXd c = A.colPivHouseholderQr().solve(f); + + Standard_Real t = c[0] * c[0] + c[1] * c[1] + c[2] * c[2] + c[3]; + theRadius = std::sqrt(t); + theCenter.SetCoord(c[0], c[1], c[2]); + + //check that all points belong to the sphere within theTolerance + std::vector aDists; + for(const auto& aPnt : thePoints) + { + aDists.push_back(aPnt.Distance(theCenter)); + } + if (!aDists.empty()) + { + Standard_Real sumDistances = std::accumulate(aDists.begin(), aDists.end(), 0.0); + Standard_Real averageDistance = sumDistances / aDists.size(); + + if (std::fabs(averageDistance - theRadius) > theTolerance) { + return false; + } + } + + return true; +} + +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_WrappingDriver:: + GetCreationInformation(std::string &theOperationName, + std::vector &theParams) +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IWrap aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "WRAPPEDFACE"; + + switch ( aType ) { + case WRAPPING_FACE: + AddParam(theParams, "Edges", aCI.GetEdges()); + AddParam(theParams, "Vertices", aCI.GetVertices()); + AddParam(theParams, "Tolerance", aCI.GetTolerance()); + break; + default: + return false; + } + + return true; +} + +IMPLEMENT_STANDARD_RTTIEXT(GEOMImpl_WrappingDriver, GEOM_BaseDriver) \ No newline at end of file diff --git a/src/GEOMImpl/GEOMImpl_WrappingDriver.hxx b/src/GEOMImpl/GEOMImpl_WrappingDriver.hxx new file mode 100644 index 000000000..45324044d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_WrappingDriver.hxx @@ -0,0 +1,68 @@ +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : GEOMImpl_WrappingDriver.hxx +// Module : GEOMImpl +// +#ifndef _GEOMImpl_WrappingDriver_HeaderFile +#define _GEOMImpl_WrappingDriver_HeaderFile + +#include + +class TopoDS_Wire; +class TopoDS_Face; +class TColgp_HArray1OfPnt; + +DEFINE_STANDARD_HANDLE( GEOMImpl_WrappingDriver, GEOM_BaseDriver ) + +class GEOMImpl_WrappingDriver : public GEOM_BaseDriver { + +public: + + Standard_EXPORT GEOMImpl_WrappingDriver(); + Standard_EXPORT ~GEOMImpl_WrappingDriver() {}; + + Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const; + Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const Handle(TFunction_Logbook)&) const { return Standard_True; } + + Standard_EXPORT static const Standard_GUID& GetID(); + + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); + + DEFINE_STANDARD_RTTIEXT(GEOMImpl_WrappingDriver,GEOM_BaseDriver) + +private: + TopoDS_Shape createWrappedFace(const TopoDS_Wire& theWire, + const std::vector& theAllPoints, + const std::vector& thePoints, + const Standard_Real theTolerance)const; + + Standard_Boolean isSphere(const std::vector& thePoints, + gp_Pnt& theCenter, + Standard_Real& theRadius, + const Standard_Real theTolerance)const; +}; + +#endif \ No newline at end of file diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index 73a42c007..7526c83ed 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -310,6 +310,47 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceFromSurface return GetObject(anObject); } +//============================================================================= +/*! + * MakeWrappedFace + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWrappedFace + (const GEOM::ListOfGO& theEdges, + const GEOM::ListOfGO& theVertices, + const CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the edges + std::list anEdges; + for( CORBA::ULong ind = 0; ind < theEdges.length(); ind++ ) { + Handle(::GEOM_Object) anObject = GetObjectImpl( theEdges[ind] ); + anEdges.push_back(anObject); + } + + //Get the vertices + std::list aVertices; + for( CORBA::ULong ind = 0; ind < theVertices.length(); ind++ ) { + Handle(::GEOM_Object) anObject = GetObjectImpl( theVertices[ind] ); + aVertices.push_back(anObject); + } + + //Create the Face + Handle(::GEOM_Object) anObject = + GetOperations()->MakeWrappedFace(anEdges, aVertices, theTolerance); + + // enable warning status + if (anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + //============================================================================= /*! * MakeFaceWithConstraints diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index f1518a005..28c5944f4 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -67,6 +67,10 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : GEOM::GEOM_Object_ptr MakeFaceFromSurface(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theWire); + GEOM::GEOM_Object_ptr MakeWrappedFace(const GEOM::ListOfGO& theEdges, + const GEOM::ListOfGO& theVertices, + const CORBA::Double theTolerance); + GEOM::GEOM_Object_ptr MakeFaceWithConstraints (const GEOM::ListOfGO& theConstraints); GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells); diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 9564a2309..d62ca1288 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -4878,6 +4878,39 @@ class geomBuilder(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp) self._autoPublish(anObj, theName, "face") return anObj + + ## Create a non-planar face from a list of closed edges and a list of vertices. + # @param theEdges list of Edges(must be closed but not nesessarily belong to the same plane). + # @param theVertices list of vertices through which the result face must pass. + # @param theTolerance tolerance + # @param theName Object name; when specified, this parameter is used + # for result publication in the study. Otherwise, if automatic + # publication is switched on, default value is used for result name. + # + # @return New GEOM.GEOM_Object, containing the created face. + # + # @ref tui_creation_face "Example" + @ManageTransactions("ShapesOp") + def MakeWrappedFace(self, theEdges, theVertices, theTolerance, theName=None): + """ + Create a non-planar face from a list of closed edges and a list of vertices. + + Parameters: + theEdges list of Edges(must be closed but not nesessarily belong to the same plane). + theVertices list of vertices through which the result face must pass. + theTolerance tolerance + theName Object name; when specified, this parameter is used + for result publication in the study. Otherwise, if automatic + publication is switched on, default value is used for result name. + + Returns: + New GEOM.GEOM_Object, containing the created face. + """ + # Example: see GEOM_TestAll.py + anObj = self.ShapesOp.MakeWrappedFace(theEdges, theVertices, theTolerance) + RaiseIfFailed("MakeWrappedFace", self.ShapesOp) + self._autoPublish(anObj, theName, "face") + return anObj ## Create a face from a set of edges with the given constraints. # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples): diff --git a/test/data/WrappedFace_bspline_edges.brep b/test/data/WrappedFace_bspline_edges.brep new file mode 100644 index 000000000..b3d5879e1 --- /dev/null +++ b/test/data/WrappedFace_bspline_edges.brep @@ -0,0 +1,177 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 2 +1 + 1 0 0 0 + 0 1 0 0 + 0 0 1 50 +2 1 -1 0 +Curve2ds 11 +1 0 -100 1 0 +1 0 0 1 0 +1 1.5707963267948966 50 0 1 +1 0 0 1 0 +1 0 100 1 0 +8 0 100 +1 6.2831853071795862 50 0 1 +8 0 100 +1 0 50 0 1 +1 0 150 1 0 +2 0 0 1 0 -0 1 100 +1 0 50 1 0 +2 0 0 1 0 -0 1 100 +Curves 4 +1 0 100 0 0 0 1 +1 100 0 0 0 0 1 +2 0 0 150 0 0 1 1 0 -0 -0 1 0 100 +2 0 0 50 0 0 1 1 0 -0 -0 1 0 100 +Polygon3D 4 +2 1 +0.4000000008 +0 100 0 0 100 100 +0 100 +2 1 +0.4000000008 +100 0 0 100 0 100 +0 100 +14 1 +0.4000000008 +100 0 150 99.2708874098054 12.0536680255323 150 97.0941817426052 23.9315664287558 150 93.5016242685415 35.4604887042536 150 88.545602565321 46.4723172043768 150 82.2983865893656 56.8064746731156 150 74.8510748171101 66.3122658240795 150 66.3122658240795 74.8510748171101 150 56.8064746731156 82.2983865893656 150 46.4723172043769 88.545602565321 150 35.4604887042536 93.5016242685415 150 23.9315664287558 97.0941817426052 150 12.0536680255323 99.2708874098054 150 0 100 150 +0 0.12083048667653 0.241660973353061 0.362491460029591 0.483321946706122 0.604152433382652 0.724982920059183 0.845813406735713 0.966643893412244 1.08747438008877 1.2083048667653 1.32913535344184 1.44996584011837 1.5707963267949 +14 1 +0.4000000008 +100 0 50 99.2708874098054 12.0536680255323 50 97.0941817426052 23.9315664287558 50 93.5016242685415 35.4604887042536 50 88.545602565321 46.4723172043768 50 82.2983865893656 56.8064746731156 50 74.8510748171101 66.3122658240795 50 66.3122658240795 74.8510748171101 50 56.8064746731156 82.2983865893656 50 46.4723172043769 88.545602565321 50 35.4604887042536 93.5016242685415 50 23.9315664287558 97.0941817426052 50 12.0536680255323 99.2708874098054 50 0 100 50 +0 0.12083048667653 0.241660973353061 0.362491460029591 0.483321946706122 0.604152433382652 0.724982920059183 0.845813406735713 0.966643893412244 1.08747438008877 1.2083048667653 1.32913535344184 1.44996584011837 1.5707963267949 +PolygonOnTriangulations 10 +2 3 4 +p 0.4000000008 1 0 100 +2 1 3 +p 0.4000000008 1 0 100 +2 49 48 +p 0.4000000008 1 0 100 +2 1 2 +p 0.4000000008 1 0 100 +2 2 4 +p 0.4000000008 1 0 100 +2 96 1 +p 0.4000000008 1 0 100 +10 39 40 41 42 43 44 45 46 47 48 +p 1.2000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 +10 1 2 3 4 5 6 7 8 9 10 +p 1.2000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 +10 50 51 52 53 54 55 56 57 58 49 +p 1.2000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 +10 1 2 3 4 5 6 7 8 9 10 +p 1.2000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 +Surfaces 7 +1 0 0 0 1 0 -0 0 0 1 0 -1 0 +1 0 100 0 -0 1 0 0 0 1 1 0 -0 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 100 +1 100 0 0 1 0 -0 0 0 1 0 -1 0 +1 0 0 0 -0 1 0 0 0 1 1 0 -0 +1 0 0 100 0 0 1 1 0 -0 -0 1 0 +1 0 0 0 0 0 1 1 0 -0 -0 1 0 +Triangulations 7 +4 2 1 0.4000000008 +0 0 0 0 0 100 0 100 0 0 100 100 0 0 100 0 0 -100 100 -100 2 1 3 2 3 4 +4 2 1 0.4000000008 +0 100 0 100 100 0 0 100 100 100 100 100 0 0 0 100 100 0 100 100 4 2 1 4 1 3 +96 94 1 1.2000000008 +100 0 150 100 -2.44929359829471e-14 300 100 -2.44929359829471e-14 300 98.4807753012208 17.364817766693 300 93.9692620785908 34.2020143325669 300 86.6025403784439 50 300 76.6044443118978 64.2787609686539 300 64.2787609686539 76.6044443118978 300 50 86.6025403784439 300 34.2020143325669 93.9692620785908 300 17.364817766693 98.4807753012208 300 6.12323399573677e-15 100 300 -17.364817766693 98.4807753012208 300 -34.2020143325669 93.9692620785908 300 -50 86.6025403784439 300 -64.2787609686539 76.6044443118978 300 -76.6044443118978 64.278760968654 300 -86.6025403784438 50.0000000000001 300 -93.9692620785908 34.202014332567 300 -98.4807753012208 17.3648177666932 300 -100 1.45473230946492e-13 300 -98.4807753012208 -17.3648177666929 300 -93.9692620785909 -34.2020143325667 300 -86.602540378444 -49.9999999999998 300 -76.604444311898 -64.2787609686538 300 -64.2787609686541 -76.6044443118977 300 -50.0000000000002 -86.6025403784437 300 -34.2020143325671 -93.9692620785908 300 -17.3648177666933 -98.4807753012208 300 -2.84823227897248e-13 -100 300 17.3648177666927 -98.4807753012209 300 34.2020143325666 -93.969262078591 300 49.9999999999997 -86.602540378444 300 64.2787609686536 -76.604444311898 300 76.6044443118976 -64.2787609686542 300 86.6025403784437 -50.0000000000004 300 93.9692620785907 -34.2020143325673 300 98.4807753012207 -17.3648177666935 300 100 0 150 98.4807753012208 17.364817766693 150 93.9692620785908 34.2020143325669 150 86.6025403784439 50 150 76.6044443118978 64.2787609686539 150 64.2787609686539 76.6044443118978 150 50 86.6025403784439 150 34.2020143325669 93.9692620785908 150 17.364817766693 98.4807753012208 150 0 100 150 0 100 50 100 0 50 98.4807753012208 17.364817766693 50 93.9692620785908 34.2020143325669 50 86.6025403784439 50 50 76.6044443118978 64.2787609686539 50 64.2787609686539 76.6044443118978 50 50 86.6025403784439 50 34.2020143325669 93.9692620785908 50 17.364817766693 98.4807753012208 50 100 -2.44929359829471e-14 0 98.4807753012208 17.364817766693 0 93.9692620785908 34.2020143325669 0 86.6025403784439 50 0 76.6044443118978 64.2787609686539 0 64.2787609686539 76.6044443118978 0 50 86.6025403784439 0 34.2020143325669 93.9692620785908 0 17.364817766693 98.4807753012208 0 6.12323399573677e-15 100 0 -17.364817766693 98.4807753012208 0 -34.2020143325669 93.9692620785908 0 -50 86.6025403784439 0 -64.2787609686539 76.6044443118978 0 -76.6044443118978 64.278760968654 0 -86.6025403784438 50.0000000000001 0 -93.9692620785908 34.202014332567 0 -98.4807753012208 17.3648177666932 0 -100 1.45473230946492e-13 0 -98.4807753012208 -17.3648177666929 0 -93.9692620785909 -34.2020143325667 0 -86.602540378444 -49.9999999999998 0 -76.604444311898 -64.2787609686538 0 -64.2787609686541 -76.6044443118977 0 -50.0000000000002 -86.6025403784437 0 -34.2020143325671 -93.9692620785908 0 -17.3648177666933 -98.4807753012208 0 -2.84823227897248e-13 -100 0 17.3648177666927 -98.4807753012209 0 34.2020143325666 -93.969262078591 0 49.9999999999997 -86.602540378444 0 64.2787609686536 -76.604444311898 0 76.6044443118976 -64.2787609686542 0 86.6025403784437 -50.0000000000004 0 93.9692620785907 -34.2020143325673 0 98.4807753012207 -17.3648177666935 0 100 -2.44929359829471e-14 0 100 0 50 6.28318530717959 150 6.28318530717959 300 0 300 0.174532925199433 300 0.349065850398866 300 0.523598775598299 300 0.698131700797732 300 0.872664625997165 300 1.0471975511966 300 1.22173047639603 300 1.39626340159546 300 1.5707963267949 300 1.74532925199433 300 1.91986217719376 300 2.0943951023932 300 2.26892802759263 300 2.44346095279206 300 2.61799387799149 300 2.79252680319093 300 2.96705972839036 300 3.14159265358979 300 3.31612557878922 300 3.49065850398866 300 3.66519142918809 300 3.83972435438752 300 4.01425727958696 300 4.18879020478639 300 4.36332312998582 300 4.53785605518525 300 4.71238898038469 300 4.88692190558412 300 5.06145483078355 300 5.23598775598299 300 5.41052068118242 300 5.58505360638185 300 5.75958653158128 300 5.93411945678072 300 6.10865238198015 300 0 150 0.174532925199433 150 0.349065850398866 150 0.523598775598299 150 0.698131700797732 150 0.872664625997165 150 1.0471975511966 150 1.22173047639603 150 1.39626340159546 150 1.5707963267949 150 1.5707963267949 50 0 50 0.174532925199433 50 0.349065850398866 50 0.523598775598299 50 0.698131700797732 50 0.872664625997165 50 1.0471975511966 50 1.22173047639603 50 1.39626340159546 50 0 0 0.174532925199433 0 0.349065850398866 0 0.523598775598299 0 0.698131700797732 0 0.872664625997165 0 1.0471975511966 0 1.22173047639603 0 1.39626340159546 0 1.5707963267949 0 1.74532925199433 0 1.91986217719376 0 2.0943951023932 0 2.26892802759263 0 2.44346095279206 0 2.61799387799149 0 2.79252680319093 0 2.96705972839036 0 3.14159265358979 0 3.31612557878922 0 3.49065850398866 0 3.66519142918809 0 3.83972435438752 0 4.01425727958696 0 4.18879020478639 0 4.36332312998582 0 4.53785605518525 0 4.71238898038469 0 4.88692190558412 0 5.06145483078355 0 5.23598775598299 0 5.41052068118242 0 5.58505360638185 0 5.75958653158128 0 5.93411945678072 0 6.10865238198015 0 6.28318530717959 0 6.28318530717959 50 60 50 59 51 50 60 52 51 60 52 60 61 4 3 39 4 39 40 53 52 61 53 61 62 5 4 40 5 40 41 54 53 62 54 62 63 6 5 41 6 41 42 55 54 63 55 63 64 7 6 42 7 42 43 56 55 64 56 64 65 8 7 43 8 43 44 57 56 65 57 65 66 9 44 45 9 8 44 46 9 45 67 57 66 58 57 67 10 9 46 49 58 67 49 67 68 11 46 47 11 10 46 69 48 49 69 49 68 12 47 48 12 11 47 13 12 48 13 48 69 14 69 70 14 13 69 15 70 71 15 14 70 16 71 72 16 15 71 17 72 73 17 16 72 18 73 74 18 17 73 19 18 74 19 74 75 20 19 75 20 75 76 21 20 76 21 76 77 22 21 77 22 77 78 22 78 79 23 22 79 24 23 79 24 79 80 25 24 80 25 80 81 26 25 81 26 81 82 26 82 83 27 26 83 28 27 83 28 83 84 29 28 84 29 84 85 30 29 85 30 85 86 31 30 86 31 86 87 31 87 88 32 31 88 33 32 88 33 88 89 33 89 90 34 33 90 35 34 90 35 90 91 36 35 91 36 91 92 37 36 92 37 92 93 96 94 95 38 37 93 38 93 94 1 38 94 1 94 96 2 38 1 +4 2 1 0.4000000008 +100 0 0 100 0 100 100 100 0 100 100 100 0 0 100 0 0 -100 100 -100 2 1 3 2 3 4 +4 2 1 0.4000000008 +0 0 0 100 0 0 0 0 100 100 0 100 0 0 0 100 100 0 100 100 4 2 1 4 1 3 +11 9 1 1.2000000008 +100 0 150 98.4807753012208 17.364817766693 150 93.9692620785908 34.2020143325669 150 86.6025403784439 50 150 76.6044443118978 64.2787609686539 150 64.2787609686539 76.6044443118978 150 50 86.6025403784439 150 34.2020143325669 93.9692620785908 150 17.364817766693 98.4807753012208 150 0 100 150 0 0 150 100 0 98.4807753012208 17.364817766693 93.9692620785908 34.2020143325669 86.6025403784439 50 76.6044443118978 64.2787609686539 64.2787609686539 76.6044443118978 50 86.6025403784439 34.2020143325669 93.9692620785908 17.364817766693 98.4807753012208 0 100 0 0 9 10 11 2 11 1 8 9 11 3 11 2 4 11 3 7 8 11 5 11 4 6 7 11 6 11 5 +11 9 1 1.2000000008 +100 0 50 98.4807753012208 17.364817766693 50 93.9692620785908 34.2020143325669 50 86.6025403784439 50 50 76.6044443118978 64.2787609686539 50 64.2787609686539 76.6044443118978 50 50 86.6025403784439 50 34.2020143325669 93.9692620785908 50 17.364817766693 98.4807753012208 50 0 100 50 0 0 50 100 0 98.4807753012208 17.364817766693 93.9692620785908 34.2020143325669 86.6025403784439 50 76.6044443118978 64.2787609686539 64.2787609686539 76.6044443118978 50 86.6025403784439 34.2020143325669 93.9692620785908 17.364817766693 98.4807753012208 0 100 0 0 9 10 11 2 11 1 8 9 11 3 11 2 4 11 3 7 8 11 5 11 4 6 7 11 6 11 5 + +TShapes 9 +Ve +1.00000006123234e-07 +0 100 100 +0 0 + +0101101 +* +Ve +1.00000006123234e-07 +0 100 0 +0 0 + +0101101 +* +Ed + 1.00000006123234e-07 1 1 0 +1 1 0 0 100 +2 1 1 0 0 100 +2 2 2 0 0 100 +6 1 1 0 +6 2 2 0 +2 3 3 2 0 100 +6 3 3 2 +5 1 0 +0 + +0101000 +-9 0 +8 0 * +Ve +1.50001e-07 +100 0 100 +0 0 + +0101101 +* +Ve +1.50001e-07 +100 0 0 +0 0 + +0101101 +* +Ed + 1.00000024492936e-07 1 1 0 +1 2 0 0 100 +2 4 4 0 0 100 +2 5 5 0 0 100 +6 4 4 0 +6 5 5 0 +3 6 7C0 3 2 0 100 +6 6 3 2 +5 2 0 +0 + +0101000 +-6 0 +5 0 * +Ed + 1e-07 1 1 0 +1 3 0 0 1.5707963267949 +2 8 3 0 0 1.5707963267949 +2 9 6 1 0 1.5707963267949 +6 7 3 0 +6 8 6 0 +5 3 0 +0 + +0101000 ++6 1 -9 1 * +Ed + 1e-07 1 1 0 +1 4 0 0 1.5707963267949 +2 10 3 0 0 1.5707963267949 +2 11 7 1 0 1.5707963267949 +6 9 3 0 +6 10 7 0 +5 4 0 +0 + +0101000 ++5 1 -8 1 * +Co + +1100000 +-7 1 +4 1 +3 0 -2 0 * + ++1 0 \ No newline at end of file diff --git a/test/data/WrappedFace_bspline_vertices.brep b/test/data/WrappedFace_bspline_vertices.brep new file mode 100644 index 000000000..c652ecd38 --- /dev/null +++ b/test/data/WrappedFace_bspline_vertices.brep @@ -0,0 +1,60 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 0 +Triangulations 0 + +TShapes 7 +Ve +1e-07 +30.9016994374947 95.1056516295154 60 +0 0 + +0101101 +* +Ve +1e-07 +53.5826794978997 84.4327925502015 90 +0 0 + +0101101 +* +Ve +1e-07 +95.1056516295154 30.9016994374947 75 +0 0 + +0101101 +* +Ve +1e-07 +80.9016994374947 58.7785252292473 120 +0 0 + +0101101 +* +Ve +1e-07 +92.9776485888251 36.8124552684678 135 +0 0 + +0101101 +* +Ve +1e-07 +30.9016994374947 95.1056516295154 129 +0 0 + +0101101 +* +Co + +1100000 ++7 0 +6 0 +5 0 +4 0 +3 0 +2 0 * + ++1 0 \ No newline at end of file diff --git a/test/data/WrappedFace_sphere_face.brep b/test/data/WrappedFace_sphere_face.brep new file mode 100755 index 000000000..fec448673 --- /dev/null +++ b/test/data/WrappedFace_sphere_face.brep @@ -0,0 +1,89 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 1 +1 + 1 0 0 -25 + 0 1 0 0 + 0 0 1 0 +Curve2ds 4 +7 0 0 8 219 32 3.1415926535897931 1.318116071652818 3.1891213099488587 1.318116071652818 3.2366499663448849 1.3174494833264134 3.283840502917883 1.3161163110075904 3.3303548257263174 1.3141263873985736 3.3758846467371768 1.3114994674115223 3.4201823689259072 1.3082631680535997 3.463064495965531 1.3044498869759045 3.5451024940117137 1.2958072286237334 3.5843061322988525 1.2909946597522894 3.6218984793871414 1.2856901079814094 3.6578162828468521 1.2799292323119857 3.6920457213965392 1.2737477631992462 3.7246093437545147 1.2671800055047839 3.75555256992571 1.2602580385124882 3.8138606064339315 1.2458781937786021 3.8412737614369821 1.2384303782200674 3.8672334472503991 1.2306963236747492 3.8918115507606217 1.2227019751475154 3.9150857788521591 1.2144707144524247 3.9371346937574891 1.2060234595452157 3.9580350162802627 1.1973789159101054 4.0168910226981032 1.17117933017418 4.0517546108994793 1.1531049439456638 4.0830115225417103 1.1344581639227727 4.1111724191687244 1.1153365619647957 4.1366571473081422 1.0958151337767958 4.1598172185576914 1.0759534236665331 4.1809442334757989 1.0557991791805552 4.2190174218057646 1.0156213507107801 4.2360736023371768 0.99561336494835673 4.2516740356729201 0.97540287330935627 4.2659994988318886 0.95501757262246656 4.2791988878059612 0.93447979712628637 4.2913965356754638 0.91380795348557298 4.3026974952544137 0.89301739534788571 4.3335229671191993 0.83163458607718899 4.3508245879661445 0.79075119916035419 4.3657471617079864 0.74956544548740567 4.3787234456649458 0.70813850634613118 4.3900714888695802 0.66651572856017083 4.400029979802639 0.62473128452825222 4.4087840046276643 0.58281227803808933 4.4236922659335693 0.50137587782305948 4.4299748034643791 0.46187213161851814 4.4354457048505225 0.42228738235921703 4.4401938609332774 0.38263570586484263 4.4442875949010272 0.34292868825218292 4.447780006582839 0.30317622021793889 4.4507117173270245 0.2633869445400418 4.4576157339459836 0.14890944427676123 4.4602539472543867 0.074148304296457468 4.4612279224711529 -0.00066322955666464622 4.4606097123942163 -0.075483853137257029 4.4583886929503933 -0.15027424510896026 4.4544622265430007 -0.22499221660584112 4.4486282191598399 -0.29958848108010311 4.4369250993772287 -0.40654316335934532 4.4329216496968531 -0.43905764528812774 4.4284430709445246 -0.47152920851099012 4.4234486499040031 -0.5039510729812946 4.4178886880104642 -0.53631537877864588 4.4117023380737805 -0.56861286962130964 4.404813926294568 -0.60083235761564235 4.389919804360277 -0.66307926085728275 4.3820108374212134 -0.69311782447583636 4.373319908597594 -0.72306389209570199 4.3637509684781435 -0.75290369182835093 4.3531865630855577 -0.78262045993617591 4.3414815644048534 -0.81219354744094452 4.3284520831798456 -0.8415967000947322 4.3001718473390049 -0.8981679570487664 4.2851108206559729 -0.92536089414829803 4.2684730061100709 -0.95234460739857241 4.2500137492716021 -0.97908320855367492 4.2294275083841057 -1.0055314144151453 4.2063294655881691 -1.0316306005208844 4.1802169017730195 -1.0573025572614343 4.1364656067734833 -1.0942169225376597 4.1216948114604417 -1.1058797203276032 4.1060483397781127 -1.1174126479505162 4.0894504644143126 -1.1288026054403986 4.071817081733883 -1.1400345795056239 4.0530547545792421 -1.1510912445303951 4.0330604893159574 -1.1619524819253098 3.9910527585524269 -1.1829046130948553 3.969121920513524 -1.193008972867653 3.9458297650713234 -1.2028865932009865 3.9210682785644622 -1.2125131986866791 3.8947238933490667 -1.2218611607241101 3.86668058423286 -1.2308989539559518 3.8368271055429277 -1.2395908281888357 3.774307120468523 -1.2559437155329225 3.7417576738043863 -1.2636284553476571 3.7073384517625527 -1.2709151657304574 3.6709817421069602 -1.2777642398732496 3.6326481186861201 -1.2841328896729465 3.5923427335001179 -1.2899758909156844 3.5501385467876956 -1.2952478959044091 3.4636029923086014 -1.3044199217298862 3.4193793156700849 -1.3083576689796246 3.3736478742412146 -1.3116815687690178 3.3266101719600556 -1.3143560327162049 3.278540482331664 -1.3163508868656209 3.2297819383425121 -1.3176450231551371 3.1807088008447471 -1.3182287324338826 3.0842066816157758 -1.3179820157598279 3.0367742431330953 -1.3171952116246075 2.9897316235437756 -1.3157442870842715 2.9434128012235306 -1.3136403147764213 2.8981189220703527 -1.3109041085426725 2.8540890216308981 -1.307564032139453 2.81149815169023 -1.3036529401816563 2.7307105570501253 -1.2948979341360871 2.6924180962717741 -1.2900869908879655 2.6556921588860405 -1.2848050412201601 2.62058760272987 -1.2790860135365278 2.5871141319205293 -1.2729637724206739 2.5552483125006811 -1.2664707868283771 2.5249457786091556 -1.2596374255625258 2.4403527467387045 -1.2386470472992828 2.390206637561505 -1.2236299801575115 2.3452861969080914 -1.2076447550934972 2.3049734520118363 -1.190862792705957 2.2686825286382373 -1.1734164847898683 2.2358981528436743 -1.155411519389645 2.2061757480588908 -1.1369319699122957 2.1537876259299567 -1.1003403403166565 2.1307969708076842 -1.0822774760161311 2.1098525687595568 -1.0639134877887457 2.0906932187085658 -1.0452920432221049 2.0731021746796898 -1.0264480114881209 2.0568984440663258 -1.0074098238642586 2.0419287412504947 -0.98820098823095659 2.002064524380077 -0.93254159173909879 1.9799469356460122 -0.89571128789293653 1.9608517267979551 -0.85848007394633896 1.9442027991681243 -0.82093064766513635 1.9295797175318512 -0.78312341069204194 1.9166656051131667 -0.74510326298991458 1.9052149381818488 -0.70690528898314686 1.8861257435647465 -0.63500290105157375 1.8781896108382485 -0.60133363769516635 1.8710959103499576 -0.56756822949644992 1.8647451683623331 -0.53372118624935183 1.8590584296185 -0.49980430459196157 1.8539718014013316 -0.46582746172684131 1.8494333836375589 -0.43179905863243201 1.8383434854690126 -0.33809929249123988 1.8328350757269618 -0.27833668499869191 1.8286479412836343 -0.21847780260173977 1.8256435585572035 -0.15855161481169944 1.8237351585430588 -0.098582494983133984 1.8228786252625468 -0.038592237062601953 1.8230666341883606 0.021398018221502071 1.8252840508978476 0.12634158855163929 1.8268413513516033 0.17130474812742644 1.8290202320588733 0.2162457530765769 1.8318483639408214 0.26115468578822743 1.8353679958926676 0.30602065695819114 1.8396382265475535 0.35083128888889115 1.8447403258090465 0.39557185146545515 1.8553244424423214 0.47371252997231134 1.8603925985951262 0.50715147263850258 1.8660410433341426 0.5405326088661937 1.8723283000055062 0.57384681332510468 1.8793262039381204 0.60708327134540596 1.8871234218434125 0.64022897629126629 1.8958317267540097 0.67326781305587247 1.9129213674028811 0.73086215488403572 1.9208401773860204 0.75547356560545242 1.9294153342174738 0.78000426768976894 1.9387193720097002 0.80444391737989918 1.9488385877810401 0.82878019900115163 1.9598767187021684 0.85299827711218867 1.9719607258979133 0.87707986520084191 1.995216975664132 0.91894293111987024 2.0058619131433297 0.93679433321874861 2.0172520595010162 0.95454599031408172 2.0294649827445053 0.97218641536931016 2.0425906828789859 0.9897021638703174 2.0567345774110617 1.0070772619615249 2.0720213727804566 1.0242923662962062 2.1010336584244649 1.0540971225796323 2.1141940524356762 1.0667671912579313 2.1281437491697162 1.079323803863101 2.1429531400816586 1.0917554662818816 2.1587012616880372 1.1040489601357635 2.1754771599594824 1.1161889657334907 2.1933809907690289 1.1281575742817493 2.2268816543162151 1.1487657378247886 2.2419362466376858 1.1574895181439673 2.2577350227699498 1.1660961002298293 2.2743285796004784 1.1745755590748672 2.2917710616558651 1.1829168130794798 2.3101199924401845 1.191107452213656 2.3294355232708965 1.1991335640122511 2.3802933532110759 1.218748621553019 2.4131201645880083 1.2301124557981211 2.4484648486377409 1.2410185778385312 2.4865379558141285 1.2514061092088014 2.5275387681122083 1.2612048590372069 2.5716342164919297 1.2703345468889893 2.6188961562909014 1.2787064791426241 2.6944197078699692 1.2899932287676368 2.7203660020806208 1.2935436203994546 2.7470741618592456 1.2968709422220499 2.7745248636991846 1.299963921273843 2.8026876894832782 1.3028114388165548 2.8315196712958501 1.3054028449586115 2.8609647666371871 1.3077283202932279 2.9209451675178415 1.311830144829347 2.9514804749107011 1.3136064938026784 2.9824928618276374 1.3150996471024854 3.0139023828162408 1.316302153734398 3.0456180447602463 1.3172080982415011 3.0775406249837278 1.3178134135365576 3.1095666382229936 1.318116071652818 3.1415926535897927 1.318116071652818 + 0 9 0.098174770424679203 7 0.19481556006147327 7 0.2899463373601896 7 0.47723505516703246 7 0.65867100054241789 7 1.0102031447072282 7 1.3397645298617404 7 1.9576921270264513 7 2.2280354507860118 7 2.4814823168105962 7 2.7190887537086437 7 2.8304667710046085 7 2.9383642252600772 7 3.0428898840700627 7 3.1441491160422359 7 3.2422439970152781 7 3.3372734129579111 7 3.5213929063467635 7 3.6940049313988133 7 4.0176524783714047 7 4.3008440819724241 7 4.7964293882742082 7 5.1681183680005462 7 5.4468851027953011 7 5.6559601538913684 7 5.8127664422134275 7 5.9303711584549701 7 6.0185746956361248 7 6.1508800014078568 7 6.2170326542937238 7 6.2831853071795862 9 +2 0 0 1 0 -0 1 96.824583655185421 +7 0 0 8 219 32 3.1415926535897931 1.318116071652818 3.1891213099488587 1.318116071652818 3.2366499663448849 1.3174494833264134 3.283840502917883 1.3161163110075904 3.3303548257263174 1.3141263873985736 3.3758846467371768 1.3114994674115223 3.4201823689259072 1.3082631680535997 3.463064495965531 1.3044498869759045 3.5451024940117137 1.2958072286237334 3.5843061322988525 1.2909946597522894 3.6218984793871414 1.2856901079814094 3.6578162828468521 1.2799292323119857 3.6920457213965392 1.2737477631992462 3.7246093437545147 1.2671800055047839 3.75555256992571 1.2602580385124882 3.8138606064339315 1.2458781937786021 3.8412737614369821 1.2384303782200674 3.8672334472503991 1.2306963236747492 3.8918115507606217 1.2227019751475154 3.9150857788521591 1.2144707144524247 3.9371346937574891 1.2060234595452157 3.9580350162802627 1.1973789159101054 4.0168910226981032 1.17117933017418 4.0517546108994793 1.1531049439456638 4.0830115225417103 1.1344581639227727 4.1111724191687244 1.1153365619647957 4.1366571473081422 1.0958151337767958 4.1598172185576914 1.0759534236665331 4.1809442334757989 1.0557991791805552 4.2190174218057646 1.0156213507107801 4.2360736023371768 0.99561336494835673 4.2516740356729201 0.97540287330935627 4.2659994988318886 0.95501757262246656 4.2791988878059612 0.93447979712628637 4.2913965356754638 0.91380795348557298 4.3026974952544137 0.89301739534788571 4.3335229671191993 0.83163458607718899 4.3508245879661445 0.79075119916035419 4.3657471617079864 0.74956544548740567 4.3787234456649458 0.70813850634613118 4.3900714888695802 0.66651572856017083 4.400029979802639 0.62473128452825222 4.4087840046276643 0.58281227803808933 4.4236922659335693 0.50137587782305948 4.4299748034643791 0.46187213161851814 4.4354457048505225 0.42228738235921703 4.4401938609332774 0.38263570586484263 4.4442875949010272 0.34292868825218292 4.447780006582839 0.30317622021793889 4.4507117173270245 0.2633869445400418 4.4576157339459836 0.14890944427676123 4.4602539472543867 0.074148304296457468 4.4612279224711529 -0.00066322955666464622 4.4606097123942163 -0.075483853137257029 4.4583886929503933 -0.15027424510896026 4.4544622265430007 -0.22499221660584112 4.4486282191598399 -0.29958848108010311 4.4369250993772287 -0.40654316335934532 4.4329216496968531 -0.43905764528812774 4.4284430709445246 -0.47152920851099012 4.4234486499040031 -0.5039510729812946 4.4178886880104642 -0.53631537877864588 4.4117023380737805 -0.56861286962130964 4.404813926294568 -0.60083235761564235 4.389919804360277 -0.66307926085728275 4.3820108374212134 -0.69311782447583636 4.373319908597594 -0.72306389209570199 4.3637509684781435 -0.75290369182835093 4.3531865630855577 -0.78262045993617591 4.3414815644048534 -0.81219354744094452 4.3284520831798456 -0.8415967000947322 4.3001718473390049 -0.8981679570487664 4.2851108206559729 -0.92536089414829803 4.2684730061100709 -0.95234460739857241 4.2500137492716021 -0.97908320855367492 4.2294275083841057 -1.0055314144151453 4.2063294655881691 -1.0316306005208844 4.1802169017730195 -1.0573025572614343 4.1364656067734833 -1.0942169225376597 4.1216948114604417 -1.1058797203276032 4.1060483397781127 -1.1174126479505162 4.0894504644143126 -1.1288026054403986 4.071817081733883 -1.1400345795056239 4.0530547545792421 -1.1510912445303951 4.0330604893159574 -1.1619524819253098 3.9910527585524269 -1.1829046130948553 3.969121920513524 -1.193008972867653 3.9458297650713234 -1.2028865932009865 3.9210682785644622 -1.2125131986866791 3.8947238933490667 -1.2218611607241101 3.86668058423286 -1.2308989539559518 3.8368271055429277 -1.2395908281888357 3.774307120468523 -1.2559437155329225 3.7417576738043863 -1.2636284553476571 3.7073384517625527 -1.2709151657304574 3.6709817421069602 -1.2777642398732496 3.6326481186861201 -1.2841328896729465 3.5923427335001179 -1.2899758909156844 3.5501385467876956 -1.2952478959044091 3.4636029923086014 -1.3044199217298862 3.4193793156700849 -1.3083576689796246 3.3736478742412146 -1.3116815687690178 3.3266101719600556 -1.3143560327162049 3.278540482331664 -1.3163508868656209 3.2297819383425121 -1.3176450231551371 3.1807088008447471 -1.3182287324338826 3.0842066816157758 -1.3179820157598279 3.0367742431330953 -1.3171952116246075 2.9897316235437756 -1.3157442870842715 2.9434128012235306 -1.3136403147764213 2.8981189220703527 -1.3109041085426725 2.8540890216308981 -1.307564032139453 2.81149815169023 -1.3036529401816563 2.7307105570501253 -1.2948979341360871 2.6924180962717741 -1.2900869908879655 2.6556921588860405 -1.2848050412201601 2.62058760272987 -1.2790860135365278 2.5871141319205293 -1.2729637724206739 2.5552483125006811 -1.2664707868283771 2.5249457786091556 -1.2596374255625258 2.4403527467387045 -1.2386470472992828 2.390206637561505 -1.2236299801575115 2.3452861969080914 -1.2076447550934972 2.3049734520118363 -1.190862792705957 2.2686825286382373 -1.1734164847898683 2.2358981528436743 -1.155411519389645 2.2061757480588908 -1.1369319699122957 2.1537876259299567 -1.1003403403166565 2.1307969708076842 -1.0822774760161311 2.1098525687595568 -1.0639134877887457 2.0906932187085658 -1.0452920432221049 2.0731021746796898 -1.0264480114881209 2.0568984440663258 -1.0074098238642586 2.0419287412504947 -0.98820098823095659 2.002064524380077 -0.93254159173909879 1.9799469356460122 -0.89571128789293653 1.9608517267979551 -0.85848007394633896 1.9442027991681243 -0.82093064766513635 1.9295797175318512 -0.78312341069204194 1.9166656051131667 -0.74510326298991458 1.9052149381818488 -0.70690528898314686 1.8861257435647465 -0.63500290105157375 1.8781896108382485 -0.60133363769516635 1.8710959103499576 -0.56756822949644992 1.8647451683623331 -0.53372118624935183 1.8590584296185 -0.49980430459196157 1.8539718014013316 -0.46582746172684131 1.8494333836375589 -0.43179905863243201 1.8383434854690126 -0.33809929249123988 1.8328350757269618 -0.27833668499869191 1.8286479412836343 -0.21847780260173977 1.8256435585572035 -0.15855161481169944 1.8237351585430588 -0.098582494983133984 1.8228786252625468 -0.038592237062601953 1.8230666341883606 0.021398018221502071 1.8252840508978476 0.12634158855163929 1.8268413513516033 0.17130474812742644 1.8290202320588733 0.2162457530765769 1.8318483639408214 0.26115468578822743 1.8353679958926676 0.30602065695819114 1.8396382265475535 0.35083128888889115 1.8447403258090465 0.39557185146545515 1.8553244424423214 0.47371252997231134 1.8603925985951262 0.50715147263850258 1.8660410433341426 0.5405326088661937 1.8723283000055062 0.57384681332510468 1.8793262039381204 0.60708327134540596 1.8871234218434125 0.64022897629126629 1.8958317267540097 0.67326781305587247 1.9129213674028811 0.73086215488403572 1.9208401773860204 0.75547356560545242 1.9294153342174738 0.78000426768976894 1.9387193720097002 0.80444391737989918 1.9488385877810401 0.82878019900115163 1.9598767187021684 0.85299827711218867 1.9719607258979133 0.87707986520084191 1.995216975664132 0.91894293111987024 2.0058619131433297 0.93679433321874861 2.0172520595010162 0.95454599031408172 2.0294649827445053 0.97218641536931016 2.0425906828789859 0.9897021638703174 2.0567345774110617 1.0070772619615249 2.0720213727804566 1.0242923662962062 2.1010336584244649 1.0540971225796323 2.1141940524356762 1.0667671912579313 2.1281437491697162 1.079323803863101 2.1429531400816586 1.0917554662818816 2.1587012616880372 1.1040489601357635 2.1754771599594824 1.1161889657334907 2.1933809907690289 1.1281575742817493 2.2268816543162151 1.1487657378247886 2.2419362466376858 1.1574895181439673 2.2577350227699498 1.1660961002298293 2.2743285796004784 1.1745755590748672 2.2917710616558651 1.1829168130794798 2.3101199924401845 1.191107452213656 2.3294355232708965 1.1991335640122511 2.3802933532110759 1.218748621553019 2.4131201645880083 1.2301124557981211 2.4484648486377409 1.2410185778385312 2.4865379558141285 1.2514061092088014 2.5275387681122083 1.2612048590372069 2.5716342164919297 1.2703345468889893 2.6188961562909014 1.2787064791426241 2.6944197078699692 1.2899932287676368 2.7203660020806208 1.2935436203994546 2.7470741618592456 1.2968709422220499 2.7745248636991846 1.299963921273843 2.8026876894832782 1.3028114388165548 2.8315196712958501 1.3054028449586115 2.8609647666371871 1.3077283202932279 2.9209451675178415 1.311830144829347 2.9514804749107011 1.3136064938026784 2.9824928618276374 1.3150996471024854 3.0139023828162408 1.316302153734398 3.0456180447602463 1.3172080982415011 3.0775406249837278 1.3178134135365576 3.1095666382229936 1.318116071652818 3.1415926535897927 1.318116071652818 + 0 9 0.098174770424679203 7 0.19481556006147327 7 0.2899463373601896 7 0.47723505516703246 7 0.65867100054241789 7 1.0102031447072282 7 1.3397645298617404 7 1.9576921270264513 7 2.2280354507860118 7 2.4814823168105962 7 2.7190887537086437 7 2.8304667710046085 7 2.9383642252600772 7 3.0428898840700627 7 3.1441491160422359 7 3.2422439970152781 7 3.3372734129579111 7 3.5213929063467635 7 3.6940049313988133 7 4.0176524783714047 7 4.3008440819724241 7 4.7964293882742082 7 5.1681183680005462 7 5.4468851027953011 7 5.6559601538913684 7 5.8127664422134275 7 5.9303711584549701 7 6.0185746956361248 7 6.1508800014078568 7 6.2170326542937238 7 6.2831853071795862 9 +2 0 0 1 0 -0 1 96.824583655185421 +Curves 2 +8 0 2.1362830044410597 +2 -25 0 0 1 0 0 -0 0 1 0 -1 0 96.824583655185421 +8 2.1362830044410597 6.2831853071795862 +2 -25 0 0 1 0 0 -0 0 1 0 -1 0 96.824583655185421 +Polygon3D 2 +14 1 +0.774596670041483 +-25 0 96.8245836551854 -25 -15.839617200244 95.520189106543 -25 -31.2524603406654 91.6421503602744 -25 -45.8232541303722 85.2949551902299 -25 -59.1594109997371 76.6496189825115 -25 -70.9016087670672 65.9390769896102 -25 -80.7334720206937 53.4519082492278 -25 -88.3900963665694 39.5245602671122 -25 -93.6651858686676 24.5322839578372 -25 -96.4166113748581 8.87902308756872 -25 -96.5702399677396 -7.01346936780919 -25 -94.1219323617811 -22.7169947062611 -25 -89.1376544299886 -37.8084456533185 -25 -81.751699855179 -51.8812063351338 +0 0.164329461880082 0.328658923760163 0.492988385640245 0.657317847520326 0.821647309400408 0.985976771280489 1.15030623316057 1.31463569504065 1.47896515692073 1.64329461880081 1.8076240806809 1.97195354256098 2.13628300444106 +25 1 +0.774596670041483 +-25 -81.751699855179 -51.8812063351338 -25 -71.6144728297328 -65.1641564153137 -25 -59.3444702892758 -76.5064300963341 -25 -45.3071094456283 -85.5702391821004 -25 -29.9204418227311 -92.0856512228293 -25 -13.6427031188592 -95.8586284671895 -25 3.04133367003308 -96.7768065680384 -25 19.6347954434554 -94.812840944113 -25 35.6435065469453 -90.0252211385113 -25 50.5907059890537 -82.5565289212739 -25 64.0312460261966 -72.6291920121151 -25 75.5648492623805 -60.5388598831669 -25 84.8480294495048 -46.6455989192545 -25 91.6043209707437 -31.3631691556985 -25 95.6325123592052 -15.1467019468421 -25 96.8126386465856 1.52085445905681 -25 95.109554081602 18.143117769524 -25 90.5739788178304 34.2250545815082 -25 83.3409883991773 49.2877231432757 -25 73.6259910281423 62.8825368852427 -25 61.7183124192442 74.6046239325725 -25 47.9725792893206 84.104884735251 -25 32.7981580959739 91.1003887231635 -25 16.6469635527646 95.3828003597762 -25 0 96.8245836551854 +2.13628300444106 2.3090706003885 2.48185819633594 2.65464579228338 2.82743338823081 3.00022098417825 3.17300858012569 3.34579617607313 3.51858377202057 3.69137136796801 3.86415896391544 4.03694655986288 4.20973415581032 4.38252175175776 4.5553093477052 4.72809694365264 4.90088453960008 5.07367213554751 5.24645973149495 5.41924732744239 5.59203492338983 5.76482251933727 5.93761011528471 6.11039771123215 6.28318530717959 +PolygonOnTriangulations 2 +14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 +p 0.774596670041483 1 0 0.164329461880082 0.328658923760163 0.492988385640245 0.657317847520326 0.821647309400408 0.985976771280489 1.15030623316057 1.31463569504065 1.47896515692073 1.64329461880081 1.8076240806809 1.97195354256098 2.13628300444106 +25 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 1 +p 0.774596670041483 1 2.13628300444106 2.3090706003885 2.48185819633594 2.65464579228338 2.82743338823081 3.00022098417825 3.17300858012569 3.34579617607313 3.51858377202057 3.69137136796801 3.86415896391544 4.03694655986288 4.20973415581032 4.38252175175776 4.5553093477052 4.72809694365264 4.90088453960008 5.07367213554751 5.24645973149495 5.41924732744239 5.59203492338983 5.76482251933727 5.93761011528471 6.11039771123215 6.28318530717959 +Surfaces 2 +1 0 0 0 1 0 0 -0 0 1 0 -1 0 +4 0 0 0 0 0 1 1 0 -0 -0 1 0 100 +Triangulations 1 +37 35 1 0.774596670041483 +-25 0 96.8245836551854 -25 -15.839617200244 95.520189106543 -25 -31.2524603406654 91.6421503602744 -25 -45.8232541303722 85.2949551902299 -25 -59.1594109997371 76.6496189825115 -25 -70.9016087670672 65.9390769896102 -25 -80.7334720206937 53.4519082492278 -25 -88.3900963665694 39.5245602671122 -25 -93.6651858686676 24.5322839578372 -25 -96.4166113748581 8.87902308756872 -25 -96.5702399677396 -7.01346936780919 -25 -94.1219323617811 -22.7169947062611 -25 -89.1376544299886 -37.8084456533185 -25 -81.751699855179 -51.8812063351338 -25 -71.6144728297328 -65.1641564153137 -25 -59.3444702892758 -76.5064300963341 -25 -45.3071094456283 -85.5702391821004 -25 -29.9204418227311 -92.0856512228293 -25 -13.6427031188592 -95.8586284671895 -25 3.04133367003308 -96.7768065680384 -25 19.6347954434554 -94.812840944113 -25 35.6435065469453 -90.0252211385113 -25 50.5907059890537 -82.5565289212739 -25 64.0312460261966 -72.6291920121151 -25 75.5648492623805 -60.5388598831669 -25 84.8480294495048 -46.6455989192545 -25 91.6043209707437 -31.3631691556985 -25 95.6325123592052 -15.1467019468421 -25 96.8126386465856 1.52085445905681 -25 95.109554081602 18.143117769524 -25 90.5739788178304 34.2250545815082 -25 83.3409883991773 49.2877231432757 -25 73.6259910281423 62.8825368852427 -25 61.7183124192442 74.6046239325725 -25 47.9725792893206 84.104884735251 -25 32.7981580959739 91.1003887231635 -25 16.6469635527646 95.3828003597762 96.8245836551854 0 95.520189106543 15.839617200244 91.6421503602744 31.2524603406654 85.2949551902299 45.8232541303722 76.6496189825115 59.1594109997371 65.9390769896102 70.9016087670672 53.4519082492278 80.7334720206937 39.5245602671122 88.3900963665694 24.5322839578372 93.6651858686675 8.87902308756873 96.4166113748581 -7.01346936780919 96.5702399677396 -22.7169947062611 94.1219323617811 -37.8084456533185 89.1376544299886 -51.8812063351338 81.751699855179 -65.1641564153137 71.6144728297328 -76.5064300963341 59.3444702892758 -85.5702391821004 45.3071094456283 -92.0856512228293 29.9204418227311 -95.8586284671895 13.6427031188592 -96.7768065680384 -3.04133367003308 -94.812840944113 -19.6347954434554 -90.0252211385113 -35.6435065469453 -82.5565289212739 -50.5907059890537 -72.6291920121151 -64.0312460261966 -60.5388598831669 -75.5648492623805 -46.6455989192545 -84.8480294495048 -31.3631691556985 -91.6043209707437 -15.1467019468421 -95.6325123592052 1.52085445905681 -96.8126386465856 18.143117769524 -95.109554081602 34.2250545815082 -90.5739788178304 49.2877231432757 -83.3409883991773 62.8825368852426 -73.6259910281423 74.6046239325725 -61.7183124192442 84.104884735251 -47.9725792893206 91.1003887231635 -32.7981580959739 95.3828003597762 -16.6469635527646 23 24 25 22 23 25 27 25 26 27 22 25 21 22 27 20 21 27 19 20 27 30 28 29 16 17 18 33 18 19 33 27 28 33 30 31 33 31 32 33 19 27 33 28 30 15 16 18 15 18 33 34 15 33 13 14 15 36 34 35 37 15 34 37 34 36 10 11 12 10 12 13 9 13 15 9 10 13 9 15 37 3 1 2 4 37 1 4 1 3 4 9 37 6 9 4 6 4 5 6 7 8 6 8 9 + +TShapes 6 +Ve +1.00000023715183e-07 +-25 0 96.8245836551854 +0 0 + +0101101 +* +Ve +1e-07 +-25 -81.751699855179 -51.8812063351338 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 1 0 0 2.13628300444106 +2 1 2 0 0 2.13628300444106 +2 2 1 1 0 2.13628300444106 +5 1 0 +6 1 1 0 +0 + +0101000 ++6 0 -5 0 * +Ed + 1e-07 1 1 0 +1 2 0 2.13628300444106 6.28318530717959 +2 3 2 0 2.13628300444106 6.28318530717959 +2 4 1 1 2.13628300444106 6.28318530717959 +5 2 0 +6 2 1 0 +0 + +0101000 ++5 0 -6 0 * +Wi + +0101100 ++4 0 +3 0 * +Fa +0 1e-07 1 1 +2 1 +0101000 ++2 0 * + ++1 0 \ No newline at end of file diff --git a/test/data/WrappedFace_sphere_vertices.brep b/test/data/WrappedFace_sphere_vertices.brep new file mode 100755 index 000000000..8bda63831 --- /dev/null +++ b/test/data/WrappedFace_sphere_vertices.brep @@ -0,0 +1,53 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 0 +Triangulations 0 + +TShapes 6 +Ve +1e-07 +-98.2778854144335 12.9942378002121 13.1379991802029 +0 0 + +0101101 +* +Ve +1e-07 +-62.4980389121083 48.4176397451153 61.2350168910961 +0 0 + +0101101 +* +Ve +1e-07 +-91.4519040662823 -38.2576611431453 -13.1491675214732 +0 0 + +0101101 +* +Ve +1e-07 +-78.3669668760696 -10.4350950638792 61.2350168910961 +0 0 + +0101101 +* +Ve +1e-07 +-85.1638454334068 35.5349860871206 -38.5277068456318 +0 0 + +0101101 +* +Co + +1100000 ++6 0 +5 0 +4 0 +3 0 +2 0 * + ++1 0 diff --git a/test/test_WrappedFace.py b/test/test_WrappedFace.py new file mode 100755 index 000000000..bdb203212 --- /dev/null +++ b/test/test_WrappedFace.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import sys +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +import math +from inspect import getfile +from os.path import abspath, dirname, join +import SALOMEDS + +geompy = geomBuilder.New() + +data_dir = abspath(join(dirname(getfile(lambda: None)), 'data')) + +myInitFace = geompy.ImportBREP(join(data_dir, 'WrappedFace_sphere_face.brep')) +listE = geompy.ExtractShapes(myInitFace, geompy.ShapeType["EDGE"], True) + +myVertices = geompy.ImportBREP(join(data_dir, 'WrappedFace_sphere_vertices.brep')) +lVertices = geompy.SubShapeAll(myVertices, geompy.ShapeType["VERTEX"]) + +wrappedFaceSphere = geompy.MakeWrappedFace(listE, lVertices, 0.01) +wrappedAreaSphere = geompy.BasicProperties(wrappedFaceSphere)[1] + +eps = 1e-5 +expectedArea = 47123.88980388897 +print(wrappedAreaSphere) +assert(math.fabs(expectedArea - wrappedAreaSphere) < eps) + +########################################################################### + +myEdges = geompy.ImportBREP(join(data_dir, 'WrappedFace_bspline_edges.brep')) +listE2 = geompy.ExtractShapes(myEdges, geompy.ShapeType["EDGE"], True) + +myVertices2 = geompy.ImportBREP(join(data_dir, 'WrappedFace_bspline_vertices.brep')) +lVertices2 = geompy.SubShapeAll(myVertices2, geompy.ShapeType["VERTEX"]) + +wrappedFace = geompy.MakeWrappedFace(listE2, lVertices2, 0.01) +wrappedArea = geompy.BasicProperties(wrappedFace)[1] + +expectedArea = 15702.653817260858 +print(wrappedArea) +assert(math.fabs(expectedArea - wrappedArea) < eps) + + diff --git a/test/tests.set b/test/tests.set index 5e264b447..aa00e8dfe 100644 --- a/test/tests.set +++ b/test/tests.set @@ -31,5 +31,6 @@ IF(${OpenCASCADE_VERSION}.${OpenCASCADE_SP_VERSION} VERSION_GREATER "7.5.3.3") test_proximity_edge_edge.py test_proximity_face_face.py test_boolean_fuzzy.py + test_WrappedFace.py ) ENDIF()