Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
WeightPoint.h
Go to the documentation of this file.
1//! @file WeightPoint.h
2//! @brief CWeightPoint is a point that float value for matching a ponderation weight.
3//!//
4//////////////////////////////////////////////////////////////////////
5
6#if !defined(FLOATPOINT_INCLUDE)
7#define FLOATPOINT_INCLUDE
8
9#ifdef _MSC_VER
10#pragma once
11#endif // _MSC_VER
12
13#include "Point.h"
14
15BEGIN_MOOTOOLS_NAMESPACE
16
17//! @class CWeightPoint
18//! @brief CWeightPoint is a point that have a float value and can be used for adding ponderation information.
19class DLL_3DFUNCTION CWeightPoint : public CPt
20{
21public:
22 real weight;
23
25
26 // Access operators
27 real* ValPtr();
28
29 void SetWeight(float weight);
30
31 virtual void To4DPoint(C4DPoint& pt) const;
32 virtual CPt& operator=(const C4DPoint& pt);
33 virtual void Serialize(CXArchive& ar);
34
35 // Operator (must be defined to allow low level copy)
36 CWeightPoint& operator=(const CWeightPoint& coord);
37 virtual CPt& operator=(const CPt& refpoint);
38 bool operator==(const CWeightPoint& coord) const;
39
40#ifdef _DEBUG
41 virtual void Dump() const;
42
43 bool IsKindOf(unsigned int classid) const;
44 virtual unsigned int ClassID() const;
45#endif
46};
47
48template <> class CHashMethods<CWeightPoint>
49{
50public:
51 static inline bool HashCompare(const CWeightPoint& pt1, const CWeightPoint& pt2)
52 {
53 return CHashMethods<real>::HashCompare(pt1.weight, pt2.weight);
54 }
55
56 static inline unsigned int HashValue(const CWeightPoint& hash)
57 {
58 return CHashMethods<real>::HashValue(hash.weight);
59 }
60};
61
62// Access operators
63inline real* CWeightPoint::ValPtr()
64{
65 return(&weight);
66}
67
68inline void CWeightPoint::SetWeight(float weight)
69{
70 this->weight = weight;
71}
72
73inline CWeightPoint& CWeightPoint::operator=(const CWeightPoint& coord)
74{
75 CPt::operator=(coord);
76 weight = coord.weight;
77
78 return *this;
79}
80
81inline bool CWeightPoint::operator==(const CWeightPoint& coord) const
82{
83 return (weight == coord.weight);
84}
85
86END_MOOTOOLS_NAMESPACE
87
88#endif // !defined(FLOATPOINT_INCLUDE)
CPt class is the base class for different class of points (C3DPoint, CUVWPoint...)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Definition 4DPoint.h:17
Definition Hash.h:146
CPt base only contains some flags that are used by the derived class.
Definition Point.h:60
CWeightPoint is a point that have a float value and can be used for adding ponderation information.
Definition WeightPoint.h:20
Definition XArchive.h:17