Implement the hull transformation API.
Implement the test DRAW method to call the API.
class BRepBuilderAPI_Transform;
class BRepBuilderAPI_NurbsConvert;
class BRepBuilderAPI_GTransform;
+class BRepBuilderAPI_HullTransform;
class BRepBuilderAPI_Copy;
class BRepBuilderAPI_Collect;
friend class BRepBuilderAPI_Transform;
friend class BRepBuilderAPI_NurbsConvert;
friend class BRepBuilderAPI_GTransform;
+friend class BRepBuilderAPI_HullTransform;
friend class BRepBuilderAPI_Copy;
friend class BRepBuilderAPI_Collect;
--- /dev/null
+// Created on: 2023-07-07
+// Created by: Irina KOCHETKOVA
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <BRepBuilderAPI_HullTransform.hxx>
+#include <BRepBuilderAPI_NurbsConvert.hxx>
+#include <BRepTools_HullTransformation.hxx>
+
+//=======================================================================
+//function : BRepBuilderAPI_HullTransform
+//purpose :
+//=======================================================================
+BRepBuilderAPI_HullTransform::BRepBuilderAPI_HullTransform ()
+{
+ myModification = new BRepTools_HullTransformation();
+}
+
+//=======================================================================
+//function : InitLinear
+//purpose :
+//=======================================================================
+void BRepBuilderAPI_HullTransform::InitLinear(const double theCM,
+ const double theCBNew,
+ const double theCBOld,
+ const double theLPP)
+{
+ Handle(BRepTools_HullTransformation) aHullTrsf = Handle(BRepTools_HullTransformation)::DownCast(myModification);
+ aHullTrsf->InitLinear(theCM, theCBNew, theCBOld, theLPP);
+}
+
+//=======================================================================
+//function : InitQuad
+//purpose :
+//=======================================================================
+void BRepBuilderAPI_HullTransform::InitQuad(const double theAftlim,
+ const double theCCA,
+ const double theCCF,
+ const double theForelim,
+ const double theAftCoef,
+ const double theForeCoef,
+ const bool theModifyAftZone,
+ const bool theModifyForeZone)
+{
+ Handle(BRepTools_HullTransformation) aHullTrsf = Handle(BRepTools_HullTransformation)::DownCast(myModification);
+ aHullTrsf->InitQuad(theAftlim, theCCA, theCCF, theForelim, theAftCoef, theForeCoef, theModifyAftZone, theModifyForeZone);
+}
+
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+
+void BRepBuilderAPI_HullTransform::Perform(const TopoDS_Shape& S,
+ const Standard_Boolean Copy)
+{
+ BRepBuilderAPI_NurbsConvert nc;
+ nc.Perform(S, Copy);
+ myHist.Add(S,nc);
+ TopoDS_Shape Slocal = nc.Shape();
+ Handle(BRepTools_HullTransformation) theModif =
+ Handle(BRepTools_HullTransformation)::DownCast(myModification);
+ DoModif(Slocal,myModification);
+}
+
+
+//=======================================================================
+//function : Modified
+//purpose :
+//=======================================================================
+
+const TopTools_ListOfShape& BRepBuilderAPI_HullTransform::Modified
+ (const TopoDS_Shape& F)
+{
+ myGenerated.Clear();
+ const TopTools_DataMapOfShapeListOfShape& M = myHist.Modification();
+ if (M.IsBound(F)) {
+ TopTools_ListOfShape Li;
+ TopTools_ListIteratorOfListOfShape itL(M(F));
+ for (;itL.More();itL.Next())
+ Li.Assign(BRepBuilderAPI_ModifyShape::Modified(itL.Value()));
+ }
+ return myGenerated;
+}
+
+
+//=======================================================================
+//function : ModifiedShape
+//purpose :
+//=======================================================================
+
+TopoDS_Shape BRepBuilderAPI_HullTransform::ModifiedShape
+ (const TopoDS_Shape& S) const
+{
+ const TopTools_DataMapOfShapeListOfShape &aMapModif = myHist.Modification();
+ TopoDS_Shape aShape = S;
+
+ if (aMapModif.IsBound(S)) {
+ const TopTools_ListOfShape &aListModShape = aMapModif(S);
+ Standard_Integer aNbShapes = aListModShape.Extent();
+
+ if (aNbShapes > 0)
+ aShape = aListModShape.First();
+ }
+
+ return BRepBuilderAPI_ModifyShape::ModifiedShape(aShape);
+}
+
--- /dev/null
+// Created on: 2023-07-07
+// Created by: Irina KOCHETKOVA
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepBuilderAPI_HullTransform_HeaderFile
+#define _BRepBuilderAPI_HullTransform_HeaderFile
+
+#include <BRepBuilderAPI_Collect.hxx>
+#include <BRepBuilderAPI_ModifyShape.hxx>
+
+//! Custom geometric transformation on a shape.
+class BRepBuilderAPI_HullTransform : public BRepBuilderAPI_ModifyShape
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+
+ //! Constructs a framework for applying the geometric
+ //! transformation to a shape.
+ //! Use InitLinear/InitQuad to define transformation parameters.
+ //! After that use Perform to define the shape to transform and do the modification.
+ Standard_EXPORT BRepBuilderAPI_HullTransform();
+
+ //! Initialize parameters for linear transformation function.
+ Standard_EXPORT void InitLinear(const double theCM,
+ const double theCBNew,
+ const double theCBOld,
+ const double theLPP);
+
+ //! Initialize parameters for quad transformation function.
+ Standard_EXPORT void InitQuad(const double theAftlim,
+ const double theCCA,
+ const double theCCF,
+ const double theForelim,
+ const double theAftCoef,
+ const double theForeCoef,
+ const bool theModifyAftZone,
+ const bool theModifyForeZone);
+
+ //! Applies the geometric transformation defined at the
+ //! time of construction of this framework to the shape S.
+ //! The transformation will applied to a duplicate of S.
+ //! Use the function Shape to access the result.
+ //! Note: this framework can be reused to apply the same
+ //! geometric transformation to other shapes: just specify
+ //! them by calling the function Perform again.
+ Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_True);
+
+ //! Returns the list of shapes modified from the shape
+ //! <S>.
+ Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
+
+ //! Returns the modified shape corresponding to <S>.
+ Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
+
+private:
+
+ BRepBuilderAPI_Collect myHist;
+};
+#endif // _BRepBuilderAPI_HullTransform_HeaderFile
BRepBuilderAPI_FindPlane.hxx
BRepBuilderAPI_GTransform.cxx
BRepBuilderAPI_GTransform.hxx
+BRepBuilderAPI_HullTransform.cxx
+BRepBuilderAPI_HullTransform.hxx
BRepBuilderAPI_MakeEdge.cxx
BRepBuilderAPI_MakeEdge.hxx
BRepBuilderAPI_MakeEdge2d.cxx
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_GTransform.hxx>
+#include <BRepBuilderAPI_HullTransform.hxx>
#include <BRepBuilderAPI_NurbsConvert.hxx>
#include <gp_Ax2.hxx>
#include <gp_Mat.hxx>
#include <Standard_Dump.hxx>
+#include <ShapeFix_Shape.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPTest_Objects.hxx>
+#include <BOPAlgo_Splitter.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <list>
+
#include <stdio.h>
Standard_IMPORT Draw_Viewer dout;
return 0;
}
+///=======================================================================
+// hulltrsf
+//=======================================================================
+static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n < 3)
+ {
+ di << "Usage result hull [-l cm cb_new cb_old lpp] or [-q incrX aftlim cca ccf forelim aft_coef fore_coef modify_aft_zone modify_fore_zone] ";
+ di << "[-s XCoord_section1 ... XCoord_sectionN]\n";
+ return 1;
+ }
+
+ TopoDS_Shape S = DBRep::Get(a[2]);
+ if (S.IsNull()) {
+ di << a[2] << " is not a valid shape\n";
+ return 0;
+ }
+ BRepBuilderAPI_HullTransform aHTrsf;
+ std::list<double> aSections;
+ int i = 3;
+ while (i < n)
+ {
+ if (a[i][0] == '-' && a[i][1] == 'l' && n > i + 4)
+ {
+ // init linear transformation parameters
+ double _cm = Atof(a[i + 1]);
+ double _cb_new = Atof(a[i + 2]);
+ double _cb_old = Atof(a[i + 3]);
+ double _lpp = Atof(a[i + 4]);
+ aHTrsf.InitLinear(_cm, _cb_old, _cb_new, _lpp);
+ i += 4;
+ }
+ if (a[i][0] == '-' && a[i][1] == 'q' && n > i+8)
+ {
+ // init quad transformation parameters
+ double _aftlim = Atof(a[i + 1]);
+ double _cca = Atof(a[i + 2]);
+ double _ccf = Atof(a[i + 3]);
+ double _forelim = Atof(a[i + 4]);
+ double _aft_coef = Atof(a[i + 5]);
+ double _fore_coef = Atof(a[i + 6]);
+ bool _modify_aft_zone = (Draw::Atoi(a[i + 7]) == 1);
+ bool _modify_fore_zone = (Draw::Atoi(a[i + 8]) == 1);
+ aHTrsf.InitQuad(_aftlim, _cca, _ccf, _forelim, _aft_coef, _fore_coef, _modify_aft_zone, _modify_fore_zone);
+ i += 8;
+ }
+ if (a[i][0] == '-' && a[i][1] == 's')
+ {
+ i++;
+ while (i < n)
+ {
+ aSections.push_back(Atof(a[i]));
+ i++;
+ }
+ }
+ i++;
+ }
+ if (aSections.size() > 0)
+ {
+ // Add splitting edges
+ TopTools_ListOfShape aLSObjects;
+ aLSObjects.Append(S);
+ TopTools_ListOfShape aLSTools;
+ for each (double aPlaneX in aSections)
+ {
+ Handle(Geom_Plane) aPlane = new Geom_Plane(gp_Pnt(aPlaneX, 0, 0), gp_Dir(1, 0, 0));
+ TopoDS_Face aFace =
+ BRepBuilderAPI_MakeFace(aPlane, -1000, 1000, -1000, 1000, Precision::Confusion());
+ aLSTools.Append(aFace);
+ }
+
+ BOPAlgo_Splitter pSplitter;
+ pSplitter.Clear();
+ pSplitter.SetArguments(aLSObjects);
+ pSplitter.SetTools(aLSTools);
+ pSplitter.Perform();
+ S = pSplitter.Shape();
+ }
+
+ // Perform transformation
+ aHTrsf.Perform(S, true);
+ if (aHTrsf.IsDone()) {
+ // Fix shape
+ Handle(ShapeFix_Shape) aShapeFixTool = new ShapeFix_Shape;
+ aShapeFixTool->Init(aHTrsf.Shape());
+ aShapeFixTool->Perform();
+ DBRep::Set(a[1], aShapeFixTool->Shape());
+ }
+ else {
+ return 1;
+ }
+
+ return 0;
+}
+
void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
"deform newname name CoeffX CoeffY CoeffZ",
__FILE__,
deform,g);
+
+ theCommands.Add("hulltrsf",
+ "hulltrsf result hull "
+ "[-l cm cb_new cb_old lpp] for linear or "
+ "[-q incrX aftlim cca ccf forelim aft_coef fore_coef modify_aft_zone modify_fore_zone] for quad "
+ "[-s XCoord_section1 ... XCoord_sectionN] to add sections\n",
+ __FILE__,
+ hulltrsf, g);
theCommands.Add("findplane",
"findplane name planename ",
class BRepTools_TrsfModification;
class BRepTools_NurbsConvertModification;
class BRepTools_GTrsfModification;
+class BRepTools_HullTransformation;
class BRepTools_Substitution;
class BRepTools_Quilt;
class BRepTools_ShapeSet;
friend class BRepTools_TrsfModification;
friend class BRepTools_NurbsConvertModification;
friend class BRepTools_GTrsfModification;
+friend class BRepTools_HullTransformation;
friend class BRepTools_Substitution;
friend class BRepTools_Quilt;
friend class BRepTools_ShapeSet;
--- /dev/null
+// Created on: 2023-07-07
+// Created by: Irina KOCHETKOVA
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <BRep_Tool.hxx>
+#include <BRepTools_HullTransformation.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <TopLoc_Location.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(BRepTools_HullTransformation,BRepTools_Modification)
+
+//=======================================================================
+//function : BRepTools_HullTransformation
+//purpose :
+//=======================================================================
+BRepTools_HullTransformation::BRepTools_HullTransformation()
+{
+}
+
+//=======================================================================
+//function : InitLinear
+//purpose :
+//=======================================================================
+void BRepTools_HullTransformation::InitLinear(const double theCM,
+ const double theCBNew,
+ const double theCBOld,
+ const double theLPP)
+{
+ myLinear = true;
+ _cm = theCM;
+ _cb_new = theCBNew;
+ _cb_old = theCBOld;
+ _lpp = theLPP;
+ myScale = (_cm - _cb_new) / (_cm - _cb_old);
+}
+
+//=======================================================================
+//function : InitQuad
+//purpose :
+//=======================================================================
+void BRepTools_HullTransformation::InitQuad(const double theAftlim,
+ const double theCCA,
+ const double theCCF,
+ const double theForelim,
+ const double theAftCoef,
+ const double theForeCoef,
+ const bool theModifyAftZone,
+ const bool theModifyForeZone)
+{
+ myLinear = false;
+
+ _aftlim = theAftlim;
+ _cca = theCCA;
+ _ccf = theCCF;
+ _forelim = theForelim;
+ _aft_coef = theAftCoef;
+ _fore_coef = theForeCoef;
+ _modify_aft_zone = theModifyAftZone;
+ _modify_fore_zone = theModifyForeZone;
+
+ myScale = 1;
+}
+
+
+//=======================================================================
+//function : NewPointFrom
+//purpose :
+//=======================================================================
+gp_Pnt BRepTools_HullTransformation::NewPointFrom(const gp_Pnt& theOldPoint)
+{
+ Standard_Real oldX = theOldPoint.X();
+ Standard_Real newX = _lpp / 2;
+ Standard_Real incrX = 0;
+
+ if (myLinear)
+ {
+ if (oldX <= _lpp / 2)
+ {
+ newX = oldX * (_cm - _cb_new) / (_cm - _cb_old);
+ if (newX > _lpp / 2)
+ newX = _lpp / 2;
+ }
+ else if (oldX > _lpp / 2)
+ {
+ newX = oldX * (_cm - _cb_new) / (_cm - _cb_old) +
+ _lpp * (_cb_new - _cb_old) / (_cm - _cb_old);
+ if (newX < _lpp / 2) {
+ newX = _lpp / 2;
+ }
+ }
+ }
+ else
+ {
+ if (_modify_aft_zone && // Aft
+ oldX >= _aftlim && oldX <= _cca)
+ {
+ incrX = _aft_coef * (oldX - _aftlim)*(oldX - _cca);
+ }
+
+ else if (_modify_fore_zone && // Fore
+ oldX >= _ccf && oldX <= _forelim)
+ {
+ incrX = _fore_coef * (oldX - _ccf)*(oldX - _forelim);
+ }
+ newX = oldX + incrX;
+ }
+
+ return gp_Pnt(newX, theOldPoint.Y(), theOldPoint.Z());
+}
+
+//=======================================================================
+//function : NewSurface
+//purpose :
+//=======================================================================
+Standard_Boolean BRepTools_HullTransformation::NewSurface(const TopoDS_Face& F,
+ Handle(Geom_Surface)& S,
+ TopLoc_Location& L,
+ Standard_Real& Tol,
+ Standard_Boolean& RevWires,
+ Standard_Boolean& RevFace)
+{
+ S = Handle(Geom_Surface)::DownCast(BRep_Tool::Surface(F,L)->Copy());
+
+ Tol = BRep_Tool::Tolerance(F);
+ Tol *= myScale;
+ RevWires = Standard_False;
+ RevFace = (myScale > 0);
+ S = Handle(Geom_Surface)::DownCast(S->Transformed(L.Transformation()));
+
+ Handle(Standard_Type) TheTypeS = S->DynamicType();
+ if (TheTypeS == STANDARD_TYPE(Geom_BSplineSurface)) {
+ Handle(Geom_BSplineSurface) S2 = Handle(Geom_BSplineSurface)::DownCast(S);
+ for(Standard_Integer i = 1; i <= S2->NbUPoles(); i++)
+ for(Standard_Integer j = 1; j <= S2->NbVPoles(); j++) {
+ gp_Pnt P = NewPointFrom(S2->Pole(i, j));
+ S2->SetPole(i, j, P);
+ }
+ }
+ else
+ if (TheTypeS == STANDARD_TYPE(Geom_BezierSurface)) {
+ Handle(Geom_BezierSurface) S2 = Handle(Geom_BezierSurface)::DownCast(S);
+ for(Standard_Integer i = 1; i <= S2->NbUPoles(); i++)
+ for(Standard_Integer j = 1; j <= S2->NbVPoles(); j++) {
+ gp_Pnt P = NewPointFrom(S2->Pole(i, j));
+ S2->SetPole(i, j, P);
+ }
+ }
+ else{
+ throw Standard_NoSuchObject("BRepTools_HullTransformation : Pb no BSpline/Bezier Type Surface");
+ }
+
+ L.Identity();
+ return Standard_True;
+}
+
+//=======================================================================
+//function : NewCurve
+//purpose :
+//=======================================================================
+Standard_Boolean BRepTools_HullTransformation::NewCurve(const TopoDS_Edge& E,
+ Handle(Geom_Curve)& C,
+ TopLoc_Location& L,
+ Standard_Real& Tol)
+{
+ Standard_Real f,l;
+ Tol = BRep_Tool::Tolerance(E) * myScale;
+ C = BRep_Tool::Curve(E, L, f, l);
+
+ if (!C.IsNull()) {
+ C = Handle(Geom_Curve)::DownCast(C->Copy()->Transformed(L.Transformation()));
+ Handle(Standard_Type) TheTypeC = C->DynamicType();
+ if (TheTypeC == STANDARD_TYPE(Geom_BSplineCurve)) {
+ Handle(Geom_BSplineCurve) C2 = Handle(Geom_BSplineCurve)::DownCast(C);
+ for(Standard_Integer i = 1; i <= C2->NbPoles(); i++) {
+ gp_Pnt P = NewPointFrom(C2->Pole(i));
+ C2->SetPole(i, P);
+ }
+ }
+ else
+ if(TheTypeC == STANDARD_TYPE(Geom_BezierCurve)) {
+ Handle(Geom_BezierCurve) C2 = Handle(Geom_BezierCurve)::DownCast(C);
+ for(Standard_Integer i = 1; i <= C2->NbPoles(); i++) {
+ gp_Pnt P = NewPointFrom(C2->Pole(i));
+ C2->SetPole(i, P);
+ }
+ }
+ else {
+ throw Standard_NoSuchObject("BRepTools_HullTransformation : Pb no BSpline/Bezier Type Curve");
+ }
+ }
+ L.Identity();
+ return Standard_True;
+}
+
+//=======================================================================
+//function : NewPoint
+//purpose :
+//=======================================================================
+Standard_Boolean BRepTools_HullTransformation::NewPoint(const TopoDS_Vertex& V,
+ gp_Pnt& P,
+ Standard_Real& Tol)
+{
+ gp_Pnt Pnt = BRep_Tool::Pnt(V);
+ Tol = BRep_Tool::Tolerance(V);
+ Tol *= myScale;
+ P = NewPointFrom(Pnt);
+
+ return Standard_True;
+}
+
+//=======================================================================
+//function : NewCurve2d
+//purpose :
+//=======================================================================
+Standard_Boolean BRepTools_HullTransformation::NewCurve2d(const TopoDS_Edge&,
+ const TopoDS_Face&,
+ const TopoDS_Edge&,
+ const TopoDS_Face&,
+ Handle(Geom2d_Curve)&,
+ Standard_Real& )
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewParameter
+//purpose :
+//=======================================================================
+Standard_Boolean BRepTools_HullTransformation::NewParameter(const TopoDS_Vertex&,
+ const TopoDS_Edge&,
+ Standard_Real&,
+ Standard_Real&)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : Continuity
+//purpose :
+//=======================================================================
+GeomAbs_Shape BRepTools_HullTransformation::Continuity(const TopoDS_Edge& E,
+ const TopoDS_Face& F1,
+ const TopoDS_Face& F2,
+ const TopoDS_Edge&,
+ const TopoDS_Face&,
+ const TopoDS_Face&)
+{
+ return BRep_Tool::Continuity(E,F1,F2);
+}
--- /dev/null
+// Created on: 2023-07-07
+// Created by: Irina KOCHETKOVA
+// Copyright (c) 2023 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepTools_HullTransformation_HeaderFile
+#define _BRepTools_HullTransformation_HeaderFile
+
+#include <BRepTools_Modification.hxx>
+//class gp_GTrsf;
+//class TopoDS_Face;
+//class Geom_Surface;
+//class TopLoc_Location;
+//class TopoDS_Edge;
+//class Geom_Curve;
+//class TopoDS_Vertex;
+//class gp_Pnt;
+//class Geom2d_Curve;
+
+
+class BRepTools_HullTransformation;
+DEFINE_STANDARD_HANDLE(BRepTools_HullTransformation, BRepTools_Modification)
+
+//! Defines a modification of the geometry by a custom function.
+//! All methods return True and transform the geometry.
+class BRepTools_HullTransformation : public BRepTools_Modification
+{
+
+public:
+
+
+ Standard_EXPORT BRepTools_HullTransformation();
+
+ //! Calculate a new point's position.
+ Standard_EXPORT gp_Pnt NewPointFrom(const gp_Pnt& theOldP);
+
+ //! Returns Standard_True if the face <F> has been
+ //! modified. In this case, <S> is the new geometric
+ //! support of the face, <L> the new location,<Tol>
+ //! the new tolerance.<RevWires> has to be set to
+ //! Standard_True when the modification reverses the
+ //! normal of the surface.(the wires have to be
+ //! reversed). <RevFace> has to be set to
+ //! Standard_True if the orientation of the modified
+ //! face changes in the shells which contain it. --
+ //! Here, <RevFace> will return Standard_True if the
+ //! -- gp_Trsf is negative.
+ Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE;
+
+ //! Returns Standard_True if the edge <E> has been
+ //! modified. In this case, <C> is the new geometric
+ //! support of the edge, <L> the new location, <Tol>
+ //! the new tolerance. Otherwise, returns
+ //! Standard_False, and <C>, <L>, <Tol> are not
+ //! significant.
+ Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C, TopLoc_Location& L, Standard_Real& Tol) Standard_OVERRIDE;
+
+ //! Returns Standard_True if the vertex <V> has been
+ //! modified. In this case, <P> is the new geometric
+ //! support of the vertex, <Tol> the new tolerance.
+ //! Otherwise, returns Standard_False, and <P>, <Tol>
+ //! are not significant.
+ Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol) Standard_OVERRIDE;
+
+ //! Returns Standard_True if the edge <E> has a new
+ //! curve on surface on the face <F>.In this case, <C>
+ //! is the new geometric support of the edge, <L> the
+ //! new location, <Tol> the new tolerance.
+ //! Otherwise, returns Standard_False, and <C>, <L>,
+ //! <Tol> are not significant.
+ Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, const TopoDS_Face& F, const TopoDS_Edge& NewE, const TopoDS_Face& NewF, Handle(Geom2d_Curve)& C, Standard_Real& Tol) Standard_OVERRIDE;
+
+ //! Returns Standard_True if the Vertex <V> has a new
+ //! parameter on the edge <E>. In this case, <P> is
+ //! the parameter, <Tol> the new tolerance.
+ //! Otherwise, returns Standard_False, and <P>, <Tol>
+ //! are not significant.
+ Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, Standard_Real& P, Standard_Real& Tol) Standard_OVERRIDE;
+
+ //! Returns the continuity of <NewE> between <NewF1>
+ //! and <NewF2>.
+ //!
+ //! <NewE> is the new edge created from <E>. <NewF1>
+ //! (resp. <NewF2>) is the new face created from <F1>
+ //! (resp. <F2>).
+ Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
+
+ //! Initialize parameters for linear transformation function.
+ Standard_EXPORT void InitLinear(const double theCM,
+ const double theCBNew,
+ const double theCBOld,
+ const double theLPP);
+
+ //! Initialize parameters for quad transformation function.
+ Standard_EXPORT void InitQuad(const double theAftlim,
+ const double theCCA,
+ const double theCCF,
+ const double theForelim,
+ const double theAftCoef,
+ const double theForeCoef,
+ const bool theModifyAftZone,
+ const bool theModifyForeZone);
+
+ DEFINE_STANDARD_RTTIEXT(BRepTools_HullTransformation,BRepTools_Modification)
+
+private:
+
+ Standard_Real myScale;
+ bool myLinear;
+
+ double _cm;
+ double _cb_new;
+ double _cb_old;
+ double _lpp;
+
+ double _aftlim;
+ double _cca;
+ double _ccf;
+ double _forelim;
+ double _aft_coef;
+ double _fore_coef;
+ bool _modify_aft_zone;
+ bool _modify_fore_zone;
+
+};
+
+#endif // _BRepTools_HullTransformation_HeaderFile
BRepTools_GTrsfModification.hxx
BRepTools_History.hxx
BRepTools_History.cxx
+BRepTools_HullTransformation.cxx
+BRepTools_HullTransformation.hxx
BRepTools_MapOfVertexPnt2d.hxx
BRepTools_Modification.cxx
BRepTools_Modification.hxx