Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-03 10:57:09

0001 // Created on: 1992-01-30
0002 // Created by: Didier PIFFAULT
0003 // Copyright (c) 1992-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 _TopTrans_SurfaceTransition_HeaderFile
0018 #define _TopTrans_SurfaceTransition_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <gp_Dir.hxx>
0024 #include <NCollection_Array2.hxx>
0025 #include <TopAbs_Orientation.hxx>
0026 #include <TopAbs_State.hxx>
0027 
0028 //! This algorithm is used to compute the transition
0029 //! of a 3D surface intersecting a topological surfacic
0030 //! boundary on a 3D curve ( intersection curve ).
0031 //! The boundary is described by a set of faces
0032 //! each face is described by
0033 //! - its support surface,
0034 //! - an orientation defining its matter side.
0035 //! The geometric elements are described locally at the
0036 //! intersection point by a second order development.
0037 //! A surface is described by the normal vector, the
0038 //! principal directions and the principal curvatures.
0039 //! A curve is described by the tangent, the normal
0040 //! and the curvature.
0041 //! The algorithm keeps track of the two faces elements
0042 //! closest to the part of the curve "before" and "after"
0043 //! the intersection, these two elements are updated
0044 //! for each new face.
0045 //! The position of the curve can be computed when at
0046 //! least one surface element has been given, this
0047 //! position is "In","Out" or "On" for the part of the
0048 //! curve "Before" or "After" the intersection.
0049 class TopTrans_SurfaceTransition
0050 {
0051 public:
0052   DEFINE_STANDARD_ALLOC
0053 
0054   //! Create an empty Surface Transition.
0055   Standard_EXPORT TopTrans_SurfaceTransition();
0056 
0057   //! Initialize a Surface Transition with the local
0058   //! description of the intersection curve and of the
0059   //! reference surface.
0060   //! PREQUESITORY : Norm oriented OUTSIDE "geometric matter"
0061   Standard_EXPORT void Reset(const gp_Dir& Tgt,
0062                              const gp_Dir& Norm,
0063                              const gp_Dir& MaxD,
0064                              const gp_Dir& MinD,
0065                              const double  MaxCurv,
0066                              const double  MinCurv);
0067 
0068   //! Initialize a Surface Transition with the local
0069   //! description of a straight line.
0070   Standard_EXPORT void Reset(const gp_Dir& Tgt, const gp_Dir& Norm);
0071 
0072   //! Add a face element to the boundary.
0073   //!
0074   //! - S defines topological orientation for the face :
0075   //! S FORWARD means: along the intersection curve on the
0076   //! reference surface, transition states while crossing
0077   //! the face are OUT,IN.
0078   //! S REVERSED means states are IN,OUT.
0079   //! S INTERNAL means states are IN,IN.
0080   //!
0081   //! - O defines curve's position on face :
0082   //! O FORWARD means the face is before the intersection
0083   //! O REVERSED means the face is AFTER
0084   //! O INTERNAL means the curve intersection is in the face.
0085   //! PREQUESITORY : Norm oriented OUTSIDE "geometric matter"
0086   Standard_EXPORT void Compare(const double             Tole,
0087                                const gp_Dir&            Norm,
0088                                const gp_Dir&            MaxD,
0089                                const gp_Dir&            MinD,
0090                                const double             MaxCurv,
0091                                const double             MinCurv,
0092                                const TopAbs_Orientation S,
0093                                const TopAbs_Orientation O);
0094 
0095   //! Add a plane or a cylindric face to the boundary.
0096   Standard_EXPORT void Compare(const double             Tole,
0097                                const gp_Dir&            Norm,
0098                                const TopAbs_Orientation S,
0099                                const TopAbs_Orientation O);
0100 
0101   //! Returns the state of the reference surface before
0102   //! the interference, this is the position relative to
0103   //! the surface of a point very close to the intersection
0104   //! on the negative side of the tangent.
0105   Standard_EXPORT TopAbs_State StateBefore() const;
0106 
0107   //! Returns the state of the reference surface after
0108   //! interference, this is the position relative to the
0109   //! surface of a point very close to the intersection
0110   //! on the positive side of the tangent.
0111   Standard_EXPORT TopAbs_State StateAfter() const;
0112 
0113   Standard_EXPORT static TopAbs_State GetBefore(const TopAbs_Orientation Tran);
0114 
0115   Standard_EXPORT static TopAbs_State GetAfter(const TopAbs_Orientation Tran);
0116 
0117 private:
0118   Standard_EXPORT void UpdateReference(const double             Tole,
0119                                        const bool               isInfRef,
0120                                        double&                  CosInf,
0121                                        double&                  CosSup,
0122                                        const TopAbs_Orientation Tran,
0123                                        TopAbs_Orientation&      TranRef);
0124 
0125   Standard_EXPORT double ComputeCos(const double             Tole,
0126                                     const gp_Dir&            Norm,
0127                                     const TopAbs_Orientation O,
0128                                     bool&                    isleft) const;
0129 
0130   gp_Dir                                 myTgt;
0131   gp_Dir                                 myNorm;
0132   gp_Dir                                 beafter;
0133   double                                 myCurvRef;
0134   NCollection_Array2<double>             myAng;
0135   NCollection_Array2<double>             myCurv;
0136   NCollection_Array2<TopAbs_Orientation> myOri;
0137   bool                                   myIsDefined;
0138   bool                                   myTouchFlag;
0139 };
0140 
0141 #endif // _TopTrans_SurfaceTransition_HeaderFile