mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
36
src/Intrv/Intrv.cdl
Executable file
36
src/Intrv/Intrv.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: Intrv.cdl
|
||||
-- Created: Fri Dec 13 14:13:31 1991
|
||||
-- Author: Christophe MARION
|
||||
-- <cma@sdsun1>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
package Intrv
|
||||
|
||||
---Purpose:
|
||||
uses
|
||||
Standard,
|
||||
TCollection
|
||||
|
||||
is
|
||||
-- other
|
||||
enumeration Position is -- me **------------***
|
||||
Before, -- **---*
|
||||
JustBefore, -- **--------*
|
||||
OverlappingAtStart, -- **--------------*
|
||||
JustEnclosingAtEnd, -- **----------------------*
|
||||
Enclosing, -- **------------------------------*
|
||||
JustOverlappingAtStart, -- *---------*
|
||||
Similar, -- *-------------*
|
||||
JustEnclosingAtStart, -- *---------------------*
|
||||
Inside, -- *---*
|
||||
JustOverlappingAtEnd, -- *-------*
|
||||
OverlappingAtEnd, -- *---------------*
|
||||
JustAfter, -- *-------*
|
||||
After -- *--*
|
||||
end Position;
|
||||
|
||||
class Interval;
|
||||
class Intervals;
|
||||
class SequenceOfInterval instantiates Sequence from TCollection(Interval);
|
||||
|
||||
end Intrv;
|
242
src/Intrv/Intrv_Interval.cdl
Executable file
242
src/Intrv/Intrv_Interval.cdl
Executable file
@@ -0,0 +1,242 @@
|
||||
-- File: Interval.cdl
|
||||
-- Created: Fri Dec 13 14:22:13 1991
|
||||
-- Author: Christophe MARION
|
||||
-- <cma@sdsun1>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
class Interval from Intrv
|
||||
---Purpose:
|
||||
-- **-----------**** Other
|
||||
-- ***---* IsBefore
|
||||
-- ***----------* IsJustBefore
|
||||
-- ***---------------* IsOverlappingAtStart
|
||||
-- ***------------------------* IsJustEnclosingAtEnd
|
||||
-- ***-----------------------------------* IsEnclosing
|
||||
-- ***----* IsJustOverlappingAtStart
|
||||
-- ***-------------* IsSimilar
|
||||
-- ***------------------------* IsJustEnclosingAtStart
|
||||
-- ***-* IsInside
|
||||
-- ***------* IsJustOverlappingAtEnd
|
||||
-- ***-----------------* IsOverlappingAtEnd
|
||||
-- ***--------* IsJustAfter
|
||||
-- ***---* IsAfter
|
||||
|
||||
|
||||
uses
|
||||
Real from Standard,
|
||||
ShortReal from Standard,
|
||||
Integer from Standard,
|
||||
Position from Intrv
|
||||
|
||||
is
|
||||
Create returns Interval from Intrv;
|
||||
|
||||
Create(Start, End : Real from Standard) returns Interval from Intrv;
|
||||
|
||||
Create(Start : Real from Standard;
|
||||
TolStart : ShortReal from Standard;
|
||||
End : Real from Standard;
|
||||
TolEnd : ShortReal from Standard)
|
||||
returns Interval from Intrv;
|
||||
|
||||
Start(me) returns Real from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
End(me) returns Real from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
TolStart(me) returns ShortReal from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
TolEnd(me) returns ShortReal from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Bounds(me; Start : out Real from Standard;
|
||||
TolStart : out ShortReal from Standard;
|
||||
End : out Real from Standard;
|
||||
TolEnd : out ShortReal from Standard)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
SetStart(me : in out; Start : Real from Standard;
|
||||
TolStart : ShortReal from Standard)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
FuseAtStart(me : in out; Start : Real from Standard;
|
||||
TolStart : ShortReal from Standard)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- ****+****--------------------> Old one
|
||||
-- ****+****------------------------> New one to fuse
|
||||
-- <<< <<<
|
||||
-- ****+****------------------------> result
|
||||
is static;
|
||||
|
||||
CutAtStart(me : in out; Start : Real from Standard;
|
||||
TolStart : ShortReal from Standard)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- ****+****-----------> Old one
|
||||
-- <----------**+** Tool for cutting
|
||||
-- >>> >>>
|
||||
-- ****+****-----------> result
|
||||
is static;
|
||||
|
||||
SetEnd(me : in out; End : Real from Standard;
|
||||
TolEnd : ShortReal from Standard)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
FuseAtEnd(me : in out; End : Real from Standard;
|
||||
TolEnd : ShortReal from Standard)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- <---------------------****+**** Old one
|
||||
-- <-----------------**+** New one to fuse
|
||||
-- >>> >>>
|
||||
-- <---------------------****+**** result
|
||||
is static;
|
||||
|
||||
CutAtEnd(me : in out; End : Real from Standard;
|
||||
TolEnd : ShortReal from Standard)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- <-----****+**** Old one
|
||||
-- **+**------> Tool for cutting
|
||||
-- <<< <<<
|
||||
-- <-----****+**** result
|
||||
is static;
|
||||
|
||||
IsProbablyEmpty(me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if myStart+myTolStart > myEnd-myTolEnd
|
||||
-- or if myEnd+myTolEnd > myStart-myTolStart
|
||||
is static;
|
||||
|
||||
Position(me; Other : Interval from Intrv) returns Position from Intrv
|
||||
---Purpose: True if me is Before Other
|
||||
-- **-----------**** Other
|
||||
-- ***-----* Before
|
||||
-- ***------------* JustBefore
|
||||
-- ***-----------------* OverlappingAtStart
|
||||
-- ***--------------------------* JustEnclosingAtEnd
|
||||
-- ***-------------------------------------* Enclosing
|
||||
-- ***----* JustOverlappingAtStart
|
||||
-- ***-------------* Similar
|
||||
-- ***------------------------* JustEnclosingAtStart
|
||||
-- ***-* Inside
|
||||
-- ***------* JustOverlappingAtEnd
|
||||
-- ***-----------------* OverlappingAtEnd
|
||||
-- ***--------* JustAfter
|
||||
-- ***---* After
|
||||
is static;
|
||||
|
||||
IsBefore(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is Before Other
|
||||
-- ***----------------** me
|
||||
-- **-----------**** Other
|
||||
is static;
|
||||
|
||||
IsAfter(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is After Other
|
||||
-- **-----------**** me
|
||||
-- ***----------------** Other
|
||||
is static;
|
||||
|
||||
IsInside(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is Inside Other
|
||||
-- **-----------**** me
|
||||
-- ***--------------------------** Other
|
||||
is static;
|
||||
|
||||
IsEnclosing(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is Enclosing Other
|
||||
-- ***----------------------------**** me
|
||||
-- ***------------------** Other
|
||||
is static;
|
||||
|
||||
IsJustEnclosingAtStart(me; Other : Interval from Intrv)
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is just Enclosing Other at start
|
||||
-- ***---------------------------**** me
|
||||
-- ***------------------** Other
|
||||
is static;
|
||||
|
||||
IsJustEnclosingAtEnd(me; Other : Interval from Intrv)
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is just Enclosing Other at End
|
||||
-- ***----------------------------**** me
|
||||
-- ***-----------------**** Other
|
||||
is static;
|
||||
|
||||
IsJustBefore(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is just before Other
|
||||
-- ***--------**** me
|
||||
-- ***-----------** Other
|
||||
is static;
|
||||
|
||||
IsJustAfter(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is just after Other
|
||||
-- ****-------**** me
|
||||
-- ***-----------** Other
|
||||
is static;
|
||||
|
||||
IsOverlappingAtStart(me; Other : Interval from Intrv)
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is overlapping Other at start
|
||||
-- ***---------------*** me
|
||||
-- ***-----------** Other
|
||||
is static;
|
||||
|
||||
IsOverlappingAtEnd(me; Other : Interval from Intrv)
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is overlapping Other at end
|
||||
-- ***-----------** me
|
||||
-- ***---------------*** Other
|
||||
is static;
|
||||
|
||||
IsJustOverlappingAtStart(me; Other : Interval from Intrv)
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is just overlapping Other at start
|
||||
-- ***-----------*** me
|
||||
-- ***------------------------** Other
|
||||
is static;
|
||||
|
||||
IsJustOverlappingAtEnd(me; Other : Interval from Intrv)
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me is just overlapping Other at end
|
||||
-- ***-----------* me
|
||||
-- ***------------------------** Other
|
||||
is static;
|
||||
|
||||
IsSimilar(me; Other : Interval from Intrv) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: True if me and Other have the same bounds
|
||||
-- *----------------*** me
|
||||
-- ***-----------------** Other
|
||||
is static;
|
||||
|
||||
fields
|
||||
myStart : Real from Standard;
|
||||
myEnd : Real from Standard;
|
||||
myTolStart : ShortReal from Standard;
|
||||
myTolEnd : ShortReal from Standard;
|
||||
|
||||
end;
|
102
src/Intrv/Intrv_Interval.cxx
Executable file
102
src/Intrv/Intrv_Interval.cxx
Executable file
@@ -0,0 +1,102 @@
|
||||
// File: Intrv_Interval.cxx
|
||||
// Created: Fri Dec 13 14:56:47 1991
|
||||
// Author: Christophe MARION
|
||||
// <cma@sdsun1>
|
||||
|
||||
#include <Intrv_Interval.ixx>
|
||||
|
||||
// **-----------**** Other
|
||||
// ***-----* Before
|
||||
// ***------------* JustBefore
|
||||
// ***-----------------* OverlappingAtStart
|
||||
// ***--------------------------* JustEnclosingAtEnd
|
||||
// ***-------------------------------------* Enclosing
|
||||
// ***----* JustOverlappingAtStart
|
||||
// ***-------------* Similar
|
||||
// ***------------------------* JustEnclosingAtStart
|
||||
// ***-* Inside
|
||||
// ***------* JustOverlappingAtEnd
|
||||
// ***-----------------* OverlappingAtEnd
|
||||
// ***--------* JustAfter
|
||||
// ***---* After
|
||||
|
||||
//=======================================================================
|
||||
//function : Intrv_Interval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Interval::Intrv_Interval
|
||||
() : myStart(RealFirst()), myEnd (RealLast ())
|
||||
{
|
||||
myTolStart = (Standard_ShortReal)Epsilon(RealFirst());
|
||||
myTolEnd = (Standard_ShortReal)Epsilon(RealLast ());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intrv_Interval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Interval::Intrv_Interval
|
||||
(const Standard_Real Start, const Standard_Real End) :
|
||||
myStart(Start), myEnd (End)
|
||||
{
|
||||
myTolStart = (Standard_ShortReal)Epsilon(myStart);
|
||||
myTolEnd = (Standard_ShortReal)Epsilon(myEnd);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intrv_Interval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Interval::Intrv_Interval
|
||||
(const Standard_Real Start, const Standard_ShortReal TolStart,
|
||||
const Standard_Real End , const Standard_ShortReal TolEnd) :
|
||||
myStart(Start), myEnd (End),
|
||||
myTolStart(TolStart),myTolEnd (TolEnd)
|
||||
{
|
||||
Standard_ShortReal epsStart = (Standard_ShortReal)Epsilon(myStart);
|
||||
Standard_ShortReal epsEnd = (Standard_ShortReal)Epsilon(myEnd);
|
||||
if (myTolStart < epsStart) myTolStart = epsStart;
|
||||
if (myTolEnd < epsEnd ) myTolEnd = epsEnd;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Position
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Position Intrv_Interval::Position (const Intrv_Interval& Other) const
|
||||
{
|
||||
Standard_Real mySMin = myStart - myTolStart;
|
||||
Standard_Real mySMax = myStart + myTolStart;
|
||||
Standard_Real myEMin = myEnd - myTolEnd ;
|
||||
Standard_Real myEMax = myEnd + myTolEnd ;
|
||||
Standard_Real otSMin = Other.myStart - Other.myTolStart;
|
||||
Standard_Real otSMax = Other.myStart + Other.myTolStart;
|
||||
Standard_Real otEMin = Other.myEnd - Other.myTolEnd ;
|
||||
Standard_Real otEMax = Other.myEnd + Other.myTolEnd ;
|
||||
Intrv_Position P;
|
||||
if ( mySMax < otSMin ) {
|
||||
if ( myEMax < otSMin ) P = Intrv_Before;
|
||||
else if ( otSMax >= myEMin ) P = Intrv_JustBefore;
|
||||
else if ( myEMax < otEMin ) P = Intrv_OverlappingAtStart;
|
||||
else if ( otEMax >= myEMin ) P = Intrv_JustEnclosingAtEnd;
|
||||
else P = Intrv_Enclosing;
|
||||
}
|
||||
else if ( otSMax >= mySMin ) {
|
||||
if ( myEMax < otEMin ) P = Intrv_JustOverlappingAtStart;
|
||||
else if ( otEMax >= myEMin ) P = Intrv_Similar;
|
||||
else P = Intrv_JustEnclosingAtStart;
|
||||
}
|
||||
else if ( mySMax < otEMin ) {
|
||||
if ( myEMax < otEMin ) P = Intrv_Inside;
|
||||
else if ( otEMax >= myEMin ) P = Intrv_JustOverlappingAtEnd;
|
||||
else P = Intrv_OverlappingAtEnd;
|
||||
}
|
||||
else if ( otEMax >= mySMin ) P = Intrv_JustAfter;
|
||||
else P = Intrv_After;
|
||||
return P;
|
||||
}
|
||||
|
325
src/Intrv/Intrv_Interval.lxx
Executable file
325
src/Intrv/Intrv_Interval.lxx
Executable file
@@ -0,0 +1,325 @@
|
||||
// File: Intrv_Interval.lxx
|
||||
// Created: Fri Dec 13 14:57:29 1991
|
||||
// Author: Christophe MARION
|
||||
// <cma@sdsun1>
|
||||
|
||||
// **-----------**** Other
|
||||
// ***-----* IsBefore
|
||||
// ***------------* IsJustBefore
|
||||
// ***-----------------* IsOverlappingAtStart
|
||||
// ***--------------------------* IsJustEnclosingAtEnd
|
||||
// ***-------------------------------------* IsEnclosing
|
||||
// ***----* IsJustOverlappingAtStart
|
||||
// ***-------------* IsSimilar
|
||||
// ***------------------------* IsJustEnclosingAtStart
|
||||
// ***-* IsInside
|
||||
// ***------* IsJustOverlappingAtEnd
|
||||
// ***-----------------* IsOverlappingAtEnd
|
||||
// ***--------* IsJustAfter
|
||||
// ***---* IsAfter
|
||||
|
||||
//=======================================================================
|
||||
//function : Start
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real Intrv_Interval::Start () const
|
||||
{ return myStart; }
|
||||
|
||||
//=======================================================================
|
||||
//function : End
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real Intrv_Interval::End () const
|
||||
{ return myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
//function : TolStart
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_ShortReal Intrv_Interval::TolStart () const
|
||||
{ return myTolStart; }
|
||||
|
||||
//=======================================================================
|
||||
//function : TolEnd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_ShortReal Intrv_Interval::TolEnd () const
|
||||
{ return myTolEnd; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::Bounds
|
||||
(Standard_Real& Start, Standard_ShortReal& TolStart,
|
||||
Standard_Real& End , Standard_ShortReal& TolEnd) const
|
||||
{
|
||||
Start = myStart;
|
||||
TolStart = myTolStart;
|
||||
End = myEnd;
|
||||
TolEnd = myTolEnd;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStart
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::SetStart
|
||||
(const Standard_Real Start, const Standard_ShortReal TolStart)
|
||||
{
|
||||
myStart = Start;
|
||||
myTolStart = TolStart;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FuseAtStart
|
||||
//
|
||||
// ****+****--------------------> Old one
|
||||
// ****+****------------------------> New one to fuse
|
||||
// <<< <<<
|
||||
// ****+****------------------------> result
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::FuseAtStart
|
||||
(const Standard_Real Start, const Standard_ShortReal TolStart)
|
||||
{
|
||||
if (myStart != RealFirst()) {
|
||||
Standard_Real a = Min(myStart-myTolStart,Start-TolStart);
|
||||
Standard_Real b = Min(myStart+myTolStart,Start+TolStart);
|
||||
myStart = (a+b)/2;
|
||||
myTolStart = (Standard_ShortReal)(b-a)/2;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CutAtStart
|
||||
//
|
||||
// ****+****-----------> Old one
|
||||
// <----------**+** Tool for cutting
|
||||
// >>> >>>
|
||||
// ****+****-----------> result
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::CutAtStart
|
||||
(const Standard_Real Start, const Standard_ShortReal TolStart)
|
||||
{
|
||||
if (myStart != RealFirst()) {
|
||||
Standard_Real a = Max(myStart-myTolStart,Start-TolStart);
|
||||
Standard_Real b = Max(myStart+myTolStart,Start+TolStart);
|
||||
myStart = (a+b)/2;
|
||||
myTolStart = (Standard_ShortReal)(b-a)/2;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetEnd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::SetEnd
|
||||
(const Standard_Real End, const Standard_ShortReal TolEnd)
|
||||
{
|
||||
myEnd = End;
|
||||
myTolEnd = TolEnd;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FuseAtEnd
|
||||
//
|
||||
// <---------------------****+**** Old one
|
||||
// <-----------------**+** New one to fuse
|
||||
// >>> >>>
|
||||
// <---------------------****+**** result
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::FuseAtEnd
|
||||
(const Standard_Real End, const Standard_ShortReal TolEnd)
|
||||
{
|
||||
if (myEnd != RealLast()) {
|
||||
Standard_Real a = Max(myEnd-myTolEnd,End-TolEnd);
|
||||
Standard_Real b = Max(myEnd+myTolEnd,End+TolEnd);
|
||||
myEnd = (a+b)/2;
|
||||
myTolEnd = (Standard_ShortReal)(b-a)/2;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CutAtEnd
|
||||
//
|
||||
// <-----****+**** Old one
|
||||
// **+**------> Tool for cutting
|
||||
// <<< <<<
|
||||
// <-----****+**** result
|
||||
//
|
||||
//=======================================================================
|
||||
|
||||
inline void Intrv_Interval::CutAtEnd
|
||||
(const Standard_Real End, const Standard_ShortReal TolEnd)
|
||||
{
|
||||
if (myEnd != RealLast()) {
|
||||
Standard_Real a = Min(myEnd-myTolEnd,End-TolEnd);
|
||||
Standard_Real b = Min(myEnd+myTolEnd,End+TolEnd);
|
||||
myEnd = (a+b)/2;
|
||||
myTolEnd = (Standard_ShortReal)(b-a)/2;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AreFused
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean AreFused
|
||||
(const Standard_Real c1,const Standard_ShortReal t1,
|
||||
const Standard_Real c2,const Standard_ShortReal t2)
|
||||
{ return t1 + t2 >= Abs (c1 - c2); }
|
||||
|
||||
//=======================================================================
|
||||
//function : IsProbablyEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsProbablyEmpty () const
|
||||
{ return AreFused (myStart, myTolStart, myEnd, myTolEnd); }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***-----* IsBefore
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsBefore
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolEnd + Other.myTolStart < Other.myStart - myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***---* IsAfter
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsAfter
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolEnd < myStart - Other.myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***-* IsInside
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsInside
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolStart < myStart - Other.myStart &&
|
||||
myTolEnd + Other.myTolEnd < Other.myEnd - myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***-------------------------------------* IsEnclosing
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsEnclosing
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolStart < Other.myStart - myStart &&
|
||||
myTolEnd + Other.myTolEnd < myEnd - Other.myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***------------------------* IsJustEnclosingAtStart
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsJustEnclosingAtStart
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return AreFused (myStart, myTolStart, Other.myStart, Other.myTolStart) &&
|
||||
myTolEnd + Other.myTolEnd < myEnd - Other.myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***--------------------------* IsJustEnclosingAtEnd
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsJustEnclosingAtEnd
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolStart < Other.myStart - myStart &&
|
||||
AreFused (Other.myEnd, Other.myTolEnd, myEnd, myTolEnd); }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***------------* IsJustBefore
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsJustBefore
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return AreFused (myEnd, myTolEnd, Other.myStart, Other.myTolStart); }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***--------* IsJustAfter
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsJustAfter
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return AreFused (Other.myEnd, Other.myTolEnd, myStart, myTolStart); }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***-----------------* IsOverlappingAtStart
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsOverlappingAtStart
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolStart < Other.myStart - myStart &&
|
||||
myTolEnd + Other.myTolStart < myEnd - Other.myStart &&
|
||||
myTolEnd + Other.myTolEnd < Other.myEnd - myEnd ; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***-----------------* IsOverlappingAtEnd
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsOverlappingAtEnd
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolStart < myStart - Other.myStart &&
|
||||
myTolStart + Other.myTolEnd < Other.myEnd - myStart &&
|
||||
myTolEnd + Other.myTolEnd < myEnd - Other.myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***----* IsJustOverlappingAtStart
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsJustOverlappingAtStart
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return AreFused (myStart, myTolStart, Other.myStart, Other.myTolStart) &&
|
||||
myTolEnd + Other.myTolEnd < Other.myEnd - myEnd; }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***------* IsJustOverlappingAtEnd
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsJustOverlappingAtEnd
|
||||
(const Intrv_Interval& Other) const
|
||||
{ return myTolStart + Other.myTolStart < myStart - Other.myStart &&
|
||||
AreFused (Other.myEnd, Other.myTolEnd, myEnd, myTolEnd); }
|
||||
|
||||
//=======================================================================
|
||||
// **-----------**** Other
|
||||
// ***-------------* IsSimilar
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean Intrv_Interval::IsSimilar
|
||||
(const Intrv_Interval& Other) const
|
||||
{
|
||||
Standard_Boolean b1,b2;
|
||||
b1 = AreFused (myStart,myTolStart,Other.myStart,Other.myTolStart);
|
||||
b2 = AreFused (myEnd ,myTolEnd ,Other.myEnd ,Other.myTolEnd);
|
||||
return b1 && b2;
|
||||
}
|
||||
|
71
src/Intrv/Intrv_Intervals.cdl
Executable file
71
src/Intrv/Intrv_Intervals.cdl
Executable file
@@ -0,0 +1,71 @@
|
||||
-- File: Intervals.cdl
|
||||
-- Created: Fri Dec 13 14:20:52 1991
|
||||
-- Author: Christophe MARION
|
||||
-- <cma@sdsun1>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
class Intervals from Intrv
|
||||
---Purpose: The class Intervals is a sorted sequence of non
|
||||
-- overlapping Real Intervals.
|
||||
|
||||
uses
|
||||
Integer from Standard,
|
||||
Interval from Intrv,
|
||||
SequenceOfInterval from Intrv
|
||||
|
||||
raises
|
||||
OutOfRange
|
||||
|
||||
is
|
||||
Create returns Intervals from Intrv;
|
||||
---Purpose: Creates a void sequence of intervals.
|
||||
|
||||
Create(Int : Interval from Intrv) returns Intervals from Intrv;
|
||||
---Purpose: Creates a sequence of one interval.
|
||||
|
||||
Create(Int : Intervals from Intrv) returns Intervals from Intrv;
|
||||
---Purpose: Creates by copying an existing sequence of
|
||||
-- intervals.
|
||||
|
||||
Intersect(me : in out; Tool : Interval from Intrv)
|
||||
---Purpose: Intersects the intervals with the interval <Tool>.
|
||||
is static;
|
||||
|
||||
Intersect(me : in out; Tool : Intervals from Intrv)
|
||||
---Purpose: Intersects the intervals with the intervals in the
|
||||
-- sequence <Tool>.
|
||||
is static;
|
||||
|
||||
Subtract(me : in out; Tool : Interval from Intrv)
|
||||
is static;
|
||||
|
||||
Subtract(me : in out; Tool : Intervals from Intrv)
|
||||
is static;
|
||||
|
||||
Unite(me : in out; Tool : Interval from Intrv)
|
||||
is static;
|
||||
|
||||
Unite(me : in out; Tool : Intervals from Intrv)
|
||||
is static;
|
||||
|
||||
XUnite(me : in out; Tool : Interval from Intrv)
|
||||
is static;
|
||||
|
||||
XUnite(me : in out; Tool : Intervals from Intrv)
|
||||
is static;
|
||||
|
||||
NbIntervals(me) returns Integer from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Value(me; Index : Integer from Standard)
|
||||
returns Interval from Intrv
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
fields
|
||||
myInter : SequenceOfInterval from Intrv;
|
||||
|
||||
end Intervals;
|
271
src/Intrv/Intrv_Intervals.cxx
Executable file
271
src/Intrv/Intrv_Intervals.cxx
Executable file
@@ -0,0 +1,271 @@
|
||||
// File: Intrv_Intervals.cxx
|
||||
// Created: Fri Dec 13 15:44:50 1991
|
||||
// Author: Christophe MARION
|
||||
// <cma@sdsun1>
|
||||
#ifndef No_Exception
|
||||
#define No_Exception
|
||||
#endif
|
||||
#include <Intrv_Intervals.ixx>
|
||||
|
||||
// **---------**** Other
|
||||
// ***-----* IsBefore
|
||||
// ***------------* IsJustBefore
|
||||
// ***-----------------* IsOverlappingAtStart
|
||||
// ***------------------------* IsJustEnclosingAtEnd
|
||||
// ***-----------------------------------* IsEnclosing
|
||||
// ***----* IsJustOverlappingAtStart
|
||||
// ***-----------* IsSimilar
|
||||
// ***----------------------* IsJustEnclosingAtStart
|
||||
// ***-* IsInside
|
||||
// ***------* IsJustOverlappingAtEnd
|
||||
// ***-----------------* IsOverlappingAtEnd
|
||||
// ***--------* IsJustAfter
|
||||
// ***---* IsAfter
|
||||
|
||||
//=======================================================================
|
||||
//function : Intrv_Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Intervals::Intrv_Intervals ()
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intrv_Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Intervals::Intrv_Intervals (const Intrv_Interval& Int)
|
||||
{ myInter.Append(Int); }
|
||||
|
||||
//=======================================================================
|
||||
//function : Intrv_Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Intrv_Intervals::Intrv_Intervals (const Intrv_Intervals& Int)
|
||||
{ myInter = Int.myInter; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Intersect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::Intersect (const Intrv_Interval& Tool)
|
||||
{
|
||||
Intrv_Intervals Inter(Tool);
|
||||
Intersect(Inter);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intersect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::Intersect (const Intrv_Intervals& Tool)
|
||||
{
|
||||
Intrv_Intervals XUni(*this);
|
||||
XUni.XUnite(Tool);
|
||||
Unite(Tool);
|
||||
Subtract(XUni);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Subtract
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::Subtract (const Intrv_Interval& Tool)
|
||||
{
|
||||
Standard_Integer index = 1;
|
||||
|
||||
while (index <= myInter.Length()) {
|
||||
|
||||
switch (Tool.Position (myInter(index))) {
|
||||
|
||||
case Intrv_Before :
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_JustBefore :
|
||||
myInter(index).CutAtStart
|
||||
(Tool.End (),Tool.TolEnd ()); // modifier le debut
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_OverlappingAtStart :
|
||||
case Intrv_JustOverlappingAtStart :
|
||||
myInter(index).SetStart
|
||||
(Tool.End (),Tool.TolEnd ()); // garder la fin
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_JustEnclosingAtEnd :
|
||||
case Intrv_Enclosing :
|
||||
case Intrv_Similar :
|
||||
case Intrv_JustEnclosingAtStart :
|
||||
myInter.Remove(index); // detruire et
|
||||
index--; // continuer
|
||||
break;
|
||||
|
||||
case Intrv_Inside :
|
||||
myInter.InsertAfter(index,myInter(index));
|
||||
myInter(index ).SetEnd
|
||||
(Tool.Start(),Tool.TolStart()); // garder le debut
|
||||
myInter(index+1).SetStart
|
||||
(Tool.End (),Tool.TolEnd ()); // garder la fin
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_JustOverlappingAtEnd :
|
||||
case Intrv_OverlappingAtEnd :
|
||||
myInter(index).SetEnd
|
||||
(Tool.Start(),Tool.TolStart()); // garder le debut
|
||||
break; // continuer
|
||||
|
||||
case Intrv_JustAfter :
|
||||
myInter(index).CutAtEnd
|
||||
(Tool.Start(),Tool.TolStart()); // modifier la fin
|
||||
break; // continuer
|
||||
|
||||
case Intrv_After :
|
||||
break; // continuer
|
||||
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Subtract
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::Subtract (const Intrv_Intervals& Tool)
|
||||
{
|
||||
Standard_Integer index;
|
||||
for (index = 1; index <= Tool.myInter.Length(); index++)
|
||||
Subtract (Tool.myInter(index));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::Unite (const Intrv_Interval& Tool)
|
||||
{
|
||||
Standard_Boolean Inserted = Standard_False;
|
||||
Intrv_Interval Tins(Tool);
|
||||
Standard_Integer index = 1;
|
||||
|
||||
while (index <= myInter.Length()) {
|
||||
|
||||
switch (Tins.Position (myInter(index))) {
|
||||
|
||||
case Intrv_Before :
|
||||
Inserted = Standard_True;
|
||||
myInter.InsertBefore(index,Tins); // inserer avant et
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_JustBefore :
|
||||
case Intrv_OverlappingAtStart :
|
||||
Inserted = Standard_True;
|
||||
myInter(index).SetStart
|
||||
(Tins.Start(),Tins.TolStart()); // changer le debut
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_Similar :
|
||||
Tins.FuseAtStart(myInter(index).Start(),
|
||||
myInter(index).TolStart()); // modifier le debut
|
||||
case Intrv_JustEnclosingAtEnd :
|
||||
Tins.FuseAtEnd (myInter(index).End (),
|
||||
myInter(index).TolEnd ()); // modifier la fin
|
||||
case Intrv_Enclosing :
|
||||
myInter.Remove(index); // detruire et
|
||||
index--; // continuer
|
||||
break;
|
||||
|
||||
case Intrv_JustOverlappingAtEnd :
|
||||
Tins.SetStart (myInter(index).Start(),
|
||||
myInter(index).TolStart()); // changer le debut
|
||||
Tins.FuseAtEnd (myInter(index).End (),
|
||||
myInter(index).TolEnd ()); // modifier la fin
|
||||
myInter.Remove(index); // detruire et
|
||||
index--; // continuer
|
||||
break;
|
||||
|
||||
case Intrv_JustOverlappingAtStart :
|
||||
Inserted = Standard_True;
|
||||
myInter(index).FuseAtStart
|
||||
(Tins.Start(),Tins.TolStart()); // modifier le debut
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_JustEnclosingAtStart :
|
||||
Tins.FuseAtStart(myInter(index).Start(),
|
||||
myInter(index).TolStart()); // modifier le debut
|
||||
myInter.Remove(index); // detruire et
|
||||
index--; // continuer
|
||||
break;
|
||||
|
||||
case Intrv_Inside :
|
||||
Inserted = Standard_True;
|
||||
index = myInter.Length(); // sortir
|
||||
break;
|
||||
|
||||
case Intrv_OverlappingAtEnd :
|
||||
case Intrv_JustAfter :
|
||||
Tins.SetStart(myInter(index).Start(),
|
||||
myInter(index).TolStart()); // changer le debut
|
||||
myInter.Remove(index); // detruire et
|
||||
index--; // continuer
|
||||
break;
|
||||
|
||||
case Intrv_After :
|
||||
break; // continuer
|
||||
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if ( !Inserted ) myInter.Append (Tins);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::Unite (const Intrv_Intervals& Tool)
|
||||
{
|
||||
Standard_Integer index;
|
||||
for (index = 1; index<=Tool.myInter.Length(); index++)
|
||||
Unite (Tool.myInter(index));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : XUnite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::XUnite (const Intrv_Interval& Tool)
|
||||
{
|
||||
Intrv_Intervals Inter(Tool);
|
||||
XUnite(Inter);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : XUnite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intrv_Intervals::XUnite (const Intrv_Intervals& Tool)
|
||||
{
|
||||
Intrv_Intervals Sub2(Tool);
|
||||
Sub2.Subtract(*this);
|
||||
Subtract(Tool);
|
||||
Unite(Sub2);
|
||||
}
|
||||
|
26
src/Intrv/Intrv_Intervals.lxx
Executable file
26
src/Intrv/Intrv_Intervals.lxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: Intrv_Intervals.lxx
|
||||
// Created: Fri Dec 13 15:44:05 1991
|
||||
// Author: Christophe MARION
|
||||
// <cma@sdsun1>
|
||||
|
||||
#include <Intrv_SequenceOfInterval.hxx>
|
||||
#include <Intrv_Interval.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose : returns the number of Intervals
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer Intrv_Intervals::NbIntervals () const
|
||||
{ return myInter.Length(); }
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose : returns the Interval of rank Index
|
||||
//=======================================================================
|
||||
|
||||
inline const Intrv_Interval& Intrv_Intervals::Value
|
||||
(const Standard_Integer Index) const
|
||||
{ return myInter(Index); }
|
||||
|
||||
|
Reference in New Issue
Block a user