VR-Vantage API Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Tutorials
File List
File Members
include
vrvGraphics
DtBoundingBox.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* Copyright (c) 2011 MAK Technologies, Inc.
3
* All rights reserved.
4
*****************************************************************************/
5
9
10
#pragma once
11
12
#include <
vrvGraphics/vrvGraphics.h
>
13
14
namespace
makVrv
15
{
16
19
class
DT_DLL_VRVGRAPHICS
DtPoint
20
{
21
public
:
22
24
DtPoint
(
float
x = 0.0f,
float
y = 0.0f )
25
: myX( x )
26
, myY( y )
27
{
28
}
29
31
inline
DtPoint
& operator+=(
const
DtPoint
& p2 )
32
{
33
myX += p2.
myX
;
34
myY += p2.
myY
;
35
return
*
this
;
36
}
37
39
inline
DtPoint
& operator-=(
const
DtPoint
& p2 )
40
{
41
myX -= p2.
myX
;
42
myY -= p2.
myY
;
43
return
*
this
;
44
}
45
47
inline
bool
operator==(
const
DtPoint
& p2 )
const
48
{
49
return
myX == p2.
myX
&& myY == p2.
myY
;
50
}
51
53
inline
bool
operator!=(
const
DtPoint
& p2 )
const
54
{
55
return
myX != p2.
myX
|| myY != p2.
myY
;
56
}
57
59
inline
DtPoint
operator+(
const
DtPoint
& p2 )
const
60
{
61
return
DtPoint
( myX + p2.
myX
, myY + p2.
myY
);
62
}
63
65
inline
DtPoint
operator-(
const
DtPoint
& p2 )
const
66
{
67
return
DtPoint
( myX - p2.
myX
, myY - p2.
myY
);
68
}
69
70
public
:
71
72
float
myX
;
73
float
myY
;
74
75
};
76
77
80
class
DT_DLL_VRVGRAPHICS
DtPen
81
{
82
public
:
83
85
DtPen
(
const
DtPoint
& location );
86
88
DtPen
(
float
x = 0.0f,
float
y = 0.0f );
89
90
public
:
91
92
DtPoint
myLocation
;
93
DtPoint
mySpacing
;
94
float
myColor[4];
95
96
};
97
98
101
class
DT_DLL_VRVGRAPHICS
DtBoundingBox
102
{
103
public
:
104
106
DtBoundingBox
();
107
109
DtBoundingBox
(
float
lx,
float
ly,
float
ux,
float
uy );
110
111
//Construct a bounding box from a lower point and an upper point.
112
DtBoundingBox
(
DtPoint
l,
DtPoint
u );
113
115
~
DtBoundingBox
();
116
119
void
invalidate();
120
122
bool
valid()
const
;
123
125
DtBoundingBox
& operator+=(
const
DtPoint
vector );
126
128
DtBoundingBox
& operator|=(
const
DtBoundingBox
& other );
129
131
void
centerOn(
DtPoint
pos );
132
135
void
expandTo(
float
width,
float
height );
136
138
void
getCenter(
DtPoint
& point )
const
;
139
142
144
inline
float
width
()
const
{
return
myUpperPoint.myX - myLowerPoint.myX;}
145
147
inline
float
height
()
const
{
return
myUpperPoint.myY - myLowerPoint.myY;}
148
150
153
155
inline
DtPoint
&
upperPoint
() {
return
myUpperPoint; }
156
158
inline
const
DtPoint
&
upperPoint
()
const
{
return
myUpperPoint; }
159
161
inline
DtPoint
&
lowerPoint
() {
return
myLowerPoint; }
162
164
inline
const
DtPoint
&
lowerPoint
()
const
{
return
myLowerPoint; }
165
167
169
void
toPoints(
float
points[8] )
const
;
170
171
protected
:
172
173
DtPoint
myLowerPoint
;
174
DtPoint
myUpperPoint
;
175
176
};
177
178
}
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)