Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:05

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _BOPTools_AlgoTools3D_HeaderFile
0016 #define _BOPTools_AlgoTools3D_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 class TopoDS_Edge;
0024 class TopoDS_Face;
0025 class gp_Dir;
0026 class Geom_Surface;
0027 class Geom2d_Curve;
0028 class gp_Pnt;
0029 class IntTools_Context;
0030 class gp_Pnt2d;
0031 class TopoDS_Shape;
0032 
0033 
0034 
0035 //! The class contains handy static functions
0036 //! dealing with the topology
0037 //! This is the copy of BOPTools_AlgoTools3D.cdl file
0038 class BOPTools_AlgoTools3D 
0039 {
0040 public:
0041 
0042   DEFINE_STANDARD_ALLOC
0043 
0044   //! Makes the edge <theESplit> seam edge for the face <theFace> basing on the surface properties (U and V periods)
0045   Standard_EXPORT static Standard_Boolean DoSplitSEAMOnFace (const TopoDS_Edge& theESplit,
0046                                                              const TopoDS_Face& theFace);
0047 
0048   //! Makes the split edge <theESplit> seam edge for the face <theFace> basing on the positions
0049   //! of 2d curves of the original edge <theEOrigin>.
0050   Standard_EXPORT static Standard_Boolean DoSplitSEAMOnFace (const TopoDS_Edge& theEOrigin,
0051                                                              const TopoDS_Edge& theESplit,
0052                                                              const TopoDS_Face& theFace);
0053 
0054   //! Computes normal to the face <aF> for the point on the edge <aE>
0055   //! at parameter <aT>.<br>
0056   //! <theContext> - storage for caching the geometrical tools
0057   Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
0058                                                      const TopoDS_Face& aF,
0059                                                      const Standard_Real aT,
0060                                                      gp_Dir& aD,
0061                                                      const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0062   
0063 
0064   //! Computes normal to the face <aF> for the point on the edge <aE>
0065   //! at arbitrary intermediate parameter.<br>
0066   //! <theContext> - storage for caching the geometrical tools
0067   Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
0068                                                      const TopoDS_Face& aF,
0069                                                      gp_Dir& aD,
0070                                                      const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0071   
0072 
0073   //! Returns 1  if scalar product aNF1* aNF2>0.<br>
0074   //! Returns 0  if directions aNF1 aNF2 coincide<br>
0075   //! Returns -1 if scalar product aNF1* aNF2<0.
0076   Standard_EXPORT static Standard_Integer SenseFlag (const gp_Dir& aNF1,
0077                                                      const gp_Dir& aNF2);
0078 
0079   //! Compute normal <aD> to surface <aS> in point (U,V)
0080   //! Returns TRUE if directions aD1U, aD1V coincide
0081   Standard_EXPORT static Standard_Boolean GetNormalToSurface (const Handle(Geom_Surface)& aS,
0082                                                               const Standard_Real U,
0083                                                               const Standard_Real V,
0084                                                               gp_Dir& aD);
0085 
0086   //! Computes normal to the face <aF> for the 3D-point that
0087   //! belongs to the edge <aE> at parameter <aT>.<br>
0088   //! Output:<br>
0089   //! aPx  -  the 3D-point where the normal computed<br>
0090   //! aD   -  the normal;<br>
0091   //! Warning:<br>
0092   //! The normal is computed not exactly in the point on the
0093   //! edge, but in point that is near to the edge towards to
0094   //! the face material (so, we'll have approx. normal);<br>
0095   //! The point is computed using PointNearEdge function,
0096   //! with the shifting value BOPTools_AlgoTools3D::MinStepIn2d(),
0097   //! from the edge, but if this value is too big,
0098   //! the point will be computed using Hatcher (PointInFace function).<br>
0099   //! Returns TRUE in case of success.
0100   Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aE,
0101                                                                        const TopoDS_Face& aF,
0102                                                                        const Standard_Real aT,
0103                                                                        gp_Pnt& aPx,
0104                                                                        gp_Dir& aD,
0105                                                                        const Handle(IntTools_Context)& theContext);
0106   
0107   //! Computes normal to the face <aF> for the 3D-point that
0108   //! belongs to the edge <aE> at parameter <aT>.<br>
0109   //! Output:<br>
0110   //! aPx  -  the 3D-point where the normal computed<br>
0111   //! aD   -  the normal;<br>
0112   //! Warning:<br>
0113   //! The normal is computed not exactly in the point on the
0114   //! edge, but in point that is near to the edge towards to
0115   //! the face material (so, we'll have approx. normal);<br>
0116   //! The point is computed using PointNearEdge function
0117   //! with the shifting value <aDt2D> from the edge;<br>
0118   //! No checks on this value will be done.<br>
0119   //! Returns TRUE in case of success.
0120   Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge (const TopoDS_Edge& theE,
0121                                                                        const TopoDS_Face& theF,
0122                                                                        const Standard_Real aT,
0123                                                                        gp_Pnt& aP,
0124                                                                        gp_Dir& aDNF,
0125                                                                        const Standard_Real aDt2D);
0126   
0127   //! Computes normal to the face <aF> for the 3D-point that
0128   //! belongs to the edge <aE> at parameter <aT>.<br>
0129   //! Output:<br>
0130   //! aPx  -  the 3D-point where the normal computed<br>
0131   //! aD   -  the normal;<br>
0132   //! Warning:<br>
0133   //! The normal is computed not exactly in the point on the
0134   //! edge, but in point that is near to the edge towards to
0135   //! the face material (so, we'll have approx. normal);<br>
0136   //! The point is computed using PointNearEdge function
0137   //! with the shifting value <aDt2D> from the edge,
0138   //! but if this value is too big the point will be 
0139   //! computed using Hatcher (PointInFace function).<br>
0140   //! Returns TRUE in case of success.
0141   Standard_EXPORT static Standard_Boolean GetApproxNormalToFaceOnEdge (const TopoDS_Edge& theE,
0142                                                                        const TopoDS_Face& theF,
0143                                                                        const Standard_Real aT,
0144                                                                        const Standard_Real aDt2D,
0145                                                                        gp_Pnt& aP,
0146                                                                        gp_Dir& aDNF,
0147                                                                        const Handle(IntTools_Context)& theContext);
0148 
0149   //! Compute the point <aPx>,  (<aP2D>)  that is near to
0150   //! the edge <aE>   at parameter <aT>  towards to the
0151   //! material of the face <aF>. The value of shifting in
0152   //! 2D is <aDt2D><br>
0153   //! If the value of shifting is too big the point 
0154   //! will be computed using Hatcher (PointInFace function).<br>
0155   //! Returns error status:<br>
0156   //! 0 - in case of success;<br>
0157   //! 1 - <aE> does not have 2d curve on the face <aF>;<br>
0158   //! 2 - the computed point is out of the face.
0159   Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
0160                                                          const TopoDS_Face& aF,
0161                                                          const Standard_Real aT,
0162                                                          const Standard_Real aDt2D,
0163                                                          gp_Pnt2d& aP2D,
0164                                                          gp_Pnt& aPx,
0165                                                          const Handle(IntTools_Context)& theContext);
0166 
0167   //! Compute the point <aPx>,  (<aP2D>)  that is near to
0168   //! the edge <aE>   at parameter <aT>  towards to the
0169   //! material of the face <aF>. The value of shifting in
0170   //! 2D is <aDt2D>. No checks on this value will be done.<br>
0171   //! Returns error status:<br>
0172   //! 0 - in case of success;<br>
0173   //! 1 - <aE> does not have 2d curve on the face <aF>.
0174   Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
0175                                                          const TopoDS_Face& aF,
0176                                                          const Standard_Real aT,
0177                                                          const Standard_Real aDt2D,
0178                                                          gp_Pnt2d& aP2D,
0179                                                          gp_Pnt& aPx);
0180 
0181   //! Computes the point <aPx>,  (<aP2D>)  that is near to
0182   //! the edge <aE>   at parameter <aT>  towards to the
0183   //! material of the face <aF>. The value of shifting in
0184   //! 2D is  dt2D=BOPTools_AlgoTools3D::MinStepIn2d()<br>
0185   //! If the value of shifting is too big the point will be computed
0186   //! using Hatcher (PointInFace function).<br>
0187   //! Returns error status:<br>
0188   //! 0 - in case of success;<br>
0189   //! 1 - <aE> does not have 2d curve on the face <aF>;<br>
0190   //! 2 - the computed point is out of the face.
0191   Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
0192                                                          const TopoDS_Face& aF,
0193                                                          const Standard_Real aT,
0194                                                          gp_Pnt2d& aP2D,
0195                                                          gp_Pnt& aPx,
0196                                                          const Handle(IntTools_Context)& theContext);
0197   
0198 
0199   //! Compute the point <aPx>,  (<aP2D>)  that is near to
0200   //! the edge <aE>   at arbitrary  parameter  towards to the
0201   //! material of the face <aF>. The value of shifting in
0202   //! 2D is  dt2D=BOPTools_AlgoTools3D::MinStepIn2d().<br>
0203   //! If the value of shifting is too big the point will be computed
0204   //! using Hatcher (PointInFace function).<br>
0205   //! Returns error status:<br>
0206   //! 0 - in case of success;<br>
0207   //! 1 - <aE> does not have 2d curve on the face <aF>;<br>
0208   //! 2 - the computed point is out of the face.
0209   Standard_EXPORT static Standard_Integer PointNearEdge (const TopoDS_Edge& aE,
0210                                                          const TopoDS_Face& aF,
0211                                                          gp_Pnt2d& aP2D,
0212                                                          gp_Pnt& aPx,
0213                                                          const Handle(IntTools_Context)& theContext);
0214   
0215 
0216   //! Returns simple step value that is used in 2D-computations
0217   //! = 1.e-5
0218   Standard_EXPORT static Standard_Real MinStepIn2d();
0219   
0220 
0221   //! Returns TRUE if the shape <aS> does not contain
0222   //! geometry information  (e.g. empty compound)
0223   Standard_EXPORT static Standard_Boolean IsEmptyShape (const TopoDS_Shape& aS);
0224   
0225 
0226   //! Get the edge <aER> from the face <aF> that is the same as
0227   //! the edge <aE>
0228   Standard_EXPORT static void OrientEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF, TopoDS_Edge& aER);
0229   
0230   //! Computes arbitrary point <theP> inside the face <theF>.<br>
0231   //! <theP2D> -  2D  representation of <theP>
0232   //! on the surface of <theF><br>
0233   //! Returns 0 in case of success.
0234   Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF, 
0235                                                        gp_Pnt& theP, 
0236                                                        gp_Pnt2d& theP2D, 
0237                                                        const Handle(IntTools_Context)& theContext);
0238 
0239   //! Computes a point <theP> inside the face <theF> 
0240   //! using starting point taken by the parameter <theT> 
0241   //! from the 2d curve of the edge <theE> on the face <theF>
0242   //! in the direction perpendicular to the tangent vector
0243   //! of the 2d curve of the edge.<br>
0244   //! The point will be distanced on <theDt2D> from the 2d curve.
0245   //! <theP2D> -  2D  representation of <theP>
0246   //! on the surface of <theF><br>
0247   //! Returns 0 in case of success.
0248   Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF, 
0249                                                        const TopoDS_Edge& theE,
0250                                                        const Standard_Real theT,
0251                                                        const Standard_Real theDt2D,
0252                                                        gp_Pnt& theP, 
0253                                                        gp_Pnt2d& theP2D, 
0254                                                        const Handle(IntTools_Context)& theContext);
0255 
0256   //! Computes a point <theP> inside the face <theF> 
0257   //! using the line <theL> so that 2D point
0258   //! <theP2D>, 2D representation of <theP>
0259   //! on the surface of <theF>, lies on that line.<br>
0260   //! Returns 0 in case of success.
0261   Standard_EXPORT static Standard_Integer PointInFace (const TopoDS_Face& theF, 
0262                                                        const Handle(Geom2d_Curve)& theL,
0263                                                        gp_Pnt& theP, 
0264                                                        gp_Pnt2d& theP2D, 
0265                                                        const Handle(IntTools_Context)& theContext,
0266                                                        const Standard_Real theDt2D = 0.0);
0267 
0268 
0269 protected:
0270 
0271 private:
0272 
0273 };
0274 
0275 #endif // _BOPTools_AlgoTools3D_HeaderFile