File indexing completed on 2025-01-18 10:04:54
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
0051 DEFINE_STANDARD_ALLOC
0052
0053
0054
0055 Standard_EXPORT ShapeAnalysis_CanonicalRecognition();
0056
0057
0058 Standard_EXPORT ShapeAnalysis_CanonicalRecognition(const TopoDS_Shape& theShape);
0059
0060
0061 Standard_EXPORT void SetShape(const TopoDS_Shape& theShape);
0062
0063
0064 const TopoDS_Shape& GetShape() const
0065 {
0066 return myShape;
0067 }
0068
0069
0070 Standard_Real GetGap() const
0071 {
0072 return myGap;
0073 }
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 Standard_Integer GetStatus() const
0085 {
0086 return myStatus;
0087 }
0088
0089
0090 void ClearStatus()
0091 {
0092 myStatus = 0;
0093 }
0094
0095
0096
0097 Standard_EXPORT Standard_Boolean IsPlane(const Standard_Real theTol, gp_Pln& thePln);
0098
0099
0100
0101 Standard_EXPORT Standard_Boolean IsCylinder(const Standard_Real theTol, gp_Cylinder& theCyl);
0102
0103
0104
0105 Standard_EXPORT Standard_Boolean IsCone(const Standard_Real theTol, gp_Cone& theCone);
0106
0107
0108
0109 Standard_EXPORT Standard_Boolean IsSphere(const Standard_Real theTol, gp_Sphere& theSphere);
0110
0111
0112
0113 Standard_EXPORT Standard_Boolean IsLine(const Standard_Real theTol, gp_Lin& theLin);
0114
0115
0116
0117 Standard_EXPORT Standard_Boolean IsCircle(const Standard_Real theTol, gp_Circ& theCirc);
0118
0119
0120
0121 Standard_EXPORT Standard_Boolean IsEllipse(const Standard_Real theTol, gp_Elips& theElips);
0122
0123
0124 private:
0125 Standard_Boolean IsElementarySurf(const GeomAbs_SurfaceType theTarget, const Standard_Real theTol,
0126 gp_Ax3& thePos, TColStd_Array1OfReal& theParams);
0127
0128 Standard_Boolean IsConic(const GeomAbs_CurveType theTarget, const Standard_Real theTol,
0129 gp_Ax2& thePos, TColStd_Array1OfReal& theParams);
0130
0131 static Handle(Geom_Surface) GetSurface(const TopoDS_Face& theFace, const Standard_Real theTol,
0132 const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
0133 Standard_Real& theGap, Standard_Integer& theStatus);
0134
0135 static Handle(Geom_Surface) GetSurface(const TopoDS_Shell& theShell, const Standard_Real theTol,
0136 const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
0137 Standard_Real& theGap, Standard_Integer& theStatus);
0138
0139 static Handle(Geom_Surface) GetSurface(const TopoDS_Edge& theEdge, const Standard_Real theTol,
0140 const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
0141 gp_Ax3& thePos, TColStd_Array1OfReal& theParams,
0142 Standard_Real& theGap, Standard_Integer& theStatus);
0143
0144 static Handle(Geom_Surface) GetSurface(const TopoDS_Wire& theWire, const Standard_Real theTol,
0145 const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
0146 gp_Ax3& thePos, TColStd_Array1OfReal& theParams,
0147 Standard_Real& theGap, Standard_Integer& theStatus);
0148
0149 static Handle(Geom_Curve) GetCurve(const TopoDS_Edge& theEdge, const Standard_Real theTol,
0150 const GeomConvert_ConvType theType, const GeomAbs_CurveType theTarget,
0151 Standard_Real& theGap, Standard_Integer& theStatus);
0152
0153 static Standard_Boolean GetSurfaceByLS(const TopoDS_Wire& theWire, const Standard_Real theTol,
0154 const GeomAbs_SurfaceType theTarget,
0155 gp_Ax3& thePos, TColStd_Array1OfReal& theParams,
0156 Standard_Real& theGap, Standard_Integer& theStatus);
0157
0158 void Init(const TopoDS_Shape& theShape);
0159
0160 private:
0161
0162 TopoDS_Shape myShape;
0163 TopAbs_ShapeEnum mySType;
0164 Standard_Real myGap;
0165 Standard_Integer myStatus;
0166
0167 };
0168
0169 #endif