Back to home page

EIC code displayed by LXR

 
 

    


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

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