HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SIM_Slice.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
*/
7
8
#ifndef __SIM_Slice_h__
9
#define __SIM_Slice_h__
10
11
#include "
SIM_API.h
"
12
#include "
SIM_DataUtils.h
"
13
#include <
UT/UT_Vector3.h
>
14
#include <
UT/UT_Array.h
>
15
#include <
UT/UT_VectorTypes.h
>
16
17
class
GU_ConstDetailHandle
;
18
class
SIM_Geometry
;
19
class
SIM_Position
;
20
class
SIM_Motion
;
21
22
class
SIM_Slice
;
23
24
class
SIM_SliceSearchEntry
25
{
26
public
:
27
SIM_SliceSearchEntry
()
28
{
29
mySlice
= 0;
30
myInside
=
false
;
31
}
32
SIM_SliceSearchEntry
(
const
SIM_Slice
*slice,
bool
isinside)
33
{
34
mySlice
= slice;
35
myInside
= isinside;
36
}
37
const
SIM_Slice
*
mySlice
;
38
bool
myInside
;
39
};
40
41
typedef
UT_Array<SIM_SliceSearchEntry>
SIM_SliceSearchList
;
42
typedef
UT_Array<SIM_SliceSearchList>
SIM_SliceSearchTable
;
43
44
/// This is the definition of the SIM_Slice interface. The only function that
45
/// needs to be overridden (besides any standard SIM_Data overrides) is the
46
/// getSliceBoundaryDistSubclass() functions.
47
class
SIM_API
SIM_Slice
:
public
SIM_Data
48
{
49
public
:
50
/// Returns whether we are inside this slice or not.
51
/// true is inside. This corresponds to a negative slice
52
/// boundary distance but is overrideable for efficiency.
53
bool
isInsideSlice(
const
UT_Vector3
&pos)
const
;
54
55
/// Returns the distance to the slice's boundary. If the point
56
/// is inside the slice this is a negative distance, else positive.
57
fpreal
getSliceBoundaryDist(
const
UT_Vector3
&pos)
const
;
58
59
/// Returns the minimal distance to the slice's boundary within
60
/// the bounding box. A negative result implies the slice and
61
/// bounding box overlap.
62
fpreal
getMinSliceBoundaryDist(
const
UT_BoundingBox
&bbox)
const
;
63
fpreal
getMaxSliceBoundaryDist(
const
UT_BoundingBox
&bbox)
const
;
64
65
/// This is used to determine which side of my parent I am on.
66
virtual
UT_Vector3
getCenter()
const
;
67
68
/// Count number of slices from myself and my children.
69
int
countSlices()
const
;
70
static
int
countSlices(
const
SIM_ConstDataArray
&slices);
71
72
/// The nth entry of this list stores how to search for the nth
73
/// slice.
74
void
buildSliceSearch(
SIM_SliceSearchTable
&
table
)
const
;
75
static
void
buildSliceSearch(
SIM_SliceSearchTable
&table,
76
SIM_ConstDataArray
&slices);
77
78
static
fpreal
computeSliceDist(
const
SIM_SliceSearchList
&list,
79
const
UT_Vector3
&pos);
80
/// This is different than a computeSliceDist < 0 because
81
/// we need to ensure that we are consistent with <= against
82
/// a zero result...
83
static
bool
isInsideSlice(
const
SIM_SliceSearchList
&list,
84
const
UT_Vector3
&pos);
85
86
/// This returns true only if the bounding box is fully contained
87
/// in the slice. Assumes convex slices.
88
static
bool
isInsideSlice(
const
SIM_SliceSearchList
&list,
89
const
UT_BoundingBox
&bbox);
90
91
/// Returns true if the bounding box at all intersects the slice.
92
static
bool
doesIntersectSlice(
const
SIM_SliceSearchList
&list,
93
const
UT_BoundingBox
&bbox);
94
95
protected
:
96
explicit
SIM_Slice
(
const
SIM_DataFactory
*factory);
97
~
SIM_Slice
()
override
;
98
99
/// Returns whether we are inside this slice or not.
100
/// true is inside. This corresponds to a negative slice
101
/// boundary distance but is overrideable for efficiency.
102
/// Default implementation just compares the distance with 0.
103
virtual
bool
isInsideSliceSubclass(
const
UT_Vector3
&pos)
const
;
104
105
/// Returns the distance to the slice's boundary. If the point
106
/// is inside the slice this is a negative distance, else positive.
107
/// This is what must be overridden to make the slice do something
108
/// interesting
109
virtual
fpreal
getSliceBoundaryDistSubclass(
const
UT_Vector3
&pos)
const
= 0;
110
111
/// Returns the minimum value the slice attains inside the given bounding
112
/// box. A negative value implies the slice and bounding box overlap.
113
virtual
fpreal
getMinSliceBoundaryDistSubclass(
const
UT_BoundingBox
&bbox)
const
= 0;
114
virtual
fpreal
getMaxSliceBoundaryDistSubclass(
const
UT_BoundingBox
&bbox)
const
= 0;
115
116
/// This is used to determine which side of my parent I am on.
117
virtual
UT_Vector3
getCenterSubclass()
const
= 0;
118
119
private
:
120
DECLARE_STANDARD_GETCASTTOTYPE
();
121
DECLARE_CLASSNAME
(
SIM_Slice
,
SIM_Data
);
122
};
123
124
#endif
125
DECLARE_STANDARD_GETCASTTOTYPE
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition:
SIM_DataUtils.h:50
SIM_SliceSearchList
UT_Array< SIM_SliceSearchEntry > SIM_SliceSearchList
Definition:
SIM_Slice.h:41
DECLARE_CLASSNAME
#define DECLARE_CLASSNAME(DataClass, SuperClass)
Definition:
SIM_DataUtils.h:20
UT_BoundingBoxT< float >
SIM_Data
Definition:
SIM_Data.h:137
UT_Vector3.h
SIM_SliceSearchTable
UT_Array< SIM_SliceSearchList > SIM_SliceSearchTable
Definition:
SIM_Slice.h:42
SIM_Geometry
Definition:
SIM_Geometry.h:30
UT_Array.h
UT_Vector3T< float >
UT_ValArray< const SIM_Data * >
UT_Array
Definition:
BV_KDOPTree.h:18
SIM_API.h
SIM_SliceSearchEntry::myInside
bool myInside
Definition:
SIM_Slice.h:38
SIM_Motion
This is the default implementation for standard motion data.
Definition:
SIM_Motion.h:18
SIM_SliceSearchEntry
Definition:
SIM_Slice.h:24
GU_ConstDetailHandle
Definition:
GU_DetailHandle.h:176
SIM_SliceSearchEntry::SIM_SliceSearchEntry
SIM_SliceSearchEntry()
Definition:
SIM_Slice.h:27
SIM_DataFactory
Definition:
SIM_DataFactory.h:33
UT_VectorTypes.h
table
GLenum GLenum GLsizei void * table
Definition:
glad.h:5129
SIM_Slice
Definition:
SIM_Slice.h:47
SIM_DataUtils.h
SIM_Position
Definition:
SIM_Position.h:22
fpreal
fpreal64 fpreal
Definition:
SYS_Types.h:277
SIM_API
#define SIM_API
Definition:
SIM_API.h:12
SIM_SliceSearchEntry::mySlice
const SIM_Slice * mySlice
Definition:
SIM_Slice.h:37
SIM_SliceSearchEntry::SIM_SliceSearchEntry
SIM_SliceSearchEntry(const SIM_Slice *slice, bool isinside)
Definition:
SIM_Slice.h:32
SIM
SIM_Slice.h
Generated on Sat Dec 21 2024 02:48:45 for HDK by
1.8.6