Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:23:50

0001 // Created on: 1998-06-03
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ShapeCustom_HeaderFile
0018 #define _ShapeCustom_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Shape.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <GeomAbs_Shape.hxx>
0030 #include <Message_ProgressRange.hxx>
0031 
0032 class TopoDS_Shape;
0033 class BRepTools_Modification;
0034 class BRepTools_Modifier;
0035 class ShapeBuild_ReShape;
0036 class ShapeCustom_RestrictionParameters;
0037 
0038 //! This package is intended to
0039 //! convert geometrical objects and topological. The
0040 //! modifications of one geometrical object to another
0041 //! (one) geometrical object are provided. The supported
0042 //! modifications are the following:
0043 //! conversion of BSpline and Bezier surfaces to analytical form,
0044 //! conversion of indirect elementary surfaces (with left-handed
0045 //! coordinate systems) into direct ones,
0046 //! conversion of elementary surfaces to surfaces of revolution,
0047 //! conversion of surface of linear extrusion, revolution, offset
0048 //! surface to bspline,
0049 //! modification of parameterization, degree, number of segments of bspline
0050 //! surfaces, scale the shape.
0051 class ShapeCustom
0052 {
0053 public:
0054   DEFINE_STANDARD_ALLOC
0055 
0056   //! Applies modifier to shape and checks sharing in the case assemblies.
0057   Standard_EXPORT static TopoDS_Shape ApplyModifier(
0058     const TopoDS_Shape&                                                       S,
0059     const occ::handle<BRepTools_Modification>&                                M,
0060     NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>& context,
0061     BRepTools_Modifier&                                                       MD,
0062     const Message_ProgressRange&           theProgress = Message_ProgressRange(),
0063     const occ::handle<ShapeBuild_ReShape>& aReShape    = nullptr);
0064 
0065   //! Returns a new shape without indirect surfaces.
0066   Standard_EXPORT static TopoDS_Shape DirectFaces(const TopoDS_Shape& S);
0067 
0068   //! Returns a new shape which is scaled original
0069   Standard_EXPORT static TopoDS_Shape ScaleShape(const TopoDS_Shape& S, const double scale);
0070 
0071   //! Returns a new shape with all surfaces, curves and pcurves
0072   //! which type is BSpline/Bezier or based on them converted
0073   //! having Degree less than <MaxDegree> or number of spans less
0074   //! than <NbMaxSegment> in dependence on parameter priority <Degree>.
0075   //! <GmaxDegree> and <GMaxSegments> are maximum possible degree
0076   //! and number of spans correspondingly.
0077   //! These values will be used in those cases when approximation with
0078   //! specified parameters is impossible and one of GmaxDegree or
0079   //! GMaxSegments is selected in dependence on priority.
0080   //! Note that even if approximation is impossible with <GMaxDegree>
0081   //! then number of spans can exceed specified <GMaxSegment>
0082   //! <Rational> specifies if to convert Rational BSpline/Bezier into
0083   //! polynomial B-Spline.
0084   //! If flags ConvOffSurf,ConvOffCurve3d,ConvOffCurve2d are true there are means
0085   //! that Offset surfaces , Offset curves 3d and Offset curves 2d are converted to BSPline
0086   //! correspondingly.
0087   Standard_EXPORT static TopoDS_Shape BSplineRestriction(
0088     const TopoDS_Shape&                                   S,
0089     const double                                          Tol3d,
0090     const double                                          Tol2d,
0091     const int                                             MaxDegree,
0092     const int                                             MaxNbSegment,
0093     const GeomAbs_Shape                                   Continuity3d,
0094     const GeomAbs_Shape                                   Continuity2d,
0095     const bool                                            Degree,
0096     const bool                                            Rational,
0097     const occ::handle<ShapeCustom_RestrictionParameters>& aParameters);
0098 
0099   //! Returns a new shape with all elementary periodic surfaces converted
0100   //! to Geom_SurfaceOfRevolution
0101   Standard_EXPORT static TopoDS_Shape ConvertToRevolution(const TopoDS_Shape& S);
0102 
0103   //! Returns a new shape with all surfaces of revolution and linear extrusion
0104   //! convert to elementary periodic surfaces
0105   Standard_EXPORT static TopoDS_Shape SweptToElementary(const TopoDS_Shape& S);
0106 
0107   //! Returns a new shape with all surfaces of linear extrusion, revolution,
0108   //! offset, and planar surfaces converted according to flags to
0109   //! Geom_BSplineSurface (with same parameterisation).
0110   Standard_EXPORT static TopoDS_Shape ConvertToBSpline(const TopoDS_Shape& S,
0111                                                        const bool          extrMode,
0112                                                        const bool          revolMode,
0113                                                        const bool          offsetMode,
0114                                                        const bool          planeMode = false);
0115 };
0116 
0117 #endif // _ShapeCustom_HeaderFile