Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-31 09:36:28

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 double Start, const double End);
0049 
0050   Standard_EXPORT Intrv_Interval(const double Start,
0051                                  const float  TolStart,
0052                                  const double End,
0053                                  const float  TolEnd);
0054 
0055   double Start() const;
0056 
0057   double End() const;
0058 
0059   float TolStart() const;
0060 
0061   float TolEnd() const;
0062 
0063   void Bounds(double& Start, float& TolStart, double& End, float& TolEnd) const;
0064 
0065   void SetStart(const double Start, const float TolStart);
0066 
0067   //! ****+****-------------------->      Old one
0068   //! ****+****------------------------>      New one to fuse
0069   //! <<<     <<<
0070   //! ****+****------------------------>      result
0071   void FuseAtStart(const double Start, const float TolStart);
0072 
0073   //! ****+****----------->      Old one
0074   //! <----------**+**                        Tool for cutting
0075   //! >>>     >>>
0076   //! ****+****----------->      result
0077   void CutAtStart(const double Start, const float TolStart);
0078 
0079   void SetEnd(const double End, const float TolEnd);
0080 
0081   //! <---------------------****+****      Old one
0082   //! <-----------------**+**              New one to fuse
0083   //! >>>     >>>
0084   //! <---------------------****+****      result
0085   void FuseAtEnd(const double End, const float TolEnd);
0086 
0087   //! <-----****+****                      Old one
0088   //! **+**------>             Tool for cutting
0089   //! <<<     <<<
0090   //! <-----****+****                      result
0091   void CutAtEnd(const double End, const float TolEnd);
0092 
0093   //! True if myStart+myTolStart > myEnd-myTolEnd
0094   //! or if myEnd+myTolEnd > myStart-myTolStart
0095   bool IsProbablyEmpty() const;
0096 
0097   //! True if me is Before Other
0098   //! **-----------****             Other
0099   //! ***-----*                                   Before
0100   //! ***------------*                            JustBefore
0101   //! ***-----------------*                       OverlappingAtStart
0102   //! ***--------------------------*              JustEnclosingAtEnd
0103   //! ***-------------------------------------*   Enclosing
0104   //! ***----*                       JustOverlappingAtStart
0105   //! ***-------------*              Similar
0106   //! ***------------------------*   JustEnclosingAtStart
0107   //! ***-*                   Inside
0108   //! ***------*              JustOverlappingAtEnd
0109   //! ***-----------------*   OverlappingAtEnd
0110   //! ***--------*   JustAfter
0111   //! ***---*   After
0112   Standard_EXPORT Intrv_Position Position(const Intrv_Interval& Other) const;
0113 
0114   //! True if me is Before Other
0115   //! ***----------------**                              me
0116   //! **-----------****          Other
0117   bool IsBefore(const Intrv_Interval& Other) const;
0118 
0119   //! True if me is After Other
0120   //! **-----------****          me
0121   //! ***----------------**                              Other
0122   bool IsAfter(const Intrv_Interval& Other) const;
0123 
0124   //! True if me is Inside Other
0125   //! **-----------****                          me
0126   //! ***--------------------------**                    Other
0127   bool IsInside(const Intrv_Interval& Other) const;
0128 
0129   //! True if me is Enclosing Other
0130   //! ***----------------------------****                  me
0131   //! ***------------------**                        Other
0132   bool IsEnclosing(const Intrv_Interval& Other) const;
0133 
0134   //! True if me is just Enclosing Other at start
0135   //! ***---------------------------****            me
0136   //! ***------------------**                        Other
0137   bool IsJustEnclosingAtStart(const Intrv_Interval& Other) const;
0138 
0139   //! True if me is just Enclosing Other at End
0140   //! ***----------------------------****                  me
0141   //! ***-----------------****                   Other
0142   bool IsJustEnclosingAtEnd(const Intrv_Interval& Other) const;
0143 
0144   //! True if me is just before Other
0145   //! ***--------****                                      me
0146   //! ***-----------**                        Other
0147   bool IsJustBefore(const Intrv_Interval& Other) const;
0148 
0149   //! True if me is just after Other
0150   //! ****-------****                         me
0151   //! ***-----------**                                     Other
0152   bool IsJustAfter(const Intrv_Interval& Other) const;
0153 
0154   //! True if me is overlapping Other at start
0155   //! ***---------------***                                me
0156   //! ***-----------**                        Other
0157   bool IsOverlappingAtStart(const Intrv_Interval& Other) const;
0158 
0159   //! True if me is overlapping Other at end
0160   //! ***-----------**                        me
0161   //! ***---------------***                                Other
0162   bool IsOverlappingAtEnd(const Intrv_Interval& Other) const;
0163 
0164   //! True if me is just overlapping Other at start
0165   //! ***-----------***                                    me
0166   //! ***------------------------**                        Other
0167   bool IsJustOverlappingAtStart(const Intrv_Interval& Other) const;
0168 
0169   //! True if me is just overlapping Other at end
0170   //! ***-----------*                         me
0171   //! ***------------------------**                        Other
0172   bool IsJustOverlappingAtEnd(const Intrv_Interval& Other) const;
0173 
0174   //! True if me and Other have the same bounds
0175   //! *----------------***                                me
0176   //! ***-----------------**                               Other
0177   bool IsSimilar(const Intrv_Interval& Other) const;
0178 
0179 private:
0180   double myStart;
0181   double myEnd;
0182   float  myTolStart;
0183   float  myTolEnd;
0184 };
0185 
0186 #include <Intrv_Interval.lxx>
0187 
0188 #endif // _Intrv_Interval_HeaderFile