1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Coding - Apply .clang-format formatting #286

Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
dpasukhi
2025-01-25 20:15:22 +00:00
parent dbba6f1289
commit a5a7b3185b
14005 changed files with 1273539 additions and 1195567 deletions

View File

@@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepOffset.hxx>
#include <BRep_Tool.hxx>
#include <Geom_ConicalSurface.hxx>
@@ -40,146 +39,160 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
//=================================================================================================
Handle(Geom_Surface) BRepOffset::Surface(const Handle(Geom_Surface)& Surface,
const Standard_Real Offset,
BRepOffset_Status& theStatus,
Standard_Boolean allowC0)
const Standard_Real Offset,
BRepOffset_Status& theStatus,
Standard_Boolean allowC0)
{
constexpr Standard_Real Tol = Precision::Confusion();
theStatus = BRepOffset_Good;
Handle(Geom_Surface) Result;
Handle(Standard_Type) TheType = Surface->DynamicType();
if (TheType == STANDARD_TYPE(Geom_Plane)) {
Handle(Geom_Plane) P =
Handle(Geom_Plane)::DownCast(Surface);
gp_Vec T = P->Position().XDirection()^P->Position().YDirection();
if (TheType == STANDARD_TYPE(Geom_Plane))
{
Handle(Geom_Plane) P = Handle(Geom_Plane)::DownCast(Surface);
gp_Vec T = P->Position().XDirection() ^ P->Position().YDirection();
T *= Offset;
Result = Handle(Geom_Plane)::DownCast(P->Translated(T));
}
else if (TheType == STANDARD_TYPE(Geom_CylindricalSurface)) {
Handle(Geom_CylindricalSurface) C =
Handle(Geom_CylindricalSurface)::DownCast(Surface);
Standard_Real Radius = C->Radius();
gp_Ax3 Axis = C->Position();
if (Axis.Direct())
else if (TheType == STANDARD_TYPE(Geom_CylindricalSurface))
{
Handle(Geom_CylindricalSurface) C = Handle(Geom_CylindricalSurface)::DownCast(Surface);
Standard_Real Radius = C->Radius();
gp_Ax3 Axis = C->Position();
if (Axis.Direct())
Radius += Offset;
else
else
Radius -= Offset;
if ( Radius >= Tol ) {
Result = new Geom_CylindricalSurface( Axis, Radius);
if (Radius >= Tol)
{
Result = new Geom_CylindricalSurface(Axis, Radius);
}
else if ( Radius <= -Tol ){
Axis.Rotate(gp_Ax1(Axis.Location(),Axis.Direction()),M_PI);
Result = new Geom_CylindricalSurface( Axis, Abs(Radius));
else if (Radius <= -Tol)
{
Axis.Rotate(gp_Ax1(Axis.Location(), Axis.Direction()), M_PI);
Result = new Geom_CylindricalSurface(Axis, Abs(Radius));
theStatus = BRepOffset_Reversed;
}
else {
else
{
theStatus = BRepOffset_Degenerated;
}
}
else if (TheType == STANDARD_TYPE(Geom_ConicalSurface)) {
Handle(Geom_ConicalSurface) C =
Handle(Geom_ConicalSurface)::DownCast(Surface);
Standard_Real Alpha = C->SemiAngle();
Standard_Real Radius = C->RefRadius() + Offset * Cos(Alpha);
gp_Ax3 Axis = C->Position();
if ( Radius >= 0.) {
gp_Vec Z( Axis.Direction());
Z *= - Offset * Sin(Alpha);
else if (TheType == STANDARD_TYPE(Geom_ConicalSurface))
{
Handle(Geom_ConicalSurface) C = Handle(Geom_ConicalSurface)::DownCast(Surface);
Standard_Real Alpha = C->SemiAngle();
Standard_Real Radius = C->RefRadius() + Offset * Cos(Alpha);
gp_Ax3 Axis = C->Position();
if (Radius >= 0.)
{
gp_Vec Z(Axis.Direction());
Z *= -Offset * Sin(Alpha);
Axis.Translate(Z);
}
else {
Radius = -Radius;
gp_Vec Z( Axis.Direction());
Z *= - Offset * Sin(Alpha);
else
{
Radius = -Radius;
gp_Vec Z(Axis.Direction());
Z *= -Offset * Sin(Alpha);
Axis.Translate(Z);
Axis.Rotate(gp_Ax1(Axis.Location(),Axis.Direction()),M_PI);
Alpha = -Alpha;
Axis.Rotate(gp_Ax1(Axis.Location(), Axis.Direction()), M_PI);
Alpha = -Alpha;
}
Result = new Geom_ConicalSurface(Axis, Alpha, Radius);
}
else if (TheType == STANDARD_TYPE(Geom_SphericalSurface)) {
Handle(Geom_SphericalSurface) S =
Handle(Geom_SphericalSurface)::DownCast(Surface);
Standard_Real Radius = S->Radius();
gp_Ax3 Axis = S->Position();
if (Axis.Direct())
else if (TheType == STANDARD_TYPE(Geom_SphericalSurface))
{
Handle(Geom_SphericalSurface) S = Handle(Geom_SphericalSurface)::DownCast(Surface);
Standard_Real Radius = S->Radius();
gp_Ax3 Axis = S->Position();
if (Axis.Direct())
Radius += Offset;
else
else
Radius -= Offset;
if ( Radius >= Tol) {
if (Radius >= Tol)
{
Result = new Geom_SphericalSurface(Axis, Radius);
}
else if ( Radius <= -Tol ) {
Axis.Rotate(gp_Ax1(Axis.Location(),Axis.Direction()),M_PI);
else if (Radius <= -Tol)
{
Axis.Rotate(gp_Ax1(Axis.Location(), Axis.Direction()), M_PI);
Axis.ZReverse();
Result = new Geom_SphericalSurface(Axis, -Radius);
Result = new Geom_SphericalSurface(Axis, -Radius);
theStatus = BRepOffset_Reversed;
}
else {
else
{
theStatus = BRepOffset_Degenerated;
}
}
else if (TheType == STANDARD_TYPE(Geom_ToroidalSurface)) {
Handle(Geom_ToroidalSurface) S =
Handle(Geom_ToroidalSurface)::DownCast(Surface);
Standard_Real MajorRadius = S->MajorRadius();
Standard_Real MinorRadius = S->MinorRadius();
gp_Ax3 Axis = S->Position();
if (MinorRadius < MajorRadius) { // A FINIR
else if (TheType == STANDARD_TYPE(Geom_ToroidalSurface))
{
Handle(Geom_ToroidalSurface) S = Handle(Geom_ToroidalSurface)::DownCast(Surface);
Standard_Real MajorRadius = S->MajorRadius();
Standard_Real MinorRadius = S->MinorRadius();
gp_Ax3 Axis = S->Position();
if (MinorRadius < MajorRadius)
{ // A FINIR
if (Axis.Direct())
MinorRadius += Offset;
else
MinorRadius -= Offset;
if (MinorRadius >= Tol) {
Result = new Geom_ToroidalSurface(Axis,MajorRadius,MinorRadius);
MinorRadius += Offset;
else
MinorRadius -= Offset;
if (MinorRadius >= Tol)
{
Result = new Geom_ToroidalSurface(Axis, MajorRadius, MinorRadius);
}
else if (MinorRadius <= -Tol) {
theStatus = BRepOffset_Reversed;
else if (MinorRadius <= -Tol)
{
theStatus = BRepOffset_Reversed;
}
else {
theStatus = BRepOffset_Degenerated;
else
{
theStatus = BRepOffset_Degenerated;
}
}
}
else if (TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
else if (TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution))
{
}
else if (TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
else if (TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
{
}
else if (TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
else if (TheType == STANDARD_TYPE(Geom_BSplineSurface))
{
}
else if (TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
Handle(Geom_RectangularTrimmedSurface) S =
else if (TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface))
{
Handle(Geom_RectangularTrimmedSurface) S =
Handle(Geom_RectangularTrimmedSurface)::DownCast(Surface);
Standard_Real U1,U2,V1,V2;
S->Bounds(U1,U2,V1,V2);
Handle(Geom_Surface) Off = BRepOffset::Surface (S->BasisSurface(), Offset, theStatus, allowC0);
Result = new Geom_RectangularTrimmedSurface (Off,U1,U2,V1,V2);
Standard_Real U1, U2, V1, V2;
S->Bounds(U1, U2, V1, V2);
Handle(Geom_Surface) Off = BRepOffset::Surface(S->BasisSurface(), Offset, theStatus, allowC0);
Result = new Geom_RectangularTrimmedSurface(Off, U1, U2, V1, V2);
}
else if (TheType == STANDARD_TYPE(Geom_OffsetSurface)) {
else if (TheType == STANDARD_TYPE(Geom_OffsetSurface))
{
}
if ( Result.IsNull()) {
Result = new Geom_OffsetSurface( Surface, Offset, allowC0);
if (Result.IsNull())
{
Result = new Geom_OffsetSurface(Surface, Offset, allowC0);
}
return Result;
}
//=======================================================================
//function : CollapseSingularities
//purpose :
//=======================================================================
Handle(Geom_Surface) BRepOffset::CollapseSingularities (const Handle(Geom_Surface)& theSurface,
const TopoDS_Face& theFace,
Standard_Real thePrecision)
//=================================================================================================
Handle(Geom_Surface) BRepOffset::CollapseSingularities(const Handle(Geom_Surface)& theSurface,
const TopoDS_Face& theFace,
Standard_Real thePrecision)
{
// check surface type to see if it can be processed
Handle(Standard_Type) aType = theSurface->DynamicType();
@@ -191,74 +204,88 @@ Handle(Geom_Surface) BRepOffset::CollapseSingularities (const Handle(Geom_Surfac
}
// find singularities (vertices of degenerated edges)
NCollection_List<gp_Pnt> aDegenPnt;
NCollection_List<gp_Pnt> aDegenPnt;
NCollection_List<Standard_Real> aDegenTol;
for (TopExp_Explorer anExp (theFace, TopAbs_EDGE); anExp.More(); anExp.Next())
for (TopExp_Explorer anExp(theFace, TopAbs_EDGE); anExp.More(); anExp.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge (anExp.Current());
if (! BRep_Tool::Degenerated (anEdge))
TopoDS_Edge anEdge = TopoDS::Edge(anExp.Current());
if (!BRep_Tool::Degenerated(anEdge))
{
continue;
}
TopoDS_Vertex aV1, aV2;
TopExp::Vertices (anEdge, aV1, aV2);
if (! aV1.IsSame (aV2))
TopExp::Vertices(anEdge, aV1, aV2);
if (!aV1.IsSame(aV2))
{
continue;
}
aDegenPnt.Append (BRep_Tool::Pnt (aV1));
aDegenTol.Append (BRep_Tool::Tolerance (aV1));
aDegenPnt.Append(BRep_Tool::Pnt(aV1));
aDegenTol.Append(BRep_Tool::Tolerance(aV1));
}
// iterate by sides of the surface
if (aType == STANDARD_TYPE(Geom_BSplineSurface))
{
Handle(Geom_BSplineSurface) aBSpline = Handle(Geom_BSplineSurface)::DownCast (theSurface);
const TColgp_Array2OfPnt& aPoles = aBSpline->Poles();
Handle(Geom_BSplineSurface) aBSpline = Handle(Geom_BSplineSurface)::DownCast(theSurface);
const TColgp_Array2OfPnt& aPoles = aBSpline->Poles();
Handle(Geom_BSplineSurface) aCopy;
// iterate by sides: {U=0; V=0; U=1; V=1}
Standard_Integer RowStart[4] = {aPoles.LowerRow(), aPoles.LowerRow(), aPoles.UpperRow(), aPoles.LowerRow()};
Standard_Integer ColStart[4] = {aPoles.LowerCol(), aPoles.LowerCol(), aPoles.LowerCol(), aPoles.UpperCol()};
Standard_Integer RowStart[4] = {aPoles.LowerRow(),
aPoles.LowerRow(),
aPoles.UpperRow(),
aPoles.LowerRow()};
Standard_Integer ColStart[4] = {aPoles.LowerCol(),
aPoles.LowerCol(),
aPoles.LowerCol(),
aPoles.UpperCol()};
Standard_Integer RowStep[4] = {0, 1, 0, 1};
Standard_Integer ColStep[4] = {1, 0, 1, 0};
Standard_Integer NbSteps[4] = {aPoles.RowLength(), aPoles.ColLength(), aPoles.RowLength(), aPoles.ColLength()};
Standard_Integer NbSteps[4] = {aPoles.RowLength(),
aPoles.ColLength(),
aPoles.RowLength(),
aPoles.ColLength()};
for (Standard_Integer iSide = 0; iSide < 4; iSide++)
{
// compute center of gravity of side poles
gp_XYZ aSum;
for (int iPole = 0; iPole < NbSteps[iSide]; iPole++)
{
aSum += aPoles (RowStart[iSide] + iPole * RowStep[iSide], ColStart[iSide] + iPole * ColStep[iSide]).XYZ();
aSum +=
aPoles(RowStart[iSide] + iPole * RowStep[iSide], ColStart[iSide] + iPole * ColStep[iSide])
.XYZ();
}
gp_Pnt aCenter (aSum / NbSteps[iSide]);
gp_Pnt aCenter(aSum / NbSteps[iSide]);
// determine if all poles of the side fit into:
Standard_Boolean isCollapsed = Standard_True; // aCenter precisely (with gp::Resolution())
Standard_Boolean isSingular = Standard_True; // aCenter with thePrecision
// clang-format off
Standard_Boolean isSingular = Standard_True; // aCenter with thePrecision
// clang-format off
NCollection_LocalArray<Standard_Boolean,4> isDegenerated (aDegenPnt.Extent()); // degenerated vertex
// clang-format on
for (size_t iDegen = 0; iDegen < isDegenerated.Size(); ++iDegen) isDegenerated[iDegen] = Standard_True;
// clang-format on
for (size_t iDegen = 0; iDegen < isDegenerated.Size(); ++iDegen)
isDegenerated[iDegen] = Standard_True;
for (int iPole = 0; iPole < NbSteps[iSide]; iPole++)
{
const gp_Pnt& aPole = aPoles (RowStart[iSide] + iPole * RowStep[iSide], ColStart[iSide] + iPole * ColStep[iSide]);
const gp_Pnt& aPole = aPoles(RowStart[iSide] + iPole * RowStep[iSide],
ColStart[iSide] + iPole * ColStep[iSide]);
// distance from CG
Standard_Real aDistCG = aCenter.Distance (aPole);
Standard_Real aDistCG = aCenter.Distance(aPole);
if (aDistCG > gp::Resolution())
isCollapsed = Standard_False;
if (aDistCG > thePrecision)
isSingular = Standard_False;
// distances from degenerated points
NCollection_List<gp_Pnt>::Iterator aDegPntIt (aDegenPnt);
NCollection_List<gp_Pnt>::Iterator aDegPntIt(aDegenPnt);
NCollection_List<Standard_Real>::Iterator aDegTolIt(aDegenTol);
for (size_t iDegen = 0; iDegen < isDegenerated.Size(); aDegPntIt.Next(), aDegTolIt.Next(), ++iDegen)
for (size_t iDegen = 0; iDegen < isDegenerated.Size();
aDegPntIt.Next(), aDegTolIt.Next(), ++iDegen)
{
if (isDegenerated[iDegen] && aDegPntIt.Value().Distance (aPole) >= aDegTolIt.Value())
if (isDegenerated[iDegen] && aDegPntIt.Value().Distance(aPole) >= aDegTolIt.Value())
{
isDegenerated[iDegen] = Standard_False;
}
@@ -271,18 +298,19 @@ Handle(Geom_Surface) BRepOffset::CollapseSingularities (const Handle(Geom_Surfac
// decide to collapse the side: either if it is singular with thePrecision,
// or if it fits into one (and only one) degenerated point
if (! isSingular)
if (!isSingular)
{
Standard_Integer aNbFit = 0;
NCollection_List<gp_Pnt>::Iterator aDegPntIt (aDegenPnt);
Standard_Integer aNbFit = 0;
NCollection_List<gp_Pnt>::Iterator aDegPntIt(aDegenPnt);
NCollection_List<Standard_Real>::Iterator aDegTolIt(aDegenTol);
for (size_t iDegen = 0; iDegen < isDegenerated.Size(); ++iDegen)
{
if (isDegenerated[iDegen])
{
// remove degenerated point as soon as it fits at least one side, to prevent total collapse
aDegenPnt.Remove (aDegPntIt);
aDegenTol.Remove (aDegTolIt);
// remove degenerated point as soon as it fits at least one side, to prevent total
// collapse
aDegenPnt.Remove(aDegPntIt);
aDegenTol.Remove(aDegTolIt);
aNbFit++;
}
else
@@ -296,22 +324,24 @@ Handle(Geom_Surface) BRepOffset::CollapseSingularities (const Handle(Geom_Surfac
// to be on the safe side
isSingular = (aNbFit == 1);
}
// do collapse
if (isSingular)
{
if (aCopy.IsNull())
{
aCopy = Handle(Geom_BSplineSurface)::DownCast (theSurface->Copy());
aCopy = Handle(Geom_BSplineSurface)::DownCast(theSurface->Copy());
}
for (int iPole = 0; iPole < NbSteps[iSide]; iPole++)
{
aCopy->SetPole (RowStart[iSide] + iPole * RowStep[iSide], ColStart[iSide] + iPole * ColStep[iSide], aCenter);
aCopy->SetPole(RowStart[iSide] + iPole * RowStep[iSide],
ColStart[iSide] + iPole * ColStep[iSide],
aCenter);
}
}
}
if (! aCopy.IsNull())
if (!aCopy.IsNull())
return aCopy;
}

View File

@@ -28,10 +28,9 @@ class TopoDS_Face;
//! Auxiliary tools for offset algorithms
class BRepOffset
class BRepOffset
{
public:
//! returns the Offset surface computed from the
//! surface <Surface> at an OffsetDistance <Offset>.
//!
@@ -40,29 +39,29 @@ public:
//!
//! If no particular case is detected, the returned
//! surface will have the Type Geom_OffsetSurface.
//! Parameter allowC0 is then passed as last argument to
//! Parameter allowC0 is then passed as last argument to
//! constructor of Geom_OffsetSurface.
Standard_EXPORT static Handle(Geom_Surface) Surface (const Handle(Geom_Surface)& Surface,
const Standard_Real Offset,
BRepOffset_Status& theStatus,
Standard_Boolean allowC0 = Standard_False);
Standard_EXPORT static Handle(Geom_Surface) Surface(const Handle(Geom_Surface)& Surface,
const Standard_Real Offset,
BRepOffset_Status& theStatus,
Standard_Boolean allowC0 = Standard_False);
//! Preprocess surface to be offset (bspline, bezier, or revolution based on
//! bspline or bezier curve), by collapsing each singular side to single point.
//!
//! This is to avoid possible flipping of normal at the singularity
//! This is to avoid possible flipping of normal at the singularity
//! of the surface due to non-zero distance between the poles that
//! logically should be in one point (singularity).
//!
//! The (parametric) side of the surface is considered to be singularity if face
//!
//! The (parametric) side of the surface is considered to be singularity if face
//! has degenerated edge whose vertex encompasses (by its tolerance) all points on that side,
//! or if all poles defining that side fit into sphere with radius thePrecision.
//!
//! Returns either original surface or its modified copy (if some poles have been moved).
Standard_EXPORT static Handle(Geom_Surface) CollapseSingularities (const Handle(Geom_Surface)& theSurface,
const TopoDS_Face& theFace,
Standard_Real thePrecision);
Standard_EXPORT static Handle(Geom_Surface) CollapseSingularities(
const Handle(Geom_Surface)& theSurface,
const TopoDS_Face& theFace,
Standard_Real thePrecision);
};
#endif // _BRepOffset_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -40,104 +40,91 @@ class TopoDS_Compound;
//! Analyses the shape to find the parts of edges
//! connecting the convex, concave or tangent faces.
class BRepOffset_Analyse
class BRepOffset_Analyse
{
public:
DEFINE_STANDARD_ALLOC
public: //! @name Constructors
//! Empty c-tor
Standard_EXPORT BRepOffset_Analyse();
//! C-tor performing the job inside
Standard_EXPORT BRepOffset_Analyse (const TopoDS_Shape& theS,
const Standard_Real theAngle);
public: //! @name Performing analysis
Standard_EXPORT BRepOffset_Analyse(const TopoDS_Shape& theS, const Standard_Real theAngle);
public: //! @name Performing analysis
//! Performs the analysis
Standard_EXPORT void Perform (const TopoDS_Shape& theS,
const Standard_Real theAngle,
const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void Perform(const TopoDS_Shape& theS,
const Standard_Real theAngle,
const Message_ProgressRange& theRange = Message_ProgressRange());
public: //! @name Results
//! Returns status of the algorithm
Standard_Boolean IsDone() const
{
return myDone;
}
Standard_Boolean IsDone() const { return myDone; }
//! Returns the connectivity type of the edge
Standard_EXPORT const BRepOffset_ListOfInterval& Type (const TopoDS_Edge& theE) const;
Standard_EXPORT const BRepOffset_ListOfInterval& Type(const TopoDS_Edge& theE) const;
//! Stores in <L> all the edges of Type <T>
//! on the vertex <V>.
Standard_EXPORT void Edges (const TopoDS_Vertex& theV,
const ChFiDS_TypeOfConcavity theType,
TopTools_ListOfShape& theL) const;
Standard_EXPORT void Edges(const TopoDS_Vertex& theV,
const ChFiDS_TypeOfConcavity theType,
TopTools_ListOfShape& theL) const;
//! Stores in <L> all the edges of Type <T>
//! on the face <F>.
Standard_EXPORT void Edges (const TopoDS_Face& theF,
const ChFiDS_TypeOfConcavity theType,
TopTools_ListOfShape& theL) const;
Standard_EXPORT void Edges(const TopoDS_Face& theF,
const ChFiDS_TypeOfConcavity theType,
TopTools_ListOfShape& theL) const;
//! set in <Edges> all the Edges of <Shape> which are
//! tangent to <Edge> at the vertex <Vertex>.
Standard_EXPORT void TangentEdges (const TopoDS_Edge& theEdge,
const TopoDS_Vertex& theVertex,
TopTools_ListOfShape& theEdges) const;
Standard_EXPORT void TangentEdges(const TopoDS_Edge& theEdge,
const TopoDS_Vertex& theVertex,
TopTools_ListOfShape& theEdges) const;
//! Checks if the given shape has ancestors
Standard_Boolean HasAncestor (const TopoDS_Shape& theS) const
Standard_Boolean HasAncestor(const TopoDS_Shape& theS) const
{
return myAncestors.Contains (theS);
return myAncestors.Contains(theS);
}
//! Returns ancestors for the shape
const TopTools_ListOfShape& Ancestors (const TopoDS_Shape& theS) const
const TopTools_ListOfShape& Ancestors(const TopoDS_Shape& theS) const
{
return myAncestors.FindFromKey (theS);
return myAncestors.FindFromKey(theS);
}
//! Explode in compounds of faces where
//! all the connex edges are of type <Side>
Standard_EXPORT void Explode (TopTools_ListOfShape& theL,
const ChFiDS_TypeOfConcavity theType) const;
Standard_EXPORT void Explode(TopTools_ListOfShape& theL,
const ChFiDS_TypeOfConcavity theType) const;
//! Explode in compounds of faces where
//! all the connex edges are of type <Side1> or <Side2>
Standard_EXPORT void Explode (TopTools_ListOfShape& theL,
const ChFiDS_TypeOfConcavity theType1,
const ChFiDS_TypeOfConcavity theType2) const;
Standard_EXPORT void Explode(TopTools_ListOfShape& theL,
const ChFiDS_TypeOfConcavity theType1,
const ChFiDS_TypeOfConcavity theType2) const;
//! Add in <CO> the faces of the shell containing <Face>
//! where all the connex edges are of type <Side>.
Standard_EXPORT void AddFaces (const TopoDS_Face& theFace,
TopoDS_Compound& theCo,
TopTools_MapOfShape& theMap,
const ChFiDS_TypeOfConcavity theType) const;
Standard_EXPORT void AddFaces(const TopoDS_Face& theFace,
TopoDS_Compound& theCo,
TopTools_MapOfShape& theMap,
const ChFiDS_TypeOfConcavity theType) const;
//! Add in <CO> the faces of the shell containing <Face>
//! where all the connex edges are of type <Side1> or <Side2>.
Standard_EXPORT void AddFaces (const TopoDS_Face& theFace,
TopoDS_Compound& theCo,
TopTools_MapOfShape& theMap,
const ChFiDS_TypeOfConcavity theType1,
const ChFiDS_TypeOfConcavity theType2) const;
Standard_EXPORT void AddFaces(const TopoDS_Face& theFace,
TopoDS_Compound& theCo,
TopTools_MapOfShape& theMap,
const ChFiDS_TypeOfConcavity theType1,
const ChFiDS_TypeOfConcavity theType2) const;
void SetOffsetValue (const Standard_Real theOffset)
{
myOffset = theOffset;
}
void SetOffsetValue(const Standard_Real theOffset) { myOffset = theOffset; }
//! Sets the face-offset data map to analyze tangential cases
void SetFaceOffsetMap (const TopTools_DataMapOfShapeReal& theMap)
{
myFaceOffsetMap = theMap;
}
void SetFaceOffsetMap(const TopTools_DataMapOfShapeReal& theMap) { myFaceOffsetMap = theMap; }
//! Returns the new faces constructed between tangent faces
//! having different offset values on the shape
@@ -145,48 +132,47 @@ public: //! @name Results
//! Returns the new face constructed for the edge connecting
//! the two tangent faces having different offset values
Standard_EXPORT TopoDS_Shape Generated (const TopoDS_Shape& theS) const;
Standard_EXPORT TopoDS_Shape Generated(const TopoDS_Shape& theS) const;
//! Checks if the edge has generated a new face.
Standard_Boolean HasGenerated (const TopoDS_Shape& theS) const
Standard_Boolean HasGenerated(const TopoDS_Shape& theS) const
{
return myGenerated.Seek (theS) != NULL;
return myGenerated.Seek(theS) != NULL;
}
//! Returns the replacement of the edge in the face.
//! If no replacement exists, returns the edge
Standard_EXPORT const TopoDS_Edge& EdgeReplacement (const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge) const;
Standard_EXPORT const TopoDS_Edge& EdgeReplacement(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge) const;
//! Returns the shape descendants.
Standard_EXPORT const TopTools_ListOfShape* Descendants (const TopoDS_Shape& theS,
const Standard_Boolean theUpdate = Standard_False) const;
Standard_EXPORT const TopTools_ListOfShape* Descendants(
const TopoDS_Shape& theS,
const Standard_Boolean theUpdate = Standard_False) const;
public: //! @name Clearing the content
//! Clears the content of the algorithm
Standard_EXPORT void Clear();
private: //! @name Treatment of tangential cases
//! Treatment of the tangential cases.
//! @param theEdges List of edges connecting tangent faces
Standard_EXPORT void TreatTangentFaces (const TopTools_ListOfShape& theEdges, const Message_ProgressRange& theRange);
Standard_EXPORT void TreatTangentFaces(const TopTools_ListOfShape& theEdges,
const Message_ProgressRange& theRange);
private: //! @name Fields
// Inputs
TopoDS_Shape myShape; //!< Input shape to analyze
TopoDS_Shape myShape; //!< Input shape to analyze
Standard_Real myAngle; //!< Criteria angle to check tangency
Standard_Real myOffset; //!< Offset value
Standard_Real myOffset; //!< Offset value
TopTools_DataMapOfShapeReal myFaceOffsetMap; //!< Map to store offset values for the faces.
//! Should be set by the calling algorithm.
// Results
Standard_Boolean myDone; //!< Status of the algorithm
// clang-format off
// clang-format off
BRepOffset_DataMapOfShapeListOfInterval myMapEdgeType; //!< Map containing the list of intervals on the edge
TopTools_IndexedDataMapOfShapeListOfShape myAncestors; //!< Ancestors map
NCollection_DataMap<TopoDS_Shape,
@@ -198,7 +184,7 @@ private: //! @name Fields
TopTools_ListOfShape myNewFaces; //!< New faces generated to close the gaps between adjacent
//! tangential faces having different offset values
TopTools_DataMapOfShapeShape myGenerated; //!< Binding between edge and face generated from the edge
// clang-format on
// clang-format on
};
#endif // _BRepOffset_Analyse_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepOffset_DataMapIteratorOfDataMapOfShapeListOfInterval_HeaderFile
#define BRepOffset_DataMapIteratorOfDataMapOfShapeListOfInterval_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepOffset_DataMapIteratorOfDataMapOfShapeMapOfShape_HeaderFile
#define BRepOffset_DataMapIteratorOfDataMapOfShapeMapOfShape_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepOffset_DataMapIteratorOfDataMapOfShapeOffset_HeaderFile
#define BRepOffset_DataMapIteratorOfDataMapOfShapeOffset_HeaderFile

View File

@@ -22,8 +22,9 @@
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape,BRepOffset_ListOfInterval,TopTools_ShapeMapHasher> BRepOffset_DataMapOfShapeListOfInterval;
typedef NCollection_DataMap<TopoDS_Shape,BRepOffset_ListOfInterval,TopTools_ShapeMapHasher>::Iterator BRepOffset_DataMapIteratorOfDataMapOfShapeListOfInterval;
typedef NCollection_DataMap<TopoDS_Shape, BRepOffset_ListOfInterval, TopTools_ShapeMapHasher>
BRepOffset_DataMapOfShapeListOfInterval;
typedef NCollection_DataMap<TopoDS_Shape, BRepOffset_ListOfInterval, TopTools_ShapeMapHasher>::
Iterator BRepOffset_DataMapIteratorOfDataMapOfShapeListOfInterval;
#endif

View File

@@ -22,8 +22,9 @@
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape,TopTools_MapOfShape,TopTools_ShapeMapHasher> BRepOffset_DataMapOfShapeMapOfShape;
typedef NCollection_DataMap<TopoDS_Shape,TopTools_MapOfShape,TopTools_ShapeMapHasher>::Iterator BRepOffset_DataMapIteratorOfDataMapOfShapeMapOfShape;
typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher>
BRepOffset_DataMapOfShapeMapOfShape;
typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher>::Iterator
BRepOffset_DataMapIteratorOfDataMapOfShapeMapOfShape;
#endif

View File

@@ -22,8 +22,9 @@
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape,BRepOffset_Offset,TopTools_ShapeMapHasher> BRepOffset_DataMapOfShapeOffset;
typedef NCollection_DataMap<TopoDS_Shape,BRepOffset_Offset,TopTools_ShapeMapHasher>::Iterator BRepOffset_DataMapIteratorOfDataMapOfShapeOffset;
typedef NCollection_DataMap<TopoDS_Shape, BRepOffset_Offset, TopTools_ShapeMapHasher>
BRepOffset_DataMapOfShapeOffset;
typedef NCollection_DataMap<TopoDS_Shape, BRepOffset_Offset, TopTools_ShapeMapHasher>::Iterator
BRepOffset_DataMapIteratorOfDataMapOfShapeOffset;
#endif

View File

@@ -17,7 +17,6 @@
#ifndef _BRepOffset_Error_HeaderFile
#define _BRepOffset_Error_HeaderFile
enum BRepOffset_Error
{
BRepOffset_NoError,
@@ -26,11 +25,12 @@ enum BRepOffset_Error
BRepOffset_C0Geometry,
BRepOffset_NullOffset,
BRepOffset_NotConnectedShell,
BRepOffset_CannotTrimEdges, //!< exception while trim edges
BRepOffset_CannotFuseVertices, //!< exception while fuse vertices
BRepOffset_CannotExtentEdge, //!< exception while extent edges
BRepOffset_UserBreak, //!< user break
BRepOffset_MixedConnectivity //!< Different connectivity of faces along edge: partially C0 and tangent
BRepOffset_CannotTrimEdges, //!< exception while trim edges
BRepOffset_CannotFuseVertices, //!< exception while fuse vertices
BRepOffset_CannotExtentEdge, //!< exception while extent edges
BRepOffset_UserBreak, //!< user break
BRepOffset_MixedConnectivity //!< Different connectivity of faces along edge: partially C0 and
//!< tangent
};
#endif // _BRepOffset_Error_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -32,46 +32,45 @@ class TopoDS_Face;
//! Computes the intersections between edges on a face
//! stores result is SD as AsDes from BRepOffset.
class BRepOffset_Inter2d
class BRepOffset_Inter2d
{
public:
DEFINE_STANDARD_ALLOC
//! Computes the intersections between the edges stored
//! is AsDes as descendants of <F> . Intersections is computed
//! between two edges if one of them is bound in NewEdges.
//! When all faces of the shape are treated the intersection
//! vertices have to be fused using the FuseVertices method.
//! theDMVV contains the vertices that should be fused
Standard_EXPORT static void Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
Standard_EXPORT static void Compute(const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
//! Computes the intersection between the offset edges of the <FI>.
//! All intersection vertices will be stored in AsDes2d.
//! When all faces of the shape are treated the intersection vertices
//! have to be fused using the FuseVertices method.
//! theDMVV contains the vertices that should be fused.
Standard_EXPORT static Standard_Boolean ConnexIntByInt (const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& theAsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
Standard_EXPORT static Standard_Boolean ConnexIntByInt(
const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& theAsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
//! Computes the intersection between the offset edges generated
//! from vertices and stored into AsDes as descendants of the <FI>.
@@ -79,29 +78,30 @@ public:
//! When all faces of the shape are treated the intersection vertices
//! have to be fused using the FuseVertices method.
//! theDMVV contains the vertices that should be fused.
Standard_EXPORT static void ConnexIntByIntInVert (const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
Standard_EXPORT static void ConnexIntByIntInVert(
const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
//! Fuses the chains of vertices in the theDMVV
//! and updates AsDes by replacing the old vertices
//! with the new ones.
Standard_EXPORT static Standard_Boolean FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImageVV);
//! extents the edge
Standard_EXPORT static Standard_Boolean ExtentEdge (const TopoDS_Edge& E,
TopoDS_Edge& NE,
const Standard_Real theOffset);
Standard_EXPORT static Standard_Boolean FuseVertices(
const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImageVV);
//! extents the edge
Standard_EXPORT static Standard_Boolean ExtentEdge(const TopoDS_Edge& E,
TopoDS_Edge& NE,
const Standard_Real theOffset);
};
#endif // _BRepOffset_Inter2d_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -34,8 +34,6 @@ class TopoDS_Face;
class TopoDS_Shape;
class BRepOffset_Analyse;
//! Computes the connection of the offset and not offset faces
//! according to the connection type required.
//! Store the result in AsDes tool.
@@ -45,89 +43,86 @@ public:
DEFINE_STANDARD_ALLOC
public:
//! Constructor
Standard_EXPORT BRepOffset_Inter3d (const Handle (BRepAlgo_AsDes)& AsDes,
const TopAbs_State Side,
const Standard_Real Tol);
Standard_EXPORT BRepOffset_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes,
const TopAbs_State Side,
const Standard_Real Tol);
// Computes intersection of the given faces among each other
Standard_EXPORT void CompletInt (const TopTools_ListOfShape& SetOfFaces,
const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange);
Standard_EXPORT void CompletInt(const TopTools_ListOfShape& SetOfFaces,
const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange);
//! Computes intersection of pair of faces
Standard_EXPORT void FaceInter (const TopoDS_Face& F1,
const TopoDS_Face& F2,
const BRepAlgo_Image& InitOffsetFace);
Standard_EXPORT void FaceInter(const TopoDS_Face& F1,
const TopoDS_Face& F2,
const BRepAlgo_Image& InitOffsetFace);
//! Computes connections of the offset faces that have to be connected by arcs.
Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces,
const TopoDS_Shape& ShapeInit,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange);
Standard_EXPORT void ConnexIntByArc(const TopTools_ListOfShape& SetOfFaces,
const TopoDS_Shape& ShapeInit,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange);
//! Computes intersection of the offset faces that have to be connected by
//! sharp edges, i.e. it computes intersection between extended offset faces.
Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const BRepOffset_Analyse& A,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ConnexIntByInt(const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const BRepOffset_Analyse& A,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar = Standard_False);
//! Computes intersection with not offset faces .
Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean ExtentContext,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const BRepOffset_Analyse& A,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ContextIntByInt(const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean ExtentContext,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const BRepOffset_Analyse& A,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar = Standard_False);
//! Computes connections of the not offset faces that have to be connected by arcs
Standard_EXPORT void ContextIntByArc (const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean ExtentContext,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
BRepAlgo_Image& InitOffsetEdge,
const Message_ProgressRange& theRange);
Standard_EXPORT void ContextIntByArc(const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean ExtentContext,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
BRepAlgo_Image& InitOffsetEdge,
const Message_ProgressRange& theRange);
//! Marks the pair of faces as already intersected
Standard_EXPORT void SetDone (const TopoDS_Face& F1, const TopoDS_Face& F2);
Standard_EXPORT void SetDone(const TopoDS_Face& F1, const TopoDS_Face& F2);
//! Checks if the pair of faces has already been treated.
Standard_EXPORT Standard_Boolean IsDone (const TopoDS_Face& F1,
const TopoDS_Face& F2) const;
Standard_EXPORT Standard_Boolean IsDone(const TopoDS_Face& F1, const TopoDS_Face& F2) const;
//! Returns touched faces
TopTools_IndexedMapOfShape& TouchedFaces() { return myTouched; };
//! Returns AsDes tool
Handle (BRepAlgo_AsDes) AsDes() const { return myAsDes; }
Handle(BRepAlgo_AsDes) AsDes() const { return myAsDes; }
//! Returns new edges
TopTools_IndexedMapOfShape& NewEdges() { return myNewEdges; }
private:
//! Stores the intersection results into AsDes
Standard_EXPORT void Store (const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopTools_ListOfShape& LInt1,
const TopTools_ListOfShape& LInt2);
Standard_EXPORT void Store(const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopTools_ListOfShape& LInt1,
const TopTools_ListOfShape& LInt2);
private:
Handle (BRepAlgo_AsDes) myAsDes;
TopTools_IndexedMapOfShape myTouched;
Handle(BRepAlgo_AsDes) myAsDes;
TopTools_IndexedMapOfShape myTouched;
TopTools_DataMapOfShapeListOfShape myDone;
TopTools_IndexedMapOfShape myNewEdges;
TopAbs_State mySide;
Standard_Real myTol;
TopTools_IndexedMapOfShape myNewEdges;
TopAbs_State mySide;
Standard_Real myTol;
};
#endif // _BRepOffset_Inter3d_HeaderFile

View File

@@ -14,31 +14,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepOffset_Interval.hxx>
//=======================================================================
//function : BRepOffset_Interval
//purpose :
//=======================================================================
BRepOffset_Interval::BRepOffset_Interval()
//=================================================================================================
BRepOffset_Interval::BRepOffset_Interval() {}
//=================================================================================================
BRepOffset_Interval::BRepOffset_Interval(const Standard_Real U1,
const Standard_Real U2,
const ChFiDS_TypeOfConcavity Type)
: f(U1),
l(U2),
type(Type)
{
}
//=======================================================================
//function : BRepOffset_Interval
//purpose :
//=======================================================================
BRepOffset_Interval::BRepOffset_Interval(const Standard_Real U1,
const Standard_Real U2,
const ChFiDS_TypeOfConcavity Type):
f(U1),
l(U2),
type(Type)
{
}

View File

@@ -24,58 +24,36 @@
#include <Standard_Real.hxx>
#include <ChFiDS_TypeOfConcavity.hxx>
class BRepOffset_Interval
class BRepOffset_Interval
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepOffset_Interval();
Standard_EXPORT BRepOffset_Interval(const Standard_Real U1,
const Standard_Real U2,
Standard_EXPORT BRepOffset_Interval(const Standard_Real U1,
const Standard_Real U2,
const ChFiDS_TypeOfConcavity Type);
void First (const Standard_Real U);
void Last (const Standard_Real U);
void Type (const ChFiDS_TypeOfConcavity T);
Standard_Real First() const;
Standard_Real Last() const;
ChFiDS_TypeOfConcavity Type() const;
void First(const Standard_Real U);
void Last(const Standard_Real U);
void Type(const ChFiDS_TypeOfConcavity T);
Standard_Real First() const;
Standard_Real Last() const;
ChFiDS_TypeOfConcavity Type() const;
protected:
private:
Standard_Real f;
Standard_Real l;
Standard_Real f;
Standard_Real l;
ChFiDS_TypeOfConcavity type;
};
#include <BRepOffset_Interval.lxx>
#endif // _BRepOffset_Interval_HeaderFile

View File

@@ -15,8 +15,8 @@
// commercial license or contractual agreement.
//=======================================================================
//function : First
//purpose :
// function : First
// purpose :
//=======================================================================
inline void BRepOffset_Interval::First(const Standard_Real U)
@@ -24,10 +24,9 @@ inline void BRepOffset_Interval::First(const Standard_Real U)
f = U;
}
//=======================================================================
//function : Last
//purpose :
// function : Last
// purpose :
//=======================================================================
inline void BRepOffset_Interval::Last(const Standard_Real U)
@@ -35,10 +34,9 @@ inline void BRepOffset_Interval::Last(const Standard_Real U)
l = U;
}
//=======================================================================
//function : Type
//purpose :
// function : Type
// purpose :
//=======================================================================
inline void BRepOffset_Interval::Type(const ChFiDS_TypeOfConcavity T)
@@ -46,37 +44,32 @@ inline void BRepOffset_Interval::Type(const ChFiDS_TypeOfConcavity T)
type = T;
}
//=======================================================================
//function : First
//purpose :
// function : First
// purpose :
//=======================================================================
inline Standard_Real BRepOffset_Interval::First() const
inline Standard_Real BRepOffset_Interval::First() const
{
return f;
}
//=======================================================================
//function : Last
//purpose :
// function : Last
// purpose :
//=======================================================================
inline Standard_Real BRepOffset_Interval::Last() const
inline Standard_Real BRepOffset_Interval::Last() const
{
return l;
}
//=======================================================================
//function : Type
//purpose :
// function : Type
// purpose :
//=======================================================================
inline ChFiDS_TypeOfConcavity BRepOffset_Interval::Type() const
inline ChFiDS_TypeOfConcavity BRepOffset_Interval::Type() const
{
return type;
}

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BRepOffset_ListIteratorOfListOfInterval_HeaderFile
#define BRepOffset_ListIteratorOfListOfInterval_HeaderFile

View File

@@ -20,8 +20,7 @@
#include <BRepOffset_Interval.hxx>
#include <NCollection_List.hxx>
typedef NCollection_List<BRepOffset_Interval> BRepOffset_ListOfInterval;
typedef NCollection_List<BRepOffset_Interval> BRepOffset_ListOfInterval;
typedef NCollection_List<BRepOffset_Interval>::Iterator BRepOffset_ListIteratorOfListOfInterval;
#endif

View File

@@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRep_TVertex.hxx>
@@ -33,34 +32,30 @@
#include <stdio.h>
#ifdef DRAW
#include <DBRep.hxx>
Standard_Integer NbF = 1;
#include <DBRep.hxx>
Standard_Integer NbF = 1;
static Standard_Boolean Affich = Standard_False;
#endif
BRepOffset_MakeLoops::BRepOffset_MakeLoops()
{
}
BRepOffset_MakeLoops::BRepOffset_MakeLoops() {}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
//=================================================================================================
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV,
const Message_ProgressRange& theRange)
{
TopTools_ListIteratorOfListOfShape it(LF);
TopTools_ListIteratorOfListOfShape itl,itLCE;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap );
Loops.SetImageVV (theImageVV);
TopTools_ListIteratorOfListOfShape it(LF);
TopTools_ListIteratorOfListOfShape itl, itLCE;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute(myVerVerMap);
Loops.SetImageVV(theImageVV);
Message_ProgressScope aPSOuter(theRange, NULL, 2);
Message_ProgressScope aPS1(aPSOuter.Next(), "Init loops", LF.Size());
for (; it.More(); it.Next(), aPS1.Next()) {
for (; it.More(); it.Next(), aPS1.Next())
{
if (!aPS1.More())
{
return;
@@ -76,58 +71,65 @@ void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const TopTools_ListOfShape& LE = AsDes->Descendant(F);
TopTools_ListOfShape AddedEdges;
for (itl.Initialize(LE); itl.More(); itl.Next()) {
for (itl.Initialize(LE); itl.More(); itl.Next())
{
TopoDS_Edge E = TopoDS::Edge(itl.Value());
if (Image.HasImage(E)) {
//-------------------------------------------
// E was already cut in another face.
// Return the cut edges reorientate them as E.
// See pb for the edges that have disappeared?
//-------------------------------------------
const TopTools_ListOfShape& LCE = Image.Image(E);
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next()) {
TopoDS_Shape CE = itLCE.Value().Oriented(E.Orientation());
Loops.AddConstEdge(TopoDS::Edge(CE));
}
if (Image.HasImage(E))
{
//-------------------------------------------
// E was already cut in another face.
// Return the cut edges reorientate them as E.
// See pb for the edges that have disappeared?
//-------------------------------------------
const TopTools_ListOfShape& LCE = Image.Image(E);
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next())
{
TopoDS_Shape CE = itLCE.Value().Oriented(E.Orientation());
Loops.AddConstEdge(TopoDS::Edge(CE));
}
}
else {
Loops .AddEdge(E, AsDes->Descendant(E));
AddedEdges.Append (E);
else
{
Loops.AddEdge(E, AsDes->Descendant(E));
AddedEdges.Append(E);
}
}
//------------------------
// Unwind.
//------------------------
Loops.Perform();
Loops.WiresToFaces();
Loops.WiresToFaces();
//------------------------
// MAJ SD.
//------------------------
const TopTools_ListOfShape& NF = Loops.NewFaces();
const TopTools_ListOfShape& NF = Loops.NewFaces();
//-----------------------
// F => New faces;
//-----------------------
Image.Bind(F,NF);
Image.Bind(F, NF);
TopTools_ListIteratorOfListOfShape itAdded;
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next()) {
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
//-----------------------
// E => New edges;
//-----------------------
const TopTools_ListOfShape& LoopNE = Loops.NewEdges(E);
if (Image.HasImage(E)) {
Image.Add(E,LoopNE);
if (Image.HasImage(E))
{
Image.Add(E, LoopNE);
}
else {
Image.Bind(E,LoopNE);
else
{
Image.Bind(E, LoopNE);
}
}
}
Loops.GetVerticesForSubstitute( myVerVerMap );
Loops.GetVerticesForSubstitute(myVerVerMap);
if (myVerVerMap.IsEmpty())
return;
BRep_Builder BB;
BRep_Builder BB;
Message_ProgressScope aPS2(aPSOuter.Next(), "Building loops", LF.Size());
for (it.Initialize(LF); it.More(); it.Next(), aPS2.Next())
{
@@ -135,18 +137,18 @@ void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
{
return;
}
TopoDS_Shape F = it.Value();
TopoDS_Shape F = it.Value();
TopTools_ListOfShape LIF;
Image.LastImage(F, LIF);
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp(IF, TopAbs_EDGE);
TopExp_Explorer EdExp(IF, TopAbs_EDGE);
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp(E);
TopoDS_Iterator VerExp(E);
for (; VerExp.More(); VerExp.Next())
VList.Append(VerExp.Value());
TopTools_ListIteratorOfListOfShape itlv(VList);
@@ -158,8 +160,8 @@ void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
TopoDS_Shape NewV = myVerVerMap(V);
E.Free(Standard_True);
NewV.Orientation(V.Orientation());
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*)&V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*)&NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance(TV->Tolerance());
NewTV->ChangePoints().Append(TV->ChangePoints());
@@ -173,40 +175,40 @@ void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
}
}
//=======================================================================
//function : IsBetweenCorks
//purpose :
//=======================================================================
//=================================================================================================
static Standard_Boolean IsBetweenCorks(const TopoDS_Shape& E,
const Handle(BRepAlgo_AsDes)& AsDes,
const TopTools_ListOfShape& LContext)
static Standard_Boolean IsBetweenCorks(const TopoDS_Shape& E,
const Handle(BRepAlgo_AsDes)& AsDes,
const TopTools_ListOfShape& LContext)
{
if (!AsDes->HasAscendant(E)) return 1;
const TopTools_ListOfShape& LF = AsDes->Ascendant(E);
if (!AsDes->HasAscendant(E))
return 1;
const TopTools_ListOfShape& LF = AsDes->Ascendant(E);
TopTools_ListIteratorOfListOfShape it;
for (it.Initialize(LF); it.More(); it.Next()) {
const TopoDS_Shape& S = it.Value();
Standard_Boolean found = 0;
for (it.Initialize(LF); it.More(); it.Next())
{
const TopoDS_Shape& S = it.Value();
Standard_Boolean found = 0;
TopTools_ListIteratorOfListOfShape it2;
for (it2.Initialize(LContext); it2.More(); it2.Next()) {
if(S.IsSame(it2.Value())) {
found = 1;
break;
for (it2.Initialize(LContext); it2.More(); it2.Next())
{
if (S.IsSame(it2.Value()))
{
found = 1;
break;
}
}
if (!found) return 0;
if (!found)
return 0;
}
return 1;
}
//=======================================================================
//function : BuildOnContext
//purpose :
//=======================================================================
void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
//=================================================================================================
void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Standard_Boolean InSide,
const Message_ProgressRange& theRange)
@@ -214,204 +216,226 @@ void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext
//-----------------------------------------
// unwinding of caps.
//-----------------------------------------
TopTools_ListIteratorOfListOfShape it(LContext);
TopTools_ListIteratorOfListOfShape itl,itLCE;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap );
TopExp_Explorer exp;
TopTools_MapOfShape MapExtent;
TopTools_ListIteratorOfListOfShape it(LContext);
TopTools_ListIteratorOfListOfShape itl, itLCE;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute(myVerVerMap);
TopExp_Explorer exp;
TopTools_MapOfShape MapExtent;
Message_ProgressScope aPS(theRange, "Building deepening faces", LContext.Extent());
for (; it.More(); it.Next(), aPS.Next()) {
for (; it.More(); it.Next(), aPS.Next())
{
if (!aPS.More())
{
return;
}
const TopoDS_Face& F = TopoDS::Face(it.Value());
TopTools_MapOfShape MBound;
const TopoDS_Face& F = TopoDS::Face(it.Value());
TopTools_MapOfShape MBound;
//-----------------------------------------------
// Initialisation of Loops.
// F is reversed it will be added in myOffC.
// and myOffC will be reversed in the final result.
//-----------------------------------------------
TopoDS_Shape aReversedF = F.Reversed();
if (InSide) Loops.Init(TopoDS::Face(aReversedF));
// if (InSide) Loops.Init(TopoDS::Face(F.Reversed()));
else Loops.Init(F);
if (InSide)
Loops.Init(TopoDS::Face(aReversedF));
// if (InSide) Loops.Init(TopoDS::Face(F.Reversed()));
else
Loops.Init(F);
//--------------------------------------------------------
// return edges of F not modified by definition.
//--------------------------------------------------------
for (exp.Init(F.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More();
exp.Next()) {
for (exp.Init(F.Oriented(TopAbs_FORWARD), TopAbs_EDGE); exp.More(); exp.Next())
{
TopoDS_Edge CE = TopoDS::Edge(exp.Current());
MBound.Add(CE);
if (Analyse.HasAncestor(CE)) {
// the stop of cups except for the connectivity stops between caps.
// if (!AsDes->HasAscendant(CE)) {
MBound.Add(CE);
if (Analyse.HasAncestor(CE))
{
// the stop of cups except for the connectivity stops between caps.
// if (!AsDes->HasAscendant(CE)) {
TopoDS_Shape aReversedE = CE.Reversed();
if (InSide) Loops.AddConstEdge(CE);
else Loops.AddConstEdge(TopoDS::Edge(aReversedE));
// else Loops.AddConstEdge(TopoDS::Edge(CE.Reversed()));
if (InSide)
Loops.AddConstEdge(CE);
else
Loops.AddConstEdge(TopoDS::Edge(aReversedE));
// else Loops.AddConstEdge(TopoDS::Edge(CE.Reversed()));
}
}
//------------------------------------------------------
// Trace of offsets + connectivity edge between caps.
//------------------------------------------------------
//------------------------------------------------------
const TopTools_ListOfShape& LE = AsDes->Descendant(F);
TopTools_ListOfShape AddedEdges;
for (itl.Initialize(LE); itl.More(); itl.Next()) {
for (itl.Initialize(LE); itl.More(); itl.Next())
{
TopoDS_Edge E = TopoDS::Edge(itl.Value());
if (Image.HasImage(E)) {
//-------------------------------------------
// E was already cut in another face.
// Return cut edges and orientate them as E.
// See pb for the edges that have disappeared?
//-------------------------------------------
const TopTools_ListOfShape& LCE = Image.Image(E);
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next()) {
TopoDS_Shape CE = itLCE.Value().Oriented(E.Orientation());
if (MapExtent.Contains(E)) {
Loops.AddConstEdge(TopoDS::Edge(CE));
continue;
}
if (!MBound.Contains(E)) CE.Reverse();
if (InSide) Loops.AddConstEdge(TopoDS::Edge(CE));
else
{
TopoDS_Shape aReversedE = CE.Reversed();
Loops.AddConstEdge(TopoDS::Edge(aReversedE));
}
// else Loops.AddConstEdge(TopoDS::Edge(CE.Reversed()));
}
if (Image.HasImage(E))
{
//-------------------------------------------
// E was already cut in another face.
// Return cut edges and orientate them as E.
// See pb for the edges that have disappeared?
//-------------------------------------------
const TopTools_ListOfShape& LCE = Image.Image(E);
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next())
{
TopoDS_Shape CE = itLCE.Value().Oriented(E.Orientation());
if (MapExtent.Contains(E))
{
Loops.AddConstEdge(TopoDS::Edge(CE));
continue;
}
if (!MBound.Contains(E))
CE.Reverse();
if (InSide)
Loops.AddConstEdge(TopoDS::Edge(CE));
else
{
TopoDS_Shape aReversedE = CE.Reversed();
Loops.AddConstEdge(TopoDS::Edge(aReversedE));
}
// else Loops.AddConstEdge(TopoDS::Edge(CE.Reversed()));
}
}
else {
if (IsBetweenCorks(E,AsDes,LContext) && AsDes->HasDescendant(E)) {
//connection between 2 caps
MapExtent.Add(E);
TopTools_ListOfShape LV;
if (InSide) {
for (itLCE.Initialize(AsDes->Descendant(E)); itLCE.More(); itLCE.Next()) {
LV.Append(itLCE.Value().Reversed());
}
Loops.AddEdge(E,LV);
}
else {
Loops.AddEdge(E,AsDes->Descendant(E));
}
AddedEdges.Append (E);
}
else if (IsBetweenCorks(E,AsDes,LContext)) {
TopoDS_Shape aLocalShape = E.Reversed();
if (InSide) Loops.AddConstEdge(E);
else Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
// if (InSide) Loops.AddConstEdge(TopoDS::Edge(E));
// else Loops.AddConstEdge(TopoDS::Edge(E.Reversed()));
}
else {
TopoDS_Shape aLocalShape = E.Reversed();
if (InSide) Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
else Loops.AddConstEdge(E);
// if (InSide) Loops.AddConstEdge(TopoDS::Edge(E.Reversed()));
// else Loops.AddConstEdge(TopoDS::Edge(E));
}
else
{
if (IsBetweenCorks(E, AsDes, LContext) && AsDes->HasDescendant(E))
{
// connection between 2 caps
MapExtent.Add(E);
TopTools_ListOfShape LV;
if (InSide)
{
for (itLCE.Initialize(AsDes->Descendant(E)); itLCE.More(); itLCE.Next())
{
LV.Append(itLCE.Value().Reversed());
}
Loops.AddEdge(E, LV);
}
else
{
Loops.AddEdge(E, AsDes->Descendant(E));
}
AddedEdges.Append(E);
}
else if (IsBetweenCorks(E, AsDes, LContext))
{
TopoDS_Shape aLocalShape = E.Reversed();
if (InSide)
Loops.AddConstEdge(E);
else
Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
// if (InSide) Loops.AddConstEdge(TopoDS::Edge(E));
// else Loops.AddConstEdge(TopoDS::Edge(E.Reversed()));
}
else
{
TopoDS_Shape aLocalShape = E.Reversed();
if (InSide)
Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
else
Loops.AddConstEdge(E);
// if (InSide) Loops.AddConstEdge(TopoDS::Edge(E.Reversed()));
// else Loops.AddConstEdge(TopoDS::Edge(E));
}
}
}
//------------------------
// Unwind.
//------------------------
Loops.Perform();
Loops.WiresToFaces();
Loops.WiresToFaces();
//------------------------
// MAJ SD.
//------------------------
const TopTools_ListOfShape& NF = Loops.NewFaces();
const TopTools_ListOfShape& NF = Loops.NewFaces();
//-----------------------
// F => New faces;
//-----------------------
Image.Bind(F,NF);
Image.Bind(F, NF);
TopTools_ListIteratorOfListOfShape itAdded;
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next()) {
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
//-----------------------
// E => New edges;
//-----------------------
if (Image.HasImage(E)) {
Image.Add(E,Loops.NewEdges(E));
if (Image.HasImage(E))
{
Image.Add(E, Loops.NewEdges(E));
}
else {
Image.Bind(E,Loops.NewEdges(E));
else
{
Image.Bind(E, Loops.NewEdges(E));
}
}
}
Loops.GetVerticesForSubstitute( myVerVerMap );
Loops.GetVerticesForSubstitute(myVerVerMap);
if (myVerVerMap.IsEmpty())
return;
BRep_Builder BB;
for (it.Initialize( LContext ); it.More(); it.Next())
for (it.Initialize(LContext); it.More(); it.Next())
{
TopoDS_Shape F = it.Value();
TopTools_ListOfShape LIF;
Image.LastImage(F, LIF);
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
TopoDS_Shape F = it.Value();
TopTools_ListOfShape LIF;
Image.LastImage( F, LIF );
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp( IF, TopAbs_EDGE );
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp( E );
for (; VerExp.More(); VerExp.Next())
VList.Append( VerExp.Value() );
TopTools_ListIteratorOfListOfShape itlv( VList );
for (; itlv.More(); itlv.Next())
{
const TopoDS_Shape& V = itlv.Value();
if (myVerVerMap.IsBound( V ))
{
TopoDS_Shape NewV = myVerVerMap( V );
E.Free( Standard_True );
NewV.Orientation( V.Orientation() );
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance( TV->Tolerance() );
NewTV->ChangePoints().Append( TV->ChangePoints() );
AsDes->Replace( V, NewV );
BB.Remove( E, V );
BB.Add( E, NewV );
}
}
}
}
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp(IF, TopAbs_EDGE);
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp(E);
for (; VerExp.More(); VerExp.Next())
VList.Append(VerExp.Value());
TopTools_ListIteratorOfListOfShape itlv(VList);
for (; itlv.More(); itlv.Next())
{
const TopoDS_Shape& V = itlv.Value();
if (myVerVerMap.IsBound(V))
{
TopoDS_Shape NewV = myVerVerMap(V);
E.Free(Standard_True);
NewV.Orientation(V.Orientation());
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*)&V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*)&NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance(TV->Tolerance());
NewTV->ChangePoints().Append(TV->ChangePoints());
AsDes->Replace(V, NewV);
BB.Remove(E, V);
BB.Add(E, NewV);
}
}
}
}
}
}
//=================================================================================================
//=======================================================================
//function : BuildFaces
//purpose :
//=======================================================================
void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Message_ProgressRange& theRange)
{
TopTools_ListIteratorOfListOfShape itr,itl,itLCE;
TopTools_ListIteratorOfListOfShape itr, itl, itLCE;
Standard_Boolean ToRebuild;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap );
BRep_Builder B;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute(myVerVerMap);
BRep_Builder B;
//----------------------------------
// Loop on all faces //.
//----------------------------------
Message_ProgressScope aPS(theRange, "Building faces", LF.Size());
for (itr.Initialize(LF); itr.More(); itr.Next(), aPS.Next()) {
for (itr.Initialize(LF); itr.More(); itr.Next(), aPS.Next())
{
if (!aPS.More())
{
return;
@@ -419,9 +443,10 @@ void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
TopoDS_Face F = TopoDS::Face(itr.Value());
Loops.Init(F);
ToRebuild = Standard_False;
TopTools_ListOfShape AddedEdges;
if (!Image.HasImage(F)) {
TopTools_ListOfShape AddedEdges;
if (!Image.HasImage(F))
{
//----------------------------------
// Face F not yet reconstructed.
//----------------------------------
@@ -432,83 +457,96 @@ void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
// coincide geometrically with old but are not IsSame.
//----------------------------------------------------------------
TopTools_DataMapOfShapeShape MONV;
TopoDS_Vertex OV1,OV2,NV1,NV2;
for (itl.Initialize(LE); itl.More(); itl.Next()) {
TopoDS_Edge E = TopoDS::Edge(itl.Value());
if (Image.HasImage(E)) {
const TopTools_ListOfShape& LCE = Image.Image(E);
if (LCE.Extent() == 1 && LCE.First().IsSame(E)) {
TopoDS_Shape aLocalShape = LCE.First().Oriented(E.Orientation());
TopoDS_Edge CE = TopoDS::Edge(aLocalShape);
// TopoDS_Edge CE = TopoDS::Edge(LCE.First().Oriented(E.Orientation()));
Loops.AddConstEdge(CE);
continue;
}
//----------------------------------
// F should be reconstructed.
//----------------------------------
ToRebuild = Standard_True;
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next()) {
TopoDS_Shape aLocalShape = itLCE.Value().Oriented(E.Orientation());
TopoDS_Edge CE = TopoDS::Edge(aLocalShape);
// TopoDS_Edge CE = TopoDS::Edge(itLCE.Value().Oriented(E.Orientation()));
TopExp::Vertices (E ,OV1,OV2);
TopExp::Vertices (CE,NV1,NV2);
if (!OV1.IsSame(NV1)) MONV.Bind(OV1,NV1);
if (!OV2.IsSame(NV2)) MONV.Bind(OV2,NV2);
Loops.AddConstEdge(CE);
}
}
TopoDS_Vertex OV1, OV2, NV1, NV2;
for (itl.Initialize(LE); itl.More(); itl.Next())
{
TopoDS_Edge E = TopoDS::Edge(itl.Value());
if (Image.HasImage(E))
{
const TopTools_ListOfShape& LCE = Image.Image(E);
if (LCE.Extent() == 1 && LCE.First().IsSame(E))
{
TopoDS_Shape aLocalShape = LCE.First().Oriented(E.Orientation());
TopoDS_Edge CE = TopoDS::Edge(aLocalShape);
// TopoDS_Edge CE = TopoDS::Edge(LCE.First().Oriented(E.Orientation()));
Loops.AddConstEdge(CE);
continue;
}
//----------------------------------
// F should be reconstructed.
//----------------------------------
ToRebuild = Standard_True;
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next())
{
TopoDS_Shape aLocalShape = itLCE.Value().Oriented(E.Orientation());
TopoDS_Edge CE = TopoDS::Edge(aLocalShape);
// TopoDS_Edge CE = TopoDS::Edge(itLCE.Value().Oriented(E.Orientation()));
TopExp::Vertices(E, OV1, OV2);
TopExp::Vertices(CE, NV1, NV2);
if (!OV1.IsSame(NV1))
MONV.Bind(OV1, NV1);
if (!OV2.IsSame(NV2))
MONV.Bind(OV2, NV2);
Loops.AddConstEdge(CE);
}
}
}
if (ToRebuild) {
if (ToRebuild)
{
#ifdef DRAW
if ( Affich) {
char name[256];
sprintf(name,"CF_%d",NbF++);
DBRep::Set(name,F);
}
if (Affich)
{
char name[256];
sprintf(name, "CF_%d", NbF++);
DBRep::Set(name, F);
}
#endif
//-----------------------------------------------------------
// Non-reconstructed edges on other faces are added.
// If their vertices were reconstructed they are reconstructed.
//-----------------------------------------------------------
for (itl.Initialize(LE); itl.More(); itl.Next()) {
Standard_Real f,l;
TopoDS_Edge E = TopoDS::Edge(itl.Value());
BRep_Tool::Range(E,f,l);
if (!Image.HasImage(E)) {
TopExp::Vertices (E,OV1,OV2);
TopTools_ListOfShape LV;
if (MONV.IsBound(OV1)) {
TopoDS_Vertex VV = TopoDS::Vertex(MONV(OV1));
VV.Orientation(TopAbs_FORWARD);
LV.Append(VV);
TopoDS_Shape aLocalShape = VV.Oriented(TopAbs_INTERNAL);
B.UpdateVertex(TopoDS::Vertex(aLocalShape),
f,E,BRep_Tool::Tolerance(VV));
}
if (MONV.IsBound(OV2)) {
TopoDS_Vertex VV = TopoDS::Vertex(MONV(OV2));
VV.Orientation(TopAbs_REVERSED);
LV.Append(VV);
TopoDS_Shape aLocalShape = VV.Oriented(TopAbs_INTERNAL);
B.UpdateVertex(TopoDS::Vertex(aLocalShape),
l,E,BRep_Tool::Tolerance(VV));
// B.UpdateVertex(TopoDS::Vertex(VV.Oriented(TopAbs_INTERNAL)),
// l,E,BRep_Tool::Tolerance(VV));
}
if (LV.IsEmpty()) Loops.AddConstEdge(E);
else {
Loops.AddEdge (E,LV);
AddedEdges.Append(E);
}
}
}
}
//-----------------------------------------------------------
// Non-reconstructed edges on other faces are added.
// If their vertices were reconstructed they are reconstructed.
//-----------------------------------------------------------
for (itl.Initialize(LE); itl.More(); itl.Next())
{
Standard_Real f, l;
TopoDS_Edge E = TopoDS::Edge(itl.Value());
BRep_Tool::Range(E, f, l);
if (!Image.HasImage(E))
{
TopExp::Vertices(E, OV1, OV2);
TopTools_ListOfShape LV;
if (MONV.IsBound(OV1))
{
TopoDS_Vertex VV = TopoDS::Vertex(MONV(OV1));
VV.Orientation(TopAbs_FORWARD);
LV.Append(VV);
TopoDS_Shape aLocalShape = VV.Oriented(TopAbs_INTERNAL);
B.UpdateVertex(TopoDS::Vertex(aLocalShape), f, E, BRep_Tool::Tolerance(VV));
}
if (MONV.IsBound(OV2))
{
TopoDS_Vertex VV = TopoDS::Vertex(MONV(OV2));
VV.Orientation(TopAbs_REVERSED);
LV.Append(VV);
TopoDS_Shape aLocalShape = VV.Oriented(TopAbs_INTERNAL);
B.UpdateVertex(TopoDS::Vertex(aLocalShape), l, E, BRep_Tool::Tolerance(VV));
// B.UpdateVertex(TopoDS::Vertex(VV.Oriented(TopAbs_INTERNAL)),
// l,E,BRep_Tool::Tolerance(VV));
}
if (LV.IsEmpty())
Loops.AddConstEdge(E);
else
{
Loops.AddEdge(E, LV);
AddedEdges.Append(E);
}
}
}
}
}
if (ToRebuild) {
if (ToRebuild)
{
//------------------------
// Reconstruction.
//------------------------
@@ -517,67 +555,70 @@ void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
//------------------------
// MAJ SD.
//------------------------
const TopTools_ListOfShape& NF = Loops.NewFaces();
const TopTools_ListOfShape& NF = Loops.NewFaces();
//-----------------------
// F => New faces;
//-----------------------
Image.Bind(F,NF);
Image.Bind(F, NF);
TopTools_ListIteratorOfListOfShape itAdded;
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
//-----------------------
// E => New edges;
//-----------------------
if (Image.HasImage(E)) {
Image.Add(E,Loops.NewEdges(E));
}
else {
Image.Bind(E,Loops.NewEdges(E));
}
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
//-----------------------
// E => New edges;
//-----------------------
if (Image.HasImage(E))
{
Image.Add(E, Loops.NewEdges(E));
}
else
{
Image.Bind(E, Loops.NewEdges(E));
}
}
}
}
Loops.GetVerticesForSubstitute( myVerVerMap );
Loops.GetVerticesForSubstitute(myVerVerMap);
if (myVerVerMap.IsEmpty())
return;
BRep_Builder BB;
for (itr.Initialize( LF ); itr.More(); itr.Next())
for (itr.Initialize(LF); itr.More(); itr.Next())
{
TopoDS_Shape F = itr.Value();
TopTools_ListOfShape LIF;
Image.LastImage(F, LIF);
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
TopoDS_Shape F = itr.Value();
TopTools_ListOfShape LIF;
Image.LastImage( F, LIF );
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp( IF, TopAbs_EDGE );
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp( E );
for (; VerExp.More(); VerExp.Next())
VList.Append( VerExp.Value() );
TopTools_ListIteratorOfListOfShape itlv( VList );
for (; itlv.More(); itlv.Next())
{
const TopoDS_Shape& V = itlv.Value();
if (myVerVerMap.IsBound( V ))
{
TopoDS_Shape NewV = myVerVerMap( V );
E.Free( Standard_True );
NewV.Orientation( V.Orientation() );
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance( TV->Tolerance() );
NewTV->ChangePoints().Append( TV->ChangePoints() );
AsDes->Replace( V, NewV );
BB.Remove( E, V );
BB.Add( E, NewV );
}
}
}
}
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp(IF, TopAbs_EDGE);
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp(E);
for (; VerExp.More(); VerExp.Next())
VList.Append(VerExp.Value());
TopTools_ListIteratorOfListOfShape itlv(VList);
for (; itlv.More(); itlv.Next())
{
const TopoDS_Shape& V = itlv.Value();
if (myVerVerMap.IsBound(V))
{
TopoDS_Shape NewV = myVerVerMap(V);
E.Free(Standard_True);
NewV.Orientation(V.Orientation());
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*)&V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*)&NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance(TV->Tolerance());
NewTV->ChangePoints().Append(TV->ChangePoints());
AsDes->Replace(V, NewV);
BB.Remove(E, V);
BB.Add(E, NewV);
}
}
}
}
}
}

View File

@@ -29,57 +29,34 @@ class BRepAlgo_AsDes;
class BRepAlgo_Image;
class BRepOffset_Analyse;
class BRepOffset_MakeLoops
class BRepOffset_MakeLoops
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepOffset_MakeLoops();
Standard_EXPORT void Build (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Standard_Boolean InSide,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Message_ProgressRange& theRange);
Standard_EXPORT void Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildOnContext(const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Standard_Boolean InSide,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildFaces(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Message_ProgressRange& theRange);
protected:
private:
TopTools_DataMapOfShapeShape myVerVerMap;
};
#endif // _BRepOffset_MakeLoops_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -40,77 +40,75 @@ class BRepAlgo_AsDes;
class TopoDS_Face;
class BRepOffset_Inter3d;
class BRepOffset_MakeOffset
class BRepOffset_MakeOffset
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepOffset_MakeOffset();
Standard_EXPORT BRepOffset_MakeOffset(const TopoDS_Shape& S,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Mode Mode = BRepOffset_Skin,
const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean Thickening = Standard_False,
const Standard_Boolean RemoveIntEdges = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void Initialize (const TopoDS_Shape& S,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Mode Mode = BRepOffset_Skin,
const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean Thickening = Standard_False,
const Standard_Boolean RemoveIntEdges = Standard_False);
Standard_EXPORT BRepOffset_MakeOffset(
const TopoDS_Shape& S,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Mode Mode = BRepOffset_Skin,
const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean Thickening = Standard_False,
const Standard_Boolean RemoveIntEdges = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void Initialize(const TopoDS_Shape& S,
const Standard_Real Offset,
const Standard_Real Tol,
const BRepOffset_Mode Mode = BRepOffset_Skin,
const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean Thickening = Standard_False,
const Standard_Boolean RemoveIntEdges = Standard_False);
Standard_EXPORT void Clear();
//! Changes the flag allowing the linearization
Standard_EXPORT void AllowLinearization (const Standard_Boolean theIsAllowed);
Standard_EXPORT void AllowLinearization(const Standard_Boolean theIsAllowed);
//! Add Closing Faces, <F> has to be in the initial
//! shape S.
Standard_EXPORT void AddFace (const TopoDS_Face& F);
Standard_EXPORT void AddFace(const TopoDS_Face& F);
//! set the offset <Off> on the Face <F>
Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
Standard_EXPORT void MakeOffsetShape(const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void MakeThickSolid(const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void SetOffsetOnFace(const TopoDS_Face& F, const Standard_Real Off);
Standard_EXPORT void MakeOffsetShape(
const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void MakeThickSolid(
const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const;
Standard_EXPORT Standard_Boolean IsDone() const;
Standard_EXPORT const TopoDS_Shape& Shape() const;
const TopoDS_Shape& InitShape() const
{
return myInitialShape;
}
const TopoDS_Shape& InitShape() const { return myInitialShape; }
//! returns information about offset state.
Standard_EXPORT BRepOffset_Error Error() const;
//! Returns <Image> containing links between initials
//! shapes and offset faces.
Standard_EXPORT const BRepAlgo_Image& OffsetFacesFromShapes() const;
//! Returns myJoin.
Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
//! Returns <Image> containing links between initials
//! shapes and offset edges.
Standard_EXPORT const BRepAlgo_Image& OffsetEdgesFromShapes() const;
//! Returns the list of closing faces stores by AddFace
Standard_EXPORT const TopTools_IndexedMapOfShape& ClosingFaces() const;
@@ -127,79 +125,80 @@ public:
Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
public: //! @name History methods
//! Returns the list of shapes generated from the shape <S>.
Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS);
//! Returns the list of shapes modified from the shape <S>.
Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS);
//! Returns true if the shape S has been deleted.
Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& S);
Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS);
//! Returns the list of shapes modified from the shape <S>.
Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS);
//! Returns true if the shape S has been deleted.
Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S);
protected:
//! Analyze progress steps of the whole operation.
//! @param theWhole - sum of progress of all operations.
//! @oaram theSteps - steps of the operations supported by PI
Standard_EXPORT void analyzeProgress (const Standard_Real theWhole,
TColStd_Array1OfReal& theSteps) const;
Standard_EXPORT void analyzeProgress(const Standard_Real theWhole,
TColStd_Array1OfReal& theSteps) const;
private:
//! Check if shape consists of only planar faces
//! If <myIsLinearizationAllowed> is TRUE, try to approximate images of faces
//! by planar faces
Standard_EXPORT Standard_Boolean IsPlanar();
//! Set the faces that are to be removed
Standard_EXPORT void SetFaces();
//! Set the faces with special value of offset
Standard_EXPORT void SetFacesWithOffset();
Standard_EXPORT void BuildFaceComp();
Standard_EXPORT void BuildOffsetByArc(const Message_ProgressRange& theRange);
Standard_EXPORT void BuildOffsetByInter(const Message_ProgressRange& theRange);
//! Make Offset faces
Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF, const Message_ProgressRange& theRange);
Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF,
const Message_ProgressRange& theRange);
Standard_EXPORT void SelfInter(TopTools_MapOfShape& Modif);
Standard_EXPORT void Intersection3D(BRepOffset_Inter3d& Inter,
const Message_ProgressRange& theRange);
Standard_EXPORT void Intersection2D(const TopTools_IndexedMapOfShape& Modif,
const TopTools_IndexedMapOfShape& NewEdges,
const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoops(TopTools_IndexedMapOfShape& Modif,
const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoopsOnContext(TopTools_MapOfShape& Modif);
Standard_EXPORT void MakeFaces(TopTools_IndexedMapOfShape& Modif,
const Message_ProgressRange& theRange);
Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter, const Message_ProgressRange& theRange);
Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif,
const TopTools_IndexedMapOfShape& NewEdges,
const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange);
Standard_EXPORT void MakeShells(const Message_ProgressRange& theRange);
Standard_EXPORT void SelectShells();
Standard_EXPORT void EncodeRegularity();
//! Replace roots in history maps
Standard_EXPORT void ReplaceRoots();
Standard_EXPORT void MakeSolid(const Message_ProgressRange& theRange);
Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
Standard_EXPORT void ToContext(BRepOffset_DataMapOfShapeOffset& MapSF);
//! Private method use to update the map face<->offset
Standard_EXPORT void UpdateFaceOffset();
//! Private method used to correct degenerated edges on conical faces
Standard_EXPORT void CorrectConicalFaces();
//! Private method used to build walls for thickening the shell
Standard_EXPORT void MakeMissingWalls(const Message_ProgressRange& theRange);
@@ -207,67 +206,68 @@ private:
Standard_EXPORT void RemoveInternalEdges();
//! Intersects edges
Standard_EXPORT void IntersectEdges (const TopTools_ListOfShape& theFaces,
BRepOffset_DataMapOfShapeOffset& theMapSF,
TopTools_DataMapOfShapeShape& theMES,
TopTools_DataMapOfShapeShape& theBuild,
Handle(BRepAlgo_AsDes)& theAsDes,
Handle(BRepAlgo_AsDes)& theAsDes2d,
const Message_ProgressRange& theRange);
Standard_EXPORT void IntersectEdges(const TopTools_ListOfShape& theFaces,
BRepOffset_DataMapOfShapeOffset& theMapSF,
TopTools_DataMapOfShapeShape& theMES,
TopTools_DataMapOfShapeShape& theBuild,
Handle(BRepAlgo_AsDes)& theAsDes,
Handle(BRepAlgo_AsDes)& theAsDes2d,
const Message_ProgressRange& theRange);
//! Building of the splits of the offset faces for mode Complete
//! and joint type Intersection. This method is an advanced alternative
//! for BRepOffset_MakeLoops::Build method.
//! Currently the Complete intersection mode is limited to work only on planar cases.
Standard_EXPORT void BuildSplitsOfExtendedFaces(const TopTools_ListOfShape& theLF,
const BRepOffset_Analyse& theAnalyse,
const Handle(BRepAlgo_AsDes)& theAsDes,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeShape& theFacesOrigins,
TopTools_DataMapOfShapeShape& theETrimEInf,
BRepAlgo_Image& theImage,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildSplitsOfExtendedFaces(
const TopTools_ListOfShape& theLF,
const BRepOffset_Analyse& theAnalyse,
const Handle(BRepAlgo_AsDes)& theAsDes,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeShape& theFacesOrigins,
TopTools_DataMapOfShapeShape& theETrimEInf,
BRepAlgo_Image& theImage,
const Message_ProgressRange& theRange);
//! Building of the splits of the already trimmed offset faces for mode Complete
//! and joint type Intersection.
Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF,
Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF,
const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImage,
const Message_ProgressRange& theRange);
BRepAlgo_Image& theImage,
const Message_ProgressRange& theRange);
Standard_Real myOffset;
Standard_Real myTol;
TopoDS_Shape myInitialShape;
TopoDS_Shape myShape;
TopoDS_Compound myFaceComp;
BRepOffset_Mode myMode;
Standard_Boolean myIsLinearizationAllowed;
Standard_Boolean myInter;
Standard_Boolean mySelfInter;
GeomAbs_JoinType myJoin;
Standard_Boolean myThickening;
Standard_Boolean myRemoveIntEdges;
TopTools_DataMapOfShapeReal myFaceOffset;
TopTools_IndexedMapOfShape myFaces;
TopTools_IndexedMapOfShape myOriginalFaces;
BRepOffset_Analyse myAnalyse;
TopoDS_Shape myOffsetShape;
BRepAlgo_Image myInitOffsetFace;
BRepAlgo_Image myInitOffsetEdge;
BRepAlgo_Image myImageOffset;
BRepAlgo_Image myImageVV;
TopTools_ListOfShape myWalls;
Handle(BRepAlgo_AsDes) myAsDes;
Standard_Real myOffset;
Standard_Real myTol;
TopoDS_Shape myInitialShape;
TopoDS_Shape myShape;
TopoDS_Compound myFaceComp;
BRepOffset_Mode myMode;
Standard_Boolean myIsLinearizationAllowed;
Standard_Boolean myInter;
Standard_Boolean mySelfInter;
GeomAbs_JoinType myJoin;
Standard_Boolean myThickening;
Standard_Boolean myRemoveIntEdges;
TopTools_DataMapOfShapeReal myFaceOffset;
TopTools_IndexedMapOfShape myFaces;
TopTools_IndexedMapOfShape myOriginalFaces;
BRepOffset_Analyse myAnalyse;
TopoDS_Shape myOffsetShape;
BRepAlgo_Image myInitOffsetFace;
BRepAlgo_Image myInitOffsetEdge;
BRepAlgo_Image myImageOffset;
BRepAlgo_Image myImageVV;
TopTools_ListOfShape myWalls;
Handle(BRepAlgo_AsDes) myAsDes;
TopTools_DataMapOfShapeListOfShape myEdgeIntEdges;
Standard_Boolean myDone;
BRepOffset_Error myError;
BRepOffset_MakeLoops myMakeLoops;
Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
Standard_Boolean myIsPlanar;
TopoDS_Shape myBadShape;
TopTools_DataMapOfShapeShape myFacePlanfaceMap;
TopTools_ListOfShape myGenerated;
TopTools_MapOfShape myResMap;
Standard_Boolean myDone;
BRepOffset_Error myError;
BRepOffset_MakeLoops myMakeLoops;
Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
Standard_Boolean myIsPlanar;
TopoDS_Shape myBadShape;
TopTools_DataMapOfShapeShape myFacePlanfaceMap;
TopTools_ListOfShape myGenerated;
TopTools_MapOfShape myResMap;
};
#endif // _BRepOffset_MakeOffset_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -42,55 +42,46 @@
#include <TopoDS.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
//=================================================================================================
//=============================================================================
//function : BRepOffset_MakeSimpleOffset
//purpose : Constructor
//=============================================================================
BRepOffset_MakeSimpleOffset::BRepOffset_MakeSimpleOffset()
: myOffsetValue(0.),
myTolerance(Precision::Confusion()),
myIsBuildSolid(Standard_False),
myMaxAngle(0.0),
myError(BRepOffsetSimple_OK),
myIsDone(Standard_False)
: myOffsetValue(0.),
myTolerance(Precision::Confusion()),
myIsBuildSolid(Standard_False),
myMaxAngle(0.0),
myError(BRepOffsetSimple_OK),
myIsDone(Standard_False)
{
myReShape = new ShapeBuild_ReShape();
}
//=============================================================================
//function : BRepOffset_MakeSimpleOffset
//purpose : Constructor
//=============================================================================
//=================================================================================================
BRepOffset_MakeSimpleOffset::BRepOffset_MakeSimpleOffset(const TopoDS_Shape& theInputShape,
const Standard_Real theOffsetValue)
: myInputShape(theInputShape),
myOffsetValue(theOffsetValue),
myTolerance(Precision::Confusion()),
myIsBuildSolid(Standard_False),
myMaxAngle(0.0),
myError(BRepOffsetSimple_OK),
myIsDone(Standard_False)
: myInputShape(theInputShape),
myOffsetValue(theOffsetValue),
myTolerance(Precision::Confusion()),
myIsBuildSolid(Standard_False),
myMaxAngle(0.0),
myError(BRepOffsetSimple_OK),
myIsDone(Standard_False)
{
myReShape = new ShapeBuild_ReShape();
}
//=============================================================================
//function : Initialize
//purpose :
//=============================================================================
//=================================================================================================
void BRepOffset_MakeSimpleOffset::Initialize(const TopoDS_Shape& theInputShape,
const Standard_Real theOffsetValue)
{
myInputShape = theInputShape;
myInputShape = theInputShape;
myOffsetValue = theOffsetValue;
Clear();
}
//=============================================================================
//function : GetErrorMessage
//purpose :
//=============================================================================
//=================================================================================================
TCollection_AsciiString BRepOffset_MakeSimpleOffset::GetErrorMessage() const
{
TCollection_AsciiString anError = "";
@@ -124,23 +115,19 @@ TCollection_AsciiString BRepOffset_MakeSimpleOffset::GetErrorMessage() const
return anError;
}
//=============================================================================
//function : Clear
//purpose :
//=============================================================================
//=================================================================================================
void BRepOffset_MakeSimpleOffset::Clear()
{
myIsDone = Standard_False;
myError = BRepOffsetSimple_OK;
myIsDone = Standard_False;
myError = BRepOffsetSimple_OK;
myMaxAngle = 0.0;
myMapVE.Clear();
myReShape->Clear(); // Clear possible stored modifications.
}
//=============================================================================
//function : GetSafeOffset
//purpose :
//=============================================================================
//=================================================================================================
Standard_Real BRepOffset_MakeSimpleOffset::GetSafeOffset(const Standard_Real theExpectedToler)
{
if (myInputShape.IsNull())
@@ -151,17 +138,15 @@ Standard_Real BRepOffset_MakeSimpleOffset::GetSafeOffset(const Standard_Real the
ComputeMaxAngle();
Standard_Real aMaxTol = 0.0;
aMaxTol = BRep_Tool::MaxTolerance(myInputShape, TopAbs_VERTEX);
aMaxTol = BRep_Tool::MaxTolerance(myInputShape, TopAbs_VERTEX);
const Standard_Real anExpOffset = Max((theExpectedToler - aMaxTol) / (2.0 * myMaxAngle),
0.0); // Minimal distance can't be lower than 0.0.
return anExpOffset;
}
//=============================================================================
//function : Perform
//purpose :
//=============================================================================
//=================================================================================================
void BRepOffset_MakeSimpleOffset::Perform()
{
// Clear result of previous computations.
@@ -178,7 +163,8 @@ void BRepOffset_MakeSimpleOffset::Perform()
ComputeMaxAngle();
myBuilder.Init(myInputShape);
Handle(BRepOffset_SimpleOffset) aMapper = new BRepOffset_SimpleOffset(myInputShape, myOffsetValue, myTolerance);
Handle(BRepOffset_SimpleOffset) aMapper =
new BRepOffset_SimpleOffset(myInputShape, myOffsetValue, myTolerance);
myBuilder.Perform(aMapper);
if (!myBuilder.IsDone())
@@ -190,16 +176,16 @@ void BRepOffset_MakeSimpleOffset::Perform()
myResShape = myBuilder.ModifiedShape(myInputShape);
// Fix degeneracy. Degenerated edge should be mapped to the degenerated.
BRep_Builder aBB;
BRep_Builder aBB;
TopExp_Explorer anExpSE(myInputShape, TopAbs_EDGE);
for(; anExpSE.More(); anExpSE.Next())
for (; anExpSE.More(); anExpSE.Next())
{
const TopoDS_Edge & aCurrEdge = TopoDS::Edge(anExpSE.Current());
const TopoDS_Edge& aCurrEdge = TopoDS::Edge(anExpSE.Current());
if (!BRep_Tool::Degenerated(aCurrEdge))
continue;
const TopoDS_Edge & anEdge = TopoDS::Edge(myBuilder.ModifiedShape(aCurrEdge));
const TopoDS_Edge& anEdge = TopoDS::Edge(myBuilder.ModifiedShape(aCurrEdge));
aBB.Degenerated(anEdge, Standard_True);
}
@@ -211,80 +197,89 @@ void BRepOffset_MakeSimpleOffset::Perform()
}
//=============================================================================
//function : tgtfaces
//purpose : check the angle at the border between two squares.
// function : tgtfaces
// purpose : check the angle at the border between two squares.
// Two shares should have a shared front edge.
//=============================================================================
static void tgtfaces(const TopoDS_Edge& Ed,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
static void tgtfaces(const TopoDS_Edge& Ed,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
const Standard_Boolean couture,
Standard_Real& theResAngle)
Standard_Real& theResAngle)
{
// Check that pcurves exist on both faces of edge.
Standard_Real aFirst,aLast;
// Check that pcurves exist on both faces of edge.
Standard_Real aFirst, aLast;
Handle(Geom2d_Curve) aCurve;
aCurve = BRep_Tool::CurveOnSurface(Ed,F1,aFirst,aLast);
if(aCurve.IsNull())
aCurve = BRep_Tool::CurveOnSurface(Ed, F1, aFirst, aLast);
if (aCurve.IsNull())
return;
aCurve = BRep_Tool::CurveOnSurface(Ed,F2,aFirst,aLast);
if(aCurve.IsNull())
aCurve = BRep_Tool::CurveOnSurface(Ed, F2, aFirst, aLast);
if (aCurve.IsNull())
return;
Standard_Real u;
TopoDS_Edge E = Ed;
BRepAdaptor_Surface aBAS1(F1,Standard_False);
BRepAdaptor_Surface aBAS2(F2,Standard_False);
Standard_Real u;
TopoDS_Edge E = Ed;
BRepAdaptor_Surface aBAS1(F1, Standard_False);
BRepAdaptor_Surface aBAS2(F2, Standard_False);
Handle(BRepAdaptor_Surface) HS1 = new BRepAdaptor_Surface (aBAS1);
Handle(BRepAdaptor_Surface) HS1 = new BRepAdaptor_Surface(aBAS1);
Handle(BRepAdaptor_Surface) HS2;
if(couture) HS2 = HS1;
else HS2 = new BRepAdaptor_Surface(aBAS2);
//case when edge lies on the one face
if (couture)
HS2 = HS1;
else
HS2 = new BRepAdaptor_Surface(aBAS2);
// case when edge lies on the one face
E.Orientation(TopAbs_FORWARD);
BRepAdaptor_Curve2d C2d1(E, F1);
if(couture) E.Orientation(TopAbs_REVERSED);
BRepAdaptor_Curve2d C2d2(E,F2);
if (couture)
E.Orientation(TopAbs_REVERSED);
BRepAdaptor_Curve2d C2d2(E, F2);
Standard_Boolean rev1 = (F1.Orientation() == TopAbs_REVERSED);
Standard_Boolean rev2 = (F2.Orientation() == TopAbs_REVERSED);
Standard_Real f,l,eps;
BRep_Tool::Range(E,f,l);
Standard_Real f, l, eps;
BRep_Tool::Range(E, f, l);
Extrema_LocateExtPC ext;
eps = (l - f) / 100.0;
f += eps; // to avoid calculations on
f += eps; // to avoid calculations on
l -= eps; // points of pointed squares.
gp_Pnt2d p;
gp_Pnt pp1,pp2;//,PP;
gp_Vec du1, dv1;
gp_Vec du2, dv2;
gp_Vec d1,d2;
gp_Pnt2d p;
gp_Pnt pp1, pp2; //,PP;
gp_Vec du1, dv1;
gp_Vec du2, dv2;
gp_Vec d1, d2;
Standard_Real norm;
const Standard_Integer NBPNT = 23;
for(Standard_Integer i = 0; i <= NBPNT; i++)
for (Standard_Integer i = 0; i <= NBPNT; i++)
{
// First suppose that this is sameParameter
u = f + (l - f) * i / NBPNT;
// take derivatives of surfaces at the same u, and compute normals
C2d1.D0(u,p);
HS1->D1 (p.X(), p.Y(), pp1, du1, dv1);
d1 = (du1.Crossed(dv1));
norm = d1.Magnitude();
if (norm > 1.e-12) d1 /= norm;
else continue; // skip degenerated point
if(rev1) d1.Reverse();
C2d1.D0(u, p);
HS1->D1(p.X(), p.Y(), pp1, du1, dv1);
d1 = (du1.Crossed(dv1));
norm = d1.Magnitude();
if (norm > 1.e-12)
d1 /= norm;
else
continue; // skip degenerated point
if (rev1)
d1.Reverse();
C2d2.D0(u,p);
HS2->D1 (p.X(), p.Y(), pp2, du2, dv2);
d2 = (du2.Crossed(dv2));
C2d2.D0(u, p);
HS2->D1(p.X(), p.Y(), pp2, du2, dv2);
d2 = (du2.Crossed(dv2));
norm = d2.Magnitude();
if (norm > 1.e-12) d2 /= norm;
else continue; // skip degenerated point
if(rev2) d2.Reverse();
if (norm > 1.e-12)
d2 /= norm;
else
continue; // skip degenerated point
if (rev2)
d2.Reverse();
// Compute angle.
Standard_Real aCurrentAng = d1.Angle(d2);
@@ -295,57 +290,62 @@ static void tgtfaces(const TopoDS_Edge& Ed,
//=============================================================================
// function : ComputeMaxAngleOnShape
// purpose : Code the regularities on all edges of the shape, boundary of
// purpose : Code the regularities on all edges of the shape, boundary of
// two faces that do not have it.
//=============================================================================
static void ComputeMaxAngleOnShape(const TopoDS_Shape& S,
Standard_Real& theResAngle)
static void ComputeMaxAngleOnShape(const TopoDS_Shape& S, Standard_Real& theResAngle)
{
TopTools_IndexedDataMapOfShapeListOfShape M;
TopExp::MapShapesAndAncestors(S,TopAbs_EDGE,TopAbs_FACE,M);
TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, M);
TopTools_ListIteratorOfListOfShape It;
TopExp_Explorer Ex;
TopoDS_Face F1,F2;
Standard_Boolean found, couture;
for(Standard_Integer i = 1; i <= M.Extent(); i++)
TopExp_Explorer Ex;
TopoDS_Face F1, F2;
Standard_Boolean found, couture;
for (Standard_Integer i = 1; i <= M.Extent(); i++)
{
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
found = Standard_False; couture = Standard_False;
found = Standard_False;
couture = Standard_False;
F1.Nullify();
for(It.Initialize(M.FindFromIndex(i));It.More() && !found;It.Next())
for (It.Initialize(M.FindFromIndex(i)); It.More() && !found; It.Next())
{
if(F1.IsNull()) { F1 = TopoDS::Face(It.Value()); }
if (F1.IsNull())
{
F1 = TopoDS::Face(It.Value());
}
else
{
if(!F1.IsSame(TopoDS::Face(It.Value())))
if (!F1.IsSame(TopoDS::Face(It.Value())))
{
found = Standard_True;
F2 = TopoDS::Face(It.Value());
F2 = TopoDS::Face(It.Value());
}
}
}
if (!found && !F1.IsNull()){//is it a sewing edge?
if (!found && !F1.IsNull())
{ // is it a sewing edge?
TopAbs_Orientation orE = E.Orientation();
TopoDS_Edge curE;
for(Ex.Init(F1,TopAbs_EDGE);Ex.More() && !found;Ex.Next()){
curE= TopoDS::Edge(Ex.Current());
if(E.IsSame(curE) && orE != curE.Orientation())
TopoDS_Edge curE;
for (Ex.Init(F1, TopAbs_EDGE); Ex.More() && !found; Ex.Next())
{
curE = TopoDS::Edge(Ex.Current());
if (E.IsSame(curE) && orE != curE.Orientation())
{
found = Standard_True;
found = Standard_True;
couture = Standard_True;
F2 = F1;
F2 = F1;
}
}
}
if(found)
if (found)
{
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0)
if (BRep_Tool::Continuity(E, F1, F2) <= GeomAbs_C0)
{
try
{
tgtfaces(E, F1, F2, couture, theResAngle);
}
catch(Standard_Failure const&)
catch (Standard_Failure const&)
{
}
}
@@ -354,8 +354,8 @@ static void ComputeMaxAngleOnShape(const TopoDS_Shape& S,
}
//=============================================================================
//function : ComputeMaxAngle
//purpose : Computes max angle in faces junction
// function : ComputeMaxAngle
// purpose : Computes max angle in faces junction
//=============================================================================
void BRepOffset_MakeSimpleOffset::ComputeMaxAngle()
{
@@ -363,29 +363,29 @@ void BRepOffset_MakeSimpleOffset::ComputeMaxAngle()
}
//=============================================================================
//function : BuildMissingWalls
//purpose : Builds walls to the result solid.
// function : BuildMissingWalls
// purpose : Builds walls to the result solid.
//=============================================================================
Standard_Boolean BRepOffset_MakeSimpleOffset::BuildMissingWalls()
{
// Internal list of new faces.
TopoDS_Compound aNewFaces;
BRep_Builder aBB;
BRep_Builder aBB;
aBB.MakeCompound(aNewFaces);
// Compute outer bounds of original shape.
ShapeAnalysis_FreeBounds aFB(myInputShape);
const TopoDS_Compound& aFreeWires = aFB.GetClosedWires();
const TopoDS_Compound& aFreeWires = aFB.GetClosedWires();
// Build linear faces on each edge and its image.
TopExp_Explorer anExpCW(aFreeWires,TopAbs_WIRE);
for(; anExpCW.More() ; anExpCW.Next())
TopExp_Explorer anExpCW(aFreeWires, TopAbs_WIRE);
for (; anExpCW.More(); anExpCW.Next())
{
const TopoDS_Wire& aCurWire = TopoDS::Wire(anExpCW.Current());
// Iterate over outer edges in outer wires.
TopExp_Explorer anExpWE(aCurWire, TopAbs_EDGE);
for(; anExpWE.More() ; anExpWE.Next())
for (; anExpWE.More(); anExpWE.Next())
{
const TopoDS_Edge& aCurEdge = TopoDS::Edge(anExpWE.Current());
@@ -405,7 +405,7 @@ Standard_Boolean BRepOffset_MakeSimpleOffset::BuildMissingWalls()
ShapeFix_Edge aSFE;
aSFE.SetContext(myReShape);
TopExp_Explorer anExpCE(aNewFaces, TopAbs_EDGE);
for ( ; anExpCE.More() ; anExpCE.Next())
for (; anExpCE.More(); anExpCE.Next())
{
// Fix same parameter and same range flags.
const TopoDS_Edge& aCurrEdge = TopoDS::Edge(anExpCE.Current());
@@ -418,17 +418,17 @@ Standard_Boolean BRepOffset_MakeSimpleOffset::BuildMissingWalls()
// Add old faces the result.
TopExp_Explorer anExpSF(myInputShape, TopAbs_FACE);
for ( ; anExpSF.More() ; anExpSF.Next())
for (; anExpSF.More(); anExpSF.Next())
aBB.Add(aResCompound, anExpSF.Current());
// Add new faces the result.
anExpSF.Init(myResShape, TopAbs_FACE);
for ( ; anExpSF.More() ; anExpSF.Next())
for (; anExpSF.More(); anExpSF.Next())
aBB.Add(aResCompound, anExpSF.Current());
// Add wall faces to the result.
TopExp_Explorer anExpCF(aNewFaces, TopAbs_FACE);
for ( ; anExpCF.More() ; anExpCF.Next())
for (; anExpCF.More(); anExpCF.Next())
{
const TopoDS_Face& aF = TopoDS::Face(anExpCF.Current());
aBB.Add(aResCompound, aF);
@@ -443,8 +443,8 @@ Standard_Boolean BRepOffset_MakeSimpleOffset::BuildMissingWalls()
TopoDS_Shape aShells = aQuilt.Shells();
TopExp_Explorer anExpSSh(aShells, TopAbs_SHELL);
TopoDS_Shell aResShell;
for ( ; anExpSSh.More() ; anExpSSh.Next() )
TopoDS_Shell aResShell;
for (; anExpSSh.More(); anExpSSh.Next())
{
if (!aResShell.IsNull())
{
@@ -470,10 +470,8 @@ Standard_Boolean BRepOffset_MakeSimpleOffset::BuildMissingWalls()
return Standard_True;
}
//=============================================================================
//function : BuildWallFace
//purpose :
//=============================================================================
//=================================================================================================
TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOrigEdge)
{
TopoDS_Face aResFace;
@@ -508,7 +506,7 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOri
else
{
// Edge does not exist - create it and add to the map.
BRepLib_MakeEdge aME1(TopoDS::Vertex(aV2.Oriented(TopAbs_FORWARD)),
BRepLib_MakeEdge aME1(TopoDS::Vertex(aV2.Oriented(TopAbs_FORWARD)),
TopoDS::Vertex(aNewV2.Oriented(TopAbs_REVERSED)));
if (!aME1.IsDone())
return aResFace;
@@ -527,7 +525,7 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOri
else
{
// Edge does not exist - create it and add to the map.
BRepLib_MakeEdge aME2(TopoDS::Vertex(aV1.Oriented(TopAbs_FORWARD)),
BRepLib_MakeEdge aME2(TopoDS::Vertex(aV1.Oriented(TopAbs_FORWARD)),
TopoDS::Vertex(aNewV1.Oriented(TopAbs_REVERSED)));
if (!aME2.IsDone())
return aResFace;
@@ -549,7 +547,7 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOri
aBB.Add(aWire, aWall2);
// Build 3d curves on wire
BRepLib::BuildCurves3d( aWire );
BRepLib::BuildCurves3d(aWire);
// Try to build using simple planar approach.
TopoDS_Face aF;
@@ -560,42 +558,42 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOri
if (aFM.IsDone())
aF = aFM.Face();
}
catch(Standard_Failure const&)
catch (Standard_Failure const&)
{
}
if (aF.IsNull()) // Exception in face maker or result is not computed.
{
// Build using thrusections.
Standard_Boolean ToReverse = Standard_False;
Standard_Real fpar, lpar, fparOE, lparOE;
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(theOrigEdge, fpar, lpar);
Handle(Geom_TrimmedCurve) TrEdgeCurve = new Geom_TrimmedCurve( EdgeCurve, fpar, lpar );
Handle(Geom_Curve) OffsetCurve = BRep_Tool::Curve(aNewEdge, fparOE, lparOE);
Handle(Geom_TrimmedCurve) TrOffsetCurve = new Geom_TrimmedCurve( OffsetCurve, fparOE, lparOE );
Standard_Boolean ToReverse = Standard_False;
Standard_Real fpar, lpar, fparOE, lparOE;
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(theOrigEdge, fpar, lpar);
Handle(Geom_TrimmedCurve) TrEdgeCurve = new Geom_TrimmedCurve(EdgeCurve, fpar, lpar);
Handle(Geom_Curve) OffsetCurve = BRep_Tool::Curve(aNewEdge, fparOE, lparOE);
Handle(Geom_TrimmedCurve) TrOffsetCurve = new Geom_TrimmedCurve(OffsetCurve, fparOE, lparOE);
GeomFill_Generator ThrusecGenerator;
ThrusecGenerator.AddCurve( TrEdgeCurve );
ThrusecGenerator.AddCurve( TrOffsetCurve );
ThrusecGenerator.Perform( Precision::PConfusion() );
ThrusecGenerator.AddCurve(TrEdgeCurve);
ThrusecGenerator.AddCurve(TrOffsetCurve);
ThrusecGenerator.Perform(Precision::PConfusion());
Handle(Geom_Surface) theSurf = ThrusecGenerator.Surface();
//theSurf = new Geom_SurfaceOfLinearExtrusion( TrOffsetCurve, OffsetDir );
// theSurf = new Geom_SurfaceOfLinearExtrusion( TrOffsetCurve, OffsetDir );
Standard_Real Uf, Ul, Vf, Vl;
theSurf->Bounds(Uf, Ul, Vf, Vl);
TopLoc_Location Loc;
TopLoc_Location Loc;
Handle(Geom2d_Line) EdgeLine2d, OELine2d, aLine2d, aLine2d2;
EdgeLine2d = new Geom2d_Line(gp_Pnt2d(0., Vf), gp_Dir2d(1., 0.));
aBB.UpdateEdge(theOrigEdge, EdgeLine2d, theSurf, Loc, Precision::Confusion());
OELine2d = new Geom2d_Line(gp_Pnt2d(0., Vl), gp_Dir2d(1., 0.));
aBB.UpdateEdge(aNewEdge, OELine2d, theSurf, Loc, Precision::Confusion());
Standard_Real UonV1 = (ToReverse)? Ul : Uf;
Standard_Real UonV2 = (ToReverse)? Uf : Ul;
aLine2d = new Geom2d_Line(gp_Pnt2d(UonV2, 0.), gp_Dir2d(0., 1.));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(UonV1, 0.), gp_Dir2d(0., 1.));
Standard_Real UonV1 = (ToReverse) ? Ul : Uf;
Standard_Real UonV2 = (ToReverse) ? Uf : Ul;
aLine2d = new Geom2d_Line(gp_Pnt2d(UonV2, 0.), gp_Dir2d(0., 1.));
aLine2d2 = new Geom2d_Line(gp_Pnt2d(UonV1, 0.), gp_Dir2d(0., 1.));
if (aWall1.IsSame(aWall2))
{
aBB.UpdateEdge(aWall1, aLine2d, aLine2d2, theSurf, Loc, Precision::Confusion());
Handle(Geom_Curve) BSplC34 = theSurf->UIso( Uf );
Handle(Geom_Curve) BSplC34 = theSurf->UIso(Uf);
aBB.UpdateEdge(aWall1, BSplC34, Precision::Confusion());
aBB.Range(aWall1, Vf, Vl);
}
@@ -605,29 +603,26 @@ TopoDS_Face BRepOffset_MakeSimpleOffset::BuildWallFace(const TopoDS_Edge& theOri
aBB.SameRange(aWall1, Standard_False);
aBB.SameParameter(aWall2, Standard_False);
aBB.SameRange(aWall2, Standard_False);
aBB.UpdateEdge(aWall1, aLine2d, theSurf, Loc, Precision::Confusion());
aBB.UpdateEdge(aWall1, aLine2d, theSurf, Loc, Precision::Confusion());
aBB.Range(aWall1, theSurf, Loc, Vf, Vl);
aBB.UpdateEdge(aWall2, aLine2d2, theSurf, Loc, Precision::Confusion());
aBB.Range(aWall2, theSurf, Loc, Vf, Vl);
Handle(Geom_Curve) BSplC3 = theSurf->UIso( UonV2 );
Handle(Geom_Curve) BSplC3 = theSurf->UIso(UonV2);
aBB.UpdateEdge(aWall1, BSplC3, Precision::Confusion());
aBB.Range(aWall1, Vf, Vl, Standard_True); //only for 3d curve
Handle(Geom_Curve) BSplC4 = theSurf->UIso( UonV1 );
aBB.Range(aWall1, Vf, Vl, Standard_True); // only for 3d curve
Handle(Geom_Curve) BSplC4 = theSurf->UIso(UonV1);
aBB.UpdateEdge(aWall2, BSplC4, Precision::Confusion());
aBB.Range(aWall2, Vf, Vl, Standard_True); //only for 3d curve
aBB.Range(aWall2, Vf, Vl, Standard_True); // only for 3d curve
}
aF = BRepLib_MakeFace(theSurf, aWire);
}
return aF;
}
//=============================================================================
//function : Generated
//purpose :
//=============================================================================
//=================================================================================================
const TopoDS_Shape BRepOffset_MakeSimpleOffset::Generated(const TopoDS_Shape& theShape) const
{
// Shape generated by modification.
@@ -643,10 +638,8 @@ const TopoDS_Shape BRepOffset_MakeSimpleOffset::Generated(const TopoDS_Shape& th
return aRes;
}
//=============================================================================
//function : Modified
//purpose :
//=============================================================================
//=================================================================================================
const TopoDS_Shape BRepOffset_MakeSimpleOffset::Modified(const TopoDS_Shape& theShape) const
{
TopoDS_Shape aRes, anEmptyShape;
@@ -659,4 +652,3 @@ const TopoDS_Shape BRepOffset_MakeSimpleOffset::Modified(const TopoDS_Shape& the
return aRes;
}

View File

@@ -27,7 +27,6 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Shape.hxx>
enum BRepOffsetSimple_Status
{
BRepOffsetSimple_OK,
@@ -38,30 +37,30 @@ enum BRepOffsetSimple_Status
BRepOffsetSimple_ErrorNonClosedShell
};
//! This class represents simple offset algorithm itself. It builds simple offset without intersection.
//! Solid can be created using SetBuildSolidFlag method (set flag to true). By default shell will be constructed.
//! This class represents simple offset algorithm itself. It builds simple offset without
//! intersection. Solid can be created using SetBuildSolidFlag method (set flag to true). By default
//! shell will be constructed.
//!
//! Algorithm:
//! 1. Build source-image maps for vertices, edges and faces.BRepTools_Modification class will be used
//! to store this information. An image of a shared edge can be constructed from the corresponding edge
//! of the first iterated face.
//! 1. Build source-image maps for vertices, edges and faces.BRepTools_Modification class will be
//! used
//! to store this information. An image of a shared edge can be constructed from the
//! corresponding edge of the first iterated face.
//! 2. Run BRepTools_Modifier to obtain offset shape.
// 3. Ensure topological integrity of the output shape.
//!
//! Limitations:
//! According to the algorithm nature result depends on the smoothness of input data. Smooth (G1-continuity) input shape
//! will lead to the good result.
//! According to the algorithm nature result depends on the smoothness of input data. Smooth
//! (G1-continuity) input shape will lead to the good result.
//!
//! The possible drawback of the simple algorithm is that it leads, in general case, to tolerance increasing.
//! The tolerances have to grow in order to cover the gaps between the neighbor faces in the output.
//! It should be noted that the actual tolerance growth depends on the offset distance and the quality of
//! joints between the input faces. Anyway the good input shell (smooth connections between adjacent faces)
//! will lead to good result.
//! The possible drawback of the simple algorithm is that it leads, in general case, to tolerance
//! increasing. The tolerances have to grow in order to cover the gaps between the neighbor faces in
//! the output. It should be noted that the actual tolerance growth depends on the offset distance
//! and the quality of joints between the input faces. Anyway the good input shell (smooth
//! connections between adjacent faces) will lead to good result.
class BRepOffset_MakeSimpleOffset
{
public:
//! Constructor. Does nothing.
Standard_EXPORT BRepOffset_MakeSimpleOffset();
@@ -99,10 +98,10 @@ public:
Standard_Real GetTolerance() const { return myTolerance; }
//! Sets tolerance (used for handling singularities).
void SetTolerance (const Standard_Real theValue) { myTolerance = theValue; }
void SetTolerance(const Standard_Real theValue) { myTolerance = theValue; }
//! Gets done state.
Standard_Boolean IsDone() const { return myIsDone; }
Standard_Boolean IsDone() const { return myIsDone; }
//! Returns result shape.
const TopoDS_Shape& GetResultShape() const { return myResShape; }
@@ -117,7 +116,6 @@ public:
Standard_EXPORT const TopoDS_Shape Modified(const TopoDS_Shape& theShape) const;
protected:
//! Computes max angle in faces junction.
void ComputeMaxAngle();
@@ -125,7 +123,6 @@ protected:
void Clear();
private:
//! Builds face on specified wall.
TopoDS_Face BuildWallFace(const TopoDS_Edge& theOrigEdge);
@@ -171,7 +168,6 @@ private:
//! Result shape.
TopoDS_Shape myResShape;
};
#endif // _BRepOffset_MakeSimpleOffset_HeaderFile

View File

@@ -17,7 +17,6 @@
#ifndef _BRepOffset_Mode_HeaderFile
#define _BRepOffset_Mode_HeaderFile
//! Lists the offset modes. These are the following:
//! - BRepOffset_Skin which describes the offset along
//! the surface of a solid, used to obtain a manifold topological space,
@@ -27,9 +26,9 @@
//! of a given surface shell along both sides of the surface.
enum BRepOffset_Mode
{
BRepOffset_Skin,
BRepOffset_Pipe,
BRepOffset_RectoVerso
BRepOffset_Skin,
BRepOffset_Pipe,
BRepOffset_RectoVerso
};
#endif // _BRepOffset_Mode_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -40,17 +40,18 @@ class TopoDS_Vertex;
//! 1 - from a face.
//! 2 - from an edge.
//! 3 - from a vertex.
class BRepOffset_Offset
class BRepOffset_Offset
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepOffset_Offset();
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, const Standard_Real Offset, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face,
const Standard_Real Offset,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
//! This method will be called when you want to share
//! the edges soon generated from an other face.
//! e.g. when two faces are tangents the common edge
@@ -63,65 +64,96 @@ public:
//! E' = the image of E in the offsetting of
//! another face sharing E with a
//! continuity at least G1
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, const Standard_Real Offset, const TopTools_DataMapOfShapeShape& Created, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const TopoDS_Edge& FirstEdge, const TopoDS_Edge& LastEdge, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face,
const Standard_Real Offset,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const TopoDS_Edge& FirstEdge,
const TopoDS_Edge& LastEdge,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Tol and Conti are only used if Polynomial is True
//! (Used to perform the approximation)
Standard_EXPORT BRepOffset_Offset(const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Face& Face, const Standard_Real Offset, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Face& Face, const Standard_Real Offset, const TopTools_DataMapOfShapeShape& Created, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const TopoDS_Edge& FirstEdge, const TopoDS_Edge& LastEdge, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Vertex& Vertex,
const TopTools_ListOfShape& LEdge,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init(const TopoDS_Face& Face,
const Standard_Real Offset,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init(const TopoDS_Face& Face,
const Standard_Real Offset,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const TopoDS_Edge& FirstEdge,
const TopoDS_Edge& LastEdge,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Tol and Conti are only used if Polynomial is True
//! (Used to perform the approximation)
Standard_EXPORT void Init (const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init(const TopoDS_Vertex& Vertex,
const TopTools_ListOfShape& LEdge,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Only used in Rolling Ball. Pipe on Free Boundary
Standard_EXPORT void Init (const TopoDS_Edge& Edge, const Standard_Real Offset);
const TopoDS_Shape& InitialShape() const;
Standard_EXPORT void Init(const TopoDS_Edge& Edge, const Standard_Real Offset);
const TopoDS_Shape& InitialShape() const;
Standard_EXPORT const TopoDS_Face& Face() const;
Standard_EXPORT TopoDS_Shape Generated (const TopoDS_Shape& Shape) const;
Standard_EXPORT TopoDS_Shape Generated(const TopoDS_Shape& Shape) const;
Standard_EXPORT BRepOffset_Status Status() const;
protected:
private:
TopoDS_Shape myShape;
BRepOffset_Status myStatus;
TopoDS_Face myFace;
TopoDS_Shape myShape;
BRepOffset_Status myStatus;
TopoDS_Face myFace;
TopTools_DataMapOfShapeShape myMap;
};
#include <BRepOffset_Offset.lxx>
#endif // _BRepOffset_Offset_HeaderFile

View File

@@ -35,98 +35,88 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
//=============================================================================
//function : BRepOffset_SimpleOffset
//purpose : Constructor
//=============================================================================
//=================================================================================================
BRepOffset_SimpleOffset::BRepOffset_SimpleOffset(const TopoDS_Shape& theInputShape,
const Standard_Real theOffsetValue,
const Standard_Real theTolerance)
: myOffsetValue(theOffsetValue),
myTolerance(theTolerance)
: myOffsetValue(theOffsetValue),
myTolerance(theTolerance)
{
FillOffsetData(theInputShape);
}
//=============================================================================
//function : NewSurface
//purpose :
//=============================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewSurface(const TopoDS_Face& F,
//=================================================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewSurface(const TopoDS_Face& F,
Handle(Geom_Surface)& S,
TopLoc_Location& L,
Standard_Real& Tol,
Standard_Boolean& RevWires,
Standard_Boolean& RevFace)
TopLoc_Location& L,
Standard_Real& Tol,
Standard_Boolean& RevWires,
Standard_Boolean& RevFace)
{
if (!myFaceInfo.IsBound(F))
return Standard_False;
const NewFaceData& aNFD = myFaceInfo.Find(F);
S = aNFD.myOffsetS;
L = aNFD.myL;
Tol = aNFD.myTol;
S = aNFD.myOffsetS;
L = aNFD.myL;
Tol = aNFD.myTol;
RevWires = aNFD.myRevWires;
RevFace = aNFD.myRevFace;
RevFace = aNFD.myRevFace;
return Standard_True;
}
//=============================================================================
//function : NewCurve
//purpose :
//=============================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewCurve(const TopoDS_Edge& E,
//=================================================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewCurve(const TopoDS_Edge& E,
Handle(Geom_Curve)& C,
TopLoc_Location& L,
Standard_Real& Tol)
TopLoc_Location& L,
Standard_Real& Tol)
{
if (!myEdgeInfo.IsBound(E))
return Standard_False;
const NewEdgeData& aNED = myEdgeInfo.Find(E);
C = aNED.myOffsetC;
L = aNED.myL;
C = aNED.myOffsetC;
L = aNED.myL;
Tol = aNED.myTol;
return Standard_True;
}
//=============================================================================
//function : NewPoint
//purpose :
//=============================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewPoint (const TopoDS_Vertex& V,
gp_Pnt& P,
Standard_Real& Tol)
//=================================================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewPoint(const TopoDS_Vertex& V,
gp_Pnt& P,
Standard_Real& Tol)
{
if (!myVertexInfo.IsBound(V))
return Standard_False;
const NewVertexData& aNVD = myVertexInfo.Find(V);
P = aNVD.myP;
P = aNVD.myP;
Tol = aNVD.myTol;
return Standard_True;
}
//=============================================================================
//function : NewCurve2d
//purpose :
//=============================================================================
Standard_Boolean BRepOffset_SimpleOffset::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_Boolean BRepOffset_SimpleOffset::NewCurve2d(const TopoDS_Edge& E,
const TopoDS_Face& F,
const TopoDS_Edge& /*NewE*/,
const TopoDS_Face& /*NewF*/,
Handle(Geom2d_Curve)& C,
Standard_Real& Tol)
{
// Use original pcurve.
Standard_Real aF, aL;
C = BRep_Tool::CurveOnSurface(E, F, aF, aL);
C = BRep_Tool::CurveOnSurface(E, F, aF, aL);
Tol = BRep_Tool::Tolerance(E);
if (myEdgeInfo.IsBound(E))
@@ -135,17 +125,15 @@ Standard_Boolean BRepOffset_SimpleOffset::NewCurve2d (const TopoDS_Edge& E,
return Standard_True;
}
//=============================================================================
//function : NewParameter
//purpose :
//=============================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewParameter (const TopoDS_Vertex& V,
const TopoDS_Edge& E,
Standard_Real& P,
Standard_Real& Tol)
//=================================================================================================
Standard_Boolean BRepOffset_SimpleOffset::NewParameter(const TopoDS_Vertex& V,
const TopoDS_Edge& E,
Standard_Real& P,
Standard_Real& Tol)
{
// Use original parameter.
P = BRep_Tool::Parameter(V, E);
P = BRep_Tool::Parameter(V, E);
Tol = BRep_Tool::Tolerance(V);
if (myVertexInfo.IsBound(V))
@@ -154,25 +142,21 @@ Standard_Boolean BRepOffset_SimpleOffset::NewParameter (const TopoDS_Vertex& V,
return Standard_True;
}
//=============================================================================
//function : NewParameter
//purpose :
//=============================================================================
GeomAbs_Shape BRepOffset_SimpleOffset::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*/)
//=================================================================================================
GeomAbs_Shape BRepOffset_SimpleOffset::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*/)
{
// Compute result using original continuity.
return BRep_Tool::Continuity(E, F1, F2);
}
//=============================================================================
//function : FillOffsetData
//purpose :
//=============================================================================
//=================================================================================================
void BRepOffset_SimpleOffset::FillOffsetData(const TopoDS_Shape& theShape)
{
// Clears old data.
@@ -182,7 +166,7 @@ void BRepOffset_SimpleOffset::FillOffsetData(const TopoDS_Shape& theShape)
// Faces loop. Compute offset surface for each face.
TopExp_Explorer anExpSF(theShape, TopAbs_FACE);
for(; anExpSF.More(); anExpSF.Next())
for (; anExpSF.More(); anExpSF.Next())
{
const TopoDS_Face& aCurrFace = TopoDS::Face(anExpSF.Current());
FillFaceData(aCurrFace);
@@ -202,28 +186,26 @@ void BRepOffset_SimpleOffset::FillOffsetData(const TopoDS_Shape& theShape)
TopExp::MapShapesAndAncestors(theShape, TopAbs_VERTEX, TopAbs_EDGE, aVertexEdgeMap);
for (Standard_Integer anIdx = 1; anIdx <= aVertexEdgeMap.Size(); ++anIdx)
{
const TopoDS_Vertex & aCurrVertex = TopoDS::Vertex(aVertexEdgeMap.FindKey(anIdx));
const TopoDS_Vertex& aCurrVertex = TopoDS::Vertex(aVertexEdgeMap.FindKey(anIdx));
FillVertexData(aCurrVertex, aVertexEdgeMap, anIdx);
}
}
//=============================================================================
//function : FillFaceData
//purpose :
//=============================================================================
//=================================================================================================
void BRepOffset_SimpleOffset::FillFaceData(const TopoDS_Face& theFace)
{
NewFaceData aNFD;
aNFD.myRevWires = Standard_False;
aNFD.myRevFace = Standard_False;
aNFD.myTol = BRep_Tool::Tolerance(theFace);
aNFD.myRevFace = Standard_False;
aNFD.myTol = BRep_Tool::Tolerance(theFace);
// Create offset surface.
// Any existing transformation is applied to the surface.
// New face will have null transformation.
Handle(Geom_Surface) aS = BRep_Tool::Surface(theFace);
aS = BRepOffset::CollapseSingularities (aS, theFace, myTolerance);
aS = BRepOffset::CollapseSingularities(aS, theFace, myTolerance);
// Take into account face orientation.
Standard_Real aMult = 1.0;
@@ -231,20 +213,19 @@ void BRepOffset_SimpleOffset::FillFaceData(const TopoDS_Face& theFace)
aMult = -1.0;
BRepOffset_Status aStatus; // set by BRepOffset::Surface(), could be used to check result...
aNFD.myOffsetS = BRepOffset::Surface (aS, aMult * myOffsetValue, aStatus, Standard_True);
aNFD.myL = TopLoc_Location(); // Null transformation.
aNFD.myOffsetS = BRepOffset::Surface(aS, aMult * myOffsetValue, aStatus, Standard_True);
aNFD.myL = TopLoc_Location(); // Null transformation.
// Save offset surface in map.
myFaceInfo.Bind(theFace, aNFD);
}
//=============================================================================
//function : FillEdgeData
//purpose :
//=============================================================================
void BRepOffset_SimpleOffset::FillEdgeData(const TopoDS_Edge& theEdge,
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeFaceMap,
const Standard_Integer theIdx)
//=================================================================================================
void BRepOffset_SimpleOffset::FillEdgeData(
const TopoDS_Edge& theEdge,
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeFaceMap,
const Standard_Integer theIdx)
{
const TopTools_ListOfShape& aFacesList = theEdgeFaceMap(theIdx);
@@ -258,18 +239,18 @@ void BRepOffset_SimpleOffset::FillEdgeData(const TopoDS_Edge& theEdge,
return;
// No need to deal with transformation - it is applied in fill faces data method.
const NewFaceData & aNFD = myFaceInfo.Find(aCurrFace);
const NewFaceData& aNFD = myFaceInfo.Find(aCurrFace);
Handle(Geom_Surface) anOffsetSurf = aNFD.myOffsetS;
// Compute offset 3d curve.
Standard_Real aF, aL;
Standard_Real aF, aL;
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theEdge, aCurrFace, aF, aL);
BRepBuilderAPI_MakeEdge anEdgeMaker(aC2d, anOffsetSurf, aF, aL);
TopoDS_Edge aNewEdge = anEdgeMaker.Edge();
TopoDS_Edge aNewEdge = anEdgeMaker.Edge();
// Compute max tolerance. Vertex tolerance usage is taken from existing offset computation algorithm.
// This piece of code significantly influences resulting performance.
// Compute max tolerance. Vertex tolerance usage is taken from existing offset computation
// algorithm. This piece of code significantly influences resulting performance.
Standard_Real aTol = BRep_Tool::MaxTolerance(theEdge, TopAbs_VERTEX);
BRepLib::BuildCurves3d(aNewEdge, aTol);
@@ -277,9 +258,9 @@ void BRepOffset_SimpleOffset::FillEdgeData(const TopoDS_Edge& theEdge,
aNED.myOffsetC = BRep_Tool::Curve(aNewEdge, aNED.myL, aF, aL);
// Iterate over adjacent faces for the current edge and compute max deviation.
Standard_Real anEdgeTol = 0.0;
Standard_Real anEdgeTol = 0.0;
TopTools_ListOfShape::Iterator anIter(aFacesList);
for ( ; !aNED.myOffsetC.IsNull() && anIter.More() ; anIter.Next())
for (; !aNED.myOffsetC.IsNull() && anIter.More(); anIter.Next())
{
const TopoDS_Face& aCurFace = TopoDS::Face(anIter.Value());
@@ -287,10 +268,12 @@ void BRepOffset_SimpleOffset::FillEdgeData(const TopoDS_Edge& theEdge,
continue;
// Create offset curve on surface.
const Handle(Geom2d_Curve) aC2dNew = BRep_Tool::CurveOnSurface(theEdge, aCurFace, aF, aL);
const Handle(Geom2d_Curve) aC2dNew = BRep_Tool::CurveOnSurface(theEdge, aCurFace, aF, aL);
const Handle(Adaptor2d_Curve2d) aHCurve2d = new Geom2dAdaptor_Curve(aC2dNew, aF, aL);
const Handle(Adaptor3d_Surface) aHSurface = new GeomAdaptor_Surface(myFaceInfo.Find(aCurFace).myOffsetS);
const Handle(Adaptor3d_CurveOnSurface) aCurveOnSurf = new Adaptor3d_CurveOnSurface(aHCurve2d, aHSurface);
const Handle(Adaptor3d_Surface) aHSurface =
new GeomAdaptor_Surface(myFaceInfo.Find(aCurFace).myOffsetS);
const Handle(Adaptor3d_CurveOnSurface) aCurveOnSurf =
new Adaptor3d_CurveOnSurface(aHCurve2d, aHSurface);
// Extract 3d-curve (it is not null).
const Handle(Adaptor3d_Curve) aCurve3d = new GeomAdaptor_Curve(aNED.myOffsetC, aF, aL);
@@ -301,7 +284,7 @@ void BRepOffset_SimpleOffset::FillEdgeData(const TopoDS_Edge& theEdge,
if (aValidateEdge.IsDone())
{
Standard_Real aMaxTol1 = aValidateEdge.GetMaxDistance();
anEdgeTol = Max (anEdgeTol, aMaxTol1);
anEdgeTol = Max(anEdgeTol, aMaxTol1);
}
}
aNED.myTol = Max(BRep_Tool::Tolerance(aNewEdge), anEdgeTol);
@@ -310,13 +293,12 @@ void BRepOffset_SimpleOffset::FillEdgeData(const TopoDS_Edge& theEdge,
myEdgeInfo.Bind(theEdge, aNED);
}
//=============================================================================
//function : FillVertexData
//purpose :
//=============================================================================
void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
const TopTools_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
const Standard_Integer theIdx)
//=================================================================================================
void BRepOffset_SimpleOffset::FillVertexData(
const TopoDS_Vertex& theVertex,
const TopTools_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
const Standard_Integer theIdx)
{
// Algorithm:
// Find adjacent edges for the given vertex.
@@ -338,7 +320,7 @@ void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
// Iterate over adjacent edges.
TopTools_ListOfShape::Iterator anIterEdges(aEdgesList);
for (; anIterEdges.More() ; anIterEdges.Next() )
for (; anIterEdges.More(); anIterEdges.Next())
{
const TopoDS_Edge& aCurrEdge = TopoDS::Edge(anIterEdges.Value());
@@ -346,7 +328,7 @@ void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
continue; // Skip shared edges with wrong orientation.
// Find the closest bound.
Standard_Real aF, aL;
Standard_Real aF, aL;
Handle(Geom_Curve) aC3d = BRep_Tool::Curve(aCurrEdge, aF, aL);
// Protection from degenerated edges.
@@ -363,13 +345,14 @@ void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
if (aSqDistL < aSqDistF)
{
// Square distance to last point is closer.
aMinParam = aL; aMaxParam = aF;
aMinParam = aL;
aMaxParam = aF;
}
// Compute point on offset edge.
const NewEdgeData& aNED = myEdgeInfo.Find(aCurrEdge);
const Handle(Geom_Curve) &anOffsetCurve = aNED.myOffsetC;
const gp_Pnt anOffsetPoint = anOffsetCurve->Value(aMinParam);
const NewEdgeData& aNED = myEdgeInfo.Find(aCurrEdge);
const Handle(Geom_Curve)& anOffsetCurve = aNED.myOffsetC;
const gp_Pnt anOffsetPoint = anOffsetCurve->Value(aMinParam);
anOffsetPointVec.Append(anOffsetPoint);
// Handle situation when edge is closed.
@@ -387,9 +370,7 @@ void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
// NCollection_Vector starts from 0 by default.
// It's better to use lower() and upper() in this case instead of direct indexes range.
gp_Pnt aCenter(0.0, 0.0, 0.0);
for(Standard_Integer i = anOffsetPointVec.Lower();
i <= anOffsetPointVec.Upper();
++i)
for (Standard_Integer i = anOffsetPointVec.Lower(); i <= anOffsetPointVec.Upper(); ++i)
{
aCenter.SetXYZ(aCenter.XYZ() + anOffsetPointVec.Value(i).XYZ());
}
@@ -397,9 +378,7 @@ void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
// Compute max distance.
Standard_Real aSqMaxDist = 0.0;
for(Standard_Integer i = anOffsetPointVec.Lower();
i <= anOffsetPointVec.Upper();
++i)
for (Standard_Integer i = anOffsetPointVec.Lower(); i <= anOffsetPointVec.Upper(); ++i)
{
const Standard_Real aSqDist = aCenter.SquareDistance(anOffsetPointVec.Value(i));
if (aSqDist > aSqMaxDist)
@@ -409,8 +388,8 @@ void BRepOffset_SimpleOffset::FillVertexData(const TopoDS_Vertex& theVertex,
const Standard_Real aResTol = Max(aMaxEdgeTol, Sqrt(aSqMaxDist));
const Standard_Real aMultCoeff = 1.001; // Avoid tolernace problems.
NewVertexData aNVD;
aNVD.myP = aCenter;
NewVertexData aNVD;
aNVD.myP = aCenter;
aNVD.myTol = aResTol * aMultCoeff;
// Save computed vertex info.

View File

@@ -28,7 +28,6 @@
#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class BRepOffset_SimpleOffset;
DEFINE_STANDARD_HANDLE(BRepOffset_SimpleOffset, BRepTools_Modification)
@@ -39,12 +38,12 @@ DEFINE_STANDARD_HANDLE(BRepOffset_SimpleOffset, BRepTools_Modification)
//! - Each surface is mapped to its geometric offset surface.
//! - For each edge, pcurves are mapped to the same pcurves on offset surfaces.
//! - For each edge, 3d curve is constructed by re-approximation of pcurve on the first offset face.
//! - Position of each vertex in a result shell is computed as average point of all ends of edges shared by that vertex.
//! - Position of each vertex in a result shell is computed as average point of all ends of edges
//! shared by that vertex.
//! - Tolerances are updated according to the resulting geometry.
class BRepOffset_SimpleOffset : public BRepTools_Modification
{
public:
DEFINE_STANDARD_RTTI_INLINE(BRepOffset_SimpleOffset, BRepTools_Modification)
//! Constructor.
@@ -66,12 +65,12 @@ public:
//! 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;
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
@@ -79,19 +78,19 @@ public:
//! 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;
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;
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>
@@ -99,22 +98,22 @@ public:
//! 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;
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;
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>.
@@ -122,47 +121,46 @@ public:
//! <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;
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;
private:
//! Method to fill new face data for single face.
void FillFaceData(const TopoDS_Face& theFace);
//! Method to fill new edge data for single edge.
void FillEdgeData(const TopoDS_Edge& theEdge,
void FillEdgeData(const TopoDS_Edge& theEdge,
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeFaceMap,
const Standard_Integer theIdx);
const Standard_Integer theIdx);
//! Method to fill new vertex data for single vertex.
void FillVertexData(const TopoDS_Vertex& theVertex,
void FillVertexData(const TopoDS_Vertex& theVertex,
const TopTools_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
const Standard_Integer theIdx);
const Standard_Integer theIdx);
struct NewFaceData
{
Handle(Geom_Surface) myOffsetS;
TopLoc_Location myL;
Standard_Real myTol;
Standard_Boolean myRevWires;
Standard_Boolean myRevFace;
TopLoc_Location myL;
Standard_Real myTol;
Standard_Boolean myRevWires;
Standard_Boolean myRevFace;
};
struct NewEdgeData
{
Handle(Geom_Curve) myOffsetC; // Resulting curve.
TopLoc_Location myL;
Standard_Real myTol;
TopLoc_Location myL;
Standard_Real myTol;
};
struct NewVertexData
{
gp_Pnt myP;
gp_Pnt myP;
Standard_Real myTol;
};

View File

@@ -24,10 +24,10 @@
//! Unknown : e.g. for a Beziersurf
enum BRepOffset_Status
{
BRepOffset_Good,
BRepOffset_Reversed,
BRepOffset_Degenerated,
BRepOffset_Unknown
BRepOffset_Good,
BRepOffset_Reversed,
BRepOffset_Degenerated,
BRepOffset_Unknown
};
#endif // _BRepOffset_Status_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -39,94 +39,92 @@ class BRepAlgo_AsDes;
class BRepAlgo_Image;
class Geom_Curve;
class BRepOffset_Tool
class BRepOffset_Tool
{
public:
DEFINE_STANDARD_ALLOC
//! <V1> is the FirstVertex ,<V2> is the Last Vertex of <Edge>
//! taking account the orientation of Edge.
Standard_EXPORT static void EdgeVertices (const TopoDS_Edge& E, TopoDS_Vertex& V1, TopoDS_Vertex& V2);
Standard_EXPORT static void EdgeVertices(const TopoDS_Edge& E,
TopoDS_Vertex& V1,
TopoDS_Vertex& V2);
//! <E> is a section between <F1> and <F2>. Computes
//! <O1> the orientation of <E> in <F1> influenced by <F2>.
//! idem for <O2>.
Standard_EXPORT static void OrientSection (const TopoDS_Edge& E,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopAbs_Orientation& O1,
TopAbs_Orientation& O2);
Standard_EXPORT static void OrientSection(const TopoDS_Edge& E,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopAbs_Orientation& O1,
TopAbs_Orientation& O2);
//! Looks for the common Vertices and Edges between faces <theF1> and <theF2>.<br>
//! Returns TRUE if common shapes have been found.<br>
//! <theLE> will contain the found common edges;<br>
//! <theLV> will contain the found common vertices.
Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
TopTools_ListOfShape& theLE,
TopTools_ListOfShape& theLV);
//! Looks for the common shapes of type <theType> between shapes <theS1> and <theS2>.<br>
//! Returns TRUE if common shapes have been found.<br>
//! <theLSC> will contain the found common shapes.
Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const TopAbs_ShapeEnum theType,
TopTools_ListOfShape& theLSC);
TopTools_ListOfShape& theLSC);
//! Computes the Section between <F1> and <F2> the
//! edges solution are stored in <LInt1> with the
//! orientation on <F1>, the sames edges are stored in
//! <Lint2> with the orientation on <F2>.
Standard_EXPORT static void Inter3D (const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const TopoDS_Face& RefFace1,
const TopoDS_Face& RefFace2);
Standard_EXPORT static void Inter3D(const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const TopoDS_Face& RefFace1,
const TopoDS_Face& RefFace2);
//! Find if the edges <Edges> of the face <F2> are on
//! the face <F1>.
//! Set in <LInt1> <LInt2> the updated edges.
//! If all the edges are computed, returns true.
Standard_EXPORT static Standard_Boolean TryProject (const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopTools_ListOfShape& Edges,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side,
const Standard_Real TolConf);
Standard_EXPORT static void PipeInter (const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side);
Standard_EXPORT static void Inter2d (const TopoDS_Face& F,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
TopTools_ListOfShape& LV,
const Standard_Real Tol);
Standard_EXPORT static void InterOrExtent (const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side);
Standard_EXPORT static void CheckBounds (const TopoDS_Face& F,
const BRepOffset_Analyse& Analyse,
Standard_Boolean& enlargeU,
Standard_Boolean& enlargeVfirst,
Standard_Boolean& enlargeVlast);
Standard_EXPORT static Standard_Boolean TryProject(const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopTools_ListOfShape& Edges,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side,
const Standard_Real TolConf);
Standard_EXPORT static void PipeInter(const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side);
Standard_EXPORT static void Inter2d(const TopoDS_Face& F,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
TopTools_ListOfShape& LV,
const Standard_Real Tol);
Standard_EXPORT static void InterOrExtent(const TopoDS_Face& F1,
const TopoDS_Face& F2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopAbs_State Side);
Standard_EXPORT static void CheckBounds(const TopoDS_Face& F,
const BRepOffset_Analyse& Analyse,
Standard_Boolean& enlargeU,
Standard_Boolean& enlargeVfirst,
Standard_Boolean& enlargeVlast);
//! Returns True if The Surface of <NF> has changed.
//! if <ChangeGeom> is TRUE , the surface can be
//! changed .
@@ -143,69 +141,68 @@ public:
//! <theLenBeforeUfirst>, <theLenAfterUlast>, <theLenBeforeVfirst>, <theLenAfterVlast>
//! set the values of enlargement on correspondent directions.
//! If some of them equals -1, the default value of enlargement is used.
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F,
TopoDS_Face& NF,
const Standard_Boolean ChangeGeom,
const Standard_Boolean UpDatePCurve = Standard_False,
const Standard_Boolean enlargeU = Standard_True,
const Standard_Boolean enlargeVfirst = Standard_True,
const Standard_Boolean enlargeVlast = Standard_True,
const Standard_Integer theExtensionMode = 1,
const Standard_Real theLenBeforeUfirst = -1.,
const Standard_Real theLenAfterUlast = -1.,
const Standard_Real theLenBeforeVfirst = -1.,
const Standard_Real theLenAfterVlast = -1.);
Standard_EXPORT static void ExtentFace (const TopoDS_Face& F,
TopTools_DataMapOfShapeShape& ConstShapes,
TopTools_DataMapOfShapeShape& ToBuild,
const TopAbs_State Side,
const Standard_Real TolConf,
TopoDS_Face& NF);
Standard_EXPORT static Standard_Boolean EnLargeFace(
const TopoDS_Face& F,
TopoDS_Face& NF,
const Standard_Boolean ChangeGeom,
const Standard_Boolean UpDatePCurve = Standard_False,
const Standard_Boolean enlargeU = Standard_True,
const Standard_Boolean enlargeVfirst = Standard_True,
const Standard_Boolean enlargeVlast = Standard_True,
const Standard_Integer theExtensionMode = 1,
const Standard_Real theLenBeforeUfirst = -1.,
const Standard_Real theLenAfterUlast = -1.,
const Standard_Real theLenBeforeVfirst = -1.,
const Standard_Real theLenAfterVlast = -1.);
Standard_EXPORT static void ExtentFace(const TopoDS_Face& F,
TopTools_DataMapOfShapeShape& ConstShapes,
TopTools_DataMapOfShapeShape& ToBuild,
const TopAbs_State Side,
const Standard_Real TolConf,
TopoDS_Face& NF);
//! Via the wire explorer store in <NOnV1> for
//! an Edge <E> of <W> his Edge neighbour on the first
//! vertex <V1> of <E>.
//! Store in NOnV2 the Neighbour of <E>on the last
//! vertex <V2> of <E>.
Standard_EXPORT static void BuildNeighbour (const TopoDS_Wire& W,
const TopoDS_Face& F,
TopTools_DataMapOfShapeShape& NOnV1,
TopTools_DataMapOfShapeShape& NOnV2);
Standard_EXPORT static void BuildNeighbour(const TopoDS_Wire& W,
const TopoDS_Face& F,
TopTools_DataMapOfShapeShape& NOnV1,
TopTools_DataMapOfShapeShape& NOnV2);
//! Store in MVE for a vertex <V> in <S> the incident
//! edges <E> in <S>.
//! An Edge is Store only one Time for a vertex.
Standard_EXPORT static void MapVertexEdges (const TopoDS_Shape& S,
TopTools_DataMapOfShapeListOfShape& MVE);
Standard_EXPORT static void MapVertexEdges(const TopoDS_Shape& S,
TopTools_DataMapOfShapeListOfShape& MVE);
//! Remove the non valid part of an offsetshape
//! 1 - Remove all the free boundary and the faces
//! connex to such edges.
//! 2 - Remove all the shapes not valid in the result
//! (according to the side of offsetting)
//! in this version only the first point is implemented.
Standard_EXPORT static TopoDS_Shape Deboucle3D (const TopoDS_Shape& S,
const TopTools_MapOfShape& Boundary);
Standard_EXPORT static void CorrectOrientation (const TopoDS_Shape& SI,
const TopTools_IndexedMapOfShape& NewEdges,
Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& InitOffset,
const Standard_Real Offset);
Standard_EXPORT static Standard_Real Gabarit (const Handle(Geom_Curve)& aCurve);
Standard_EXPORT static TopoDS_Shape Deboucle3D(const TopoDS_Shape& S,
const TopTools_MapOfShape& Boundary);
Standard_EXPORT static void CorrectOrientation(const TopoDS_Shape& SI,
const TopTools_IndexedMapOfShape& NewEdges,
Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& InitOffset,
const Standard_Real Offset);
Standard_EXPORT static Standard_Real Gabarit(const Handle(Geom_Curve)& aCurve);
//! Compares the normal directions of the planar faces and returns
//! TRUE if the directions are the same with the given precision.<br>
Standard_EXPORT static Standard_Boolean CheckPlanesNormals(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
Standard_EXPORT static Standard_Boolean CheckPlanesNormals(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
const Standard_Real theTolAng = 1.e-8);
protected:
private:
};
#endif // _BRepOffset_Tool_HeaderFile