Back to home page

EIC code displayed by LXR

 
 

    


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

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_SequenceOfCurves.hxx>
0026 #include <Precision.hxx>
0027 class TopoDS_Vertex;
0028 class TopoDS_Wire;
0029 class TopoDS_Face;
0030 class gp_Pnt2d;
0031 class TopoDS_Edge;
0032 class IntTools_CommonPrt;
0033 class gp_Pnt;
0034 class IntTools_Curve;
0035 class gp_Dir;
0036 class Geom_Curve;
0037 class Bnd_Box;
0038 class IntTools_Range;
0039 class gp_Lin;
0040 class gp_Pln;
0041 class Geom2d_Curve;
0042 class Geom_Surface;
0043 
0044 
0045 
0046 //! The class contains handy static functions
0047 //! dealing with the geometry and topology.
0048 class IntTools_Tools 
0049 {
0050 public:
0051 
0052   DEFINE_STANDARD_ALLOC
0053 
0054   
0055 
0056   //! Computes distance between vertex V1 and vertex V2,
0057   //! if the distance is less than sum of vertex tolerances
0058   //! returns zero,
0059   //! otherwise returns negative value
0060   Standard_EXPORT static Standard_Integer ComputeVV (const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0061   
0062 
0063   //! Returns True if wire aW contains edges
0064   //! with INTERNAL orientation
0065   Standard_EXPORT static Standard_Boolean HasInternalEdge (const TopoDS_Wire& aW);
0066   
0067 
0068   //! Build a face based on surface of given face aF
0069   //! and bounded by wire aW
0070   Standard_EXPORT static void MakeFaceFromWireAndFace (const TopoDS_Wire& aW, const TopoDS_Face& aF, TopoDS_Face& aFNew);
0071   
0072   Standard_EXPORT static TopAbs_State ClassifyPointByFace (const TopoDS_Face& aF, const gp_Pnt2d& P);
0073   
0074 
0075   //! Computes square distance between a point on the edge E
0076   //! corresponded to parameter t and vertices of edge E.
0077   //! Returns True if this distance is less than square
0078   //! tolerance of vertex, otherwise returns false.
0079   Standard_EXPORT static Standard_Boolean IsVertex (const TopoDS_Edge& E, const Standard_Real t);
0080   
0081 
0082   //! Returns True if square distance between vertex V
0083   //! and a point on the edge E corresponded to parameter t
0084   //! is less than square tolerance of V
0085   Standard_EXPORT static Standard_Boolean IsVertex (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real t);
0086   
0087 
0088   //! Returns True if IsVertx for middle parameter of fist range
0089   //! and first edge returns True
0090   //! and if IsVertex for middle parameter of second range and
0091   //! second range returns True,
0092   //! otherwise returns False
0093   Standard_EXPORT static Standard_Boolean IsVertex (const IntTools_CommonPrt& aCmnPrt);
0094   
0095 
0096   //! Gets boundary of parameters of E1 and E2.
0097   //! Computes 3d points on each corresponded to average parameters.
0098   //! Returns True if distance between computed points is less than
0099   //! sum of edge tolerance, otherwise returns False.
0100   Standard_EXPORT static Standard_Boolean IsMiddlePointsEqual (const TopoDS_Edge& E1, const TopoDS_Edge& E2);
0101   
0102 
0103   //! Returns True if the distance between point aP and
0104   //! vertex aV is less or equal to sum of aTolPV and
0105   //! vertex tolerance, otherwise returns False
0106   Standard_EXPORT static Standard_Boolean IsVertex (const gp_Pnt& aP, const Standard_Real aTolPV, const TopoDS_Vertex& aV);
0107   
0108 
0109   //! Returns some value between aFirst and aLast
0110   Standard_EXPORT static Standard_Real IntermediatePoint (const Standard_Real aFirst, const Standard_Real aLast);
0111   
0112 
0113   //! Split aC by average parameter if aC is closed in 3D.
0114   //! Returns positive value if splitting has been done,
0115   //! otherwise returns zero.
0116   Standard_EXPORT static Standard_Integer SplitCurve (const IntTools_Curve& aC, IntTools_SequenceOfCurves& aS);
0117   
0118 
0119   //! Puts curves from aSIn to aSOut except those curves that
0120   //! are coincide with first curve from aSIn.
0121   Standard_EXPORT static void RejectLines (const IntTools_SequenceOfCurves& aSIn, IntTools_SequenceOfCurves& aSOut);
0122   
0123 
0124   //! Returns True if D1 and D2 coincide
0125   Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2);
0126   
0127 
0128   //! Returns True if D1 and D2 coincide with given tolerance
0129   Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2, const Standard_Real aTol);
0130   
0131 
0132   //! Returns True if aC is BoundedCurve from Geom and
0133   //! the distance between first point
0134   //! of the curve aC and last point
0135   //! is less than 1.e-12
0136   Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& aC);
0137   
0138 
0139   //! Returns adaptive tolerance for given aTolBase
0140   //! if aC is trimmed curve and basis curve is parabola,
0141   //! otherwise returns value of aTolBase
0142   Standard_EXPORT static Standard_Real CurveTolerance (const Handle(Geom_Curve)& aC, const Standard_Real aTolBase);
0143 
0144   //! Checks if the curve is not covered by the default tolerance (confusion).<br>
0145   //! Builds bounding box for the curve and stores it into <theBox>.
0146   Standard_EXPORT static Standard_Boolean CheckCurve(const IntTools_Curve& theCurve,
0147                                                      Bnd_Box& theBox);
0148   
0149   Standard_EXPORT static Standard_Boolean IsOnPave (const Standard_Real theT, const IntTools_Range& theRange, const Standard_Real theTol);
0150   
0151   Standard_EXPORT static void VertexParameters (const IntTools_CommonPrt& theCP, Standard_Real& theT1, Standard_Real& theT2);
0152   
0153   Standard_EXPORT static void VertexParameter (const IntTools_CommonPrt& theCP, Standard_Real& theT);
0154   
0155   Standard_EXPORT static Standard_Boolean IsOnPave1 (const Standard_Real theT, const IntTools_Range& theRange, const Standard_Real theTol);
0156   
0157   //! Checks if the range <theR> interfere with the range <theRRef>
0158   Standard_EXPORT static Standard_Boolean IsInRange (const IntTools_Range& theRRef, const IntTools_Range& theR, const Standard_Real theTol);
0159   
0160   Standard_EXPORT static Standard_Integer SegPln (const gp_Lin& theLin, const Standard_Real theTLin1, const Standard_Real theTLin2, const Standard_Real theTolLin, const gp_Pln& thePln, const Standard_Real theTolPln, gp_Pnt& theP, Standard_Real& theT, Standard_Real& theTolP, Standard_Real& theTmin, Standard_Real& theTmax);
0161   
0162 
0163   //! Computes the max distance between points
0164   //! taken from 3D and 2D curves by the same parameter
0165   Standard_EXPORT static
0166     Standard_Boolean ComputeTolerance(const Handle(Geom_Curve)& theCurve3D,
0167                                       const Handle(Geom2d_Curve)& theCurve2D,
0168                                       const Handle(Geom_Surface)& theSurf,
0169                                       const Standard_Real theFirst,
0170                                       const Standard_Real theLast,
0171                                       Standard_Real& theMaxDist,
0172                                       Standard_Real& theMaxPar,
0173                                       const Standard_Real theTolRange = Precision::PConfusion(),
0174                                       const Standard_Boolean theToRunParallel = Standard_False);
0175 
0176 
0177   //! Computes the correct Intersection range for 
0178   //! Line/Line, Line/Plane and Plane/Plane intersections
0179   Standard_EXPORT static Standard_Real ComputeIntRange(const Standard_Real theTol1,
0180                                                        const Standard_Real theTol2,
0181                                                        const Standard_Real theAngle);
0182 
0183 
0184 protected:
0185 
0186 
0187 
0188 
0189 
0190 private:
0191 
0192 
0193 
0194 
0195 
0196 };
0197 
0198 
0199 
0200 
0201 
0202 
0203 
0204 #endif // _IntTools_Tools_HeaderFile