CFx SDK Documentation
2026 SP0
Loading...
Searching...
No Matches
SDK
CFx
dd_inc
Si
SiExtents.h
Go to the documentation of this file.
1
2
// Copyright (C) 2002-2024, 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-2024 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 _SpExtents_h_Included_
26
#define _SpExtents_h_Included_
27
28
#if _MSC_VER >= 1000
29
#pragma once
30
#endif
31
32
#include "
Si/SiSpatialIndex.h
"
33
38
namespace
OdSi
39
{
40
46
class
ODSI_API
Extent3d
:
public
OdGeExtents3d
,
public
OdSiShape
47
{
48
public
:
49
virtual
bool
contains
(
const
OdGeExtents3d
& extents,
bool
planar =
false
,
const
OdGeTol
&
tol
=
OdGeContext::gTol
)
const
50
{
51
if
( planar )
52
{
53
ODA_ASSERT
( extents.
minPoint
().
z
== 0 && extents.
maxPoint
().
z
== 0 );
54
}
55
return
OdGeExtents3d::contains
( extents,
tol
);
56
}
57
74
virtual
bool
intersects
(
const
OdGeExtents3d
& extents,
bool
planar =
false
,
const
OdGeTol
&
tol
=
OdGeContext::gTol
)
const
75
{
76
if
( planar ==
false
)
77
return
!
isDisjoint
( extents,
tol
);
78
else
79
{
80
if
(extents.
minPoint
().
x
==
maxPoint
().
x
|| extents.
minPoint
().
y
==
maxPoint
().
y
81
||
minPoint
().
x
== extents.
maxPoint
().
x
||
minPoint
().
y
== extents.
maxPoint
().
y
)
82
return
false
;
//extents not intersect, they has one a border for both
83
return
!( extents.
minPoint
().
x
> (
maxPoint
().
x
+
tol
.equalPoint())
84
|| extents.
minPoint
().
y
> (
maxPoint
().
y
+
tol
.equalPoint())
85
||
minPoint
().
x
> (extents.
maxPoint
().
x
+
tol
.equalPoint())
86
||
minPoint
().
y
> (extents.
maxPoint
().
y
+
tol
.equalPoint()));
87
}
88
}
89
90
enum
IntersectResult
91
{
92
left
= 0,
// Coordinate is to the *left* of the *extents*.
93
upon
= 1,
// Coordinate is *upon* the *extents*.
94
right
= 2
// Coordinate is to the *right* of the *extents*.
95
};
96
97
98
#ifndef SWIG
116
IntersectResult
intersects
(
double
coordinate,
int
dimension,
double
tol
=
OdGeContext::gTol
.equalPoint() )
const
117
{
118
if
(
m_min
[dimension] > (coordinate +
tol
) )
return
right
;
119
if
(
m_max
[dimension] < (coordinate -
tol
) )
return
left
;
120
return
upon
;
121
}
122
#endif
128
void
makeHalf
(
int
dimension,
bool
moveRight )
129
{
130
if
( moveRight )
131
m_max
[dimension] = (
m_min
[dimension] +
m_max
[dimension]) / 2;
132
else
133
m_min
[dimension] = (
m_min
[dimension] +
m_max
[dimension]) / 2;
134
}
135
141
void
makeDouble
(
int
dimension,
bool
moveRight )
142
{
143
if
( moveRight )
144
m_max
[dimension] += (
m_max
[dimension] -
m_min
[dimension] );
145
else
146
m_min
[dimension] -= (
m_max
[dimension] -
m_min
[dimension] );
147
}
148
152
void
makeCube
(
bool
planar )
153
{
154
if
(
m_min
.isEqualTo(
m_max
) )
return
;
155
double
ext =
odmax
(
m_max
.x -
m_min
.x,
m_max
.y -
m_min
.y );
156
if
( !planar ) ext =
odmax
(
m_max
.z -
m_min
.z, ext );
157
m_max
.x =
m_min
.x + ext;
158
m_max
.y =
m_min
.y + ext;
159
if
( !planar )
m_max
.z =
m_min
.z + ext;
160
}
161
162
Extent3d
() {}
166
Extent3d
(
const
OdGePoint3d
& min,
const
OdGePoint3d
& max )
167
:
OdGeExtents3d
( min, max ) {}
168
Extent3d
(
const
OdGeExtents3d
&
source
) :
OdGeExtents3d
(
source
) {}
169
Extent3d
(
const
OdGeExtents2d
&
source
)
170
:
OdGeExtents3d
(
OdGePoint3d
(
source
.
minPoint
().
x
,
source
.
minPoint
().
y
, 0 ),
171
OdGePoint3d
(
source
.
maxPoint
().
x
,
source
.
maxPoint
().
y
, 0 )) {}
172
};
173
}
174
#endif
ODA_ASSERT
#define ODA_ASSERT(exp)
Definition
DebugStuff.h:57
tol
tol
Definition
DimVarDefs.h:2287
odmax
ODRX_CONSTEXPR const T & odmax(const T &a, const T &b)
Definition
OdPlatform.h:38
SiSpatialIndex.h
ODSI_API
#define ODSI_API
Definition
SiSpatialIndex.h:33
OdGeExtents2d
Definition
GeExtents2d.h:44
OdGeExtents3d::isDisjoint
bool isDisjoint(const OdGeExtents3d &extents, const OdGeTol &tol=OdGeContext::gTol) const
Definition
GeExtents3d.h:545
OdGeExtents3d::m_max
OdGePoint3d m_max
Definition
GeExtents3d.h:420
OdGeExtents3d::OdGeExtents3d
OdGeExtents3d()
Definition
GeExtents3d.h:426
OdGeExtents3d::m_min
OdGePoint3d m_min
Definition
GeExtents3d.h:419
OdGeExtents3d::maxPoint
const OdGePoint3d & maxPoint() const
Definition
GeExtents3d.h:443
OdGeExtents3d::contains
bool contains(const OdGePoint3d &point, const OdGeTol &tol=OdGeContext::gTol) const
Definition
GeExtents3d.h:521
OdGeExtents3d::minPoint
const OdGePoint3d & minPoint() const
Definition
GeExtents3d.h:438
OdGePoint3d
Definition
GePoint3d.h:57
OdGePoint3d::z
double z
Definition
GePoint3d.h:518
OdGePoint3d::y
double y
Definition
GePoint3d.h:517
OdGePoint3d::x
double x
Definition
GePoint3d.h:516
OdGeTol
Definition
GeTol.h:49
OdSi::Extent3d::IntersectResult
IntersectResult
Definition
SiExtents.h:91
OdSi::Extent3d::left
@ left
Definition
SiExtents.h:92
OdSi::Extent3d::right
@ right
Definition
SiExtents.h:94
OdSi::Extent3d::upon
@ upon
Definition
SiExtents.h:93
OdSi::Extent3d::makeHalf
void makeHalf(int dimension, bool moveRight)
Definition
SiExtents.h:128
OdSi::Extent3d::Extent3d
Extent3d()
Definition
SiExtents.h:162
OdSi::Extent3d::intersects
virtual bool intersects(const OdGeExtents3d &extents, bool planar=false, const OdGeTol &tol=OdGeContext::gTol) const
Definition
SiExtents.h:74
OdSi::Extent3d::intersects
IntersectResult intersects(double coordinate, int dimension, double tol=OdGeContext::gTol.equalPoint()) const
Definition
SiExtents.h:116
OdSi::Extent3d::Extent3d
Extent3d(const OdGePoint3d &min, const OdGePoint3d &max)
Definition
SiExtents.h:166
OdSi::Extent3d::contains
virtual bool contains(const OdGeExtents3d &extents, bool planar=false, const OdGeTol &tol=OdGeContext::gTol) const
Definition
SiExtents.h:49
OdSi::Extent3d::makeCube
void makeCube(bool planar)
Definition
SiExtents.h:152
OdSi::Extent3d::Extent3d
Extent3d(const OdGeExtents2d &source)
Definition
SiExtents.h:169
OdSi::Extent3d::Extent3d
Extent3d(const OdGeExtents3d &source)
Definition
SiExtents.h:168
OdSi::Extent3d::makeDouble
void makeDouble(int dimension, bool moveRight)
Definition
SiExtents.h:141
source
GLsizei GLsizei GLchar * source
Definition
gles2_ext.h:282
x
GLfloat x
Definition
gles2_ext.h:314
y
GLfloat GLfloat y
Definition
gles2_ext.h:316
OdSi
Definition
SiVolume.h:33
OdGeContext::gTol
static GE_STATIC_EXPORT OdGeTol gTol
Definition
GeGbl.h:67
OdSiShape
Definition
SiSpatialIndex.h:51
Generated on Tue Apr 15 2025 11:30:05