VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
13 
14 namespace makVrv
15 {
16 
20  {
21  public:
22 
24  Dt2dPoint( float x = 0.0f, float y = 0.0f )
25  : myX( x )
26  , myY( y )
27  {
28  }
29 
31  inline Dt2dPoint& operator+=( const Dt2dPoint& p2 )
32  {
33  myX += p2.myX;
34  myY += p2.myY;
35  return *this;
36  }
37 
39  inline Dt2dPoint& operator-=( const Dt2dPoint& p2 )
40  {
41  myX -= p2.myX;
42  myY -= p2.myY;
43  return *this;
44  }
45 
47  inline bool operator==( const Dt2dPoint& p2 ) const
48  {
49  return myX == p2.myX && myY == p2.myY;
50  }
51 
53  inline bool operator!=( const Dt2dPoint& p2 ) const
54  {
55  return myX != p2.myX || myY != p2.myY;
56  }
57 
59  inline Dt2dPoint operator+( const Dt2dPoint& p2 ) const
60  {
61  return Dt2dPoint( myX + p2.myX, myY + p2.myY );
62  }
63 
65  inline Dt2dPoint operator-( const Dt2dPoint& p2 ) const
66  {
67  return Dt2dPoint( myX - p2.myX, myY - p2.myY );
68  }
69 
70  public:
71 
72  float myX;
73  float myY;
74 
75  };
76 
77 
81  {
82  public:
83 
85  DtPen( const Dt2dPoint& location );
86 
88  DtPen( float x = 0.0f, float y = 0.0f );
89 
90  public:
91 
94  float myColor[4];
95 
96  };
97 
98 
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.
113 
115  ~DtBoundingBox();
116 
119  void invalidate();
120 
122  bool valid() const;
123 
125  bool contains(float x, float y) const;
126 
128  DtBoundingBox& operator+=( const Dt2dPoint& vector );
129 
131  DtBoundingBox& operator|=( const DtBoundingBox& other );
132 
134  void centerOn( Dt2dPoint pos );
135 
138  void expandTo( float width, float height );
139 
141  void getCenter( Dt2dPoint& point ) const;
142 
145 
147  inline float width() const { return myUpperPoint.myX - myLowerPoint.myX;}
148 
150  inline float height() const { return myUpperPoint.myY - myLowerPoint.myY;}
151 
153 
156 
158  inline Dt2dPoint& upperPoint() { return myUpperPoint; }
159 
161  inline const Dt2dPoint& upperPoint() const { return myUpperPoint; }
162 
164  inline Dt2dPoint& lowerPoint() { return myLowerPoint; }
165 
167  inline const Dt2dPoint& lowerPoint() const { return myLowerPoint; }
168 
170 
172  void toPoints( float points[8] ) const;
173 
174  protected:
175 
178 
179  };
180 
181 }
bool operator!=(const Dt2dPoint &p2) const
Do these two points have different values?
Definition: DtBoundingBox.h:53
Dt2dPoint myLocation
Definition: DtBoundingBox.h:92
float height() const
Get the bounding box height.
Definition: DtBoundingBox.h:150
A 2D point.
Definition: DtBoundingBox.h:19
Dt2dPoint myLowerPoint
Definition: DtBoundingBox.h:176
Dt2dPoint & operator-=(const Dt2dPoint &p2)
Decrement this point by another.
Definition: DtBoundingBox.h:39
Dt2dPoint & lowerPoint()
Get the lower point.
Definition: DtBoundingBox.h:164
Dt2dPoint operator+(const Dt2dPoint &p2) const
Create a new point which is these two points added together.
Definition: DtBoundingBox.h:59
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
bool operator==(const Dt2dPoint &p2) const
Do these two points have the same values?
Definition: DtBoundingBox.h:47
float myY
Definition: DtBoundingBox.h:73
Dt2dPoint(float x=0.0f, float y=0.0f)
Constructor takes the x & y values,.
Definition: DtBoundingBox.h:24
Dt2dPoint myUpperPoint
Definition: DtBoundingBox.h:177
Dt2dPoint operator-(const Dt2dPoint &p2) const
Create a new point which is this point subtracted by another.
Definition: DtBoundingBox.h:65
Dt2dPoint & operator+=(const Dt2dPoint &p2)
Increment this point by another.
Definition: DtBoundingBox.h:31
const Dt2dPoint & upperPoint() const
Get the upper point (const).
Definition: DtBoundingBox.h:161
A pen object with parameters on how to draw text.
Definition: DtBoundingBox.h:80
float width() const
Get the bounding box width.
Definition: DtBoundingBox.h:147
const Dt2dPoint & lowerPoint() const
Get the lower point (const).
Definition: DtBoundingBox.h:167
float myX
Definition: DtBoundingBox.h:72
Dt2dPoint & upperPoint()
Get the upper point.
Definition: DtBoundingBox.h:158
A simple bounding box.
Definition: DtBoundingBox.h:101
Dt2dPoint mySpacing
Definition: DtBoundingBox.h:93

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)