Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-04 08:45:46

0001 // Created on: 1991-12-13
0002 // Created by: Christophe MARION
0003 // Copyright (c) 1991-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 _Intrv_Interval_HeaderFile
0018 #define _Intrv_Interval_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_ShortReal.hxx>
0025 #include <Intrv_Position.hxx>
0026 
0027 //! **-----------****             Other
0028 //! ***---*                                   IsBefore
0029 //! ***----------*                            IsJustBefore
0030 //! ***---------------*                       IsOverlappingAtStart
0031 //! ***------------------------*              IsJustEnclosingAtEnd
0032 //! ***-----------------------------------*   IsEnclosing
0033 //! ***----*                       IsJustOverlappingAtStart
0034 //! ***-------------*              IsSimilar
0035 //! ***------------------------*   IsJustEnclosingAtStart
0036 //! ***-*                   IsInside
0037 //! ***------*              IsJustOverlappingAtEnd
0038 //! ***-----------------*   IsOverlappingAtEnd
0039 //! ***--------*   IsJustAfter
0040 //! ***---*   IsAfter
0041 class Intrv_Interval
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   Standard_EXPORT Intrv_Interval();
0047 
0048   Standard_EXPORT Intrv_Interval(const Standard_Real Start, const Standard_Real End);
0049 
0050   Standard_EXPORT Intrv_Interval(const Standard_Real      Start,
0051                                  const Standard_ShortReal TolStart,
0052                                  const Standard_Real      End,
0053                                  const Standard_ShortReal TolEnd);
0054 
0055   Standard_Real Start() const;
0056 
0057   Standard_Real End() const;
0058 
0059   Standard_ShortReal TolStart() const;
0060 
0061   Standard_ShortReal TolEnd() const;
0062 
0063   void Bounds(Standard_Real&      Start,
0064               Standard_ShortReal& TolStart,
0065               Standard_Real&      End,
0066               Standard_ShortReal& TolEnd) const;
0067 
0068   void SetStart(const Standard_Real Start, const Standard_ShortReal TolStart);
0069 
0070   //! ****+****-------------------->      Old one
0071   //! ****+****------------------------>      New one to fuse
0072   //! <<<     <<<
0073   //! ****+****------------------------>      result
0074   void FuseAtStart(const Standard_Real Start, const Standard_ShortReal TolStart);
0075 
0076   //! ****+****----------->      Old one
0077   //! <----------**+**                        Tool for cutting
0078   //! >>>     >>>
0079   //! ****+****----------->      result
0080   void CutAtStart(const Standard_Real Start, const Standard_ShortReal TolStart);
0081 
0082   void SetEnd(const Standard_Real End, const Standard_ShortReal TolEnd);
0083 
0084   //! <---------------------****+****      Old one
0085   //! <-----------------**+**              New one to fuse
0086   //! >>>     >>>
0087   //! <---------------------****+****      result
0088   void FuseAtEnd(const Standard_Real End, const Standard_ShortReal TolEnd);
0089 
0090   //! <-----****+****                      Old one
0091   //! **+**------>             Tool for cutting
0092   //! <<<     <<<
0093   //! <-----****+****                      result
0094   void CutAtEnd(const Standard_Real End, const Standard_ShortReal TolEnd);
0095 
0096   //! True if myStart+myTolStart > myEnd-myTolEnd
0097   //! or if myEnd+myTolEnd > myStart-myTolStart
0098   Standard_Boolean IsProbablyEmpty() const;
0099 
0100   //! True if me is Before Other
0101   //! **-----------****             Other
0102   //! ***-----*                                   Before
0103   //! ***------------*                            JustBefore
0104   //! ***-----------------*                       OverlappingAtStart
0105   //! ***--------------------------*              JustEnclosingAtEnd
0106   //! ***-------------------------------------*   Enclosing
0107   //! ***----*                       JustOverlappingAtStart
0108   //! ***-------------*              Similar
0109   //! ***------------------------*   JustEnclosingAtStart
0110   //! ***-*                   Inside
0111   //! ***------*              JustOverlappingAtEnd
0112   //! ***-----------------*   OverlappingAtEnd
0113   //! ***--------*   JustAfter
0114   //! ***---*   After
0115   Standard_EXPORT Intrv_Position Position(const Intrv_Interval& Other) const;
0116 
0117   //! True if me is Before Other
0118   //! ***----------------**                              me
0119   //! **-----------****          Other
0120   Standard_Boolean IsBefore(const Intrv_Interval& Other) const;
0121 
0122   //! True if me is After Other
0123   //! **-----------****          me
0124   //! ***----------------**                              Other
0125   Standard_Boolean IsAfter(const Intrv_Interval& Other) const;
0126 
0127   //! True if me is Inside Other
0128   //! **-----------****                          me
0129   //! ***--------------------------**                    Other
0130   Standard_Boolean IsInside(const Intrv_Interval& Other) const;
0131 
0132   //! True if me is Enclosing Other
0133   //! ***----------------------------****                  me
0134   //! ***------------------**                        Other
0135   Standard_Boolean IsEnclosing(const Intrv_Interval& Other) const;
0136 
0137   //! True if me is just Enclosing Other at start
0138   //! ***---------------------------****            me
0139   //! ***------------------**                        Other
0140   Standard_Boolean IsJustEnclosingAtStart(const Intrv_Interval& Other) const;
0141 
0142   //! True if me is just Enclosing Other at End
0143   //! ***----------------------------****                  me
0144   //! ***-----------------****                   Other
0145   Standard_Boolean IsJustEnclosingAtEnd(const Intrv_Interval& Other) const;
0146 
0147   //! True if me is just before Other
0148   //! ***--------****                                      me
0149   //! ***-----------**                        Other
0150   Standard_Boolean IsJustBefore(const Intrv_Interval& Other) const;
0151 
0152   //! True if me is just after Other
0153   //! ****-------****                         me
0154   //! ***-----------**                                     Other
0155   Standard_Boolean IsJustAfter(const Intrv_Interval& Other) const;
0156 
0157   //! True if me is overlapping Other at start
0158   //! ***---------------***                                me
0159   //! ***-----------**                        Other
0160   Standard_Boolean IsOverlappingAtStart(const Intrv_Interval& Other) const;
0161 
0162   //! True if me is overlapping Other at end
0163   //! ***-----------**                        me
0164   //! ***---------------***                                Other
0165   Standard_Boolean IsOverlappingAtEnd(const Intrv_Interval& Other) const;
0166 
0167   //! True if me is just overlapping Other at start
0168   //! ***-----------***                                    me
0169   //! ***------------------------**                        Other
0170   Standard_Boolean IsJustOverlappingAtStart(const Intrv_Interval& Other) const;
0171 
0172   //! True if me is just overlapping Other at end
0173   //! ***-----------*                         me
0174   //! ***------------------------**                        Other
0175   Standard_Boolean IsJustOverlappingAtEnd(const Intrv_Interval& Other) const;
0176 
0177   //! True if me and Other have the same bounds
0178   //! *----------------***                                me
0179   //! ***-----------------**                               Other
0180   Standard_Boolean IsSimilar(const Intrv_Interval& Other) const;
0181 
0182 protected:
0183 private:
0184   Standard_Real      myStart;
0185   Standard_Real      myEnd;
0186   Standard_ShortReal myTolStart;
0187   Standard_ShortReal myTolEnd;
0188 };
0189 
0190 #include <Intrv_Interval.lxx>
0191 
0192 #endif // _Intrv_Interval_HeaderFile