1
// Wild Magic Source Code
3
// http://www.geometrictools.com
4
// Copyright (c) 1998-2007
6
// This library is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License as published by
8
// the Free Software Foundation; either version 2.1 of the License, or (at
9
// your option) any later version. The license is available for reading at
10
// either of the locations:
11
// http://www.gnu.org/copyleft/lgpl.html
12
// http://www.geometrictools.com/License/WildMagicLicense.pdf
13
// The license applies to versions 0 through 4 of Wild Magic.
15
// Version: 4.0.0 (2006/06/28)
17
//----------------------------------------------------------------------------
19
LinComp<Real>::LinComp ()
22
m_fMin = Math<Real>::MAX_REAL;
23
m_fMax = -Math<Real>::MAX_REAL;
25
//----------------------------------------------------------------------------
27
LinComp<Real>::~LinComp ()
30
//----------------------------------------------------------------------------
32
LinComp<Real>& LinComp<Real>::operator= (const LinComp& rkComponent)
34
m_iType = rkComponent.m_iType;
35
m_fMin = rkComponent.m_fMin;
36
m_fMax = rkComponent.m_fMax;
39
//----------------------------------------------------------------------------
41
int LinComp<Real>::GetType () const
45
//----------------------------------------------------------------------------
47
Real LinComp<Real>::GetMin () const
51
//----------------------------------------------------------------------------
53
Real LinComp<Real>::GetMax () const
57
//----------------------------------------------------------------------------
59
bool LinComp<Real>::Contains (Real fParam) const
61
return m_fMin <= fParam && fParam <= m_fMax;
63
//----------------------------------------------------------------------------
65
void LinComp<Real>::SetInterval (Real fMin, Real fMax)
67
m_iType = GetTypeFromInterval(fMin,fMax);
71
//----------------------------------------------------------------------------
73
int LinComp<Real>::GetTypeFromInterval (Real fMin, Real fMax)
77
if (fMax == Math<Real>::MAX_REAL)
79
if (fMin == -Math<Real>::MAX_REAL)
90
if (fMin == -Math<Real>::MAX_REAL)
100
else if (fMin == fMax)
102
if (fMin != -Math<Real>::MAX_REAL && fMax != Math<Real>::MAX_REAL)
110
//----------------------------------------------------------------------------
111
template <class Real>
112
bool LinComp<Real>::IsCanonical () const
114
if (m_iType == CT_RAY)
116
return m_fMin == (Real)0.0 && m_fMax == Math<Real>::MAX_REAL;
119
if (m_iType == CT_SEGMENT)
121
return m_fMin == -m_fMax;
124
if (m_iType == CT_POINT)
126
return m_fMin == (Real)0.0;
129
if (m_iType == CT_EMPTY)
131
return m_fMin == Math<Real>::MAX_REAL
132
&& m_fMax == -Math<Real>::MAX_REAL;
135
// m_iType == CT_LINE
138
//----------------------------------------------------------------------------