CFx SDK Documentation
2020SP3
SDK
CFx
dd_inc
Si
SiExtents.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16
// agreement with Open Design Alliance.
17
// Teigha(R) Copyright (C) 2002-2017 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
return
!( extents.
minPoint
().
x
> (maxPoint().x +
tol
.equalPoint())
81
|| extents.
minPoint
().
y
> (maxPoint().y +
tol
.equalPoint())
82
|| minPoint().x > (extents.
maxPoint
().
x
+
tol
.equalPoint())
83
|| minPoint().y > (extents.
maxPoint
().
y
+
tol
.equalPoint()));
84
}
85
}
86
87
enum
IntersectResult
88
{
89
left = 0,
// Coordinate is to the *left* of the *extents*.
90
upon = 1,
// Coordinate is *upon* the *extents*.
91
right = 2
// Coordinate is to the *right* of the *extents*.
92
};
93
94
95
#ifndef SWIG
96
113
IntersectResult
intersects
(
double
coordinate,
int
dimension,
double
tol
=
OdGeContext::gTol
.equalPoint() )
const
114
{
115
if
( m_min[dimension] > (coordinate +
tol
) )
return
right;
116
if
( m_max[dimension] < (coordinate -
tol
) )
return
left;
117
return
upon;
118
}
119
#endif
120
125
void
makeHalf
(
int
dimension,
bool
moveRight )
126
{
127
if
( moveRight )
128
m_max[dimension] = ( m_min[dimension] + m_max[dimension]) / 2;
129
else
130
m_min[dimension] = ( m_min[dimension] + m_max[dimension]) / 2;
131
}
132
138
void
makeDouble
(
int
dimension,
bool
moveRight )
139
{
140
if
( moveRight )
141
m_max[dimension] += ( m_max[dimension] - m_min[dimension] );
142
else
143
m_min[dimension] -= ( m_max[dimension] - m_min[dimension] );
144
}
149
void
makeCube
(
bool
planar )
150
{
151
if
( m_min.isEqualTo( m_max ) )
return
;
152
double
ext =
odmax
( m_max.x - m_min.x, m_max.y - m_min.y );
153
if
( !planar ) ext =
odmax
( m_max.z - m_min.z, ext );
154
m_max.x = m_min.x + ext;
155
m_max.y = m_min.y + ext;
156
if
( !planar ) m_max.z = m_min.z + ext;
157
}
158
159
Extent3d
() {}
163
Extent3d
(
const
OdGePoint3d
&
min
,
const
OdGePoint3d
&
max
)
164
:
OdGeExtents3d
(
min
,
max
) {}
165
Extent3d
(
const
OdGeExtents3d
&
source
) :
OdGeExtents3d
(
source
) {}
166
Extent3d
(
const
OdGeExtents2d
&
source
)
167
:
OdGeExtents3d
(
OdGePoint3d
(
source
.minPoint().
x
,
source
.minPoint().
y
, 0 ),
168
OdGePoint3d
(
source
.maxPoint().
x
,
source
.maxPoint().
y
, 0 )) {}
169
};
170
}
171
#endif
OdSi
Definition:
SiVolume.h:34
tol
tol
Definition:
DimVarDefs.h:2287
OdSi::Extent3d::contains
virtual bool contains(const OdGeExtents3d &extents, bool planar=false, const OdGeTol &tol=OdGeContext::gTol) const
Definition:
SiExtents.h:49
OdSi::Extent3d::makeHalf
void makeHalf(int dimension, bool moveRight)
Definition:
SiExtents.h:125
OdSi::Extent3d::Extent3d
Extent3d()
Definition:
SiExtents.h:159
source
GLsizei GLsizei GLchar * source
Definition:
gles2_ext.h:282
FacetModelerProfile2DBool::min
const T & min(const T &x, const T &y)
Definition:
FMImpProfile2DBool.h:98
SiSpatialIndex.h
OdGePoint3d::y
double y
Definition:
GePoint3d.h:368
OdGePoint3d::x
double x
Definition:
GePoint3d.h:367
x
GLfloat x
Definition:
gles2_ext.h:314
OdGeExtents2d
Definition:
GeExtents2d.h:43
OdSi::Extent3d::IntersectResult
IntersectResult
Definition:
SiExtents.h:88
OdGeExtents3d::minPoint
const OdGePoint3d & minPoint() const
Definition:
GeExtents3d.h:237
OdSi::Extent3d::Extent3d
Extent3d(const OdGeExtents3d &source)
Definition:
SiExtents.h:165
OdSi::Extent3d::makeCube
void makeCube(bool planar)
Definition:
SiExtents.h:149
OdGePoint3d
Definition:
GePoint3d.h:55
y
GLfloat GLfloat y
Definition:
gles2_ext.h:316
OdSi::Extent3d::Extent3d
Extent3d(const OdGeExtents2d &source)
Definition:
SiExtents.h:166
FacetModelerProfile2DBool::max
const T & max(const T &x, const T &y)
Definition:
FMImpProfile2DBool.h:105
OdSi::Extent3d::intersects
virtual bool intersects(const OdGeExtents3d &extents, bool planar=false, const OdGeTol &tol=OdGeContext::gTol) const
Definition:
SiExtents.h:74
OdSi::Extent3d::Extent3d
Extent3d(const OdGePoint3d &min, const OdGePoint3d &max)
Definition:
SiExtents.h:163
OdSiShape
Definition:
SiSpatialIndex.h:51
OdSi::Extent3d::intersects
IntersectResult intersects(double coordinate, int dimension, double tol=OdGeContext::gTol.equalPoint()) const
Definition:
SiExtents.h:113
odmax
#define odmax(X, Y)
Definition:
OdPlatform.h:35
OdGeExtents3d::maxPoint
const OdGePoint3d & maxPoint() const
Definition:
GeExtents3d.h:242
ODSI_API
#define ODSI_API
Definition:
SiSpatialIndex.h:33
OdGePoint3d::z
double z
Definition:
GePoint3d.h:369
OdSi::Extent3d
Definition:
SiExtents.h:47
OdGeExtents3d::contains
bool contains(const OdGePoint3d &point, const OdGeTol &tol=OdGeContext::gTol) const
Definition:
GeExtents3d.h:358
OdSi::Extent3d::makeDouble
void makeDouble(int dimension, bool moveRight)
Definition:
SiExtents.h:138
ODA_ASSERT
#define ODA_ASSERT(exp)
Definition:
DebugStuff.h:49
OdGeContext::gTol
static GE_STATIC_EXPORT OdGeTol gTol
Definition:
GeGbl.h:60
OdGeExtents3d
Definition:
GeExtents3d.h:45
OdGeTol
Definition:
GeTol.h:49
Generated on Mon Oct 12 2020 11:49:43