VR-Forces 4.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
gdb
polyImm.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 1999 MaK Technologies, Inc.
3
** All rights reserved.
4
*********************************************************************/
5
/*********************************************************************
6
** $RCSfile: polyImm.h,v $ $Revision: 1.12 $ $State: Exp $
7
*********************************************************************/
8
9
#ifndef polyImm_H_
10
#define polyImm_H_
11
12
#include "
gdb/gdbDefines.h
"
13
#include "
gdb/basePoly.h
"
14
#include <vlutil/vlConfig.h>
15
#include <vector>
16
#include <assert.h>
17
#include "
geometry/surface.h
"
18
19
20
21
//forward declarations
22
class
DtPoint
;
23
24
// class DtPolygonImmediate:
25
//
26
// DtPolygonImmediate are
27
28
class
DT_DLL_gdb
DtPolygonImmediate
:
public
DtBasePolygon
29
{
30
public
:
31
32
// default constructor
33
DtPolygonImmediate
();
34
35
// additional constructor
36
DtPolygonImmediate
(
unsigned
int
numVertices);
37
38
// set the number of polygon vertices; initializes the vertex
39
// list array to the specified size
40
virtual
void
setNumberOfVertices
(
unsigned
int
n);
41
42
// destructor
43
virtual
~
DtPolygonImmediate
();
44
45
// copy constructor
46
DtPolygonImmediate
(
const
DtPolygonImmediate
& orig);
47
48
// assignment operator
49
DtPolygonImmediate
&
operator=
(
const
DtPolygonImmediate
& orig);
50
51
// @return the type of DtGdbNode
52
virtual
DtGdbNode::DtGdbNodeType
type
()
const
;
53
54
// determine if the polygon has all vertices specified.
55
virtual
bool
isFull
()
const
;
56
57
// add a vertex to the polygon
58
virtual
int
addVertex(
const
DtPoint
& v);
59
60
// get the i-th vertex of the polygon
61
virtual
bool
getVertex
(
DtPoint
& retVal,
unsigned
int
i)
const
;
62
const
DtPoint
&
getVertex
(
unsigned
int
i)
const
;
63
64
// get the surface associated with the polygon
65
virtual
bool
getSurface
(
DtSurface
& surfPtr)
const
;
66
const
DtSurface
&
getSurface
()
const
;
67
68
// set the surface associated with the polygon
69
virtual
bool
setSurface
(
const
DtSurface
& newSurface);
70
71
// debugging aid function
72
virtual
void
dump
(
int
indentLevel)
const
;
73
74
virtual
int
sizeInBytes
()
const
;
75
76
protected
:
77
78
DtSurface
mySurface
;
79
std::vector<DtVertex>
myVertices
;
80
};
81
82
inline
const
DtSurface
&
DtPolygonImmediate::getSurface
()
const
83
{
84
return
mySurface
;
85
}
86
87
inline
DtGdbNode::DtGdbNodeType
DtPolygonImmediate::type
()
const
88
{
89
return
DtGdbNode::POLYGON_IMMEDIATE
;
90
}
91
92
inline
bool
DtPolygonImmediate::isFull
()
const
93
{
94
return
(
myVertices
.size() >=
numberOfVertices
());
95
}
96
97
inline
int
DtPolygonImmediate::addVertex
(
const
DtPoint
& v)
98
{
99
assert(
myVertices
.size() <
numberOfVertices
());
100
myVertices
.push_back(v);
101
return
myVertices
.size();
102
}
103
104
// get the i-th vertex of the polygon
105
inline
bool
DtPolygonImmediate::getVertex
(
DtPoint
& retPoint,
unsigned
int
i)
const
106
{
107
bool
returnValue =
false
;
108
if
(i <
myVertices
.size())
109
{
110
retPoint =
myVertices
[i];
111
returnValue =
true
;
112
}
113
114
return
returnValue;
115
}
116
117
inline
const
DtPoint
&
DtPolygonImmediate::getVertex
(
unsigned
int
i)
const
118
{
119
return
myVertices
[i];
120
}
121
122
// set the surface associated with the polygon
123
inline
bool
DtPolygonImmediate::setSurface
(
const
DtSurface
& newSurface)
124
{
125
mySurface
= newSurface;
126
return
true
;
127
}
128
129
#endif
Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)