#include <TopoDS_Vertex.hxx>
#include <Poly_Triangulation.hxx>
+namespace {
+
//! Tool class implementing necessary functionality for copying geometry
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
{
public:
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
- const Standard_Boolean copyMesh = Standard_False)
+ const Standard_Boolean copyMesh)
: myCopyGeom(copyGeom),
myCopyMesh(copyMesh)
{
if (T.IsNull())
return Standard_False;
- T = T->Copy();
+ if (myCopyGeom)
+ T = T->Copy();
return Standard_True;
}
DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification)
+} // anonymous namespace
//=======================================================================
//function : BRepBuilderAPI_Copy
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
{
- myModification = new BRepBuilderAPI_Copy_Modification(Standard_True);
+ myModification = new BRepBuilderAPI_Copy_Modification(Standard_True, Standard_False);
}
#include <Standard_Handle.hxx>
#include <BRepBuilderAPI_ModifyShape.hxx>
-#include <Standard_Boolean.hxx>
-class TopoDS_Shape;
+class TopoDS_Shape;
//! Duplication of a shape.
//! A Copy object provides a framework for:
public:
DEFINE_STANDARD_ALLOC
-
//! Constructs an empty copy framework. Use the function
//! Perform to copy shapes.
//! Constructs a copy framework and copies the shape S.
//! Use the function Shape to access the result.
- //! If copyGeom is False, only topological objects will be copied, while
- //! geometry will be shared with original shape.
+ //! If copyMesh is True, triangulation contained in original shape will be
+ //! copied along with geometry (by default, triangulation gets lost).
+ //! If copyGeom is False, only topological objects will be copied, while
+ //! geometry and triangulation will be shared with original shape.
//! Note: the constructed framework can be reused to copy
//! other shapes: just specify them with the function Perform.
Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
//! Copies the shape S.
//! Use the function Shape to access the result.
- //! If copyGeom is False, only topological objects will be copied, while
- //! geometry will be shared with original shape.
+ //! If copyMesh is True, triangulation contained in original shape will be
+ //! copied along with geometry (by default, triangulation gets lost).
+ //! If copyGeom is False, only topological objects will be copied, while
+ //! geometry and triangulation will be shared with original shape.
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
};
-
-
-
-
-
-
#endif // _BRepBuilderAPI_Copy_HeaderFile
// relative z-range tolerance compatible with for floating point.
static Standard_Real zEpsilon (const Standard_Real theValue)
{
- if (theValue == 0)
+ Standard_Real anAbsValue = Abs (theValue);
+ if (anAbsValue <= (double)FLT_MIN)
{
- return FLT_EPSILON;
+ return FLT_MIN;
}
- Standard_Real aLogRadix = Log10 (Abs (theValue)) / Log10 (FLT_RADIX);
+ Standard_Real aLogRadix = Log10 (anAbsValue) / Log10 (FLT_RADIX);
Standard_Real aExp = Floor (aLogRadix);
return FLT_EPSILON * Pow (FLT_RADIX, aExp);
};