CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GeInterval.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24
25#ifndef OD_GE_INTERVAL_H
26#define OD_GE_INTERVAL_H
28#include "Ge/GeExport.h"
29#include "TD_PackPush.h"
30
40{
41public:
47 OdGeInterval(double tol = 1.e-12)
48 : m_LowerParam(0.0)
49 , m_UpperParam(0.0)
50 , m_Tol(tol)
51 , m_bBoundedAbove(false)
52 , m_bBoundedBelow(false)
53 {
54 }
55
63 OdGeInterval(double lower, double upper, double tol = 1.e-12)
64 : m_LowerParam(lower)
65 , m_UpperParam(upper)
66 , m_Tol(tol)
67 , m_bBoundedAbove(true)
68 , m_bBoundedBelow(true)
69 {
70 }
71
72
81 bool boundedBelow,
82 double bound,
83 double tol = 1.e-12);
84
91 double lowerBound() const {
92 return m_LowerParam;
93 }
94
101 double upperBound() const {
102 return m_UpperParam;
103 }
104
111 double middle() const {
112 return 0.5 * (m_LowerParam + m_UpperParam);
113 }
114
127 double element() const;
128
136 double& lower,
137 double& upper) const
138 {
139 lower = m_LowerParam;
140 upper = m_UpperParam;
141 }
142
148 double getEnd(
149 int index) const
150 {
151 ODA_ASSERT(index == 0 || index == 1);
152 return index == 0 ? m_LowerParam : m_UpperParam;
153 }
154
161 double length() const
162 {
163 return (isBounded() ? (m_UpperParam - m_LowerParam) : -1.0);
164 }
165
169 double tolerance() const
170 {
171 return m_Tol;
172 }
173
180 double eval(
181 double ratio) const
182 {
183 ODA_ASSERT(isBounded());
184 return m_LowerParam * (1.0 - ratio) + m_UpperParam * ratio;
185 }
186
197 double lower,
198 double upper)
199 {
200 setLower(lower);
201 return setUpper(upper);
202 }
203
215 bool boundedBelow,
216 double bound);
217
225 {
226 m_LowerParam = m_UpperParam = 0.0;
227 m_bBoundedBelow = m_bBoundedAbove = false;
228 return *this;
229 }
230
238 double upper)
239 {
240 m_UpperParam = upper;
241 m_bBoundedAbove = true;
242 return *this;
243 }
244
253 double lower)
254 {
255 m_LowerParam = lower;
256 m_bBoundedBelow = true;
257 return *this;
258 }
259
269 double tol)
270 {
271 m_Tol = tol;
272 return *this;
273 }
274
282 const OdGeInterval& otherInterval,
283 OdGeInterval& result) const;
284
304 const OdGeInterval& otherInterval,
305 OdGeInterval& lInterval,
306 OdGeInterval& rInterval) const;
307
318 const OdGeInterval& otherInterval,
319 OdGeInterval& result) const;
320
332
336 bool isBounded() const
337 {
338 return (m_bBoundedAbove && m_bBoundedBelow);
339 }
340
344 bool isBoundedAbove() const
345 {
346 return m_bBoundedAbove;
347 }
348
352 bool isBoundedBelow() const
353 {
354 return m_bBoundedBelow;
355 }
356
360 bool isUnBounded() const
361 {
362 return (!m_bBoundedAbove || !m_bBoundedBelow);
363 }
364
370 bool isSingleton() const;
371
380 const OdGeInterval& otherInterval) const;
381
391 const OdGeInterval& otherInterval) const;
392
402 double value) const
403 {
404 return ((!m_bBoundedBelow || m_LowerParam - m_Tol <= value)
405 && (!m_bBoundedAbove || m_UpperParam + m_Tol >= value));
406 }
407
415 double clamp(
416 double value) const
417 {
418 if (m_bBoundedAbove)
419 value = odmin(value, m_UpperParam);
420 if (m_bBoundedBelow)
421 value = odmax(value, m_LowerParam);
422 return value;
423 }
424
434 const OdGeInterval& otherInterval) const;
435
454 const OdGeInterval& otherInterval,
455 OdGeInterval& overlap) const;
456
466 const OdGeInterval& otherInterval) const;
467
477 const OdGeInterval& otherInterval) const;
478
491 const OdGeInterval& otherInterval) const;
492
504 double value) const;
505
517 const OdGeInterval& otherInterval) const;
518
529 double value) const;
530
547 double period,
548 double& value);
549//DOM-IGNORE-BEGIN
550
551 friend
553 double value,
554 const OdGeInterval& interval);
556 double value) const;
558 const OdGeInterval& otherInterval) const;
559 friend
561 double value,
562 const OdGeInterval& interval);
564 double value) const;
566 const OdGeInterval& otherInterval) const;
567 friend
569 double value,
570 const OdGeInterval& interval);
572 double value) const;
574 const OdGeInterval& otherInterval) const;
575 friend
577 double value,
578 const OdGeInterval& interval);
580 double value) const;
582 const OdGeInterval& otherInterval) const;
583
584private:
585 double m_Tol;
586 double m_UpperParam;
587 double m_LowerParam;
588 bool m_bBoundedAbove;
589 bool m_bBoundedBelow;
590//DOM-IGNORE-END
591};
592
593#include "TD_PackPop.h"
594#endif // OD_GE_INTERVAL_H
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:57
tol
Definition: DimVarDefs.h:2287
true
Definition: DimVarDefs.h:2046
false
Definition: DimVarDefs.h:165
#define GE_TOOLKIT_EXPORT
Definition: GeExport.h:49
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
#define odmin(X, Y)
Definition: OdPlatform.h:34
#define odmax(X, Y)
Definition: OdPlatform.h:35
bool operator>=(const OdString &s1, const OdString &s2)
Definition: OdString.h:1376
bool operator<=(const OdString &s1, const OdString &s2)
Definition: OdString.h:1354
bool operator<(const OdString &s1, const OdString &s2)
Definition: OdString.h:1309
bool operator>(const OdString &s1, const OdString &s2)
Definition: OdString.h:1332
OdGeInterval & set(bool boundedBelow, double bound)
OdGeInterval(double tol=1.e-12)
Definition: GeInterval.h:47
OdGeInterval(bool boundedBelow, double bound, double tol=1.e-12)
double upperBound() const
Definition: GeInterval.h:101
bool isEqualAtUpper(double value) const
bool contains(const OdGeInterval &otherInterval) const
void getBounds(double &lower, double &upper) const
Definition: GeInterval.h:135
double getEnd(int index) const
Definition: GeInterval.h:148
double middle() const
Definition: GeInterval.h:111
bool isEqualAtUpper(const OdGeInterval &otherInterval) const
bool isSingleton() const
bool isOverlapAtUpper(const OdGeInterval &otherInterval, OdGeInterval &overlap) const
double lowerBound() const
Definition: GeInterval.h:91
OdGeInterval & setUpper(double upper)
Definition: GeInterval.h:237
bool isBoundedBelow() const
Definition: GeInterval.h:352
bool isPeriodicallyOn(double period, double &value)
OdGeInterval & setTolerance(double tol)
Definition: GeInterval.h:268
double clamp(double value) const
Definition: GeInterval.h:415
OdGeInterval & set(double lower, double upper)
Definition: GeInterval.h:196
double tolerance() const
Definition: GeInterval.h:169
OdGeInterval(double lower, double upper, double tol=1.e-12)
Definition: GeInterval.h:63
double eval(double ratio) const
Definition: GeInterval.h:180
bool contains(double value) const
Definition: GeInterval.h:401
bool isEqualAtLower(double value) const
bool intersectWith(const OdGeInterval &otherInterval, OdGeInterval &result) const
bool isUnBounded() const
Definition: GeInterval.h:360
bool isBounded() const
Definition: GeInterval.h:336
bool isDisjoint(const OdGeInterval &otherInterval) const
bool isBoundedAbove() const
Definition: GeInterval.h:344
void getMerge(const OdGeInterval &otherInterval, OdGeInterval &result) const
OdGeInterval & set()
Definition: GeInterval.h:224
bool isEqualAtLower(const OdGeInterval &otherInterval) const
bool finiteIntersectWith(const OdGeInterval &range, OdGeInterval &result) const
double element() const
OdGeInterval & setLower(double lower)
Definition: GeInterval.h:252
int subtract(const OdGeInterval &otherInterval, OdGeInterval &lInterval, OdGeInterval &rInterval) const
bool isContinuousAtUpper(const OdGeInterval &otherInterval) const
double length() const
Definition: GeInterval.h:161
GLuint index
Definition: gles2_ext.h:265
GLenum GLint * range
Definition: gles2_ext.h:563
GLsizei const GLfloat * value
Definition: gles2_ext.h:302