ScummVM API documentation
px_3drealpoint.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_PX_3DREALPOINT_H_INCLUDED
28 #define ICB_PX_3DREALPOINT_H_INCLUDED
29 
30 // Include the header files needed by this class.
31 #include "engines/icb/common/px_rcutypes.h"
32 
33 namespace ICB {
34 
35 // Note, this needs pre-definitions / typedef's of :
36 // PXreal, REAL_ZERO
37 // For PC PXreal = float, REAL_ZERO = 0.0f
38 // For PSX PXreal = int, REAL_ZERO = 0
39 
40 #ifndef REAL_ZERO
41 #error "REAL_ZERO not defined"
42 #endif // #ifndef REAL_ZERO
43 
44 // A 2D point on a plane with endpoints stored as floating point.
46 public:
47  // Default constructor and destructor.
48  px3DRealPoint() {
49  m_fX = REAL_ZERO;
50  m_fY = REAL_ZERO;
51  m_fZ = REAL_ZERO;
52  }
53  ~px3DRealPoint() { ; }
54 
55  // Alternative constructor that allows the point to be initialized.
56  px3DRealPoint(PXreal fX, PXreal fY, PXreal fZ) {
57  m_fX = fX;
58  m_fY = fY;
59  m_fZ = fZ;
60  }
61 
62  // Gets and sets.
63  void SetX(PXreal fX) { m_fX = fX; }
64  void SetY(PXreal fY) { m_fY = fY; }
65  void SetZ(PXreal fZ) { m_fZ = fZ; }
66  PXreal GetX() const { return m_fX; }
67  PXreal GetY() const { return m_fY; }
68  PXreal GetZ() const { return m_fZ; }
69 
70  // This allows the values of a point to be set after it has been created.
71  void Set(PXreal fX, PXreal fY, PXreal fZ) {
72  m_fX = fX;
73  m_fY = fY;
74  m_fZ = fZ;
75  }
76 
77 private:
78  PXreal m_fX, m_fY, m_fZ; // The point.
79 };
80 
81 #if 0
82 inline bool8 px3DRealPoint::operator == (const px3DRealPoint &obOpB) const {
83  if ((PXfabs(m_fX - obOpB.m_fX) < (FLT_MIN * 5.0f)) &&
84  (PXfabs(m_fY - obOpB.m_fY) < (FLT_MIN * 5.0f)) &&
85  (PXfabs(m_fZ - obOpB.m_fZ) < (FLT_MIN * 5.0f)))
86  return TRUE8;
87  else
88  return FALSE8;
89 }
90 
91 #endif
92 
93 } // End of namespace ICB
94 
95 #endif // #ifndef PX_3DREALPOINT_H_INCLUDED
Definition: px_3drealpoint.h:45
Definition: actor.h:32