Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/IntTools_Tools.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 2000-11-16
0002 // Created by: Peter KURNEV
0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _IntTools_Tools_HeaderFile
0017 #define _IntTools_Tools_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <TopAbs_State.hxx>
0025 #include <IntTools_Curve.hxx>
0026 #include <NCollection_Sequence.hxx>
0027 #include <Precision.hxx>
0028 class TopoDS_Vertex;
0029 class TopoDS_Wire;
0030 class TopoDS_Face;
0031 class gp_Pnt2d;
0032 class TopoDS_Edge;
0033 class IntTools_CommonPrt;
0034 class gp_Pnt;
0035 class IntTools_Curve;
0036 class gp_Dir;
0037 class Geom_Curve;
0038 class Bnd_Box;
0039 class IntTools_Range;
0040 class gp_Lin;
0041 class gp_Pln;
0042 class Geom2d_Curve;
0043 class Geom_Surface;
0044 
0045 //! The class contains handy static functions
0046 //! dealing with the geometry and topology.
0047 class IntTools_Tools
0048 {
0049 public:
0050   DEFINE_STANDARD_ALLOC
0051 
0052   //! Computes distance between vertex V1 and vertex V2,
0053   //! if the distance is less than sum of vertex tolerances
0054   //! returns zero,
0055   //! otherwise returns negative value
0056   Standard_EXPORT static int ComputeVV(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0057 
0058   //! Returns True if wire aW contains edges
0059   //! with INTERNAL orientation
0060   Standard_EXPORT static bool HasInternalEdge(const TopoDS_Wire& aW);
0061 
0062   //! Build a face based on surface of given face aF
0063   //! and bounded by wire aW
0064   Standard_EXPORT static void MakeFaceFromWireAndFace(const TopoDS_Wire& aW,
0065                                                       const TopoDS_Face& aF,
0066                                                       TopoDS_Face&       aFNew);
0067 
0068   Standard_EXPORT static TopAbs_State ClassifyPointByFace(const TopoDS_Face& aF, const gp_Pnt2d& P);
0069 
0070   //! Computes square distance between a point on the edge E
0071   //! corresponded to parameter t and vertices of edge E.
0072   //! Returns True if this distance is less than square
0073   //! tolerance of vertex, otherwise returns false.
0074   Standard_EXPORT static bool IsVertex(const TopoDS_Edge& E, const double t);
0075 
0076   //! Returns True if square distance between vertex V
0077   //! and a point on the edge E corresponded to parameter t
0078   //! is less than square tolerance of V
0079   Standard_EXPORT static bool IsVertex(const TopoDS_Edge&   E,
0080                                        const TopoDS_Vertex& V,
0081                                        const double         t);
0082 
0083   //! Returns True if IsVertx for middle parameter of fist range
0084   //! and first edge returns True
0085   //! and if IsVertex for middle parameter of second range and
0086   //! second range returns True,
0087   //! otherwise returns False
0088   Standard_EXPORT static bool IsVertex(const IntTools_CommonPrt& aCmnPrt);
0089 
0090   //! Gets boundary of parameters of E1 and E2.
0091   //! Computes 3d points on each corresponded to average parameters.
0092   //! Returns True if distance between computed points is less than
0093   //! sum of edge tolerance, otherwise returns False.
0094   Standard_EXPORT static bool IsMiddlePointsEqual(const TopoDS_Edge& E1, const TopoDS_Edge& E2);
0095 
0096   //! Returns True if the distance between point aP and
0097   //! vertex aV is less or equal to sum of aTolPV and
0098   //! vertex tolerance, otherwise returns False
0099   Standard_EXPORT static bool IsVertex(const gp_Pnt&        aP,
0100                                        const double         aTolPV,
0101                                        const TopoDS_Vertex& aV);
0102 
0103   //! Returns some value between aFirst and aLast
0104   Standard_EXPORT static double IntermediatePoint(const double aFirst, const double aLast);
0105 
0106   //! Split aC by average parameter if aC is closed in 3D.
0107   //! Returns positive value if splitting has been done,
0108   //! otherwise returns zero.
0109   Standard_EXPORT static int SplitCurve(const IntTools_Curve&                 aC,
0110                                         NCollection_Sequence<IntTools_Curve>& aS);
0111 
0112   //! Puts curves from aSIn to aSOut except those curves that
0113   //! are coincide with first curve from aSIn.
0114   Standard_EXPORT static void RejectLines(const NCollection_Sequence<IntTools_Curve>& aSIn,
0115                                           NCollection_Sequence<IntTools_Curve>&       aSOut);
0116 
0117   //! Returns True if D1 and D2 coincide
0118   Standard_EXPORT static bool IsDirsCoinside(const gp_Dir& D1, const gp_Dir& D2);
0119 
0120   //! Returns True if D1 and D2 coincide with given tolerance
0121   Standard_EXPORT static bool IsDirsCoinside(const gp_Dir& D1, const gp_Dir& D2, const double aTol);
0122 
0123   //! Returns True if aC is BoundedCurve from Geom and
0124   //! the distance between first point
0125   //! of the curve aC and last point
0126   //! is less than 1.e-12
0127   Standard_EXPORT static bool IsClosed(const occ::handle<Geom_Curve>& aC);
0128 
0129   //! Returns adaptive tolerance for given aTolBase
0130   //! if aC is trimmed curve and basis curve is parabola,
0131   //! otherwise returns value of aTolBase
0132   Standard_EXPORT static double CurveTolerance(const occ::handle<Geom_Curve>& aC,
0133                                                const double                   aTolBase);
0134 
0135   //! Checks if the curve is not covered by the default tolerance (confusion).
0136   //! Builds bounding box for the curve and stores it into <theBox>.
0137   Standard_EXPORT static bool CheckCurve(const IntTools_Curve& theCurve, Bnd_Box& theBox);
0138 
0139   Standard_EXPORT static bool IsOnPave(const double          theT,
0140                                        const IntTools_Range& theRange,
0141                                        const double          theTol);
0142 
0143   Standard_EXPORT static void VertexParameters(const IntTools_CommonPrt& theCP,
0144                                                double&                   theT1,
0145                                                double&                   theT2);
0146 
0147   Standard_EXPORT static void VertexParameter(const IntTools_CommonPrt& theCP, double& theT);
0148 
0149   Standard_EXPORT static bool IsOnPave1(const double          theT,
0150                                         const IntTools_Range& theRange,
0151                                         const double          theTol);
0152 
0153   //! Checks if the range <theR> interfere with the range <theRRef>
0154   Standard_EXPORT static bool IsInRange(const IntTools_Range& theRRef,
0155                                         const IntTools_Range& theR,
0156                                         const double          theTol);
0157 
0158   Standard_EXPORT static int SegPln(const gp_Lin& theLin,
0159                                     const double  theTLin1,
0160                                     const double  theTLin2,
0161                                     const double  theTolLin,
0162                                     const gp_Pln& thePln,
0163                                     const double  theTolPln,
0164                                     gp_Pnt&       theP,
0165                                     double&       theT,
0166                                     double&       theTolP,
0167                                     double&       theTmin,
0168                                     double&       theTmax);
0169 
0170   //! Computes the max distance between points
0171   //! taken from 3D and 2D curves by the same parameter
0172   Standard_EXPORT static bool ComputeTolerance(const occ::handle<Geom_Curve>&   theCurve3D,
0173                                                const occ::handle<Geom2d_Curve>& theCurve2D,
0174                                                const occ::handle<Geom_Surface>& theSurf,
0175                                                const double                     theFirst,
0176                                                const double                     theLast,
0177                                                double&                          theMaxDist,
0178                                                double&                          theMaxPar,
0179                                                const double theTolRange = Precision::PConfusion(),
0180                                                const bool   theToRunParallel = false);
0181 
0182   //! Computes the correct Intersection range for
0183   //! Line/Line, Line/Plane and Plane/Plane intersections
0184   Standard_EXPORT static double ComputeIntRange(const double theTol1,
0185                                                 const double theTol2,
0186                                                 const double theAngle);
0187 };
0188 
0189 #endif // _IntTools_Tools_HeaderFile