Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cPolygon3.h
Go to the documentation of this file.
1 
5 #ifndef _INC_cPolygon3_H
6 #define _INC_cPolygon3_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "cPolygon.h"
12 #include "cBounds3.h"
13 #include "cPoint3.h"
14 #include "../Math/cValueRange.h"
15 
16 namespace GrayLib
17 {
18  class cVector3f;
19  class cMatrix4x4f;
20 
22  {
27 
28  public:
29  typedef cPolygon3f THIS_t;
30  typedef cPoint3f POINT_t;
31 
32  public:
34 
35  public:
36  typedef cPolygonf SUPER_t;
37 
38  cPolygon3f();
39  ~cPolygon3f();
40 
41  void TransformPoly(const cMatrix4x4f& matrix);
42 
43  void SetZero()
44  {
45  m_z.m_Hi = m_z.m_Lo = 0;
46  SetEmpty();
47  }
48  void SetCube(DVALUE_t fRadius = 10);
49  void SetMax()
50  {
51  SetCube(k_FLT_MAX2 / 2);
52  }
53 
54  bool PtInPoly3D(DVALUE_t x, DVALUE_t y, DVALUE_t z) const
55  {
56  if (z > m_z.m_Hi) // z top of the region.
57  return false;
58  if (z < m_z.m_Lo) // z bottom of the region.
59  return false;
60  return PtInPoly(x, y);
61  }
62  void SetCopy(const THIS_t& poly);
63  bool IsEmptyZ() const
64  {
65  return(m_z.m_Hi <= m_z.m_Lo);
66  }
67  bool get_PolyBBoxY(cBounds3f& rBBox) const;
68  bool get_PolyBBoxZ(cBounds3f& rBBox) const;
69  void put_PolyBBoxZ(const cBounds3f& rBBox);
70  void OffsetPoly(DVALUE_t dx, DVALUE_t dy, DVALUE_t dz);
71 
72  HRESULT v_Set3D(const cVariant& vVal, int iStart = 0);
73  void v_Get3D(cVariant& vVal) const;
74 
76  {
77  return((m_z.m_Hi + m_z.m_Lo) / 2);
78  }
79  DVALUE_t get_PolyRadius() const;
80  void get_PolyCenter(OUT POINT_t& ptCenter) const;
81 
82  UNITTEST_FRIEND(cPolygon3);
83  };
84 }
85 #endif // _INC_cPolygon3_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cMatrix.h:194
Definition: cPolygon3.h:22
cPoint3f POINT_t
Definition: cPolygon3.h:30
bool IsEmptyZ() const
Definition: cPolygon3.h:63
DVALUE_t get_HeightMid() const
Definition: cPolygon3.h:75
UNITTEST_FRIEND(cPolygon3)
void SetZero()
Definition: cPolygon3.h:43
bool PtInPoly3D(DVALUE_t x, DVALUE_t y, DVALUE_t z) const
Definition: cPolygon3.h:54
void SetMax()
Definition: cPolygon3.h:49
cPolygonf SUPER_t
Definition: cPolygon3.h:36
cPolygon3f THIS_t
Definition: cPolygon3.h:29
cValueRange< DVALUE_t > m_z
z bottom/top of the region.
Definition: cPolygon3.h:33
Definition: cPolygon.h:162
SUPER_t::DVALUE_t DVALUE_t
Definition: cPolygon.h:168
Definition: cVariant.h:26
TYPE m_Hi
inclusive high side of range. int size = (hi-lo)+1, float size = hi-lo ?? weird.
Definition: cPair.h:29
TYPE m_Lo
low range value.
Definition: cPair.h:28
Definition: cMesh.h:22
class __DECL_IMPORT cMatrix4x4f
Definition: cVector.h:22