Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:54

0001 // Created on: 1999-09-13
0002 // Created by: data exchange team
0003 // Copyright (c) 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 _ShapeAnalysis_CheckSmallFace_HeaderFile
0018 #define _ShapeAnalysis_CheckSmallFace_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <TopTools_DataMapOfShapeListOfShape.hxx>
0026 #include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
0027 #include <TopTools_DataMapOfShapeShape.hxx>
0028 #include <ShapeExtend_Status.hxx>
0029 class TopoDS_Face;
0030 class gp_Pnt;
0031 class TopoDS_Edge;
0032 class TopoDS_Compound;
0033 
0034 // resolve name collisions with X11 headers
0035 #ifdef Status
0036   #undef Status
0037 #endif
0038 
0039 //! Analysis of the face size
0040 class ShapeAnalysis_CheckSmallFace 
0041 {
0042 public:
0043 
0044   DEFINE_STANDARD_ALLOC
0045 
0046   
0047   //! Creates an empty tool
0048   //! Checks a Shape i.e. each of its faces, records checks as
0049   //! diagnostics in the <infos>
0050   //!
0051   //! If <infos> has not been set before, no check is done
0052   //!
0053   //! For faces which are in a Shell, topological data are recorded
0054   //! to allow recovering connectivities after fixing or removing
0055   //! the small faces or parts of faces
0056   //! Enchains various checks on a face
0057   //! inshell : to compute more information, relevant to topology
0058   Standard_EXPORT ShapeAnalysis_CheckSmallFace();
0059   
0060   //! Checks if a Face is as a Spot
0061   //! Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
0062   //! same
0063   //! By default, considers the tolerance zone of its vertices
0064   //! A given value <tol> may be given to check a spot of this size
0065   //! If a Face is a Spot, its location is returned in <spot>, and
0066   //! <spotol> returns an equivalent tolerance, which is computed as
0067   //! half of max dimension of min-max box of the face
0068   Standard_EXPORT Standard_Integer IsSpotFace (const TopoDS_Face& F, gp_Pnt& spot, Standard_Real& spotol, const Standard_Real tol = -1.0) const;
0069   
0070   //! Acts as IsSpotFace, but records in <infos> a diagnostic
0071   //! "SpotFace" with the Pnt as value (data "Location")
0072   Standard_EXPORT Standard_Boolean CheckSpotFace (const TopoDS_Face& F, const Standard_Real tol = -1.0);
0073   
0074   //! Checks if a Face lies on a Surface which is a strip
0075   //! So the Face is a strip. But a Face may be a strip elsewhere ..
0076   //!
0077   //! A given value <tol> may be given to check max width
0078   //! By default, considers the tolerance zone of its edges
0079   //! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
0080   Standard_EXPORT Standard_Boolean IsStripSupport (const TopoDS_Face& F, const Standard_Real tol = -1.0);
0081   
0082   //! Checks if two edges define a strip, i.e. distance maxi below
0083   //! tolerance, given or some of those of E1 and E2
0084   Standard_EXPORT Standard_Boolean CheckStripEdges (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax) const;
0085   
0086   //! Searches for two and only two edges up tolerance
0087   //! Returns True if OK, false if not 2 edges
0088   //! If True, returns the two edges and their maximum distance
0089   Standard_EXPORT Standard_Boolean FindStripEdges (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax);
0090   
0091   //! Checks if a Face is a single strip, i.e. brings two great
0092   //! edges which are confused on their whole length, possible other
0093   //! edges are small or null length
0094   //!
0095   //! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
0096   //! Records diagnostic in info if it is a single strip
0097   Standard_EXPORT Standard_Boolean CheckSingleStrip (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
0098   
0099   //! Checks if a Face is as a Strip
0100   //! Returns 0 if not or non determined, 1 if in U, 2 if in V
0101   //! By default, considers the tolerance zone of its edges
0102   //! A given value <tol> may be given to check a strip of max this width
0103   //!
0104   //! If a Face is determined as a Strip, it is delinited by two
0105   //! lists of edges. These lists are recorded in diagnostic
0106   //! Diagnostic "StripFace" brings data "Direction" (U or V),
0107   //! "List1" , "List2" (if they could be computed)
0108   Standard_EXPORT Standard_Boolean CheckStripFace (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
0109   
0110   //! Checks if a Face brings vertices which split it, either
0111   //! confused with non adjacent vertices, or confused with their
0112   //! projection on non adjacent edges
0113   //! Returns the count of found splitting vertices
0114   //! Each vertex then brings a diagnostic "SplittingVertex",
0115   //! with data : "Face" for the face, "Edge" for the split edge
0116   Standard_EXPORT Standard_Integer CheckSplittingVertices (const TopoDS_Face& F, TopTools_DataMapOfShapeListOfShape& MapEdges, ShapeAnalysis_DataMapOfShapeListOfReal& MapParam, TopoDS_Compound& theAllVert);
0117   
0118   //! Checks if a Face has a pin, which can be edited
0119   //! No singularity : no pin, returns 0
0120   //! If there is a pin, checked topics, with returned value :
0121   //! - 0 : nothing to do more
0122   //! - 1 : "smooth", i.e. not a really sharp pin
0123   //! -> diagnostic "SmoothPin"
0124   //! - 2 : stretched pin, i.e. is possible to relimit the face by
0125   //! another vertex, so that this vertex still gives a pin
0126   //! -> diagnostic "StretchedPin" with location of vertex (Pnt)
0127   Standard_EXPORT Standard_Boolean CheckPin (const TopoDS_Face& F, Standard_Integer& whatrow, Standard_Integer& sence);
0128   
0129   //! Checks if a Face is twisted (apart from checking Pin, i.e. it
0130   //! does not give information on pin, only "it is twisted")
0131   Standard_EXPORT Standard_Boolean CheckTwisted (const TopoDS_Face& F, Standard_Real& paramu, Standard_Real& paramv);
0132   
0133   Standard_EXPORT Standard_Boolean CheckPinFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& mapEdges, const Standard_Real toler = -1.0);
0134   
0135   Standard_EXPORT Standard_Boolean CheckPinEdges (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const Standard_Real coef1, const Standard_Real coef2, const Standard_Real toler) const;
0136   
0137   //! Returns the status of last call to Perform()
0138   //! ShapeExtend_OK   : face was OK, nothing done
0139   //! ShapeExtend_DONE1: some wires are fixed
0140   //! ShapeExtend_DONE2: orientation of wires fixed
0141   //! ShapeExtend_DONE3: missing seam added
0142   //! ShapeExtend_DONE4: small area wire removed
0143   //! ShapeExtend_DONE5: natural bounds added
0144   //! ShapeExtend_FAIL1: some fails during fixing wires
0145   //! ShapeExtend_FAIL2: cannot fix orientation of wires
0146   //! ShapeExtend_FAIL3: cannot add missing seam
0147   //! ShapeExtend_FAIL4: cannot remove small area wire
0148     Standard_Boolean Status (const ShapeExtend_Status status) const;
0149   
0150   //! Sets a fixed Tolerance to check small face
0151   //! By default, local tolerance zone is considered
0152   //! Sets a fixed MaxTolerance to check small face
0153   //! Sets a fixed Tolerance to check small face
0154   //! By default, local tolerance zone is considered
0155   //! Unset fixed tolerance, comes back to local tolerance zones
0156   //! Unset fixed tolerance, comes back to local tolerance zones
0157     void SetTolerance (const Standard_Real tol);
0158   
0159   //! Returns the tolerance to check small faces, negative value if
0160   //! local tolerances zones are to be considered
0161     Standard_Real Tolerance() const;
0162   
0163     Standard_Boolean StatusSpot (const ShapeExtend_Status status) const;
0164   
0165     Standard_Boolean StatusStrip (const ShapeExtend_Status status) const;
0166   
0167     Standard_Boolean StatusPin (const ShapeExtend_Status status) const;
0168   
0169     Standard_Boolean StatusTwisted (const ShapeExtend_Status status) const;
0170   
0171     Standard_Boolean StatusSplitVert (const ShapeExtend_Status status) const;
0172   
0173     Standard_Boolean StatusPinFace (const ShapeExtend_Status status) const;
0174   
0175     Standard_Boolean StatusPinEdges (const ShapeExtend_Status status) const;
0176 
0177 
0178 
0179 
0180 protected:
0181 
0182 
0183 
0184 
0185 
0186 private:
0187 
0188 
0189 
0190   TopoDS_Shape myComp;
0191   Standard_Integer myStatus;
0192   Standard_Integer myStatusSpot;
0193   Standard_Integer myStatusStrip;
0194   Standard_Integer myStatusPin;
0195   Standard_Integer myStatusTwisted;
0196   Standard_Integer myStatusSplitVert;
0197   Standard_Integer myStatusPinFace;
0198   Standard_Integer myStatusPinEdges;
0199   Standard_Real myPrecision;
0200 
0201 
0202 };
0203 
0204 
0205 #include <ShapeAnalysis_CheckSmallFace.lxx>
0206 
0207 
0208 
0209 
0210 
0211 #endif // _ShapeAnalysis_CheckSmallFace_HeaderFile