Loading files
3d097a032This file is pinned to the selected release. Download the original to open it in your design tool.
// Created on: 1991-12-13
// Created by: Christophe MARION
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Intrv_Interval.hxx>
// **-----------**** Other
// ***-----* Before
// ***------------* JustBefore
// ***-----------------* OverlappingAtStart
// ***--------------------------* JustEnclosingAtEnd
// ***-------------------------------------* Enclosing
// ***----* JustOverlappingAtStart
// ***-------------* Similar
// ***------------------------* JustEnclosingAtStart
// ***-* Inside
// ***------* JustOverlappingAtEnd
// ***-----------------* OverlappingAtEnd
// ***--------* JustAfter
// ***---* After
//=================================================================================================
Intrv_Interval::Intrv_Interval()
: myStart(RealFirst()),
myEnd(RealLast())
{
myTolStart = (float)Epsilon(RealFirst());
myTolEnd = (float)Epsilon(RealLast());
}
//=================================================================================================
Intrv_Interval::Intrv_Interval(const double Start, const double End)
: myStart(Start),
myEnd(End)
{
myTolStart = (float)Epsilon(myStart);
myTolEnd = (float)Epsilon(myEnd);
}
//=================================================================================================
Intrv_Interval::Intrv_Interval(const double Start,
const float TolStart,
const double End,
const float TolEnd)
: myStart(Start),
myEnd(End),
myTolStart(TolStart),
myTolEnd(TolEnd)
{
float epsStart = (float)Epsilon(myStart);
float epsEnd = (float)Epsilon(myEnd);
if (myTolStart < epsStart)
{
myTolStart = epsStart;
}
if (myTolEnd < epsEnd)
{
myTolEnd = epsEnd;
}
}
//=================================================================================================
Intrv_Position Intrv_Interval::Position(const Intrv_Interval& Other) const
{
double mySMin = myStart - myTolStart;
double mySMax = myStart + myTolStart;
double myEMin = myEnd - myTolEnd;
double myEMax = myEnd + myTolEnd;
double otSMin = Other.myStart - Other.myTolStart;
double otSMax = Other.myStart + Other.myTolStart;
double otEMin = Other.myEnd - Other.myTolEnd;
double 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;
}