File indexing completed on 2026-06-04 08:44:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _ShapeAnalysis_CanonicalRecognition_HeaderFile
0015 #define _ShapeAnalysis_CanonicalRecognition_HeaderFile
0016
0017 #include <Standard.hxx>
0018 #include <Standard_DefineAlloc.hxx>
0019 #include <Standard_Handle.hxx>
0020
0021 #include <Standard_Boolean.hxx>
0022 #include <Standard_Integer.hxx>
0023 #include <TopAbs_ShapeEnum.hxx>
0024 #include <TopoDS_Shape.hxx>
0025 #include <TopoDS_Shell.hxx>
0026 #include <TopoDS_Face.hxx>
0027 #include <TopoDS_Wire.hxx>
0028 #include <TopoDS_Edge.hxx>
0029 #include <GeomAbs_SurfaceType.hxx>
0030 #include <GeomAbs_CurveType.hxx>
0031 #include <GeomConvert_ConvType.hxx>
0032 #include <TColStd_Array1OfReal.hxx>
0033
0034 class gp_Pln;
0035 class gp_Cone;
0036 class gp_Cylinder;
0037 class gp_Sphere;
0038 class gp_Lin;
0039 class gp_Circ;
0040 class gp_Elips;
0041 class Geom_Curve;
0042 class Geom_Surface;
0043
0044
0045
0046
0047 class ShapeAnalysis_CanonicalRecognition
0048 {
0049 public:
0050 DEFINE_STANDARD_ALLOC
0051
0052
0053 Standard_EXPORT ShapeAnalysis_CanonicalRecognition();
0054
0055
0056 Standard_EXPORT ShapeAnalysis_CanonicalRecognition(const TopoDS_Shape& theShape);
0057
0058
0059 Standard_EXPORT void SetShape(const TopoDS_Shape& theShape);
0060
0061
0062 const TopoDS_Shape& GetShape() const { return myShape; }
0063
0064
0065 Standard_Real GetGap() const { return myGap; }
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 Standard_Integer GetStatus() const { return myStatus; }
0077
0078
0079 void ClearStatus() { myStatus = 0; }
0080
0081
0082
0083 Standard_EXPORT Standard_Boolean IsPlane(const Standard_Real theTol, gp_Pln& thePln);
0084
0085
0086
0087 Standard_EXPORT Standard_Boolean IsCylinder(const Standard_Real theTol, gp_Cylinder& theCyl);
0088
0089
0090
0091 Standard_EXPORT Standard_Boolean IsCone(const Standard_Real theTol, gp_Cone& theCone);
0092
0093
0094
0095 Standard_EXPORT Standard_Boolean IsSphere(const Standard_Real theTol, gp_Sphere& theSphere);
0096
0097
0098
0099 Standard_EXPORT Standard_Boolean IsLine(const Standard_Real theTol, gp_Lin& theLin);
0100
0101
0102
0103 Standard_EXPORT Standard_Boolean IsCircle(const Standard_Real theTol, gp_Circ& theCirc);
0104
0105
0106
0107 Standard_EXPORT Standard_Boolean IsEllipse(const Standard_Real theTol, gp_Elips& theElips);
0108
0109 private:
0110 Standard_Boolean IsElementarySurf(const GeomAbs_SurfaceType theTarget,
0111 const Standard_Real theTol,
0112 gp_Ax3& thePos,
0113 TColStd_Array1OfReal& theParams);
0114
0115 Standard_Boolean IsConic(const GeomAbs_CurveType theTarget,
0116 const Standard_Real theTol,
0117 gp_Ax2& thePos,
0118 TColStd_Array1OfReal& theParams);
0119
0120 static Handle(Geom_Surface) GetSurface(const TopoDS_Face& theFace,
0121 const Standard_Real theTol,
0122 const GeomConvert_ConvType theType,
0123 const GeomAbs_SurfaceType theTarget,
0124 Standard_Real& theGap,
0125 Standard_Integer& theStatus);
0126
0127 static Handle(Geom_Surface) GetSurface(const TopoDS_Shell& theShell,
0128 const Standard_Real theTol,
0129 const GeomConvert_ConvType theType,
0130 const GeomAbs_SurfaceType theTarget,
0131 Standard_Real& theGap,
0132 Standard_Integer& theStatus);
0133
0134 static Handle(Geom_Surface) GetSurface(const TopoDS_Edge& theEdge,
0135 const Standard_Real theTol,
0136 const GeomConvert_ConvType theType,
0137 const GeomAbs_SurfaceType theTarget,
0138 gp_Ax3& thePos,
0139 TColStd_Array1OfReal& theParams,
0140 Standard_Real& theGap,
0141 Standard_Integer& theStatus);
0142
0143 static Handle(Geom_Surface) GetSurface(const TopoDS_Wire& theWire,
0144 const Standard_Real theTol,
0145 const GeomConvert_ConvType theType,
0146 const GeomAbs_SurfaceType theTarget,
0147 gp_Ax3& thePos,
0148 TColStd_Array1OfReal& theParams,
0149 Standard_Real& theGap,
0150 Standard_Integer& theStatus);
0151
0152 static Handle(Geom_Curve) GetCurve(const TopoDS_Edge& theEdge,
0153 const Standard_Real theTol,
0154 const GeomConvert_ConvType theType,
0155 const GeomAbs_CurveType theTarget,
0156 Standard_Real& theGap,
0157 Standard_Integer& theStatus);
0158
0159 static Standard_Boolean GetSurfaceByLS(const TopoDS_Wire& theWire,
0160 const Standard_Real theTol,
0161 const GeomAbs_SurfaceType theTarget,
0162 gp_Ax3& thePos,
0163 TColStd_Array1OfReal& theParams,
0164 Standard_Real& theGap,
0165 Standard_Integer& theStatus);
0166
0167 void Init(const TopoDS_Shape& theShape);
0168
0169 private:
0170 TopoDS_Shape myShape;
0171 TopAbs_ShapeEnum mySType;
0172 Standard_Real myGap;
0173 Standard_Integer myStatus;
0174 };
0175
0176 #endif